2 回答
TA贡献1798条经验 获得超3个赞
它对我有用,谢谢@thrinadh
import nltk
from nltk.corpus import conll2000
from nltk.chunk import conlltags2tree, tree2conlltags
from nltk.chunk import ne_chunk
from nltk import pos_tag
sentence = "Clement and Mathieu are working at Apple."
ne_tree = ne_chunk(pos_tag(word_tokenize(sentence)))
TA贡献1784条经验 获得超8个赞
您需要下载以下软件包: 命名实体分块器将为您提供一个包含分块和标签的树。
# nltk for NER-tagging
import nltk
from nltk.corpus import conll2000
from nltk.chunk import conlltags2tree, tree2conlltags
from nltk.chunk import ne_chunk
from nltk import pos_tag
sentence = "Clement and Mathieu are working at Apple."
ne_tree = ne_chunk(pos_tag(word_tokenize(sentence)))
添加回答
举报