synesthesiam / rhasspy

Rhasspy voice assistant for offline home automation
https://rhasspy.readthedocs.io
MIT License
950 stars 101 forks source link

PocketSphinx Wake KeyPhrase using Custom Words #168

Closed jeikabu closed 4 years ago

jeikabu commented 4 years ago

I installed rhasspy 2.4.16 via Docker and have been trying to use PocketSphinx to setup a custom wake phase by:

  1. Add to Words, Save Custom Words, Train
  2. Use in Settings, Wake Word Wake Keyphrase
  3. Save settings, restart

Log outputs something similar to:

[WARNING:955754080] PocketsphinxWakeListener: XXX not in dictionary
[DEBUG:3450672] PocketsphinxWakeListener: Loading wake decoder with hmm=/profiles/en/acoustic_model, dict=/profiles/en/dictionary.txt

If I open a shell into the container, the new word is in /profiles/en/custom_words.txt, but after training it hasn't been added to /profiles/en/dictionary.txt.

How can I go about trouble-shooting this?

clemos commented 4 years ago

I'm also interested in helping with this, I stumbled upon the exact same issue. Let me know if you make any progress. Cheers :)

clemos commented 4 years ago

Another way to solve this is to add an entry in sentences.ini with your wakeword in it, and then train, which will push the word to dictionary.txt. I believe dictionary.txt is not populated with wakewords, which makes sense for all systems but pocketsphinx. Maybe it would indeed make sense to add the pocketsphinx wakeword to dictionary.txt during training, and thus mention in the docs that setting or changing pocketsphinx wakeword requires training.

clemos commented 4 years ago

There is also the possibility to set your profile's wake.pocketsphinx.dictionary to a dictionnary that contains only your wakeword, which is probably a cleaner solution (doesn't add unnecessary words to dictionary.txt) I can definitely make a PR, but what do you think would be best ?

jeikabu commented 4 years ago

Ah, interesting. Actually, that's all very helpful. Pocketsphinx wakewords not being added to the dictionary is perhaps unexpected, but not unreasonable. I was more surprised that even custom words didn't work like the docs make it sound like they should.

I don't have enough familiarity with rhasspy design/internals to make an informed opinion about this, so I'll defer regarding the best solution.

synesthesiam commented 4 years ago

Pocketsphinx wake words used to be automatically added to the dictionary before I apparently broke it! :man_facepalming:

Without a fix, @clemos is correct: only words from sentences.ini will make it into the final dictionary. I'll add this to my TODO list, though. Thanks!

synesthesiam commented 4 years ago

This will be fixed in 2.4.18

synesthesiam commented 4 years ago

Fixed in 2.4.18