Skip to content

fix(taggers): avoid regex hang in not_alphanum_paragraph_v1#304

Open
Chessing234 wants to merge 1 commit into
allenai:mainfrom
Chessing234:fix/not-alphanum-emoji-hang
Open

fix(taggers): avoid regex hang in not_alphanum_paragraph_v1#304
Chessing234 wants to merge 1 commit into
allenai:mainfrom
Chessing234:fix/not-alphanum-emoji-hang

Conversation

@Chessing234

Copy link
Copy Markdown

Fixes #123

The not_alphanum_paragraph_v1 tagger could hang for tens of seconds (or indefinitely) on long emoji-only paragraphs because re_all_punctuation.search() triggered catastrophic backtracking in the regex package.

Switch to fullmatch() since we only need to detect paragraphs that consist entirely of punctuation, whitespace, and emoji. Adds a regression test with a long emoji paragraph from the HPLT dataset.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
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

Successfully merging this pull request may close these issues.

not_alphanum_paragraph_v1 tagger takes forever to run on certain inputs.

1 participant