From 31483c79fffe3875bc3b954ee604be008156241b Mon Sep 17 00:00:00 2001 From: Ozbolt Menegatti Date: Tue, 12 Feb 2019 12:19:21 +0100 Subject: [PATCH] count-files for more verbose output added --- wani.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wani.py b/wani.py index b85e1f9..734d297 100644 --- a/wani.py +++ b/wani.py @@ -745,12 +745,16 @@ def load_files(args): skip_id_check = args.skip_id_check do_msd_translate = not args.no_msd_translate - for fname in filenames: - yield load_tei_file(fname, skip_id_check, do_msd_translate, args.pc_tag) + for n, fname in enumerate(filenames): + if args.count_files: + status = " :: {} / {}".format(n, len(filenames)) + else: + status = "" + yield load_tei_file(fname, skip_id_check, do_msd_translate, args.pc_tag, status) -def load_tei_file(filename, skip_id_check, do_msd_translate, pc_tag): - logging.info("LOADING FILE: {}".format(filename)) +def load_tei_file(filename, skip_id_check, do_msd_translate, pc_tag, status): + logging.info("LOADING FILE: {}{}".format(filename, status)) with open(filename, 'r') as fp: xmlstring = re.sub(' xmlns="[^"]+"', '', fp.read(), count=1) @@ -971,6 +975,7 @@ if __name__ == '__main__': parser.add_argument('--without-rep', help='Will not write representtaions in output', action='store_true') parser.add_argument('--group', help='Group collocations with same collocation ID', action='store_true') parser.add_argument('--verbose', help='Enable verbose output to stderr', choices=["warning", "info", "debug"], default="info") + parser.add_argument('--count-files', help="Count files: more verbose output", action='store_true') parser.add_argument('--multiple-output', help='Generate one output for each syntactic structure', action='store_true') parser.add_argument('--pc-tag', help='Tag for separators, usually pc or c', default="pc")