<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Aura – </title>
    <link>/docs/experiences-builder/development-use-cases/nlp-uc-development/grammars/</link>
    <description>Recent content on Aura</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    
	  <atom:link href="/docs/experiences-builder/development-use-cases/nlp-uc-development/grammars/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Docs: </title>
      <link>/docs/experiences-builder/development-use-cases/nlp-uc-development/grammars/grammars-generation/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/experiences-builder/development-use-cases/nlp-uc-development/grammars/grammars-generation/</guid>
      <description>
        
        
        &lt;h1 id=&#34;guidelines-for-the-generation-of-grammars-in-unitex&#34;&gt;Guidelines for the generation of Grammars in Unitex&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Guidelines and best practices for working with Unitex for the generation of the Grammars to be included in the NLP model.&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;general-guidelines&#34;&gt;General guidelines&lt;/h2&gt;
&lt;p&gt;Grammars is an &lt;a href=&#34;../../../../../docs/experiences-builder/development-use-cases/nlp-uc-development/nlp-pipeline-components-catalog/nlp-stages/grammars/&#34;&gt;Aura NLP stage&lt;/a&gt; that has its own path, files and configuration required to be included in the NLP model.&lt;/p&gt;
&lt;p&gt;Firstly, if your pipeline contains the Grammar stage, you need to work with &lt;strong&gt;Unitex Gramlab&lt;/strong&gt; and &lt;strong&gt;Grape NLP&lt;/strong&gt;, which are included in the &lt;a href=&#34;../../../../../docs/experiences-builder/tools/nlp-virtual-machine/&#34;&gt;NLP Virtual Machine&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After that, linguists can proceed to create the grammars associated to the new use case. This process will be similar for &lt;a href=&#34;../../../../../docs/experiences-builder/development-use-cases/nlp-uc-development/grammars/#types&#34;&gt;global and local grammars&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The intent, entities and utterances defined for the new use case must be considered. A representative set of utterances will be selected and represented in Unitex through the creation of &lt;strong&gt;connected boxes&lt;/strong&gt; that will contain, from left to right, different options for expressing each token of the selected utterances. The combination of different connected boxes provides a full variability of utterances to be recognized.&lt;/p&gt;
&lt;p&gt;It is necessary to bear in mind that grammar engine only provides an &lt;strong&gt;exact recognition of utterances&lt;/strong&gt; previously integrated in the model. Therefore, it is necessary to build up a rich and realistic utterance database to cover all the representative users&amp;rsquo; utterances for a given use case.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-nlp/grammars-graph-2.png&#34; alt=&#34;Example of Grammars graph&#34;&gt;&lt;/p&gt;
&lt;p&gt;Once the grammars have been developed in Unitex, the grammar engine &lt;strong&gt;Grape NLP&lt;/strong&gt; goes through the grammar from the beginning (left side of the graph) and compares box by box the user&amp;rsquo;s utterance with the grammar to evaluate the matching.&lt;/p&gt;
&lt;p&gt;The output will be a set of labels together with a start and end index.&lt;/p&gt;
&lt;h2 id=&#34;intents-and-entities-tagging&#34;&gt;Intents and entities tagging&lt;/h2&gt;
&lt;h3 id=&#34;tag-an-intent-in-the-grammar-interface&#34;&gt;Tag an intent in the grammar interface&lt;/h3&gt;
&lt;p&gt;In order to tag an intent in a grammar graph, a box previous to the closing box of the graph should be created with the following information and format:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-typescript&#34; data-lang=&#34;typescript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;E&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;intent.&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#c4a000&#34;&gt;intent_name&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;]&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;tag-an-entity-in-the-grammar-interface&#34;&gt;Tag an entity in the grammar interface&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Two separate boxes need to be created: one before and one after the entity values. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;We need two entity tags because we need to wrap the entity values in order to know its position in the user&amp;rsquo;s utterance. &lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Opening entity tag should have the following information and format: &lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-typescript&#34; data-lang=&#34;typescript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;E&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;ent.&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#c4a000&#34;&gt;entity_name&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;]&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Closing entity tag requires the following information and format: &lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-typescript&#34; data-lang=&#34;typescript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;E&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;/&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#a40000&#34;&gt;/ent.[entity_name]&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Consider the difference between the opening and closing entity tag and remember that the entity tags need to be included within the entity graph and not outside of it.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-nlp/grammars-tagging.png&#34; alt=&#34;Intent and entity tagging&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;best-practices-for-graphs-generation&#34;&gt;Best practices for graphs generation&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;We highly recommend you the webinar &lt;a href=&#34;https://telefonicacorp.sharepoint.com/sites/ColaboraTID/SourcingDeployment/AuraL-CDO/Shared%20Documents/Forms/AllItems.aspx?csf=1&amp;amp;web=1&amp;amp;e=r0usvb&amp;amp;cid=0efaca42%2D34ad%2D4f9c%2D8735%2D07d8d32ed97a&amp;amp;RootFolder=%2Fsites%2FColaboraTID%2FSourcingDeployment%2FAuraL%2DCDO%2FShared%20Documents%2FTraining%20Sessions%2FWebminars%2FNLP%5FImplementing%20New%20Use%20Cases%5FGrammar%20Guidelines&amp;amp;FolderCTID=0x012000D13BA42C276A3740ACEFDEF3DDC24471&#34;&gt;Implementing new use cases: Grammar guidelines&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The graphs must be as &lt;strong&gt;visually clear&lt;/strong&gt; as possible. &lt;/li&gt;
&lt;li&gt;Avoid &lt;strong&gt;crosslines&lt;/strong&gt;. &lt;/li&gt;
&lt;li&gt;The verbal graphs should be &lt;strong&gt;vertically aligned&lt;/strong&gt; and the arrows connecting boxes should be &lt;strong&gt;horizontally aligned&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Be careful when using too much &lt;strong&gt;optionality&lt;/strong&gt; (&amp;ldquo;Epsilon&amp;rdquo; symbol), this may lead the grammar to recognize unwanted strings, collisions between UCs, etc.&lt;/li&gt;
&lt;li&gt;All graphs should have an &lt;strong&gt;appropriate size&lt;/strong&gt; not to leave info/boxes out of the them. &lt;/li&gt;
&lt;li&gt;Try not to repeat the same &lt;strong&gt;box structure&lt;/strong&gt; several times. Try to reuse it for different paths or to create a subgraph that can be reused anywhere in the intent axiom. Hence, avoid creating two or more paths recognizing the same input.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;comments&lt;/strong&gt; if needed to clarify, for instance, if a path has some limitations due to potential conflicts with other UCs or just as explanatory notes of what a path is contemplating. For creating a comment within a graph, create a box and do not connect it to any other box. This way, you will see that the characters of comment message appear in red colour.&lt;/li&gt;
&lt;li&gt;Avoid leaving &lt;strong&gt;empty boxes&lt;/strong&gt; in any graph. &lt;/li&gt;
&lt;li&gt;Avoid &lt;strong&gt;typos&lt;/strong&gt; within the boxes info. &lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;opening and closing entity tags&lt;/strong&gt; used for wrapping the entity values should be contemplated in the entity graph and not outside of it.&lt;/li&gt;
&lt;li&gt;Make sure the &lt;strong&gt;intent and entity tags&lt;/strong&gt; have been properly included.&lt;/li&gt;
&lt;li&gt;When adding &lt;strong&gt;prepositions and articles&lt;/strong&gt; in boxes, put them separately. That is, create a box for the prepositions and another one for the articles. &lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;circumstantial complements&lt;/strong&gt; (e.g., time, location, manner&amp;hellip;) are optional on many occasions regardless of whether they are in initial, middle or final position.&lt;/li&gt;
&lt;li&gt;No graph must recognize the &amp;ldquo;Epsilon&amp;rdquo; symbol:
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-typescripy&#34; data-lang=&#34;typescripy&#34;&gt; &amp;lt;E&amp;gt;
&lt;/code&gt;&lt;/pre&gt;So in case of optional subgraphs, the optionality should be in the graph where it is called and not in the subgraph.&lt;/li&gt;
&lt;li&gt;If the grammar makes use of the &lt;strong&gt;NER dictionaries&lt;/strong&gt; to do the matching value &amp;gt; canon &amp;gt; label, the values contemplated in the different dictionaries should be also contemplated in the entity graphs of the grammar for the matching process to be successful.
&lt;ul&gt;
&lt;li&gt;It is crucial to consider here that the grammar values contemplated in the entity graph should be &lt;strong&gt;normalized&lt;/strong&gt; (same process as the normalization pipeline carries out except for the normalization of upper-case characters) in order to be recognized.&lt;/li&gt;
&lt;li&gt;That is, if a value in the dictionaries is &amp;lsquo;Mr. Robot&amp;rsquo;, since the normalization pipeline erases punctuation marks, the value that should be included in the entity graph should be &amp;lsquo;Mr Robot’.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;There are &lt;strong&gt;special symbols&lt;/strong&gt; that have specific meaning for the grammar and should be escaped (to check these symbols go to &amp;ldquo;Encoding of special characters in the graph editor&amp;rdquo; section of the &lt;a href=&#34;https://unitexgramlab.org/&#34;&gt;Unitex Gram Lab official documentation&lt;/a&gt;).&lt;br&gt;
An example of a special character would be &amp;ldquo;+&amp;rdquo; that needs to be escaped by using &amp;ldquo;“ (See figure below).&lt;/li&gt;
&lt;li&gt;It is highly recommendable to &lt;strong&gt;compile the grammar before pushing changes into the Pull Request&lt;/strong&gt;. This way, the NLP developer will see if there is any error in the call to the subgraphs, if the grammar recognizes an empty path (the grammar recognizes: &amp;quot; &amp;ldquo;) or if there is any corrupt file.&lt;/li&gt;
&lt;li&gt;When compiling the grammar, some files are generated. These files have different extensions (&lt;code&gt;.fst2&lt;/code&gt;, &lt;code&gt;.snt&lt;/code&gt;, &lt;code&gt;.diff&lt;/code&gt;) and should be avoided. Thus, the NLP developer should erase them locally before committing further changes into the PR.&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;main verbs&lt;/strong&gt; or &lt;strong&gt;list of keywords&lt;/strong&gt;, create another graph.&lt;/li&gt;
&lt;li&gt;Try to reuse &lt;strong&gt;basic structures&lt;/strong&gt; (grammar block) from one graph to another.&lt;/li&gt;
&lt;li&gt;Try to avoid &lt;strong&gt;ungrammatical paths&lt;/strong&gt; if possible.&lt;/li&gt;
&lt;li&gt;If one graph gets &lt;strong&gt;too complex&lt;/strong&gt;, try to split it into smaller blocks/subgraphs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-nlp/grammars-graph-3.png&#34; alt=&#34;Example of Grammars graph&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;best-practices-for-the-generation-of-grf-files&#34;&gt;Best practices for the generation of .grf files&lt;/h2&gt;
&lt;p&gt;Create as many folders as existing domains/intents.&lt;/p&gt;
&lt;h3 id=&#34;graphs&#34;&gt;Graphs&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Call &lt;code&gt;axiom.grf&lt;/code&gt; to the main graph of the whole grammar (general graph that calls to the different domains).&lt;/li&gt;
&lt;li&gt;Generate another &lt;code&gt;axiom.grf&lt;/code&gt; file in the subfolder of each specific domain, which will be the main graph for this domain (graph that calls to the UCs related to that domain).&lt;/li&gt;
&lt;li&gt;Generate another &lt;code&gt;axiom.grf&lt;/code&gt; file for each use case/intent. Remember that, if different subgraphs are created to contemplate different structures or entity combinations for a given UC, the intent tag should be found in this general UC/intent axiom and not in the individual subgraphs.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;domain-folder&#34;&gt;Domain folder&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The name of the &lt;strong&gt;domain folder&lt;/strong&gt; should be identical to the name of the corresponding domain.&lt;/li&gt;
&lt;li&gt;This way, when opening the main graph of the whole grammar, one could quickly see the domains that have, at least, some UC developed through the grammar engine. Make sure when including a new domain to make the proper call to it in the main axiom of the whole grammar.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;intent-folder&#34;&gt;Intent folder&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The name of the &lt;strong&gt;intent folder&lt;/strong&gt; should contemplate the name of the corresponding intent. &lt;br&gt;
For example: If the intent name is &lt;code&gt;intent.common.greetings&lt;/code&gt;, the intent folder name would be &lt;code&gt;greetings&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If a given intent has different &lt;strong&gt;sub-use cases&lt;/strong&gt; or the intent is divided into different graphs according to different linguistic structures/entities combination, the intent tag should be only tagged once in the main axiom of the use case and not in each of the different subgraphs.&lt;br&gt;
Make sure when including a new intent to make the proper call to it in the domain axiom.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;entity-graphs&#34;&gt;Entity graphs&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The entity graphs should have the name of the corresponding entity name, that is, if an entity name is &lt;code&gt;ent.device_tv&lt;/code&gt;, the name of the graph in the grammar folder should be &lt;code&gt;ent.device_tv.grf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If an entity is only used in one use case/intent, the entity graph should be located in the intent folder.&lt;/li&gt;
&lt;li&gt;Otherwise, if an entity is used in different intents/UCs of the same domain, the entity graph should be located in the main folder of the domain.&lt;/li&gt;
&lt;li&gt;If an entity is used in different domains, the entity graph should be in the main folder of the whole grammar.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-nlp/grammars-grf-files.png&#34; alt=&#34;Generation of .grf files&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;verbal-structure-and-nomenclature&#34;&gt;Verbal structure and nomenclature&lt;/h2&gt;
&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Verbal graphs need to be adapted based on the target language the NLP developer is working with.&lt;/p&gt;
&lt;p&gt;The following verbal forms and tenses have been provided in Spanish as illustrative examples because the Spanish language varies morphologically depending on the person/number and tense info.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nomenclature of auxiliary verbs:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#auxiliary-verbs&#34;&gt;Auxiliary verbs&lt;/a&gt;: They serve, among other things, to form the compound tenses, the progressive forms, the passive voice, as well as negations and questions (e.g., &amp;ldquo;I would like to eat an apple&amp;rdquo;).&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#main-verbs&#34;&gt;Main/Full verbs&lt;/a&gt;: They add meaning to the sentence and are essential for understanding the statement (e.g., &amp;ldquo;I eat two apples every morning&amp;rdquo;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To this end, the NLP team has been working on an efficient structure and nomenclature to have them contemplated in the grammar.&lt;/p&gt;
&lt;h3 id=&#34;auxiliary-verbs&#34;&gt;Auxiliary verbs&lt;/h3&gt;
&lt;h4 id=&#34;aux_w-auxiliary-verb--infinitive-tense&#34;&gt;aux_W: auxiliary verb + infinitive tense&lt;/h4&gt;
&lt;p&gt;It contemplates all the possible auxiliary verbs that can be found before a verb in infinitive tense. &lt;/p&gt;
&lt;p&gt;This graph should be always optional since the infinitive tense without the auxiliary verb is also acceptable in linguistic terms (e.g., &amp;ldquo;I want to check my agenda&amp;rdquo; &amp;amp; &amp;ldquo;Check my agenda&amp;rdquo; are both linguistically correct). &lt;/p&gt;
&lt;h4 id=&#34;aux_y-auxiliary-expressionsverbs--imperative-tense&#34;&gt;aux_Y: auxiliary expressions/verbs + imperative tense&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;aux_Y2s: second person singular in imperative tense.&lt;/li&gt;
&lt;li&gt;aux_Y3s: third person singular in imperative tense.&lt;/li&gt;
&lt;li&gt;aux_Y2p: second person plural in imperative tense.&lt;/li&gt;
&lt;li&gt;aux_Y3p: third person plural in imperative tense.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All these graphs contain possible auxiliary expressions that may be found before verbs in imperative tense. &lt;/p&gt;
&lt;p&gt;These graphs should be also optional as the verbs in this tense can be also found in isolation (e.g., &amp;ldquo;Go and bring me some water&amp;rdquo; &amp;amp; &amp;ldquo;Bring me some water&amp;rdquo;). All these graphs should be found within the graph containing all imperative tenses of a given verb (e.g., verb_Y.grf -&amp;gt; buy_Y.grf).&lt;/p&gt;
&lt;h4 id=&#34;aux_sqt-auxiliary-verb--presentpast-imperfect-subjunctive-tense&#34;&gt;aux_SQT: auxiliary verb + present/past imperfect subjunctive tense&lt;/h4&gt;
&lt;p&gt;It contains all possible expressions that can be found before a verb in present imperfect subjunctive tense (S) and past imperfect subjunctive tense (QT). &lt;/p&gt;
&lt;p&gt;This graph should be always mandatory in these two tenses as the structure &amp;ldquo;I would like you to bring me some water&amp;rdquo; vs. &amp;ldquo;I like you to bring me some water&amp;rdquo; would be agrammatical without the modal verb. &lt;/p&gt;
&lt;h3 id=&#34;main-verbs&#34;&gt;Main verbs&lt;/h3&gt;
&lt;p&gt;This graph is used for ambivalent verbs that could work both as auxiliary and main/full verbs.&lt;/p&gt;
&lt;p&gt;When this graph is used, all these verbs are conceived as being main/full verbs and thus do not need to be accompanied by another verb but by a complement in the form of a noun (e.g., &amp;ldquo;I want some water&amp;rdquo; vs. &amp;ldquo;I want to drink some water&amp;rdquo;).&lt;/p&gt;
&lt;h3 id=&#34;verbal-graphs&#34;&gt;Verbal graphs&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;The names of the verbal graphs should be in &lt;strong&gt;English&lt;/strong&gt;. This also applies to the name of the domain, intent, keywords and complement graphs.&lt;/li&gt;
&lt;li&gt;Before creating any verbal graph, make sure it is &lt;strong&gt;not repeated&lt;/strong&gt;, that is, it is not already contemplated in any other of the grammar UCs. If a given verb is only used in a particular UC, place the verbal graphs within the folder of the UC. If a verb is shared by several UCs of the same domain, place the verbal graph at the domain folder level.&lt;/li&gt;
&lt;li&gt;If, on the other hand, a given verb is used by UCs belonging to &lt;strong&gt;different domains&lt;/strong&gt;, place the verbal graphs in the folder of the whole grammar.&lt;/li&gt;
&lt;li&gt;If you create different &lt;strong&gt;verbal subgraphs&lt;/strong&gt; for different verbal tenses, make sure you include all the verbs in each tense.
The basic verbal tenses included for each verb are:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-nlp/grammars-verbal-graphs.png&#34; alt=&#34;Basic verbal tenses&#34;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In case the developer needs to contemplate more verbal tenses, please consult the section &amp;ldquo;Common inflectional codes&amp;rdquo; in &lt;a href=&#34;https://unitexgramlab.org/&#34;&gt;Unitex Gram Lab official documentation&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;verb_main_graph-structure&#34;&gt;[verb]_main_graph structure&lt;/h3&gt;
&lt;p&gt;To ease the grammar development process, we propose a common structure for all verbs.&lt;/p&gt;
&lt;p&gt;The name of the verbal graph would be &lt;code&gt;[verb]_main_graph.grf&lt;/code&gt; and would have the following structure:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-nlp/grammars-graph-structure.png&#34; alt=&#34;Structure of verbal graph&#34;&gt;&lt;/p&gt;
&lt;p&gt;As it can be appreciated in the example, some &lt;strong&gt;pronouns&lt;/strong&gt; have been added between aux_SQT and the verbal boxes for those tenses. This also happens before P3s/p, P2s and C2s verbal boxes.&lt;br&gt;
These pronouns are needed for sentences such as: &amp;ldquo;Quiero que me compres este vuelo&amp;rdquo; (&amp;ldquo;I want you to buy me this flight&amp;rdquo;). Besides, the interrogative particle &amp;ldquo;cómo&amp;rdquo; has been added before aux_W and before P1s/p tenses for questions such as &amp;ldquo;¿Cómo puedo comprar este ticket?&amp;rdquo; (&amp;ldquo;How can I buy this ticket&amp;rdquo;) and &amp;ldquo;¿Cómo compro este ticket?&amp;rdquo; (&amp;ldquo;How do I buy this ticket&amp;rdquo;).&lt;/p&gt;
&lt;p&gt;In case the &lt;strong&gt;clitic forms&lt;/strong&gt; of verbs are needed, create a separate graph for them.
For this, create a verbal graph called &lt;code&gt;[verb]_clitic_forms.grf&lt;/code&gt;.
As in the previous example, some pronouns have been included in some of the paths, but the main difference here would be that the boxes containing the clitic pronouns have been included in a mandatory way.&lt;/p&gt;
&lt;p&gt;As seen in the figure, this graph would recognize sentences such as: &amp;ldquo;Quiero que me lo compres&amp;rdquo; (&amp;ldquo;I want you to buy it for me&amp;rdquo;).&lt;/p&gt;
&lt;h2 id=&#34;guidelines-for-testing-grammars-in-unitex&#34;&gt;Guidelines for testing Grammars in Unitex&lt;/h2&gt;
&lt;p&gt;There are two alternative ways of testing the grammars generated with Unitex:&lt;/p&gt;
&lt;h3 id=&#34;1-testing-grammars-using-the-unitex-interface&#34;&gt;1. Testing grammars using the Unitex interface&lt;/h3&gt;
&lt;p&gt;Useful for checking the potential overlaps among the different use cases developed through the grammar engine.&lt;/p&gt;
&lt;p&gt;For this purpose, a &lt;code&gt;.txt&lt;/code&gt; file should be created with the testing statements (sentences, phrases or isolated words) to be tested (each one on a different text line).&lt;/p&gt;
&lt;p&gt;Keep in mind that when testing the grammar in the Unitex interface, the testing statements are not going to be processed with the normalization pipeline and, thus, must consider capitalization, accentuation marks, etc.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-nlp/grammars-testing.png&#34; alt=&#34;Grammars testing&#34;&gt;&lt;/p&gt;
&lt;p&gt;Afterwards, the following instructions should be carried out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open the Unitex interface and go to the menu found in the upper section of the interface.&lt;/li&gt;
&lt;li&gt;Click on &amp;ldquo;Text &amp;gt; Open&amp;rdquo; and open the &lt;code&gt;.txt&lt;/code&gt; previously created (say &amp;ldquo;OK&amp;rdquo; to Process Text).&lt;/li&gt;
&lt;li&gt;Once the &lt;code&gt;.txt&lt;/code&gt; file is selected, go to &amp;ldquo;Text &amp;gt; Locate Pattern&amp;rdquo; and a window will pop up in which it is required to select the graph to be used to process the testing examples. The &amp;ldquo;Merge with input text option&amp;rdquo; should be also selected to see the intent and entity tags.&lt;/li&gt;
&lt;li&gt;Besides, we need to select the &amp;ldquo;Activate debug mode option&amp;rdquo; to see the paths activated in each of the testing examples as well as the &amp;ldquo;Longest matches option&amp;rdquo; to replicate how the system works.&lt;/li&gt;
&lt;li&gt;Click on &amp;ldquo;Search&amp;rdquo; and another window will pop up with the results.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If all the provided examples have obtained the expected intent, that means that the grammar engine has the expected behaviour.&lt;/p&gt;
&lt;h3 id=&#34;2-testing-grammars-through-run_local_pipelinesh-scripts&#34;&gt;2. Testing grammars through run_local_pipeline.sh scripts&lt;/h3&gt;
&lt;p&gt;The second option would be to launch queries through the &lt;a href=&#34;../../../../../docs/experiences-builder/development-use-cases/nlp-uc-development/uc-development-process/#64-launch-and-test-your-pipeline-locally-live-mode&#34;&gt;&lt;code&gt;run_local_pipeline.sh&lt;/code&gt;&lt;/a&gt; script to validate their intent assignment (remember that you must previously execute the &lt;a href=&#34;../../../../../docs/experiences-builder/development-use-cases/nlp-uc-development/uc-development-process/#52-execute-the-training-script&#34;&gt;&lt;code&gt;build_local.sh&lt;/code&gt;&lt;/a&gt; script in order to train the pipeline).&lt;/p&gt;
&lt;p&gt;Since the grammar engine is deterministic, based on the score (confidence) obtained, it is possible to know whether an utterance has been solved by CLU or by the grammar engine:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Utterances detected by the grammar module obtain a score of &lt;code&gt;1.0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The scores of utterances detected by CLU are float numbers between &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt; (e.g. 0.98, 0.65…).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This testing option is the most recommendable one since this way we can see the faithful output of how the system works end-to-end.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Docs: </title>
      <link>/docs/experiences-builder/development-use-cases/nlp-uc-development/grammars/utterances-several-entities/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/docs/experiences-builder/development-use-cases/nlp-uc-development/grammars/utterances-several-entities/</guid>
      <description>
        
        
        &lt;h1 id=&#34;recognition-of-utterances-with-several-entities-in-grammars&#34;&gt;Recognition of utterances with several entities in Grammars&lt;/h1&gt;


&lt;div class=&#34;pageinfo pageinfo-primary&#34;&gt;
&lt;p&gt;Specific guidelines in the scenario when the user&amp;rsquo;s utterance includes several entities to be recognized by Grammars through the use of roles&lt;/p&gt;

&lt;/div&gt;

&lt;h2 id=&#34;use-of-roles-for-the-recognition-of-utterances-with-several-entities&#34;&gt;Use of roles for the recognition of utterances with several entities&lt;/h2&gt;
&lt;p&gt;If the user&amp;rsquo;s utterance contains several entities of the same type, it is required to add a role tag to the entity identifier, following the format:
&lt;code&gt;[entity_name:rol_value]&lt;/code&gt;&lt;br&gt;
The role tag is used by the system to identify that there are two entities of the same type but with different roles. &lt;/p&gt;
&lt;p&gt;This process will not affect the final output of the Grammars.
That is, if the entity with the role is &lt;code&gt;ent.audiovisual_sports_team:visitor&lt;/code&gt;, the system will only retrieve the tag &lt;code&gt;ent.audiovisual_sports_team&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;A practical example of Grammars that use this functionality is shown below:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The utterance &amp;ldquo;I would like to see Madrid against Barsa&amp;rdquo; contains two entities of the same type: &lt;code&gt;[ent.audiovisual_sports_team]&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;For both entities to be detected correctly, it will be necessary to add the role when defining the name of the entities. For example, the roles of local and visitor could be assigned, resulting &lt;code&gt;[ent.audiovisual_sports_team:local]&lt;/code&gt; and &lt;code&gt;[ent.audiovisual_sports_team:visitor]&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Certain considerations must be considered:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In order to recognize two entities of the same type in sequence, there is no need to create two entity graphs with the role tag but one, since the system is capable of discerning between the tagged entity and the untagged one.&lt;/li&gt;
&lt;li&gt;Entity values should be the same in both graphs.&lt;/li&gt;
&lt;li&gt;For better understanding purposes, we suggest using digits to name the entity graph having the role with the name of the role itself. For example:
&lt;code&gt;ent.audiovisual_sports_team:1&lt;/code&gt; -&amp;gt; &lt;code&gt;ent.audiovisual_sports_team_1.grf&lt;/code&gt;&lt;br&gt;
This can be also done using non-digit characters. That is, if the entity &lt;code&gt;ent.audiovisual_sports_team&lt;/code&gt; has the role &amp;ldquo;visitor&amp;rdquo; (&lt;code&gt;ent.audiovisual_sports_team:visitor&lt;/code&gt;), the name of the graph should be &lt;code&gt;ent.audiovisual_sports_team_visitor.grf&lt;/code&gt;.  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;../../../../../images/aura-nlp/grammars-several-intents.png&#34; alt=&#34;Utterance with several entities in grammars&#34;&gt;&lt;/p&gt;

      </description>
    </item>
    
  </channel>
</rss>
