bravey
Version:
A simple JavaScript NLP-like library to help you creating your own bot.
851 lines (206 loc) • 12.7 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: ApiAiAdapter</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: ApiAiAdapter</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="Bravey.html">Bravey</a>.</span>ApiAiAdapter</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="ApiAiAdapter"><span class="type-signature"></span>new ApiAiAdapter<span class="signature">(packagePath)</span><span class="type-signature"></span></h4>
<div class="description">
A basic unofficial compatibility object that can read <a href="http://api.ai">Api.ai</a> exported packages and simulates its output.
</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>packagePath</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The path to the exported Api.ai package root.</td>
</tr>
<tr>
<td class="name"><code>extensions.language</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The language to be used. Possible values are namespace names of <a href="Bravey.Language.html">Bravey.Language</a>.</td>
</tr>
<tr>
<td class="name"><code>extensions.nlp</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The NLP processor to be used. Possible values are namespace names of <a href="Bravey.Nlp.html">Bravey.Nlp</a>.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="adapters_ApiAiAdapter.js.html">adapters/ApiAiAdapter.js</a>, <a href="adapters_ApiAiAdapter.js.html#line8">line 8</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="nlp"><span class="type-signature"></span>nlp<span class="type-signature"></span></h4>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nlp</code></td>
<td class="type">
<span class="param-type"><a href="Bravey.Nlp.html">Bravey.Nlp</a></span>
</td>
<td class="description last">The raw Nlp instance.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="adapters_ApiAiAdapter.js.html">adapters/ApiAiAdapter.js</a>, <a href="adapters_ApiAiAdapter.js.html#line177">line 177</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="loadEntity"><span class="type-signature"></span>loadEntity<span class="signature">(name)</span><span class="type-signature"></span></h4>
<div class="description">
Prepare for loading an entity from the specified package.
</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>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The intent name.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="adapters_ApiAiAdapter.js.html">adapters/ApiAiAdapter.js</a>, <a href="adapters_ApiAiAdapter.js.html#line107">line 107</a>
</li></ul></dd>
</dl>
<h4 class="name" id="loadIntent"><span class="type-signature"></span>loadIntent<span class="signature">(name)</span><span class="type-signature"></span></h4>
<div class="description">
Prepare for loading an intent from the specified package.
</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>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The intent name.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="adapters_ApiAiAdapter.js.html">adapters/ApiAiAdapter.js</a>, <a href="adapters_ApiAiAdapter.js.html#line94">line 94</a>
</li></ul></dd>
</dl>
<h4 class="name" id="prepare"><span class="type-signature"></span>prepare<span class="signature">(cb)</span><span class="type-signature"></span></h4>
<div class="description">
Load the needed files and prepares the NLP.
</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>cb</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The callback called when everything is ready.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="adapters_ApiAiAdapter.js.html">adapters/ApiAiAdapter.js</a>, <a href="adapters_ApiAiAdapter.js.html#line120">line 120</a>
</li></ul></dd>
</dl>
<h4 class="name" id="test"><span class="type-signature"></span>test<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Check if a given sentence matches an intent and extracts its entities. Output simulates Api.ai structure. For arguments, check Bravey.Nlp.test.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="adapters_ApiAiAdapter.js.html">adapters/ApiAiAdapter.js</a>, <a href="adapters_ApiAiAdapter.js.html#line128">line 128</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bravey.ApiAiAdapter.html">ApiAiAdapter</a></li><li><a href="Bravey.ContextManager.html">ContextManager</a></li><li><a href="Bravey.DocumentClassifier.html">DocumentClassifier</a></li><li><a href="Bravey.EMailEntityRecognizer.html">EMailEntityRecognizer</a></li><li><a href="Bravey.Filter.BasicFilter.html">BasicFilter</a></li><li><a href="Bravey.FreeTextEntityRecognizer.html">FreeTextEntityRecognizer</a></li><li><a href="Bravey.Language.EN.DateEntityRecognizer.html">DateEntityRecognizer</a></li><li><a href="Bravey.Language.EN.FreeTextEntityRecognizer.html">FreeTextEntityRecognizer</a></li><li><a href="Bravey.Language.EN.NumberEntityRecognizer.html">NumberEntityRecognizer</a></li><li><a href="Bravey.Language.EN.Stemmer.html">Stemmer</a></li><li><a href="Bravey.Language.EN.TimeEntityRecognizer.html">TimeEntityRecognizer</a></li><li><a href="Bravey.Language.EN.TimePeriodEntityRecognizer.html">TimePeriodEntityRecognizer</a></li><li><a href="Bravey.Language.IT.DateEntityRecognizer.html">DateEntityRecognizer</a></li><li><a href="Bravey.Language.IT.FreeTextEntityRecognizer.html">FreeTextEntityRecognizer</a></li><li><a href="Bravey.Language.IT.NumberEntityRecognizer.html">NumberEntityRecognizer</a></li><li><a href="Bravey.Language.IT.Stemmer.html">Stemmer</a></li><li><a href="Bravey.Language.IT.TimeEntityRecognizer.html">TimeEntityRecognizer</a></li><li><a href="Bravey.Language.IT.TimePeriodEntityRecognizer.html">TimePeriodEntityRecognizer</a></li><li><a href="Bravey.Language.PT.DateEntityRecognizer.html">DateEntityRecognizer</a></li><li><a href="Bravey.Language.PT.FreeTextEntityRecognizer.html">FreeTextEntityRecognizer</a></li><li><a href="Bravey.Language.PT.NumberEntityRecognizer.html">NumberEntityRecognizer</a></li><li><a href="Bravey.Language.PT.Stemmer.html">Stemmer</a></li><li><a href="Bravey.Language.PT.TimeEntityRecognizer.html">TimeEntityRecognizer</a></li><li><a href="Bravey.Language.PT.TimePeriodEntityRecognizer.html">TimePeriodEntityRecognizer</a></li><li><a href="Bravey.Nlp.Fuzzy.html">Fuzzy</a></li><li><a href="Bravey.Nlp.Sequential.html">Sequential</a></li><li><a href="Bravey.NumberEntityRecognizer.html">NumberEntityRecognizer</a></li><li><a href="Bravey.RegexEntityRecognizer.html">RegexEntityRecognizer</a></li><li><a href="Bravey.SessionManager.InMemorySessionManager.html">InMemorySessionManager</a></li><li><a href="Bravey.StringEntityRecognizer.html">StringEntityRecognizer</a></li><li><a href="Bravey.Text.RegexMap.html">RegexMap</a></li></ul><h3>Namespaces</h3><ul><li><a href="Bravey.html">Bravey</a></li><li><a href="Bravey.Data.html">Data</a></li><li><a href="Bravey.Date.html">Date</a></li><li><a href="Bravey.File.html">File</a></li><li><a href="Bravey.Filter.html">Filter</a></li><li><a href="Bravey.Language.html">Language</a></li><li><a href="Bravey.Language.EN.html">EN</a></li><li><a href="Bravey.Language.IT.html">IT</a></li><li><a href="Bravey.Language.PT.html">PT</a></li><li><a href="Bravey.Nlp.html">Nlp</a></li><li><a href="Bravey.SessionManager.html">SessionManager</a></li><li><a href="Bravey.Text.html">Text</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>