Constructor
new Recognizer(settings)
Constructor of the class.
Parameters:
Name | Type | Description |
---|---|---|
settings |
Object | Settings for the instance. |
- Source:
Methods
defaultRouting(bot, session, results)
Route to a default route of the bot. First the route is calculated as the
best route based on the results and the dialog stack. If no best route exists
then is routed to the active dialog.
Parameters:
Name | Type | Description |
---|---|---|
bot |
Object | Microsoft Bot Framework Universal Bot instance. |
session |
Object | Microsoft bot framework session. |
results |
Object | Results for the routing. |
- Source:
getDialogId(session) → {string}
Gets the last developer (not framework) dialogId on the stack.
Parameters:
Name | Type | Description |
---|---|---|
session |
Object | Microsoft bot framework session. |
- Source:
Returns:
Last dialog id.
- Type
- string
load(filename)
Loads the model from a file.
Parameters:
Name | Type | Description |
---|---|---|
filename |
String | Name of the file. |
- Source:
(async) loadExcel(filename)
Loads the NLP manager from an excel.
Parameters:
Name | Type | Description |
---|---|---|
filename |
String | Name of the file. |
- Source:
(async) process(srcContext, locale, Promise)
Process an utterance using the NLP manager. This is done using a given context
as the context object.
Parameters:
Name | Type | Description |
---|---|---|
srcContext |
Object | Source context |
locale |
String | Locale of the utterance. |
Promise |
Promise.String | utterance Utterance to be recognized. |
- Source:
processAnswer(session, answer)
When an answer is received over the threshold, decide what to do with this answer.
Parameters:
Name | Type | Description |
---|---|---|
session |
Object | Microsoft bot framework session. |
answer |
string | Answer given by the NLP. |
- Source:
recognize(session, cb)
Given a session of a chatbot containing a message, recognize the utterance in the message.
Parameters:
Name | Type | Description |
---|---|---|
session |
Object | Chatbot session of the message. |
cb |
function | Callback function. |
- Source:
recognizeTwice(session, cb)
Given a session of a chatbot containing a message, recognize for second time
the utterance in the message.
Parameters:
Name | Type | Description |
---|---|---|
session |
Object | Chatbot session of the message. |
cb |
function | Callback function. |
- Source:
(async) recognizeUtterance(utterance, model, cb)
Given an utterance and the locale, returns the recognition of the utterance.
Parameters:
Name | Type | Description |
---|---|---|
utterance |
String | Utterance to be recognized. |
model |
String | Model of the utterance. |
cb |
function | Callback Function. |
- Source:
save(filename)
Saves the model into a file.
Parameters:
Name | Type | Description |
---|---|---|
filename |
String | Name of the file. |
- Source:
setBot(bot, activateRouting, routingThreshold)
Sets the recognizer to a Microsoft bot framework universal bot instance.
Also, the default bot routing can be overrided and replaced by the
recognizer routing.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
bot |
Object | Microsoft Bot Framework Universal Bot instance. | |
activateRouting |
boolean | false | True if default routing should be overrided. |
routingThreshold |
number | 0.7 | Threshold for the score of the intent. |
- Source:
(async) train()
Train the NLP manager.
- Source: