rspeer / wordfreq

Access a database of word frequencies, in various natural languages.
Other
965 stars 68 forks source link

AttributeError: module 'regex' has no attribute 'Match' #101

Closed oseminck closed 2 years ago

oseminck commented 2 years ago

/wordfreq/numbers.py", line 99, in def _sub_zeroes(match: regex.Match) -> str: AttributeError: module 'regex' has no attribute 'Match'

Hi, there I got this error, but I got it solved by going into the file "numbers.py" and change

import regex

into:

import re as regex

Did I do the right thing?

rspeer commented 2 years ago

No, regex is a different module. Python's builtin re does not have nearly enough support for Unicode regexes to use here.

regex.Match exists in the regex dependency. I have to assume that you used some workaround to install wordfreq without its dependencies, such as manually setting your PYTHONPATH, and in that case you have an unrelated module called "regex" sitting around in your PYTHONPATH. All I can say is, don't do that.

You should install wordfreq using poetry, or if that's not an option, using pip.