talonhub / community

Voice command set for Talon, community-supported.
MIT License
618 stars 768 forks source link

`sentence the air is fresh` produces "TheaIs fresh" #299

Closed rntz closed 3 years ago

rntz commented 3 years ago

Someone mentioned this in #beta today: https://talonvoice.slack.com/archives/G9YTMSZ2T/p1608050965475600. @dwiel also ran into a similar issue and mentioned it in #community.

There are really two issues here:

  1. sentence is a formatter, so it doesn't behave like say|phrase, which is unintuitive given its name. eg. Because of formatter chaining, for example, sentence the snake is here becomes "Theis_here".

  2. Formatters permit letter names in them; see the formatter_immune capture, https://github.com/knausj85/knausj_talon/blob/master/code/formatters.py#L220. Thus air in the air is fresh gets interpreted as "a" and the formatter restarts. This also means that snake quick look becomes quickl instead of quick_look.

I think we should at least fix 1. 2 has some genuine uses, but I would prefer hiding it behind a prefix so you have to say snake quick spell look to get quickl; that might be less easy to trip over.

dwiel commented 3 years ago
  1. I agree, but i rarely run into this problem
  2. This was one of the most common causes of errors until I changed in my own repos just recently. I don't really see the benefit of being able to include the alphabet in the middle of a sentence. Perhaps some people are working on code bases with goofy names like XYFoobarZbaz or something? Perhaps for variable names using Hungarian notation like fvalue to signify a floating-point value?
knausj85 commented 3 years ago

IMO this is really one of the tradeoffs of anchoring the formatter.

Without anchoring, something like XYFoobarZbaz <-> plex yank title foobar [yada yada]

I try to remember to use the "over" variant of the formatters for such cases, which is a decent compromise.

I think fixing both is wise--at least a better default.

knausj85 commented 3 years ago

For the moment, I've removed user.letter from formatters_immune since I can't it to work on the current beta with Dragon.