pocketsphinx-python icon indicating copy to clipboard operation
pocketsphinx-python copied to clipboard

Multiple keywords support?

Open tlrobinson opened this issue 6 years ago • 8 comments

I couldn't find it in the documentation, but is there support for a list of keywords? i.e. pocketsphinx_continuous -kws keyword.list ....

If not, is it something that could be added?

tlrobinson avatar May 11 '18 08:05 tlrobinson

speech = LiveSpeech(kws='file.list')

should work

nshmyrev avatar May 11 '18 16:05 nshmyrev

Hello, I using pocketsphinx and have the same problem. speech = LiveSpeech(kws='key.list') my key list is very small: OPEN /1e-1/ TURN /1e-20/ STOP /1e-20/ my code picks up ends up returning any words and not just those on my list. I do not know what to do to continue.

emanuelqueiroga avatar Jun 17 '19 04:06 emanuelqueiroga

Hello, I using pocketsphinx and have the same problem. speech = LiveSpeech(kws='key.list') my key list is very small: OPEN /1e-1/ TURN /1e-20/ STOP /1e-20/ my code picks up ends up returning any words and not just those on my list. I do not know what to do to continue.

Did you try this? From the documentation:

for phrase in speech: print(phrase.segments(detailed=True))

danielml-mx avatar Jun 27 '19 21:06 danielml-mx

I too am having a issue with this. @DanielMzLz I tried what you posted and it does the opposite of what I am trying to do.

keywords=['word', 'phrase one', 'something else', 'test', 'etc']
speech = LiveSpeech(keyphrase=keywords)
print(speech)

I want the multiple keyphrases so that the voice recognition is more accurate.

Please help. Thanks.

EDIT: the above code doesn't work. I was hoping that it would.

l33tlinuxh4x0r avatar Mar 11 '20 16:03 l33tlinuxh4x0r

@https://github.com/l33tlinuxh4x0r Your keywords must be in a file with this format: keyword /1e-1/ # Note that you can put your own custom threshold

Note that you cannot pass in a list.

jfuruness avatar Sep 16 '20 20:09 jfuruness

Multiple keyword support worked for me like this:

speech = LiveSpeech(lm=False, kws='key.list')

had to set lm to False since kws aparently conflicts with lm (https://cmusphinx.github.io/wiki/tutoriallm/)

kultzak avatar Feb 15 '21 17:02 kultzak

I too am having a issue with this. @DanielMzLz I tried what you posted and it does the opposite of what I am trying to do.

keywords=['word', 'phrase one', 'something else', 'test', 'etc']
speech = LiveSpeech(keyphrase=keywords)
print(speech)

I want the multiple keyphrases so that the voice recognition is more accurate.

Please help. Thanks.

EDIT: the above code doesn't work. I was hoping that it would.

Tried the solutions mentioned above and had the exact same problem as you. But the following worked for me, it involves defining a pronunciation dictionary (explained here https://miguelmota.com/bytes/pocketsphinx-continuous-multiple-keywords/)

speech = LiveSpeech(lm=False, kws='key.list', dic='key.dict')

Hope this helps someone

JosephDillman avatar Mar 16 '21 01:03 JosephDillman

Did you tried this? `from pocketsphinx import LiveSpeech

keywords = ["yes", "no", "maybe", "I don't know"]

for keyword in keywords: live_speech = LiveSpeech(lm=False, keyphrase=keyword, kws_threshold=1e-20) for phrase in live_speech: print(phrase)`

jctelo avatar Jan 10 '23 19:01 jctelo