forked from proycon/python-frog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
20 lines (15 loc) · 676 Bytes
/
example.py
File metadata and controls
20 lines (15 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from __future__ import print_function, unicode_literals
from frog import Frog, FrogOptions
frog = Frog(FrogOptions(parser=True))
output = frog.process_raw("Dit is een test")
print("RAW OUTPUT=",output)
output = frog.process("Dit is nog een test.")
print("PARSED OUTPUT=",output)
frog = Frog(FrogOptions(parser=True,xmlout=True))
output = frog.process("Dit is een FoLiA test.")
#output is now no longer a string but an instance of folia.Document, provided by the FoLiA library in FoLiaPy
print("FOLIA OUTPUT=")
print(output.xmlstring())
print("Inspecting FoLiA output (example):")
for word in output.words():
print(word.text() + " " + word.pos() + " " + word.lemma())