WIH (Word Intelligent Handler) is a conversational bot. It has a complex architecture with several components. Some of them are the ER-memory, EP-memory and other minor modules that provide the prototype of good modeling of Spanish sentences. They constitute the knowledge-representation mechanism that is used by WIH to build automatic answers during dialogs with humans. This is a small description of these components and some of its interaction , along with test cases and a statistical analysis of the results obtained.
This chatterbot has a three layered shown below:
Internal Structure: Takes every Spanish sentence from dialogs and transforms them into sets of Homogenized Basic Elements (HBE). Every HBE was represented in an internal language for WIH and is a kind of building blocks extracted from words that are not filtered-out.
Virtual Structure: selects a subset of HBE that are related according to certain criteria and use it to build an Eci (in Spanish, Estructura de Composición Interna; Inner Structure Arrangement in English). An Eci is a logical structure modeling the relationship between words, an oriented graph representing a whole statement in the original text.
External Structure: is made up of a set of Eci from the same text. It is an interface between users and the Virtual Structure. It provides an external view of the content that is independent of the original text organization. To define the way a set of HBE is transformed to an Eci, the system uses a weighting coefficient named po, which is an Eci metric that asses the relevance of the phrase being represented [1]. It is a value based on weights that correspond to each HBE belonging to the Eci. It is calculated using the formula:
It takes the p values of previous HBE values, being i the ordinal position (between 1 and N, the number of structures in Eci). The pi values assigned to each HBE are taken from a predefined table T. It defines the individual weight based on the type of word represented. This typification is automatically determined using morphosyntactic considerations and induction trees [2].
It was also statistically shown that po is invariant to document size and type of text content. Furthermore, it could be used to discriminate the writer’s profile (in fact it can distinguish between users writing a document, for a forum, web index, or a blog) and to assess the relevance of a sentence within a text [2].
The main structures related to this novel knowledge modeling are depicted in the figure:
The ER-Memory (in Spanish Estructura de Respuesta, Structure of the answer in English), models the knowledge stored in Virtual Structure and the original way it processes language sentences. It also describes interaction between ER-Memory and MCT-Memory (Memoria de Composición Transitoria, transient structure-arrangement memory).
The EP-Memory records the sequence of linguistics categories extracted from each sentence processed, building a chain of tokens named Parsed Structure (PS). Every PS is weighted according to its usage in real previously processed dialogs. As an example for sentence: “Hola” the related EP is: “ER= {< 0.0152009> < <0.0183416> [SUSTANTIVO] # {{Hola}}”.
As the memory learns from the experience, it reinforces parts of its knowledge from initial status, changing the relative relevance of involved structures. After certain number of occurrences, weighting is stabilized and changes are minor.
In [3] EP tests show the WIH ability to process dialogs, derive weightings and generate category sequences. When EP training is performed with random structures, it shows that no special category sequence is preferred by the prototype since the dataset was constructed with no special use of any parsed structure. As a consequence, weighting values should be mostly evenly distributed in the domain.
Figure 3 is a graph with the results obtained after a test with random structures: it verifies this hypothesis.
When a test is made with real test cases, the results are like the one in the figure below:
The 3D-histogram has a strong change in the general bar distribution. There is a significant biased slope down curve from highest values.
As weighting distribution follows roughly real usage of linguistics categories, it follows that EP-Memory is able to model it. But, in order to make the prototype be able to handle language, it must be complemented with the modeling of contexts where each type of linguistic EP structure is used. That task is distributed mostly among ER-Memory and MCT-Memory.
The ER Memory is focused on learning human answering behavior. To do that it records EP relationship between a sentence and the human reply in past dialogs. In fact it keeps track of the main syntactic structure of every sentence (the EP) and the one used as a reaction.
If WIH receives a sentence, the ER memory will try to find the corresponding EP. If such EP does not exist, it is new and has to be learned. Otherwise, it was learned in past dialogs. Let EPs be the matching EP. It has one or more EPa used as answer in those dialogs. They are organized chronologically in the memory and have a weighting value that represents the frequency EPs - EPa usage.
Any time the EP-memory has previously memorized EPs the whole set of EPa is loaded and associated to the EP of the actual sentence. This EPs- EPa relation is known as an ER. Its weighting is updated according to the algorithm explained afterwards and known as Yi.
The structure of ER Memory is shown in the Equation:
Where Yj represents the usage value of a particular ERi. EPj is the related EPa, and case1, case2 are sentences in Spanish with the EPj structure (let it call 'Use Case').
Note that ER-Memory collects a set of associations between EPs cases, whereas EP-Memory records sets of sentence syntactics structures. When ER is searched for a specific sentence, it really looks for matching or similar EPj structures. The following algorithm describes the steps performed:
When RR is received by WIH, one of the set of cases (described as {case-1,case-2,...}) previously recorded by the memory is used to build an answer to the actual sentence. The procedure for the answer construction is not under the scope of this paper.
Regarding Yt, it is important to note that its value depends on a predefined learning curve determined by the equation
Here, a is used to represent the learning rate, b typify the speed of training and t is the time of the event.
In particular the t value is imposed by a discrete virtual clock who tics in every new EP matching case. The virtual clock ticks in range from 0 to MAX-TICKS. When clock rises until MAX-TICKS it’s reseats itself and starts all over again. The t value is a kind of aging value to control structure deprecation.
The MCT-memory can be thought as a transient storage used to record every input sentence and its processed information (EP, ER and its weighting value). The main role of this memory is to make a quick coherent historical reconstruction of every dialog, keeping pointers to original sources of data. As long as structures and vocabulary are assimilated the content is cleaned.
In WIH, the modules do not require human interaction and just use information gathered from real dialogs processed by the system. The architecture provides a self adapting modeling approach, since they do not involve predefined dictionaries nor other type of structures. All the internal structures are based on general morphological and syntactical information contained in the processed sentences.
Memories size indicate certain relationship with the complexity of the sentences (could be measured in number of syntactic categories in each one) and the topic (similar sentences but different topics make similar change in memory size), but not with the number of sentences
Al modules have been implemented. First results and statistical evaluation show a good performance up to now. The prototype is being under a tuning process and is expected to be presented as a whole through a web service soon.
López De Luise M. D., Agüero M. J. “Aplicabilidad de métricas categóricas en sistemas difusos”. IEEE Latin America Magazine. Vol. 5. Issue 1. Editor Jefe José Antonio Jardini. 2007.
López De Luise M.D ,“A Morphosyntactical Complementary Structure for Searching and Browsing”, In Advances in Systems, Computing Sciences and Software Engineering Proceedings of SCSS05. Springer.
López De Luise M.D, Hisgen D, Soffer M. “Automatically Modeling Linguistic Categories in Spanish”. CISSE 2009.