Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

A user mentioned they were experiencing a bug with the text manipulation commands where character names were being interpreted as dictation (e.g. "arch" was being interpreted as the word arch instead of the letter a). Here's some things you could try if you experience a similar bug, based on my incomplete understanding of the problem. Approaches number 3 and 4 will probably not work but they are much less heavy handed than 1 and 2. Approaches 1 and 2 should be done either-or not both. Approaches number 1 and 2 should definitely work, so if they do not there's probably just a typo in my code or something, so let me know.

  1. The purpose of discriminating between dictation and commands here is so you don't end up matching something like "land" when you say "go lease and". This is nice but it's not that important, so you could just handle dictation and commands in the same way. If you replace your text_manipulation_functions.py with this file which has the necessary changes (just a couple lines inside the function get_start_end_position), it will process both dictation and commands using re.escape(phrase) where phrase is the target object you are looking for. I think this will solve your problem at the risk of sometimes inadvertently matching subwords (e.g. 'and' in 'land').

  2. If you want to preserve the discrimination between dictation and commands, you could try modifying the names of the commands so as to indicate whether you are searching for dictation or character(s). One way to do this would be to have the character commands use the word "punk" (it sounds like punctuation). So for example you would say something like "go punk lease before left prekris". If you want to take this approach, you would make the changes in the file text_manipulation.py . Here's an example you could just paste right over the top of your text_manipulation.py . There are a variety of ways you can do this sort of approach

  3. train the punctuation commands which I think is what you have been doing. Just to be sure, the way I would recommend doing that is opening up a full text control application such as Dragon pad ( by saying start Dragon pad ), type in the name of the command, highlight it, then say "train that", wait for the Dragon training dialogbox to appear, then say "train", then say "comma" or "left prekris" or whatever, then say save. When you are done with this say "save user profile".

  4. if "comma" is the main culprit, you could try just making a different command name for "," that isn't in the Dragon vocabulary. Training the new command wouldn't hurt. You would place the new command and punctuation.py inside text_punc_dict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment