Suggestion for better integration in the Wit.AI #298
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, this pull request is really to get your feedback on an improved integration in the Wit.AI case I've been thinking about. It will definitely need some iterations.
I know the system needs to stay generic and this is still the case. However, I found it a pity that Jasper cannot rely on the text analysis features of Wit.AI (which are the real features of Wit for me, the STT is more a convenience).
So when you make a query to the Wit.AI API and your Wit.AI instance is configured, you get more than just the transcribed text. You get a list of intents (which map to a type of question you configured but account for variations in the way you say it) + a confidence level for each intent as well as entities (if the intent is configured to have entities)..
Entities are essentially identified data elements.
For instance, if I configure an intent to express "what is the temperature in {room}", whenever Wit.AI recognizes something that matches with it, then I will have dedicated entity named room with the actual name of the room. So it avoids a lot of parsing and Wit.AI is definitely going to be better at it than any code I can write as a module (see https://wit.ai/docs/http#response-format-link for the format of the answers).
So how do I use this?
I essentially add to the list of transcribed text the intents (if they're correctly named such as with an _, there is very little risk for a conflict with the regular text matching).
Also, when I add the intent to the list of transcribed text, I add it in a subclass of the string class that has 4 additional methods (get/setConfidence, get/SetEntities). This means that the confidence level and entities are availables for the modules who know to expect them.
One last example: I can rewrite the time module to match on "time_request" where "time_request" is the name of the intent that matches any way of saying "what time is it" ("how late is it" ...).
I know this is just for Wit.AI so it's not too generic, but what do you think of this approach?