【发布时间】:2019-02-25 16:27:21
【问题描述】:
如何区分后面句子中的post标签:
- 在碰撞后她的下背部出现间歇性射击疼痛
- 在我脑后的某个地方
spacy 的例子
doc = nlp(u'experiencing intermittent shooting pain in her lower back following the collision')
for token in doc:
print(token.text, token.pos_, token.tag_, token.dep_)
#experiencing VERB VBG ROOT
#intermittent ADJ JJ amod
#shooting NOUN NN compound
#pain NOUN NN dobj
#in ADP IN prep
#her ADJ PRP$ poss
#lower ADJ JJR advmod
#back ADV RB pobj
#following VERB VBG prep
#the DET DT det
#collision NOUN NN pobj
doc = nlp(u'somewhere in the back of my head')
for token in doc:
print(token.text, token.pos_, token.tag_, token.dep_)
#somewhere ADV RB ROOT
#in ADP IN prep
#the DET DT det
#back NOUN NN pobj
#of ADP IN prep
#my ADJ PRP$ poss
#head NOUN NN pobj
直观地说,1中的'back'是名词,2是ADV?从上面的句子中提取名词时,我期望将“her lower back”中的“back”提取出来。那么,如何实现呢?
另外,对 pos 标记结果感到困惑,如何知道 pos 标记是否正常工作?
【问题讨论】:
标签: python spacy pos-tagger