drmfinlay / pyjsgf

JSpeech Grammar Format (JSGF) compiler, matcher and parser package for Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Matching issue with alternatives and OptionalGrouping

embie27 opened this issue · comments

The following rule does not always match when in should: public <test> = this is a [big] (sentence | file);
Matches the following:

  • 'this is a sentence'
  • 'this is a big sentence'
  • 'this i a file'

But it does not match:

  • 'this is a big file'

It definitely should match the last sentence, too.

Same error with * instead of [ ].

Thanks for the issue 👍. I can't say this surprises me, the matching implementation as it stands is pretty rough around the edges. Don't worry about trying to fix it yourself, I've just finished a much better matching implementation today which doesn't have this problem. I'll commit it soon.

Great. I'm really looking forward to use the new implementation!

The new implementation is in develop now. It's up a bit later than I wanted because there were a few problems with it that the tests didn't cover. Let me know if you find any problems. I want to release this and the other changes in v1.5.0.

This is unrelated to this issue, but the matching performance is much better now.

I'll close this now that version 1.5.0 is released.