Skip to content

Regex cache error in ConTextMarkup.py #13

@jianlins

Description

@jianlins

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 .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions