nerd-dictation icon indicating copy to clipboard operation
nerd-dictation copied to clipboard

[WIP] Add word cmd map

Open omlins opened this issue 2 years ago • 8 comments

Enable mapping of single words to commands, here mouse-clicks.

WIP: This requires an option for single-pass word-by-word processing (or similar) in order to enable continuous listening to commands without emitting them multiple times, c.f. #16 (at present, the PR will lead to a firework of mouse-clicks...).

Also, to avoid undesired behavior in continuous listening the option to Add '--commands' command line argument to restrict input to a limited set of commands (#3) could also be a solution here.

omlins avatar Aug 19 '21 15:08 omlins

Nice to see this moved into examples, although this is significant enough that I think it should be a separate example, since it contains quite a lot of command specific logic.

Also, there should be a way to force nerd-dictation to reset so that existing commands are not re-written based on further speech analysis.

Although this can be handled separately.

ideasman42 avatar Aug 25 '21 00:08 ideasman42

Also, there should be a way to force nerd-dictation to reset so that existing commands are not re-written based on further speech analysis.

Yes, I also see it exactly that way. Please have a look at issue #19 where I am proposing:

For this workflow, nerd-dictation should provide a reset function that can be called from within the configuration script (nerd-dictation.py). Moreover, it could be very useful if this reset function accepted a command name which could then be passed further to nerd_dictation_process as an optional argument.

omlins avatar Aug 25 '21 10:08 omlins

@omlins got any new updates? I'm looking into this feature as well.

asamwow avatar Nov 17 '21 19:11 asamwow

this is too much to be in a config file. only the command map should be in the config file.

asamwow avatar Nov 17 '21 19:11 asamwow

so I think we need two user config functions. First one that is called looking for cmd keywords. then it will "fall through" to nerd_dictation_process if no commands are recognized.

asamwow avatar Nov 17 '21 19:11 asamwow

#27

asamwow avatar Nov 17 '21 21:11 asamwow

It would be neat if you can teach Vosk a grammar with only the words and the command structure. I'm not sure if the vosk python library supports this, but reducing the words that are matched would increase the accuracy of commands that are spoken.

KJ7LNW avatar Jan 31 '23 22:01 KJ7LNW

@omlins, nerd-dictation now has Vosk Grammar support, see #84 and the example here:

  • https://github.com/ideasman42/nerd-dictation/blob/main/examples/vosk-grammar/nerd-dictation.py

KJ7LNW avatar Feb 09 '23 22:02 KJ7LNW