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);