Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you look at
jasper.py
andclient/mic.py
, we're using theMic
class like this:So we pass in two different STT Engine instances:
But PocketsphinxSTT takes up to 3 lm/dict pairs:
3 A pair for active listen (musicmode)
This is a lot duplication, because in
jasper.py
, we're creating two separate SST Engine Instances for active listen and passive listen, so that the active listen STT Engine instance will only use the second lm/dict pair and the passive listen STT instance will only use the first pair.In MusicMode, a third STT instance will be created that only uses the third pair.
Given the case that someone wants to write a new module that also has the ability to start a mode like the MusicMode, he'd either have to hijack the music lm/dict pair, or he'd need to add a new mode to STT Engines and change the PocketsphinxSTTEngine code.
Thus, I'd like to simplify the STT engine dramatically by removing two of the three dict pairs (or rather Vocabulary Instances) from the PocketsphinxSTT engine and the
mode
parameter intranscribe
accordingly.Also, there's no need to case about custom engine-specific settings, because the
get_engine()
classmethod takes care of that for you.This vastly simplifies how STT engines are instantiated. Basically, you only need these steps:
So what happens inside
get_instance()
(which is also called by the convenience methodsget_passive_instance()
/get_active_instance()
)?my_vocab
.Because every STT engine only has one vocabulary, the
transcribe()
method becomes less complex, because it doesn't need themode
argument anymore.