summaryrefslogtreecommitdiff
path: root/src/runtime/python
diff options
context:
space:
mode:
authorprasant.kolachina <prasant.kolachina@cse.gu.se>2015-04-26 10:18:21 +0000
committerprasant.kolachina <prasant.kolachina@cse.gu.se>2015-04-26 10:18:21 +0000
commit3ec571b03d99ca2ff6f56ff0fb4ae02ce4158a65 (patch)
tree58c5d2a156e5e1e92db3e1ace4ca236344f40b57 /src/runtime/python
parentaa79f6bb280b9c03311b899af98c16a5ce3253c9 (diff)
bug fix python examples
Diffstat (limited to 'src/runtime/python')
-rw-r--r--src/runtime/python/examples/gf_utils.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/runtime/python/examples/gf_utils.py b/src/runtime/python/examples/gf_utils.py
index 3ec98b865..d6d3421ac 100644
--- a/src/runtime/python/examples/gf_utils.py
+++ b/src/runtime/python/examples/gf_utils.py
@@ -152,8 +152,9 @@ def getKBestParses(grammar, language, K, callbacks=[], serializable=False, senti
def pgf_parse(args):
grammar = pgf.readPGF(args.pgfgrammar);
import translation_pipeline;
-
- inputSet = translation_pipeline.web_lexer(grammar, args.srclang, args.inputstream);
+
+ preprocessor = lexer();
+ inputSet = translation_pipeline.web_lexer(grammar, args.srclang, preprocessor(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 +169,8 @@ def pgf_kparse(args):
grammar = pgf.readPGF(args.pgfgrammar);
import translation_pipeline;
- inputSet = translation_pipeline.web_lexer(grammar, args.srclang, args.inputstream);
+ preprocessor = lexer();
+ inputSet = translation_pipeline.web_lexer(grammar, args.srclang, preprocessor(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);