elif args.directory: if not args.section: sections = ["%02d" % s for s in range(0, 25)] elif "-" in args.section: begin_section, end_section = [int(s) for s in args.section.split("-")] sections = ["%02d" % s for s in range(begin_section, end_section + 1)] elif "," in args.section: sections = ["%02d" % int(s) for s in args.section] else: sections = ["%02d" % int(args.section)] import os if args.subsmode != "nochange": for subs, (conll, section) in izip( subssentiter(file=args.subsfile), ConLLiter(directory=args.directory, extension=args.extension) ): if section in sections: if not any([c == s for c, s in zip(conll.sentence(), subs.orginal())]): sys.stderr.write(repr(subs)) sys.stderr.write("\n") sys.stderr.write(repr(conll)) sys.stderr.write("\n") break else: for word, substitution in zip(conll, subs): if args.subsmode == "best": word._form = substitution.best() if args.tagmode == "nochange":