错误:Python3 toopia.termextract 中不可能出现类建议

sha*_*han 5 python nlp keyword-search python-3.x google-colaboratory

我正在执行 nlp 任务。我为topia.termextract 编写了以下代码。执行时显示错误。如果您建议解决错误,这将很有帮助。

from topia.termextract import extract
from topia.termextract import tag

# Setup Term Extractor
extractor = extract.TermExtractor()

# Some sample text
text ='''
Police shut Palestinian theatre in Jerusalem.

Israeli police have shut down a Palestinian theatre in East Jerusalem.

The action, on Thursday, prevented the closing event of an international
literature festival from taking place."""

# Extract Keywords
keywords_topica = extractor(text)
print(keywords_topica)
Run Code Online (Sandbox Code Playgroud)

我在 google colab 中使用 Python 3。

---------------------------------------------------------------------------      
TypeError                                 Traceback (most recent call last)      
<ipython-input-23-9a094f024dfe> in <module>()      
 ----> 1 from topia.termextract import extract    
       2 from topia.termextract import tag     

 3 frames      
 /usr/local/lib/python3.6/dist-packages/zope/interface/declarations.py in implements(*interfaces)    
     481     # the coverage for this block there. :(     
     482     if PYTHON3:     
 --> 483         raise TypeError(_ADVICE_ERROR % 'implementer')    
     484     _implements("implements", interfaces, classImplements)    
     485      

     TypeError: Class advice impossible in Python3.  Use the @implementer class decorator instead.     
Run Code Online (Sandbox Code Playgroud)

Sha*_*man 0

以下步骤为我解决了这个问题,

pip uninstall apex
git clone https://www.github.com/nvidia/apex
cd apex
python3 setup.py install
Run Code Online (Sandbox Code Playgroud)