Keyword Spotting in Speech on Android?

2019-01-25 00:00发布

问题:

I need to use speech input to insert text. How can i detect keyword when I'm speaking ?

Can i do this with Android Speech Input or I need external library ? Any ideas ?

Thanks

回答1:

Keyword detection task is different from a speech recognition task. While second tries to understand the text being spoken and check all possible word combinations, keyword spotting usually check two hypothesis - word is here or garbage is here. Its way more efficient to check keyword presence but it requires custom algorithm. You can implement one with the open source speech recognition toolkit like CMUSphinx.

http://cmusphinx.sourceforge.net

Which runs on Android too, you can check

Voice command keyword listener in Android

to see how to integrate it.



回答2:

Absolutely.

See this for some code that detects the "magic word"

Just launch an Intent with ACTION_RECOGNIZE_SPEECH and then check the results for your keyword. Checking for the keyword can be complicated, but this code should get you started.

https://github.com/gmilette/Say-the-Magic-Word-



回答3:

I used the Snowboy library for this task
Website: https://snowboy.kitt.ai
Github: https://github.com/kitt-ai/snowboy

It is a C library but it can be included in Android code using the JNI. The only downside to it is that you have to train it with audio samples if you want to use another keyword than the ones that comes with the library.