dictation-toolbox / Caster

Dragonfly-Based Voice Programming and Accessibility Toolkit
https://dictation-toolbox.github.io/Caster/
Other
340 stars 121 forks source link

fix cws bug #870

Closed kendonB closed 3 years ago

kendonB commented 3 years ago

Fixes the cws bug.

Description

This PR changes out the cat_spec_and_reverse_3 function to more obviously be correct.

Related Issue

868

Motivation and Context

Bug

How Has This Been Tested

Just once on the text engine - please retest @LexiconCode @jdcai

Types of changes

Checklist

Maintainer/Reviewer Checklist

LexiconCode commented 3 years ago

Error loading the via the test engine on Python 3

ERROR:compound.parse:Exception raised parsing '(alt (((control | fly) (shift | shin)) | ((shift | shin) (control | fly)))) | ((control | fly) ((alt (shift | shin)) | ((shift | shin) alt))) | ((shift | shin) ((alt (control | fly)) | ((control | fly) alt))': Unexpected token Token($END, '') at line 1, column 207.
Expected one of:
        * RPAR

Could not import 'voice_dev_commands'. Module has errors: Traceback (most recent call last):
  File "C:\Users\Main\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lark\parsers\lalr_parser.py", line 62, in get_action
    return states[state][token.type]
KeyError: '$END'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Main\AppData\Local\Programs\Python\Python38-32\lib\site-packages\dragonfly\grammar\elements_compound.py", line 138, in __init__
    tree = self._parser.parse(spec)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lark\lark.py", line 368, in parse
    return self.parser.parse(text, start=start)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lark\parser_frontends.py", line 125, in parse
    return self._parse(token_stream, start, set_parser_state)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lark\parser_frontends.py", line 54, in _parse
    return self.parser.parse(input, start, *args)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lark\parsers\lalr_parser.py", line 35, in parse
    return self.parser.parse(*args)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lark\parsers\lalr_parser.py", line 110, in parse
    _action, arg = get_action(token)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lark\parsers\lalr_parser.py", line 65, in get_action
    raise UnexpectedToken(token, expected, state=state)
lark.exceptions.UnexpectedToken: Unexpected token Token($END, '') at line 1, column 207.
Expected one of:
        * RPAR
kendonB commented 3 years ago

I think I forgot to push the latest commit for this. That error is happening because of missing parentheses, if it's the same as the error I saw when I was composing this PR

jdcai commented 3 years ago

I tested it and it's working for me now. control shift works properly now.