如何安装和调用斯坦福 NERTagger? [英] How to install and invoke Stanford NERTagger?
本文介绍了如何安装和调用斯坦福 NERTagger?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 python 环境中为斯坦福 NER 使用 NLTK 接口,nltk.tag.stanford.NERTagger
.
I am trying to use NLTK interface for Stanford NER in the python enviornment, nltk.tag.stanford.NERTagger
.
from nltk.tag.stanford import NERTagger
st = NERTagger('/usr/share/stanford-ner/classifiers/all.3class.distsim.crf.ser.gz',
'/usr/share/stanford-ner/stanford-ner.jar')
st.tag('Rami Eid is studying at Stony Brook University in NY'.split())
我应该得到输出:
[('Rami', 'PERSON'), ('Eid', 'PERSON'), ('is', 'O'), ('studying', 'O'),
('at', 'O'), ('Stony', 'ORGANIZATION'), ('Brook', 'ORGANIZATION'),
('University', 'ORGANIZATION'), ('in', 'O'), ('NY', 'LOCATION')]
我已经按照 NLTK 网站中描述的过程安装了 NLTK.但是,我根本找不到/usr/share/stanford-ner .我在哪里以及如何找到整个包并将其安装在我的目录中.
I have installed NLTK according the procedure described in the NLTK website. However, I can not find /usr/share/stanford-ner at all. Where and how do I find the whole package and install it in my directory.
推荐答案
只是觉得值得一提的是现在导入行:
Just thought it would be worth mentioning that the import line is now:
from nltk.tag.stanford import StanfordNERTagger
这篇关于如何安装和调用斯坦福 NERTagger?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文