From beedd6dbb7878e045977ba44e288e9eb4b2b110b Mon Sep 17 00:00:00 2001 From: "prasant.kolachina" Date: Sun, 26 Apr 2015 11:00:17 +0000 Subject: [PATCH] bug fix in python examples --- src/runtime/python/examples/gf_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/python/examples/gf_utils.py b/src/runtime/python/examples/gf_utils.py index d6d3421ac..b097cb118 100644 --- a/src/runtime/python/examples/gf_utils.py +++ b/src/runtime/python/examples/gf_utils.py @@ -154,7 +154,7 @@ def pgf_parse(args): import translation_pipeline; preprocessor = lexer(); - inputSet = translation_pipeline.web_lexer(grammar, args.srclang, preprocessor(args.inputstream) ); + inputSet = translation_pipeline.web_lexer(grammar, args.srclang, imap(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); @@ -170,7 +170,7 @@ def pgf_kparse(args): import translation_pipeline; preprocessor = lexer(); - inputSet = translation_pipeline.web_lexer(grammar, args.srclang, preprocessor(args.inputstream) ); + inputSet = translation_pipeline.web_lexer(grammar, args.srclang, imap(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);