我正在尝试在 Jupyter 笔记本中使用 Stanza。这是我使用的代码:
!pip install stanza
import stanza
corenlp_dir = './corenlp'
stanza.install_corenlp(dir=corenlp_dir)
# Set the CORENLP_HOME environment variable to point to the installation location
import os
os.environ["CORENLP_HOME"] = corenlp_dir
这段代码直接取自Colab notebook,这是一个关于 Stanza CoreNLP 界面的教程。
但是,当我在自己的 Jupyter 笔记本(Python 3.7.4)上运行它时,我收到以下错误:
AttributeError: module 'stanza' has no attribute 'install_corenlp'
发生在该行
stanza.install_corenlp(dir=corenlp_dir)
在此之前的所有其他行都可以正常工作。检查文档表明这是 Python 2 中的一个问题,但我的 Jupyter 笔记本运行的是 3.7.4。这里有什么问题,我应该如何解决?