Created
July 18, 2017 17:49
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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