我正在关注https://spacy.io/usage/visualizers的说明,并试图在Jupyter Notebook和Spyder上使用以下代码可视化依赖关系解析:
import spacy
from spacy import displacy
nlp = spacy.load('en')
doc = nlp(u'This is a sentence.')
displacy.serve(doc, style='dep')
,输出显示:
Serving on port 5000...
Using the 'dep' visualizer
有人能告诉我,如果我在这里遗失了什么吗?
我正在使用Window 10,Visual Studio 2015,并且通过Anaconda设置运行它的虚拟环境。 提前致谢
答案 0 :(得分:2)
import spacy
from spacy import displacy
nlp = spacy.load('en')
doc = nlp(u'This is a sentence.')
doc = nlp(u'Rats are various medium-sized, long-tailed rodents.')
displacy.render(doc, style='dep',jupyter=True)
答案 1 :(得分:0)