如何安装和调用斯坦福NERTagger? [英] How to install and invoke Stanford NERTagger?

查看:69
本文介绍了如何安装和调用斯坦福NERTagger?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在python环境中为Stanford NER使用NLTK接口,

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆