【发布时间】:2018-09-05 20:11:41
【问题描述】:
我正在尝试用他们的标签替换句子。我想用标签替换单词并形成一个句子。
from __future__ import unicode_literals
import spacy,en_core_web_sm
import textacy
nlp = en_core_web_sm.load()
sentence = 'The cat sat on the mat. the dog sleeps.'
doc = nlp(sentence)
for token in doc:
print(token.dep_)
输出。
det
nsubj
ROOT
prep
det
pobj
punct
det
nsubj
ROOT
punct
预期输出:
det nsubj ROOT prep det pobj det punct det nsubj ROOT punct
【问题讨论】: