{
    "componentChunkName": "component---src-templates-doc-page-js",
    "path": "/docs/en/classificator/work_with_classificator/",
    "result": {"data":{"site":{"siteMetadata":{"title":"Gatsby-doc-engine"}},"markdownRemark":{"id":"92679391-7398-5d59-9f81-bca69a69dd55","excerpt":"!> Please note that the use of the classifier by examples has been deprecated since version . Learn more about migrating projects to CAILA.?> Set classifier…","html":"<h1>Using the classifier <span class=\"tag-heading red\">Deprecated</span></h1>\n<hr>\n<p class='tip'>Please note that the use of the classifier by examples has been deprecated since version <code class=\"language-text\">1.10.0</code>. Learn more about <a href=/1.10.3/docs/en/NLU_core/project_migration  >migrating projects to CAILA</a>.</p>\n<p class='warn'><a href=/1.10.3/docs/en/classificator/connection_classificator  >Set classifier parameters in the <code class=\"language-text\">chatbot.yaml</code> configuration file</a> before you start.</p>\n<p>The following tags are used in the script when the classifier is used:</p>\n<ul>\n<li>global: <a href=\"/1.10.3/docs/en/classificator/eg!\"><code class=\"language-text\">eg!</code></a> and <a href=\"/1.10.3/docs/en/classificator/e!\"><code class=\"language-text\">e!</code></a>;</li>\n<li>local: <a href=\"/1.10.3/docs/en/classificator/eg\"><code class=\"language-text\">eg</code></a> and <a href=\"/1.10.3/docs/en/classificator/e\"><code class=\"language-text\">e</code></a>.</li>\n</ul>\n</br>\n<h3>Using a single example</h3>\n<p>The <code class=\"language-text\">e</code> and <code class=\"language-text\">e!</code> tags are used for single examples: one tag for one reply. For example, in the script:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\"><span class=\"token keyword\">theme:</span> /Bank\n    <span class=\"token keyword\">state:</span> Credit\n        <span class=\"token storageType\">e!:</span> Give me a credit.\n        <span class=\"token variableParameter\">a:</span> To get a credit, you only need to...\n\n    <span class=\"token keyword\">state:</span> CatchAll\n        <span class=\"token storageType\">q!:</span> *\n        <span class=\"token variableParameter\">a:</span> Sorry, I don’t understand you.</code></pre></div>\n<p>Specify the phrase to which user requests are to be compared in the <code class=\"language-text\">e!</code> tag. If user requests are similar to the sample reply, the bot will recognize them as belonging to the same class, and the same behavior will be used for them.</p>\n<p>For example, phrases like “get credit”, “how to get a credit”, “take credit”, “give me a credit” will be allocated to the <code class=\"language-text\">Credit</code> state. The “I want to get a credit card” phrase will be allocated to the <code class=\"language-text\">CatchAll</code> state.</p>\n</br>\n<h3>Using example groups</h3>\n<p>For a large number of examples, using the <code class=\"language-text\">e</code> and <code class=\"language-text\">e!</code> tags is impractical. In this case you can use the <code class=\"language-text\">eg</code> and <code class=\"language-text\">eg!</code> tags and specify examples in a separate reference file. The reference file can be specified both in the platform’s GUI and manually. This article covers filling in the reference file manually.</p>\n<p class='warn'><a href=/1.10.3/docs/en/classificator/classificator_platform  >Learn more about using the classifier from the platform interface</a></p>\n<p>Working with an example group includes several stages:</p>\n<ul>\n<li><a href=\"#creating-a-reference-file-of-examples\">Creating a reference file of examples</a></li>\n<li><a href=\"#accessing-the-example-reference-file-from-the-script\">Accessing the example reference file from the script</a></li>\n</ul>\n</br>\n<h4>Creating a reference file of examples</h4>\n<p>Create the <code class=\"language-text\">examples.json</code> file in the <code class=\"language-text\">/src/dictionaries</code> folder. The reference file is created in the <code class=\"language-text\">.json</code> format and includes an array of objects, each of them describing a single example class.</p>\n<p>Specify parameters in the reference file. The following tags can be defined in each object:</p>\n<ul>\n<li><code class=\"language-text\">id</code>— an optional field. Set the <code class=\"language-text\">id</code> of the class to be used in the <code class=\"language-text\">eg</code> and <code class=\"language-text\">eg!</code> tags in the scripts. If no example is specified, <code class=\"language-text\">id</code> defaults to the class path (with a period).</li>\n<li><code class=\"language-text\">path</code> — path to the state where the classifier is accessed to process a specific class.</li>\n<li><code class=\"language-text\">description</code>— an optional field. Free-form text description of the class.</li>\n<li><code class=\"language-text\">disabled</code> — the <code class=\"language-text\">true</code> or <code class=\"language-text\">false</code> boolean value is specified. The example class is disabled in the classifier.</li>\n<li><code class=\"language-text\">phrases</code> — a string array. All the examples for the class are specified here.</li>\n</ul>\n<p>Example of a class:</p>\n<div class=\"gatsby-highlight\" data-language=\"json\"><pre class=\"language-json\"><code class=\"language-json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"classes\"</span> <span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n    <span class=\"token punctuation\">{</span>\n      <span class=\"token property\">\"id\"</span> <span class=\"token operator\">:</span> <span class=\"token string\">\"common\"</span><span class=\"token punctuation\">,</span>                          <span class=\"token comment\">// class id</span>\n      <span class=\"token property\">\"path\"</span> <span class=\"token operator\">:</span> <span class=\"token string\">\"/PlayGames/Games\"</span><span class=\"token punctuation\">,</span>              <span class=\"token comment\">// path to the state from which the classifier is accessed</span>\n      <span class=\"token property\">\"description\"</span> <span class=\"token operator\">:</span> <span class=\"token string\">\"\"</span><span class=\"token punctuation\">,</span>                       <span class=\"token comment\">// class description</span>\n      <span class=\"token property\">\"disabled\"</span> <span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span>                       <span class=\"token comment\">// disables the class</span>\n      <span class=\"token property\">\"phrases\"</span> <span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>                             <span class=\"token comment\">// array of examples</span>\n        <span class=\"token string\">\"let’s play some games\"</span>\n      <span class=\"token punctuation\">]</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">{</span>\n      <span class=\"token property\">\"id\"</span> <span class=\"token operator\">:</span> <span class=\"token string\">\"\"</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"path\"</span> <span class=\"token operator\">:</span> <span class=\"token string\">\"/PlayGames/Games/CanYouPlay\"</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"description\"</span> <span class=\"token operator\">:</span> <span class=\"token string\">\"\"</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"disabled\"</span> <span class=\"token operator\">:</span> <span class=\"token boolean\">false</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"phrases\"</span> <span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n        <span class=\"token string\">\"can you play a game?\"</span><span class=\"token punctuation\">,</span>\n        <span class=\"token string\">\"do you know any games?\"</span><span class=\"token punctuation\">,</span>\n        <span class=\"token string\">\"do you know how to play?\"</span>\n      <span class=\"token punctuation\">]</span>\n    <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">]</span>\n<span class=\"token punctuation\">}</span></code></pre></div>\n<p>Now that you have your reference of examples, specify the path to it in the <code class=\"language-text\">chatbot.yaml</code> configuration file:</p>\n<div class=\"gatsby-highlight\" data-language=\"yaml\"><pre class=\"language-yaml\"><code class=\"language-yaml\"><span class=\"token key atrule\">exampleGroups</span><span class=\"token punctuation\">:</span>\n  <span class=\"token punctuation\">-</span>  src/dictionaries/examples.json</code></pre></div>\n</br>\n<h4>Accessing the example reference file from the script</h4>\n<p>Accessing the group of examples if the class <code class=\"language-text\">id</code> is specified:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\">\n<span class=\"token keyword\">state:</span> Order\n    <span class=\"token storageType\">eg!:</span> common                                       <span class=\"token comment\">// specify the class id</span>\n     <span class=\"token variableParameter\">a:</span> Let’s play!</code></pre></div>\n<p>Accessing the group of examples if the class <code class=\"language-text\">id</code> is not specified:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\"><span class=\"token keyword\">state:</span> CanYouPlay\n            <span class=\"token storageType\">q!:</span> * [what] * (can you play/do you play) *\n            <span class=\"token storageType\">q!:</span> * {games  * (know/can play)} *\n            <span class=\"token storageType\">eg!:</span> PlayGames.Games.CanYouPlay            <span class=\"token comment\">// class id is not specified, specifying the path to the state after the '.' symbol:</span>\n            <span class=\"token storageType\">q:</span> * how* [games] * || fromState = \"/Education/What can you do\"<span class=\"token entityNameClass\">, onlyThisState =</span> true\n            <span class=\"token variableParameter\">script:</span>\n                $temp.canYouPlay = true;\n            <span class=\"token variableParameter\">go!:</span> ../../Games</code></pre></div>","frontmatter":{"title":"","description":null},"headings":[{"value":"Using the classifier"}]}},"pageContext":{"slug":"/docs/en/classificator/work_with_classificator/","previous":{"fields":{"slug":"/docs/en/jaicf/jaicf/"},"frontmatter":{"title":"","description":null}},"next":{"fields":{"slug":"/docs/en/classificator/filling_from_logs/"},"frontmatter":{"title":"","description":null}}}},
    "staticQueryHashes": ["1209419333"]}