AttributeError: module 'regex' has no attribute 'Pattern'

AttributeError: module 'regex' has no attribute 'Pattern'

我在尝试 运行 google colab 中的此代码时遇到此错误:

!pip install dataprep
from dataprep.eda import create_report

错误:

NumExpr defaulting to 2 threads.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-db62224f8a79> in <module>()
----> 1 from dataprep.eda import create_report

10 frames
/usr/local/lib/python3.7/dist-packages/nltk/tokenize/casual.py in TweetTokenizer()
    355 
    356     @property
--> 357     def WORD_RE(self) -> regex.Pattern:
    358         """Core TweetTokenizer regex"""
    359         # Compiles the regex for this and all future instantiations of TweetTokenizer.

AttributeError: module 'regex' has no attribute 'Pattern'

事情很奇怪,因为这段代码昨天运行良好。 有什么想法吗?

Error

这看起来像 known issue in NLTK。也许更新 NLTK 版本。