stanford NER pyner错误:ConnectionRefusedError:[WinError 10061]无法建立连接,因为目标计算机主动拒绝它

时间:2018-01-15 09:15:30

标签: python python-3.x

我在python中编写代码,我想使用standford NER。 我去了他们的网站:https://nlp.stanford.edu/software/CRF-NER.shtml#Download 并下载了python版本。 我试图在他们的网站上运行他们的例子,这是:

>>> import ner
>>> tagger = ner.HttpNER(host='localhost', port=8080)
>>> tagger.get_entities("University of California is located in California, United States")

并打算打印:

{'LOCATION': ['California', 'United States'],
 'ORGANIZATION': ['University of California']}

到屏幕。 而是行:tagger.get_entities("加利福尼亚大学位于美国加利福尼亚州") 抛出此错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\lenovo\Anaconda3\lib\site-packages\ner-0.1-py3.6.egg\ner\client.py", line 81, in get_entities
  File "C:\Users\lenovo\Anaconda3\lib\site-packages\ner-0.1-py3.6.egg\ner\client.py", line 165, in tag_text
  File "C:\Users\lenovo\Anaconda3\lib\http\client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\lenovo\Anaconda3\lib\http\client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\lenovo\Anaconda3\lib\http\client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\lenovo\Anaconda3\lib\http\client.py", line 1026, in _send_output
    self.send(msg)
  File "C:\Users\lenovo\Anaconda3\lib\http\client.py", line 964, in send
    self.connect()
  File "C:\Users\lenovo\Anaconda3\lib\http\client.py", line 936, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "C:\Users\lenovo\Anaconda3\lib\socket.py", line 722, in create_connection
    raise err
  File "C:\Users\lenovo\Anaconda3\lib\socket.py", line 713, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

我无法找到解决问题的方法。 任何人都知道如何解决它?

0 个答案:

没有答案