Skip to content

Instantly share code, notes, and snippets.

@proycon
Created September 8, 2017 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proycon/5d344af1f1df64561941eb4c81565e7c to your computer and use it in GitHub Desktop.
Save proycon/5d344af1f1df64561941eb4c81565e7c to your computer and use it in GitHub Desktop.
from frog import Frog, FrogOptions
from pynlpl.formats import folia
frog = Frog(FrogOptions(parser=True,xmlout=True))
output = frog.process("Dit is een FoLiA test.")
for i, dependency in enumerate(output.select(folia.Dependency)):
print("#" + str(i+1)+")")
dependent = dependency.dependent()
head = dependency.head()
print(" DEPENDENT\n ---------")
for word in dependent.wrefs():
print(" ",word.id, word.text())
print(" HEAD\n -----")
for word in head.wrefs():
print(" ",word.id, word.text())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment