我试图在python环境中为Stanford NER使用NLTK接口,^{
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 website中描述的过程安装了NLTK。但是,我根本找不到/usr/share/stanford-ner。在哪里以及如何找到整个包并将其安装到我的目录中。
必须独立于NLTK下载来下载Stanford包,将其放置在路径指示的位置,并将NLTK文档中描述的路径中的目录名更改为要用于目录的任何名称。如果NLTK文档能够明确说明这一点,那就太好了。
查看斯坦福CoreNLP for python的最新接口可能会更容易,这些接口可以在这里找到:http://nlp.stanford.edu/software/corenlp.shtml
我想值得一提的是,进口线现在是:
相关问题 更多 >
编程相关推荐