Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
112 views
in Technique[技术] by (71.8m points)

java - Restricting speech recognition results on Android

I'm making an app that allows people to speak and select between a few options (Strings). I'm having a little problem making the Android Speech Recognizer fit my idea.

Is there a way to just pass to the SpeechRecognizer the parameters that are "valid" and having it select between those the "best" match?

I don't need the code, I just need some guidance as my google-fu seems to be failing me today.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Our solution to this problem is described at http://kaljurand.github.io/Grammars/, e.g. check out the paper linked from this page:

Kaarel Kaljurand, Tanel Alum?e. Controlled Natural Language in Speech Recognition Based User Interfaces (CNL 2012)

The basic idea is:

  1. don't use Google's speech recognizer because you cannot (currently) pass the language model (e.g. a grammar) to it (in our case it also didn't support the input language that we wanted to use);
  2. so you need to implement your own speech recognizer (e.g. based on Sphinx) and make it accept grammars as part of the input;
  3. implement the grammar. If it's a simple list of acceptable phrases then JSGF will do as the grammar description language, for more complex grammars I recommend Grammatical Framework (which you can automatically compile to JSGF or finite-state automata);
  4. implement an Android app that extends the RecognizerIntent API by adding a way to pass the grammar to the recognizer. You can base it e.g. on K?nele.

All this might be an overkill in your case. Post-processing of Google's results (as @gregm suggests) is certainly easier to implement. But if you want to scale to more complex and/or multilingual language models then our approach certainly provides the required modularity and expressive power.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...