Search code examples
nlpstanford-nlpgraphviz

How can I output left-to-right NLP dependency graphs?


How do I output a diagram similar to this from depparse output (in JSON or CONLLU)?

Is there a specific tool or specific settings a template in Graphviz?

enter image description here

I can output something like this in Graphviz (not the same sentence):

enter image description here

but the flat, left-to-right ordered view is much more readable.


Solution

  • Look at the rank & rankdir attributes.
    This input:

    digraph {
     {
       rank=same
       rankdir=LR
       a->b
       a->c
       a->d
       b->c
       b->e
       f->g
     }
    }
    

    Produces this: enter image description here