dictation-toolbox / Caster

Dragonfly-Based Voice Programming and Accessibility Toolkit
Other
336 stars 122 forks source link

Re-implement dictation sink for modes #914

Closed LexiconCode closed 2 years ago

LexiconCode commented 2 years ago

Dragonfly can elevate a grammar to make it exclusive. So technically the engine is recognizing sound all the time an exclusive grammar or set of grammars takes precedent over all other grammars. Meaning it's only recognized effectively making a minimal grammar set. This can be easily toggled on and off.

Specific the sleep mode CasterMicRule is made exclusive. When CasterMicRule is exclusive only the commands to switch the different modes like sleep mode (Caster on). However depending on the speech recognition backend might try to manage utterance to command aggressively leading to false recognitions of the commands that switch modes. Therefore The following command with dictation element is needed.

"<text>": Function(lambda text: False),

This captures all the dictation and its function does effectively nothing. This makes the command for switching modes more accurate as unwanted utterances get absorbed by the dictation element. More advanced handling would need to be implement it on the backend for an alternative as this works fairly well.

Why not included in CasterMicRule?

In a large grammar pool the a raw dictation element (without a prefix command) has potential to process commands unexpectedly. Therefore "<text>": Function(lambda text: False), cannot be in CasterMicRule.

The solution: Therefore CasterMicRule and a new grammar DictationSyncRule containing "<text>": Function(lambda text: False), should be only active and made exclusive when CasterMicRule is exclusive. This may be useful for any other mode as well that have yet to be implemented.