Train classifier (natural - NLP) on node.js for unexpected sentences
<p>Some context: Node.js, Bot, <a href="https://github.com/NaturalNode/natural" rel="nofollow noreferrer">natural module</a>.</p>
<p>I would like to build a Bot and I am using the natural module in order to parse and overall classify the user input.</p>
<pre><code>var classifier = new natural.BayesClassifier();
classifier.addDocument('Hi', 'welcome');
classifier.addDocument('Hello', 'welcome');
classifier.addDocument('Hey', 'welcome');
classifier.addDocument('Good', 'welcome');
...
//back to home
classifier.addDocument('go back to home', 'back2home');
classifier.addDocument('go back home', 'back2home');
classifier.addDocument('return',  'back2home');
classifier.addDocument('return to home', 'back2home');
...
classifier.train();
...
classifier.classify(text);
</code></pre>
<p>Those tests work fine:</p>
<pre><code>  &quot;I would like to go back home&quot; =&gt; back2home
  &quot;Hi&quot; =&gt; welcome
</code></pre>
<p>All good, but what if the user text contains something such as: &quot;bla bla bla&quot;, I want to get a way to know that the that the text not fits enough in any of the above cases. &quot;bla bla bla&quot; returns me =&gt; welcome, but actually i would like it return something such &quot;unknown&quot;/not understood.</p>
<p>It is a way to &quot;train&quot; the classifier in such a way?
Thanks.</p>