Creating chatbots based on semantic models

TriniData company based on the product "ArchiGraph.Logos" has developed a service for processing questions in natural language, which allows you to ask questions and receive answers to them in a direct dialogue.

Unlike traditional chatbots, which mostly irritate users with the inadequacy of their answers, the chatbot from TriniData uses semantic technologies (ontologies). This means that when processing a question, the chatbot refers to a domain model that most accurately describes the fragment of reality about which the dialogue is taking place. For example, this could be a description of any production complex: its component parts and their parameters, connections between them, relationships regarding any states or processes, restrictions and tolerance ranges, etc. The subject area is described in the form of a semantic model by specialists and subject matter experts. This makes it as accurate and detailed as the business requires.

Of course, the end user of the chatbot does not interact directly with the semantic model - such models are quite complex technologically and methodologically. Our solution for working with facts in natural language allows you to abstract from this complexity and leave it to analysts and data specialists (data stewards).

In order for a chatbot to be able to “translate” user queries from regular language to the query language of the ontological model and back, a lexical model is needed. It is a set of words and phrases that are used in a certain area of ​​business to designate certain entities of the subject area. When processing the text of a question, the chatbot turns to the lexical model to recognize the meaning of individual words, finds the necessary matches, translates the user’s question into a query to the ontological knowledge base and provides the desired answer based on connections between elements of the subject area.

A lexical model is necessary because the speaker does not necessarily ask his question in the terms that are used in the domain model - he simply may not know anything about it. The user can use synonyms, imprecise expressions, etc. For the same object/phenomenon of the subject area in the language there may be several synonyms or similar concepts; homonymy or lexical ambiguity is possible. To work with various options for formulating questions, and in some cases, to complete the lexical context, you cannot do without a lexical data layer.

In general, the flowchart for processing a user’s question looks like this:

Scheme for processing a user question to a chatbot

In this diagram, domain model entities are denoted as , connections between them by directed arrows; elements of the lexical model are indicated , their connections with the entities of the subject area – dotted lines; lexeme processing directions are shown in solid lines. According to this scheme, at the stage of processing the question, the chatbot recognizes the syntactic structure of the phrase, compares the lexemes used in it with the elements of the domain model using the lexical model, and receives a request to the knowledge graph, which will return the information the user needs. The response from the knowledge graph is then turned into natural language text that is displayed to the user.

Let's look at how a chatbot works using the following example.

Let the domain model contain information that Ivanov I.I. works at a certain enterprise and uses several telephone numbers. Let's imagine that we don't only know the number of this phone, but also the type of phone (cellular/landline). In this case, we can ask the chatbot a question: What phone number does Ivanov have?? In the response we will receive all found employees of the enterprise - individuals with the last name Ivanov (we did not indicate the name and patronymic in the question), and all their phone numbers:

User question and system response

This answer is obtained through connections between lexemes and domain entities that have the values ​​of certain parameters. In simplified form, the result of the question processing process looks like this:

Scheme for analyzing the structure and meaning of a phrase

As can be seen in the figure, the “parsed” lexemes of the source text are mapped to attributes and objects of the domain model. They, in turn, are interconnected, which makes it possible to give in the answer not only one (main) telephone number of I.I. Ivanov, but also his cell phone number.

This model of entities and their connections is a graph in which information about a certain fragment of reality is “packed.” A request to this graph, which the chatbot builds and executes, allows, based on a large graph, to construct a graph of a significantly smaller size – sufficient to answer the user’s question.

Moreover, this private graph can be reused by the chatbot if the user follows the first question with another question about the same object. Let the user continue the dialogue with a new question: What is his email?? For a native speaker, this question is quite correct and logical - if we started asking about Ivanov, then there is no need to repeat his last name every time. However, for a chatbot service, parsing such a question is an insurmountable obstacle, unless it keeps in mind the context of the conversation. In this case, the previous question concerned the object “Ivanov I.I.” The context here is the same private graph that was built when searching for the answer to the previous question. When processing the second question, it allows not only to correctly determine which domain object is being discussed, but also to save processing time. The result is the following response:

Chatbot response to user question

In fact, this implementation of a chatbot provides an interface for searching information using a knowledge graph, which describes both the structure of ideas about the subject area (types of entities, types of connections between them) and specific information about certain objects. The search is carried out taking into account the context and in some cases allows you to “predict” the user’s expectations. The validity of search results is close to 100%, because data is processed that is organized in the form of a logically verified semantic model or data whose connections can be established “on the fly.”

Here are typical scenarios in which the service we created can be used:

  1. An enterprise search system that processes large amounts of corporate data obtained as a result of consolidation from multiple information sources.
  2. Intelligent decision support system.
  3. A system for analyzing cataloged information (regulatory and reference documentation, archives of design documentation, libraries of structured and semi-structured records, etc.).

The lexical model, which acts as a terminological “binding” in relation to the domain model, can be expanded if necessary. This will allow you to process search queries more flexibly and, therefore, obtain more complete search results as a result.