mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-13 23:09:31 -06:00
added a simple test for the Python binding
This commit is contained in:
23
src/runtime/python/test.py
Normal file
23
src/runtime/python/test.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import sys
|
||||
import pgf
|
||||
|
||||
sys.stdout.write("loading...")
|
||||
sys.stdout.flush();
|
||||
gr = pgf.readPGF("../../../treebanks/PennTreebank/ParseEngAbs.pgf")
|
||||
sys.stdout.write("\n")
|
||||
|
||||
we = pgf.readExpr("UttImpSg PPos (ImpVP (UseV try_V))")
|
||||
print gr.languages["ParseEng"].linearize(we)
|
||||
|
||||
sys.stdout.write("start cat: "+gr.startCat+"\n\n")
|
||||
|
||||
while True:
|
||||
sys.stdout.write("> ")
|
||||
line = sys.stdin.readline();
|
||||
if line == '':
|
||||
sys.stdout.write("\n")
|
||||
break;
|
||||
|
||||
for e in gr.languages["ParseEng"].parse(gr.startCat,line):
|
||||
print e
|
||||
print gr.languages["ParseEngBul"].linearize(e)
|
||||
Reference in New Issue
Block a user