interegular
interegular copied to clipboard
Allows to check regexes for overlaps. Based on greenery by @qntm.
Fixes https://github.com/outlines-dev/outlines/issues/773 # Problem In `master`, interegular uses `char.upper()`, which can convert one char into two, resulting the set of `accepts()` and `strings()` being inconsistent. ``` >>> 'ß'.upper() 'SS' ```...
Currently when using `if my_fsm`, it will fallback on `__len__` which will raise an `OverflowError` in case there are an infinite many strings that match the FSM. We can just...
``` fsm = interegular.parse_pattern("(not(?=\s)|not(?=\()|-)").to_fsm() assert fsm .accepts('-') == True assert fsm .accepts('--') == False ``` Both of the above fail. I expect the first to succeed and the second to...
Hi! Package maintainer for Arch Linux here. I'm wondering if you can add some git tags for all the versions that are on PyPi but not on this repository. I...
`interegular 0.3.2`. `test_slow_example` test randomly fails on different architectures. For example, ``` =================================== FAILURES =================================== _______________________ test_slow_example[SLOW_EXAMPLE] ________________________ comp = expected = (('EXIT_TAG', 'COMMENT'),) @pytest.mark.parametrize("comp, expected", [ pytest.param(('EXIT_TAG', 'COMMENT'), (('EXIT_TAG',...
Fixes error when adding packages with newer setuptools versions `setuptools.errors.InvalidConfigError: Invalid dash-separated key 'description-file' in 'metadata' (setup.cfg), please use the underscore name 'description_file' instead.`
### Context This library is used in the [SGLang](https://github.com/sgl-project/sglang) inference server to constrain LLM outputs to specific grammars. This allows for cool features like generating deterministic and parsable outputs from...
I want to use `interegular` for tokenization in a C-like programming language. In particular, I use the regex `\/\*.*?\*\/` to match the block comments. By using `?`, I expect the...
Add visited states to hash index to avoid re-crawling