Continuous Speech Recognition Android

前端 未结 4 1014
失恋的感觉
失恋的感觉 2020-11-28 09:52

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

相关标签:
4条回答
  • 2020-11-28 10:39

    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.

    0 讨论(0)
  • 2020-11-28 10:40

    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
    0 讨论(0)
  • 2020-11-28 10:46

    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.

    0 讨论(0)
  • 2020-11-28 10:52

    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.

    0 讨论(0)
提交回复
热议问题