summaryrefslogtreecommitdiff
path: root/src/runtime/python/examples/gf_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/python/examples/gf_utils.py')
-rw-r--r--src/runtime/python/examples/gf_utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/python/examples/gf_utils.py b/src/runtime/python/examples/gf_utils.py
index 3f23f7744..0ff815e2e 100644
--- a/src/runtime/python/examples/gf_utils.py
+++ b/src/runtime/python/examples/gf_utils.py
@@ -35,7 +35,7 @@ def lexerChi(sentence):
idx += 1;
return ' '.join(tokens).encode('utf-8');
-def lexer(lang='Eng'):
+def lexer(lang='translator'):
if lang[-3:] == 'Eng':
return lexerI;
elif lang[-3:] == 'Chi':
@@ -153,7 +153,7 @@ def pgf_parse(args):
grammar = pgf.readPGF(args.pgfgrammar);
import translation_pipeline;
- inputSet = translation_pipeline.web_lexer(grammar, args.srclang, args.inputstream);
+ inputSet = translation_pipeline.web_lexer(grammar, args.srclang, lexer(args.inputstream) );
outputPrinter = lambda X: "%f\t%s" %(X[0], str(X[1])); #operator.itemgetter(1);
callbacks = [('PN', translation_pipeline.parseNames(grammar, args.srclang)), ('Symb', translation_pipeline.parseUnknown(grammar, args.srclang))];
parser = getKBestParses(grammar, args.srclang, 1, callbacks);
@@ -168,7 +168,7 @@ def pgf_kparse(args):
grammar = pgf.readPGF(args.pgfgrammar);
import translation_pipeline;
- inputSet = translation_pipeline.web_lexer(grammar, args.srclang, args.inputstream);
+ inputSet = translation_pipeline.web_lexer(grammar, args.srclang, lexer(args.inputstream) );
outputPrinter = printJohnsonRerankerFormat;
callbacks = [('PN', translation_pipeline.parseNames(grammar, args.srclang)), ('Symb', translation_pipeline.parseUnknown(grammar, args.srclang))];
parser = getKBestParses(grammar, args.srclang, args.K, callbacks=callbacks);