Skip to content
Graphviz (DOT) templates

Linguistic Parse Tree

CFG parse tree for an English sentence.

Template previewGraphviz (DOT)
parse S S NP1 NP S->NP1 VP VP S->VP DT1 DT NP1->DT1 NN1 NN NP1->NN1 V V VP->V NP2 NP VP->NP2 The The DT1->The scientist scientist NN1->scientist presented presented V->presented DT2 DT NP2->DT2 NN2 NN NP2->NN2 a a DT2->a paper paper NN2->paper

What this template contains

Graph
Directed
Edges
13
Source
18 lines

Make it your own.

digraph parse {
  rankdir=TB;
  graph [bgcolor=transparent];
  node [shape=plain, fontname=Inter, fontsize=11];
  edge [arrowhead=none];

  S [label="S"];
  NP1 [label="NP"]; VP [label="VP"];
  DT1 [label="DT"]; NN1 [label="NN"];
  V [label="V"]; NP2 [label="NP"];
  DT2 [label="DT"]; NN2 [label="NN"];

  S -> NP1; S -> VP;
  NP1 -> DT1; NP1 -> NN1;
  DT1 -> "The"; NN1 -> "scientist";
  VP -> V; VP -> NP2;
  V -> "presented";
  NP2 -> DT2; NP2 -> NN2;
  DT2 -> "a"; NN2 -> "paper";
}