我正在使用斯坦福命名实体识别器 (NER)的 python 接口。该代码可以在Pyner 代码中找到
import ner
if __name__ == "__main__":
tagger = ner.HttpNER(host='localhost', port=8080)
print tagger.get_entities("University of California is located in California, United States")
print tagger.json_entities("Alice went to the Museum of Natural History.")
假定的输出:
{'LOCATION': ['California', 'United States'], 'ORGANIZATION': ['University of California']}
'{"ORGANIZATION": ["Museum of Natural History"], "PERSON": ["Alice"]}'
问题:我得到空集,为什么?
我尝试了以下解决方案-StackoverFlow,但它不起作用我收到以下异常:
Exception in thread "main" java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at java.net.ServerSocket.<init>(ServerSocket.java:128)
at edu.stanford.nlp.ie.NERServer.<init>(NERServer.java:71)
at edu.stanford.nlp.ie.NERServer.main(NERServer.java:331)