UNPKG

node-nlp

Version:

Library for NLU (Natural Language Understanding) done in Node.js

1,763 lines (445 loc) 20.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: SlotManager</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: SlotManager</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>SlotManager<span class="signature">()</span><span class="type-signature"></span></h2> <div class="class-description">Class for a Slot Manager that takes care of the slot information.</div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="SlotManager"><span class="type-signature"></span>new SlotManager<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Constructor of the class. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line27">line 27</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="addBatch"><span class="type-signature"></span>addBatch<span class="signature">(intent, entities)</span><span class="type-signature"> &rarr; {Array.&lt;Object>}</span></h4> <div class="description"> Add several entities if they don't exists. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>intent</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the intent.</td> </tr> <tr> <td class="name"><code>entities</code></td> <td class="type"> <span class="param-type">Array.&lt;String></span> </td> <td class="description last">List of entities.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line96">line 96</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Array of resulting entities. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;Object></span> </dd> </dl> <h4 class="name" id="addSlot"><span class="type-signature"></span>addSlot<span class="signature">(intent, entity, mandatory, questions)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Adds a new slot for a given intent and entity. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>intent</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="default"> </td> <td class="description last">Name of the intent.</td> </tr> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="default"> </td> <td class="description last">Name of the entity.</td> </tr> <tr> <td class="name"><code>mandatory</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="default"> false </td> <td class="description last">Flag indicating if is mandatory or optional.</td> </tr> <tr> <td class="name"><code>questions</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="default"> </td> <td class="description last">Question to ask when is mandatory, by locale.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line66">line 66</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> New slot instance. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Clear the slot manager. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line125">line 125</a> </li></ul></dd> </dl> <h4 class="name" id="existsSlot"><span class="type-signature"></span>existsSlot<span class="signature">(intent, entity)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> Indicates if a given slot exists, given the intent and entity. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>intent</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the intent.</td> </tr> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the entity.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line54">line 54</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True if the slot exists, false otherwise. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id="getIntentEntityNames"><span class="type-signature"></span>getIntentEntityNames<span class="signature">(intent)</span><span class="type-signature"> &rarr; {Array.&lt;String>}</span></h4> <div class="description"> Given an intent, return the array of entity names of this intent. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>intent</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the intent.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line115">line 115</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Array of entity names of the intent. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;String></span> </dd> </dl> <h4 class="name" id="getMandatorySlots"><span class="type-signature"></span>getMandatorySlots<span class="signature">(intent)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Given an intent return the mandatory slots. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>intent</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the intent</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line150">line 150</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Object with the mandatory slots. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="getSlot"><span class="type-signature"></span>getSlot<span class="signature">(intent, entity)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Returns an slot given the intent and entity. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>intent</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the intent.</td> </tr> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the entity.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line41">line 41</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Slot or undefined if not found. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="load"><span class="type-signature"></span>load<span class="signature">(src)</span><span class="type-signature"></span></h4> <div class="description"> Loads the slot manager content. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>src</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Source content.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line133">line 133</a> </li></ul></dd> </dl> <h4 class="name" id="removeSlot"><span class="type-signature"></span>removeSlot<span class="signature">(intent, entity)</span><span class="type-signature"></span></h4> <div class="description"> Remove an slot given the intent and the entity. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>intent</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the intent.</td> </tr> <tr> <td class="name"><code>entity</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Name of the entity.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line84">line 84</a> </li></ul></dd> </dl> <h4 class="name" id="save"><span class="type-signature"></span>save<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Returns the slot manager content. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="slot_slot-manager.js.html">slot/slot-manager.js</a>, <a href="slot_slot-manager.js.html#line141">line 141</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Slot manager content. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BinaryNeuralNetworkClassifier.html">BinaryNeuralNetworkClassifier</a></li><li><a href="Classifier.html">Classifier</a></li><li><a href="ConversationContext.html">ConversationContext</a></li><li><a href="DutchStemmer.html">DutchStemmer</a></li><li><a href="EnglishStemmer.html">EnglishStemmer</a></li><li><a href="EnumNamedEntity.html">EnumNamedEntity</a></li><li><a href="Evaluator.html">Evaluator</a></li><li><a href="HungarianStemmer.html">HungarianStemmer</a></li><li><a href="ItalianStemmer.html">ItalianStemmer</a></li><li><a href="Language.html">Language</a></li><li><a href="LogisticRegressionClassifier.html">LogisticRegressionClassifier</a></li><li><a href="Matrix.html">Matrix</a></li><li><a href="MemoryConversationContext.html">MemoryConversationContext</a></li><li><a href="NamedEntity.html">NamedEntity</a></li><li><a href="NerManager.html">NerManager</a></li><li><a href="NlgManager.html">NlgManager</a></li><li><a href="NlpClassifier.html">NlpClassifier</a></li><li><a href="NlpManager.html">NlpManager</a></li><li><a href="NorwegianStemmer.html">NorwegianStemmer</a></li><li><a href="PortugueseStemmer.html">PortugueseStemmer</a></li><li><a href="Recognizer.html">Recognizer</a></li><li><a href="RegexNamedEntity.html">RegexNamedEntity</a></li><li><a href="RomanianStemmer.html">RomanianStemmer</a></li><li><a href="RussianStemmer.html">RussianStemmer</a></li><li><a href="SentimentAnalyzer.html">SentimentAnalyzer</a></li><li><a href="SentimentManager.html">SentimentManager</a></li><li><a href="SimilarSearch.html">SimilarSearch</a></li><li><a href="SlotManager.html">SlotManager</a></li><li><a href="StemmerJa.html">StemmerJa</a></li><li><a href="SwedishStemmer.html">SwedishStemmer</a></li><li><a href="Tokenizer.html">Tokenizer</a></li><li><a href="TrimNamedEntity.html">TrimNamedEntity</a></li><li><a href="TurkishStemmer.html">TurkishStemmer</a></li><li><a href="Vector.html">Vector</a></li><li><a href="XTable.html">XTable</a></li></ul><h3>Global</h3><ul><li><a href="global.html#endsinArr">endsinArr</a></li><li><a href="global.html#prelude">prelude</a></li><li><a href="global.html#regions">regions</a></li><li><a href="global.html#stem">stem</a></li><li><a href="global.html#stopwords">stopwords</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Oct 13 2018 19:14:51 GMT+0200 (CEST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>