Intent Matching is the process that the framework performs to determine the Intent of the message just received.
The process follows the order described in the diagram below:
Firstly, the framework tries to match the Intent using any scripted conditions implemented by the developers, using the closure 'onMatching' present in the Intent Class. If the Intent cannot be identified with scripts, or no 'onMatching' events are present, the system then tries to use Natural Language Processing. Once the NLP tried to parse the message, the matching closures are processed again. If the Intent still cannot be determined, the system will let the user know.
The 'onMatching' method is a function that returns a Boolean value. The developers can use this method to determine if the conditions present in the state Object indicate that the message of the user matches the Intent.
The following is an example of an 'onMatching' event:
//Intent hello
let helloIntent = new Intent("hello");
helloIntent.onMatching = () => {
return state.messageFromUser === "Hello";
};
In this case, the Intent will match 'true' if the user message is "Hello".
Comments
0 comments
Please sign in to leave a comment.