From 12216449e09a7c7699f0ea5be0cd26e1f69c9ce3 Mon Sep 17 00:00:00 2001 From: "prasanth.kolachina" Date: Wed, 22 Apr 2015 18:49:49 +0000 Subject: [PATCH] Minor bug in pgf parse and kparse --- src/runtime/python/examples/gf_utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/python/examples/gf_utils.py b/src/runtime/python/examples/gf_utils.py index bbb8d1766..3f23f7744 100644 --- a/src/runtime/python/examples/gf_utils.py +++ b/src/runtime/python/examples/gf_utils.py @@ -151,10 +151,10 @@ def getKBestParses(grammar, language, K, callbacks=[], serializable=False, senti def pgf_parse(args): grammar = pgf.readPGF(args.pgfgrammar); - inputSet = web_lexer(grammar, args.srclang, args.inputstream); - outputPrinter = lambda X: "%f\t%s" %(X[0], str(X[1])); #operator.itemgetter(1); - import translation_pipeline; + + inputSet = translation_pipeline.web_lexer(grammar, args.srclang, 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); @@ -166,10 +166,10 @@ def pgf_parse(args): def pgf_kparse(args): grammar = pgf.readPGF(args.pgfgrammar); - inputSet = web_lexer(grammar, args.srclang, args.inputstream); - outputPrinter = printJohnsonRerankerFormat; - import translation_pipeline; + + inputSet = translation_pipeline.web_lexer(grammar, args.srclang, 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);