Skip to content

Instantly share code, notes, and snippets.

@fergusq
Created July 18, 2017 17:49
Show Gist options
  • Save fergusq/4e0da19ed79c0867b3ba8e2f70538bb4 to your computer and use it in GitHub Desktop.
Save fergusq/4e0da19ed79c0867b3ba8e2f70538bb4 to your computer and use it in GitHub Desktop.
A script that transfers conllu files to dot files. It can be used to make graphs that represents sentences.
main {
print "digraph G {"
i := 0
filter {|a|[ #a > 0 ]} | split sep="\t" | try for n, word, base, type, form, _, ref, relation, _, _ do
i ++ if [ n = "1" ]
word ~= `\\`, `\\\\`, `"`, `\\"`
print "\t", `a${i}t$n [label="$word"];`
print "\t", `a${i}t$n -> a${i}t$ref [label="$relation"];`
done
print "}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment