gpt4 book ai didi

apache-spark - 在 Spark 中显示

转载 作者:行者123 更新时间:2023-12-05 02:42:58 24 4
gpt4 key购买 nike

我正在尝试在 Pyspark (Databricks) 中显示 Spacy 依赖树。但是我收到了这个错误。有人可以帮我显示 html 对象吗?我附上错误消息的屏幕截图。提前致谢。这是我的代码:

import spacy
from spacy import displacy

doc = nlp("Reliance is looking at buying U.K. based analytics startup for $7 billion")
displacy.render(doc, style="dep" , jupyter=True)

错误信息: enter image description here

最佳答案

这在 Databricks 笔记本中不起作用,因为它不是 Jupyter。但是你可以使用 displayHTML function连同呈现为 HTML :

displayHTML(displacy.render(doc, style="dep", page=True))

甚至直接显示 SVG 数据:

displayHTML(displacy.render(doc, style="dep"))

结果如下:

enter image description here

关于apache-spark - 在 Spark 中显示 <IPython.core.display.HTML object>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67153253/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com