位移结果未显示

时间:2019-08-17 08:48:46

标签: spacy

我正在尝试在jupyter笔记本中运行显示,但出现以下错误:

  

TypeError: init ()获得了意外的关键字参数'encoding'

代码:

cat_features

但是,依赖关系通过以下代码显示:

import en_core_web_sm
import spacy
nlp = en_core_web_sm.load()
from spacy import displacy

doc4 = nlp("The rat the cat the dog chased killed ate the malt")

displacy.render(doc4, style ='dep', jupyter = True)

请问有什么问题的人可以指导吗?

1 个答案:

答案 0 :(得分:1)

import spacy
from spacy import displacy

nlp = spacy.load("en_core_web_sm")
doc4 = nlp("The rat the cat the dog chased killed ate the malt")

displacy.render(doc4, style ='dep', jupyter = True)

(以及您的确切代码也对我有效)在spacy==2.0.16

您也可以在云中运行的jupyter上进行尝试,例如https://colab.research.google.com