Continuous Speech Recognition Android

笑着哭i 提交于 2019-12-17 06:09:34

问题


I am looking at doing speech recognition in android. The program needs to have continuous speech recognition. The library only needs to be about 10 words. I have considered using Googles api, but I don't think it will work. (I cannot have anything covering the screen). I have been looking into other ways but nothing seems like it will work. Is it possible to use java's speech recognition library, or is there any other way of going about this?

In summary
1. Need continuous speech input
2. 10 words at max
3. can train if necessary
4. overview of program - display screen, wait for voice input or touch input, update screen repeat
5. cannot cover what is being displayed on the screen

Any help would be appreciated.
Thanks in advance


回答1:


Here's Oracle's explanation of Java Speech API Frequently Asked Questions.




回答2:


I think you would have to capture audio directly from the phone's microphone and stream it to your own recognition service. The Google recognition APIs are built as an Intent that launches their own Recognition dialog and gives you back results. If you want continuous recognition without a UI, you'll have to build that functionality yourself.




回答3:


CMUSphinx has recently implemented continuous listening on Android platform. You can find the demo on the wiki page

You can configure one or multiple keywords to listen to, the default keyword is "oh mighty computer". You also can configure the detection threshold. Currently supported languages are US English and few others (French, Spanish, Russian, etc). You can train your own model for your language.

Listening is simple, you create a recognizer and just add keyword spotting search:

    recognizer = defaultSetup()
            .setAcousticModel(new File(modelsDir, "hmm/en-us-semi"))
            .setDictionary(new File(modelsDir, "lm/cmu07a.dic"))
            .setKeywordThreshold(1e-5f)
            .getRecognizer();

    recognizer.addListener(this);
    recognizer.addKeywordSearch(KWS_SEARCH_NAME, KEYPHRASE);
    switchSearch(KWS_SEARCH_NAME);

and define a listener:

@Override
public void onPartialResult(Hypothesis hypothesis) {
    String text = hypothesis.getHypstr();
    if (text.equals(KEYPHRASE))
      //  do something
}

Instead of single key phrase you can specify a commands file path on a filesystem:

    recognizer.addKeywordSearch(KWS_SEARCH, new File(assetsDir,
            "commands.lst").toString());

Which commands file commands.lst containing commands one per line:

  oh might computer
  ok google
  hello dude

To put this file on filesystem you can put it in assets and run syncAssets on application start.




回答4:


Here is another way (if you are planning to use Phonegap/Cordova).

https://stackoverflow.com/a/39695412/3603128

1) It listens continuously.

2) Does not display (occupy) on screen.




回答5:


Use CMUSphinx library:

  1. It will work in offline mode
  2. You can name it up
  3. It will start listens when you call his name



回答6:


I had the same requirements a couple of months ago and decided to write my own library.

I believe it should fit your requirements as well ;)




回答7:


In 2019 you can run Kaldi speech recognition library on Android, for setup check Kaldi demo.

Kaldi is much more advanced library than CMUSphinx and provides much better decoding accuracy.



来源:https://stackoverflow.com/questions/3148603/continuous-speech-recognition-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!