0
我最近开始玩弄Python的Spacy库。我想用它来找到一个句子的主题。我使用了this post中详细描述的方法,但没有找到整个主题。Can Spacy可以用来查找多个单词长的句子主题吗?
例如:
doc = nlp(u"Mr Bob Bobson enjoyed hunting and fishing")
sub_toks = [tok for tok in doc if (tok.dep_ == "nsubj")]
print(sub_toks)
结果
[Bobson]
但是,结果我要的是
[Mr Bob Bobson]