Building a Chatbot with Coreon

A chatbot informs or guides human users on a specific topic, but a machine can only ‘know’ what it is taught by humans. This means the chatbot must ‘know’ about the topic and – above all – how to relate this information to the request of the user. Ontologies are a very helpful data source for this because their purpose is to represent knowledge in context.

What is an Ontology?

An ontology is defined as the ‘shared and formal modelling of knowledge about a domain’ (IEC 62656-5:2017-06). It consists of classes (or concepts), relations, instances, and axioms (http://www.cs.man.ac.uk/~stevensr/onto/node3.html). Classes refer to a ‘set […] of entities or ‘things’ within a domain’. Relations represent the ‘interactions between concepts or a concept’s properties’ and instances are ‘the ‘things’ represented by a concept’. Moreover, axioms are ‘used to constrain values for classes or instances’. This means that axioms define what values a class or instance can or cannot have. Axioms are used to represent additional knowledge that cannot be derived from the classes or instances themselves (e. g., ‘there can be no train connection between Europe and America’).

An ontology can be summarized as a knowledge base consisting of concepts, as well as relations between the concepts and additional information. Ontologies are made machine-readable through standardized ontology languages such as OWL (Web Ontology Language) or RDF. They make it possible for the knowledge represented in an ontology to be understood by machines and programs, such as chatbots.

The Role of Concept Maps

Users can access terminology more easily when they see a concept in context.

In the Coreon Multilingual Knowledge System, concept maps are built as part of the terminology work. This is a very helpful addition to terminology management because the relations between concepts are captured and displayed next to the concept information. Thanks to this feature, terminologists and experts can define concepts more precisely, as the relationships with and differences to neighbor concepts are crucial factors when settling on a definition. Furthermore, users can access the terminology more easily when they see a concept in context.

Concept maps in Coreon are the perfect base for an ontology, and this is an important advantage when re-using terminology for machine applications. The information stored in concept maps can be exported, analyzed, and used by various machine applications, including chatbots. For exports from Coreon, the proprietary language coreon.xml or the standardized ontology language RDF can be used.

Use Case: A Chatbot for Company Services

In our use case we created a prototype for a chatbot to represent the services of our company, berns language consulting (blc). Its purpose was to lead users on the company website from ‘utterances’ (i.e., questions or messages typed by users) to solutions. If, for example, a customer asks: ‘How do I get a fast translation into 10 languages?’, they are led to the company service ‘Machine Translation’. Not only do customers immediately learn the name of the service, but also additional information about the advantages and different aspects of machine translation. A call to action is also displayed, e.g., an offer to speak directly to a human expert.

We created the chatbot with the programming language Python. As a database we used the export of a concept map we had created in Coreon beforehand. By doing this, we were able to use the concept map as an ontology. In the concept map, we displayed the following concept classes:

  • company service, e. g., machine translation
  • solutions (part of the service, but also concrete solutions for customers’ problems), e. g., preprocessing
  • customer experience, e. g., translation too expensive
  • other concepts, e. g., MT engine
A concept map in Coreon, focusing on blc services and solutions

The aim of the chatbot is to lead customers from their ‘utterance’ to possible solutions and company services. For this, the chatbot extracts key words from the customer’s typed enquiry and maps them to the concepts in the concept map. It then follows the paths in the concept map until it reaches solutions and/or specific company services. The extracted solutions and services determine the answer of the chatbot. To enable the chatbot to understand as many utterances as possible, there should be a large number of concepts that are related to the range of customer services.

A Smarter, More Advanced Chatbot

The major advantage of using an ontology as a database for a chatbot is that it helps the machine to understand the relationships between concepts. Users’ utterances are easily analyzed and mapped to concepts in the ontology and once the entry into a concept in the ontology is made, related concepts are found and proposed to the user. Another crucial benefit is that a concept map is a controlled database. The administrator can decide which utterances lead to which solutions. Of course, building a concept map as a base for a chatbot entails some manual effort. However, automatic procedures can be included to speed up the terminological work.

A third big advantage is that the ontology cannot only be used in this particular use case. In theory it can be re-used in practically every use case where a machine is trying to ‘understand’ a human. Such scenarios include language assistance systems, text generators, classifiers, or intelligent search engines.

Do you have a good use case for starting an ontology, or would you like to start one but don’t know how? Do you need help building an ontology? Contact us, we are happy to help!

https://berns-language-consulting.de/language/en/terminology-ontology/

Jenny Seidel is responsible for terminology management and language quality at berns language consulting (blc). She helps customers set up terminology processes and implement terminology tools for specific use cases. Her recent focus has been the potential of ontologies as a base for Machine Learning.