Skip to content
Guidone edited this page Aug 22, 2017 · 2 revisions

Api.ai has a powerful NLP and it's possible to exploit it through the API.ai node. With Api.ai it's easy to parse sentences like "I want to switch on the lights of the living room" and extract key variables.

  • Context: have the same meaning of topic in RedBot (do not confuse with chat context in RedBot ), the purpose is to restrict the working area of the parsers based on a context of the sentence. For example the words "the email is [email protected]" can trigger a particular action it the user is signing up with the chat bot (for example topic or context "signup" ) and a different one if the user intention is to send an email to someone with the chat bot (for example topic or context "send_message")
  • Intent: is a set of rules for parsing user's sentences and detect a set of entities in order to consider the sentence complete. For example in the sentence "I want to switch on the lights in the living room", the entities are Furniture (lights), OnOff (on) and Room (living room). By setting these entities as mandatory to consider the sentence complete, the Api.ai intent is able to parse them and ask further questions if the sentence is missing some informations (for example after "I want to switch on the lights" it could ask "In which room?"). When the sentence is complete the Intent changes the context/topic, for example to "switch_lights", in this way it's possible to let RedBot takes action for this context.
  • Entity: are sets of objects of the same class. For example in a sentence like "I want to switch on the lights in the living room" the entity Room can contain: living room, kitchen, lavatory, etc

The Api.ai node works like a kind of loop: the first output is always connected to a message node, this allows the Api.ai node to keep asking question to the user until all the intent requirements are met. When the sentence is complete and Api.ai has moved to a new topic (context in Api.ai ) the message is forwarded to the proper output based on the matched topic (just like the Topic node).

Clone this wiki locally