summaryrefslogtreecommitdiff
path: root/src/runtime/python/examples
diff options
context:
space:
mode:
authorprasanth.kolachina <prasanth.kolachina@cse.gu.se>2015-04-26 07:44:18 +0000
committerprasanth.kolachina <prasanth.kolachina@cse.gu.se>2015-04-26 07:44:18 +0000
commitc17501540a46cdd5de1936d5357946cd835efbdd (patch)
treed3ed218b3210d42daa774ad5b7dd090982110e13 /src/runtime/python/examples
parent100c58391664c53d4aad58f560f4bfb293581a3d (diff)
Changes in lexer
Diffstat (limited to 'src/runtime/python/examples')
-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);