bottender-recognizer
Build bottender bots with intent recognizer and action resolver.
Installation
npm install bottender-recognizer
Definition
Recognizer
(state, event) => intent | undefined
Example:
async name: 'INTENT_NAME' payload: {};
Intent
name
- Must have.payload
- Recommended.
Example:
name: "INTENT_NAME" payload: {}
Resolver
(state, intent) => action
Example:
doSomething;
With derivedState
and derivedParam
:
(state, intent) => derivedState + derivedParam + action
Example:
action: doSomething derivedState: x: 1 derivedParam: y: 2 ;
Action
context => void
Example:
async { // ...};
With parameters:
context + param => void
Example:
async { // ...};
API Reference
createHandler({ recognizer, resolver, chatbase, debug })
It creates a bottender handler function.
;
combineRecognizers(recognizers)
It turns an array of recognizers into a single recognizer that you can pass to createHandler
.
const regex = { if eventisText && /^Hi$/i return name: 'GREETING' payload: // other args... ; }; const nlu = async { //...}; ;
License
MIT © Yoctol