我正在为 nlp 使用 spacy,并且我以简洁的形式打印/输出结果。目前 (token.pos_) 的每个输出都会换行。
我希望能把它打印出来,作为一个列表。我可以在 nltk/stanford pos 中做到这一点,但是 spacy 的文档非常模糊。我似乎无法找出令牌如何工作或如何以可接受的方式调用我需要的值。斯派西,太机械了。
这是我的代码:
for token in words:
print(token.pos_)
Adj
Adj
Noun
Noun
[adj,adj]
[noun,noun]
我努力了
for token in words:
v,x = token.pos_