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

Normalizer bug - KeyError: '\\u' #205

Closed
GokulNC opened this issue Nov 23, 2021 · 1 comment
Closed

Normalizer bug - KeyError: '\\u' #205

GokulNC opened this issue Nov 23, 2021 · 1 comment

Comments

@GokulNC
Copy link

GokulNC commented Nov 23, 2021

After the PR #200 was merged, I face the following error:

>>> from hazm import Normalizer
>>> h=Normalizer()
>>> h.normalize("hi")
Traceback (most recent call last):
  File "/usr/lib/python3.8/sre_parse.py", line 1039, in parse_template
    this = chr(ESCAPES[this][1])
KeyError: '\\u'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.8/site-packages/hazm/Normalizer.py", line 75, in normalize
    text = self.character_refinement(text)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/hazm/Normalizer.py", line 106, in character_refinement
    text = pattern.sub(repl, text)
  File "/usr/lib/python3.8/re.py", line 327, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/lib/python3.8/re.py", line 318, in _compile_repl
    return sre_parse.parse_template(repl, pattern)
  File "/usr/lib/python3.8/sre_parse.py", line 1042, in parse_template
    raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \u at position 0

FYI, I am on the latest commit and python 3.7


To fix the error, I am currently using the version before the PR was merged:

pip uninstall hazm && pip install git+git://github.com/sobhe/hazm.git@0d196cf31ac162414b70cfd254f7efe9704b238b
@ghost
Copy link

ghost commented Jul 6, 2022

This problem is not there anymore.

@ghost ghost closed this as completed Jul 6, 2022
@ghost ghost added the bug label Jul 6, 2022
This issue was closed.
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