Render dependency graph with graphviz #2264
Replies: 3 comments
-
I'm not that familiar with Graphviz, but it sounds like this would be better suited for an extension package? The displaCy visualizers work well as built-ins, because they require no additional dependencies – but for more complex solutions like this, I think it'd be much nicer if users could install it as a separate package (if they want to). By the way, in case you haven't seen it yet, you might find this new spaCy visualizer useful: http://spacyvis.allennlp.org/spacy-parser The code is open-source and comes with a lightweight REST service: It might also be useful as inspiration, if you do want to build your own solution using Graphviz. |
Beta Was this translation helpful? Give feedback.
-
@ines There is a python binding to graphviz https://pypi.org/project/graphviz/. It should be relative straight-forward to use. I don't know how to make an extension. But I agree graphviz should not be required when spacy is installed. graphviz should only be reqiured when one actually use it to write to an image file. These websites are helpful. But they are limited in the sense that users have to manually input the text, which is not suitable to use when there are many pieces of texts. I am looking for something that can save the graph in an image file. So that I can easily open image files. |
Beta Was this translation helpful? Give feedback.
-
Sure, no problem – I'll tag this issue with
The UI layer "on top" is usually just an extra to make it easier to demonstrate the functionality. The demos are normally powered by scripts that take an input text and render the visualization – so the spaCy plugin would only have to do that part. Here are more details on custom extensions: The source of the built-in displaCy is here: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Since there is a
distance
option ofdisplacy.render()
, it seems that all the words are evenly placed. This can result in a waste of spaces for words that are short. Graphviz can handle this problem in a more compatible way.https://spacy.io/api/top-level#displacy_options
Can render be made to be based on Graphviz?
Beta Was this translation helpful? Give feedback.
All reactions