赞
踩
# python -m spacy download en 用管理员身份打开CMD
import spacy
nlp = spacy.load('en')
from spacy import displacy
from collections import Counter, defaultdict
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
doc = nlp('Weather is good, very windy and sunny. We have no classes in the afternoon.')
# 分词
for token in doc:
print(token)
# 分句
for sent in doc.sents:
print(sent)
for token in doc:
print('{}-{}'.format(token, token.pos_))
doc_2 = nlp("I went to Paris where I met my old friend Jack from uni.")
for ent in doc_2.ents:
print('{}-{}'.format(ent, ent.label_))
doc3 =<
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。