Display <IPython.core.display.HTML object> in Spark

Viewed 2133

I am trying to display Spacy Dependency Tree in Pyspark (Databricks). But I am getting this error. Could someone help me with the display of html object please. I am attaching screenshot of the Error message. Thanks in advance. Here is my code:

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)

Error message: enter image description here

1 Answers

This won't work in the Databricks notebooks, because it's not an Jupyter. But you can use displayHTML function together with rendering as HTML:

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

Or even display SVG data directly:

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

here is result:

enter image description here

Related