else: # parse config file parser = SafeConfigParser() parser.read(sys.argv[1]) decoder_type = parser.get('tools', 'decoder_type') aligner_type = parser.get('tools', 'aligner_type') extractor_type = parser.get('tools', 'extractor_type') annotator_type = parser.get('tools', 'annotator_type') input = open(parser.get('data', 'source'), 'r') edit = open(parser.get('data', 'reference'), 'r') if decoder_type == "Moses" : Decoder_object = Decoder_Moses(parser) elif decoder_type == "Deterministic" : Decoder_object = Decoder_Deterministic(parser) else: logging.info("This decoder is UNKNOWN") sys.exit(1) if aligner_type == "GIZA" : Aligner_object = Aligner_GIZA(parser) elif aligner_type == "onlineGIZA" : Aligner_object = Aligner_onlineGIZA(parser) elif aligner_type == "Constrained_Search" : Aligner_object = Aligner_Constrained_Search(parser) if not decoder_type == "Moses": logging.info("This alignment tool requires Moses as decoder") sys.exit(1)
input = open(parser.get('data', 'source'), 'r') edit = open(parser.get('data', 'reference'), 'r') decoder_options = '' try: decoder_options = self.parser.get('decoder', 'options') except: pass if aligner_type == "Constrained_Search" : decoder_options = decoder_options + " -print-translation-option true" parser.set('decoder', 'options', decoder_options) if decoder_type == "Moses" : Decoder_object = Decoder_Moses(parser) if not showweightsflag == "": decoder_out, decoder_err = Decoder_object.show_weights() # write weights to stdout sys.stdout.write(''.join(decoder_out)) sys.stdout.flush() sys.exit(1) elif decoder_type == "Moses_nbest" : decoder_nbestfile = '/dev/stdout' decoder_nbestsize = '500' decoder_nbestdistinct = '' try: decoder_nbestfile = parser.get('decoder', 'nbestfile')
sys.exit() else: # parse config file parser = SafeConfigParser() parser.read(sys.argv[1]) decoder_type = parser.get('tools', 'decoder_type') aligner_type = parser.get('tools', 'aligner_type') extractor_type = parser.get('tools', 'extractor_type') annotator_type = parser.get('tools', 'annotator_type') input = open(parser.get('data', 'source'), 'r') edit = open(parser.get('data', 'reference'), 'r') if decoder_type == "Moses": Decoder_object = Decoder_Moses(parser) elif decoder_type == "Deterministic": Decoder_object = Decoder_Deterministic(parser) else: logging.info("This decoder is UNKNOWN") sys.exit(1) if aligner_type == "GIZA": Aligner_object = Aligner_GIZA(parser) elif aligner_type == "onlineGIZA": Aligner_object = Aligner_onlineGIZA(parser) elif aligner_type == "Constrained_Search": Aligner_object = Aligner_Constrained_Search(parser) if not decoder_type == "Moses": logging.info("This alignment tool requires Moses as decoder") sys.exit(1)
input = open(parser.get('data', 'source'), 'r') edit = open(parser.get('data', 'reference'), 'r') decoder_options = '' try: decoder_options = self.parser.get('decoder', 'options') except: pass if aligner_type == "Constrained_Search" : decoder_options = decoder_options + " -print-translation-option true" parser.set('decoder', 'options', decoder_options) if decoder_type == "Moses" : Decoder_object = Decoder_Moses(parser) if not showweightsflag == "": decoder_out, decoder_err = Decoder_object.show_weights() # write weights to stdout sys.stdout.write(''.join(decoder_out)) sys.stdout.flush() sys.exit(1) elif decoder_type == "Moses_nbest" : decoder_nbestfile = '/dev/stdout' decoder_nbestsize = '100' decoder_nbestdistinct = '' try: