{
    "componentChunkName": "component---src-templates-doc-page-js",
    "path": "/docs/en/JS_API/built_in_services/nlp/setClass/",
    "result": {"data":{"site":{"siteMetadata":{"title":"Gatsby-doc-engine"}},"markdownRemark":{"id":"5d4bc91c-54ac-5a3d-9716-ce22b235b437","excerpt":"You can use this function to assign any nlp class to a pair of client/bot phrases, and this class will be displayed in the Class field in the dialog history…","html":"<h1><code class=\"language-text\">function setClass(string)</code></h1>\n<hr>\n<p>You can use this function to assign any nlp class to a pair of client/bot phrases, and this class will be displayed in the <a href=\"/1.10.3/docs/en/platform_ux/analytics_dialogs\"><em>Class</em></a> field in the dialog history.</p>\n<p>The function accepts the nlp class as a string argument. For example:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\">$nlp.setClass (\"/set/new/class\")</code></pre></div>\n</br>\n<h4>How to use</h4>\n<p>Here is an example:</p>\n<div class=\"gatsby-highlight\" data-language=\"sc\"><pre class=\"language-sc\"><code class=\"language-sc\"><span class=\"token keyword\">theme:</span> /\n\n    <span class=\"token keyword\">state:</span> CatchAll\n        <span class=\"token storageType\">q!:</span> *\n        <span class=\"token variableParameter\">script:</span>\n            if ($parseTree.text.equals(\"ghbdtn\")) {\n                $nlp.setClass(\"/Hello\");\n                $reactions.transition(\"/Hello\");\n            } else {\n                $reactions.answer(\"I cannot understand you\");\n            }\n\n\n    <span class=\"token keyword\">state:</span> Hello\n        <span class=\"token storageType\">q!:</span> Hi\n        <span class=\"token variableParameter\">a:</span> Good afternoon!</code></pre></div>\n</br>\n<p>Here:</p>\n<ul>\n<li>If you send any phrase to the bot, the <code class=\"language-text\">CatchAll</code> state will be triggered. The <code class=\"language-text\">/CatchAll</code> class will be displayed in the dialog history.</li>\n<li>If you send <code class=\"language-text\">ghbdtn</code> to the bot, the <code class=\"language-text\">CatchAll</code> state will be triggered. You will also be redirected to the <code class=\"language-text\">Hello</code> state. The <code class=\"language-text\">/Hello</code> class will be displayed in the dialog history.</li>\n<li>However, if you remove the <code class=\"language-text\">$nlp.setClass(\"/Hello\");</code> line from the script, the query will be handled by the <code class=\"language-text\">CatchAll</code> state. Then you will be redirected to the <code class=\"language-text\">Hello</code> state. The <code class=\"language-text\">/CatchAll</code> class will be displayed in the dialog history.</li>\n</ul>","frontmatter":{"title":"","description":null},"headings":[{"value":"<code class=\"language-text\">function setClass(string)</code>"}]}},"pageContext":{"slug":"/docs/en/JS_API/built_in_services/nlp/setClass/","previous":{"fields":{"slug":"/docs/en/JS_API/built_in_services/nlp/tokenize/"},"frontmatter":{"title":"","description":null}},"next":{"fields":{"slug":"/docs/en/JS_API/built_in_services/nlp/parseMorph/"},"frontmatter":{"title":"","description":null}}}},
    "staticQueryHashes": ["1209419333"]}