Issue
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)
Solution
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:
Answered By - Alex Ott
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.