-
-
Notifications
You must be signed in to change notification settings - Fork 474
Open
Description
While using nlpaug with Python 3.12, the following warning is raised due to invalid escape sequences in string literals used for regular expressions:
SyntaxWarning: invalid escape sequence '\s'
prefix_reg = '(?<=\s|\W)'
SyntaxWarning: invalid escape sequence '\s'
suffix_reg = '(?=\s|\W)'
These warnings originate from the context_word_embs.py file and are due to the use of unescaped backslashes in non-raw strings.
File Affected:
nlpaug/augmenter/word/context_word_embs.py, lines 123–124.
Why This Matters:
- Raw strings are the recommended way to write regular expressions in Python.
- Python 3.12+ raises SyntaxWarning for escape sequences that don’t have a clear meaning, and future versions may turn this into a SyntaxError.
- Fixing this improves compatibility and eliminates noisy warnings for users.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels