尝试运行stanfordnlp的corenlp演示脚本时发生TypeError

时间:2019-02-25 16:57:38

标签: python stanford-nlp

ds

from stanfordnlp.server import CoreNLPClient
import os
os.environ["CORENLP_HOME"] = r'C:\Users\Shreyans\Downloads\stanford-ner-2018-10-16\stanford-ner-2018-10-16'

text = "Chris Manning is a nice person. Chris wrote a simple sentence. He also gives oranges to people."

client = CoreNLPClient(annotators=['tokenize','ssplit','pos','lemma','ner','depparse','coref'], timeout=30000, memory='8G')

最后一行给我以下错误:

  File "<ipython-input-16-f102b031b1bd>", line 18, in <module>
    client = CoreNLPClient(annotators=['tokenize','ssplit','pos','lemma','ner','depparse','coref'], timeout=30000, memory='8G')

  File "C:\Users\Shreyans\Anaconda3\lib\site-packages\stanfordnlp\server\client.py", line 164, in __init__
    super(CoreNLPClient, self).__init__(start_cmd, stop_cmd, endpoint,

TypeError: super(type, obj): obj must be an instance or subtype of type

有人知道是什么原因导致这个问题吗?

1 个答案:

答案 0 :(得分:0)

您应重试完整分发版。在示例代码中,您仅使用NER发行版。

此处提供完整的发行版:

https://stanfordnlp.github.io/CoreNLP/

另外,您可能需要使用其他版本的Python。如果您升级Python版本,则可能可以解决该问题。