parser_dep.add_argument('-p', help='Score on punctuation (ignored by default)', action='store_true', dest='punctuation') parser_pos.add_argument( '--oov', help= 'Analyze performance on OOV data. Not fully functional with numbers.', type=str) args = parser.parse_args() logging_level = logging.DEBUG if args.verbose else logging.INFO utils.set_logger(logging_level) logger = logging.getLogger("Logger") config.set_data_dir(args.data) np.seterr('raise') start_time = timeit.default_timer() if args.task == 'pos': if args.oov: oov = read_oov_words(args.oov) else: oov = None evaluate_pos(gold_file=args.gold, oov=oov) elif args.task == 'dependency':
else: nn.train(reader.sentences, reader.heads, args.iterations, intervals, args.accuracy) else: nn.train(reader.sentences, reader.tags, args.iterations, intervals, args.accuracy) if __name__ == '__main__': args = arguments.get_args() logging_level = logging.DEBUG if args.verbose else logging.INFO utils.set_logger(logging_level) logger = logging.getLogger("Logger") config.set_data_dir(args.data) md = load_or_create_metadata(args) text_reader = create_reader(args, md) if args.load_network: logger.info("Loading provided network...") nn = load_network_train(args, md) else: logger.info('Creating new network...') feature_tables = utils.create_feature_tables(args, md, text_reader) nn = create_network(args, text_reader, feature_tables, md) if args.dev is not None: validation_reader = create_reader(args, md, True) set_validation_data(nn, args.task, validation_reader)