aosingh / lexpy

Python package for lexicon; Trie and DAWG implementation.
GNU General Public License v3.0
55 stars 7 forks source link

The wildcard pattern `?*` should be treated the same way as `*?` #9

Open melsabagh opened 2 years ago

melsabagh commented 2 years ago

In Lexpy, ? means "zero or one character" and * means "zero or more characters". Based on this, why is the pattern ?* considered illegal while *? is allowed? Don't they both have the same semantics here:

*?: zero or more || zero or one -> zero || zero, zero || one, more || zero, more || one -> zero, one, more -> zero or more ?*: zero or one || zero or more -> zero || zero, zero || more, one || zero, one || more -> zero, more, one -> zero or more

The code at _utils.py#L15 already translates *? to *, why isn't this also done for ?*?

https://github.com/aosingh/lexpy/blob/b69e0297fc94fe51ea897d311f50230497eb6b93/lexpy/_utils.py#L51

aosingh commented 2 years ago

This is fixed in lexpy=1.0.0

pip install lexpy==1.0.0

Please test it and let me know if you have any questions.