【发布时间】:2021-01-04 11:57:57
【问题描述】:
我有一段文本,我希望使用 pytextrank 将其呈现为图形。代码(从源代码复制)是
import spacy
nlp = spacy.load("en_core_web_sm")
import pytextrank
import graphviz
tr = pytextrank.TextRank()
nlp.add_pipe(tr.PipelineComponent, name='textrank', last=True)
line = "the ballistic nuclear threat can be thwarted by building a nuclear shield"
doc = nlp(line)
tr.write_dot(path="graph.dot")
“it”向文件“graph.dot”写入一些内容。这看起来像一个带有第一个字段“digraph {}”的 json 文件。在这一点上,我迷路了。我如何创建一个漂亮的文本图表(或者根本就没有图表)
谢谢,
安德烈亚斯
使用 ubuntu 20.04.1LTS、python 3.8、pytextrank 2.0.3
【问题讨论】:
标签: plotly networkx graphviz pytextrank