def bllip_parse_bioc(): global rrp if request.method == 'GET': text = str(request.args.get('text')) elif request.method == 'POST': text = str(request.get_data()) collection = bioc.fromstring(text) collection.clear_infons(); collection.infons['tool'] = 'Bllip'; collection.infons['process'] = 'parse'; parse_bioc(rrp, collection) return collection.tobioc()
parser.add_argument("-v", "--verbose", action="store_true", help="print debug information") args = parser.parse_args() if args.verbose: logging.basicConfig(level=logging.DEBUG) if not os.path.isfile(args.input): sys.stderr.write('Cannot find input file: %s\n' % args.input) sys.exit(2) logging.info('Input file: %s' % args.input) logging.info('Output file: %s' % args.output) return args.input, args.output if __name__ == "__main__": inputfilename, outputfilename = parse_argv() model_dir = init_model() logging.info('loading model %s ...' % model_dir) rrp = RerankingParser.from_unified_model_dir(model_dir) collection = parse(inputfilename) collection.clear_infons() collection.infons['tool'] = 'Bllip' collection.infons['process'] = 'parse' parse_bioc(rrp, collection) collection.tobiocfile(outputfilename)