Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex cache error in ConTextMarkup.py #13

Open
jianlins opened this issue Apr 2, 2019 · 0 comments
Open

Regex cache error in ConTextMarkup.py #13

jianlins opened this issue Apr 2, 2019 · 0 comments

Comments

@jianlins
Copy link

jianlins commented Apr 2, 2019

In the following py file:
https://github.com/chapmanbe/pyConTextNLP/blob/master/pyConTextNLP/ConTextMarkup.py

From line 308~323, it tries to cache the compiled regulare expressions, by looking into the "Lex"(item.getLiteral()--line 321, 323).

While the cached regex is stored in COMPILED_REGEXPRS, which is outside the ConTextMarkup class but inside "ConTextMarkup" py file. So once "ConTextMarkup" is imported, it won't clear out by itself, even if you reinitiate an new ConTextMarkup object.

That means if you only change your "Rex", but not in "Lex", the previous compiled regular expression will be directly read instead of recompile it again.

This issue could cause troubles when editting rule files in some environments, like jupyter notebook .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant