Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for better integration in the Wit.AI #298

Closed
wants to merge 3 commits into from

Conversation

jfremy
Copy link

@jfremy jfremy commented Jan 31, 2015

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?

@Holzhaus
Copy link
Member

I'd say that since the plugin has to support wit.ai anyway, I'd rather replace the "Unclear" module with a custom one that uploads the text to wit.ai (I think you can get the intent from text, too). That module can then parse the intents and do cool stuff. This way, Jasper's core remains not only general, but doesn't even need any changes.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.13%) to 45.31% when pulling 71568a5 on jfremy:witai into 54a5153 on jasperproject:jasper-dev.

@jfremy
Copy link
Author

jfremy commented Feb 1, 2015

You're right, wit.ai API handles both speech & text.
But I'm a little reluctant to put that in the unclear part. That would mean hitting possibly the API twice (once for the stt, once for the "unclear" module text). And it would mean a fallback while when you have an actual "hit" for an intent, then the odds that it's the right thing are quite high (assuming confidence is high enough).

From my understanding of Jasper, ideally, it would need an intermediate step between stt transcription and the modules checks to "normalize" the text to something that varies less than a text string (could be a semantic decomposition or a syntactic one). But that seems a little over the top at the moment.

With the changes I made, the modules can continue to work as before (they still get the full text). Only if you have a module made specifically for an "enhanced" transcription, will it have any effect.

@jfremy jfremy closed this Feb 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants