"-V", "--verbose", action="store_true", help="verbose output" ) args = parser.parse_args() if args.verbose: print >>stderr, "Reading corpus from", args.corpus corpus = HitaextDoc(file=args.corpus) from_tree = corpus.get_doc_tree("from") to_tree = corpus.get_doc_tree("to") from_tree.update() to_tree.update() corpus.inject_alignments(from_tree, to_tree) corpus.alignment.set("method", "id") corpus.extract_alignments(from_tree, to_tree) if args.verbose: print >>stderr, "Writing corpus to", args.corpus corpus.write(args.corpus)
help="") parser.add_argument("-V", "--verbose", action="store_true", help="verbose output") args = parser.parse_args() if args.verbose: print >> stderr, "Reading corpus from", args.corpus corpus = HitaextDoc(file=args.corpus) from_tree = corpus.get_doc_tree("from") to_tree = corpus.get_doc_tree("to") from_tree.update() to_tree.update() corpus.inject_alignments(from_tree, to_tree) corpus.alignment.set("method", "id") corpus.extract_alignments(from_tree, to_tree) if args.verbose: print >> stderr, "Writing corpus to", args.corpus corpus.write(args.corpus)
if args.verbose or args.test: print >>stderr, "Reading Hitaext document", fn htdoc = HitaextDoc(file=fn) for side in ("from", "to"): path = htdoc.get_filename(side) if args.verbose or args.test: print >>stderr, "Current %s path is %s" % (side, path) # a heuristic to deal with windows paths if path[0] in uppercase and path[1] == ":": # strip drive letter path = path[2:] path = path.replace("\\", "/") path = join(args.dir, basename(path)) if args.verbose or args.test: print >>stderr, "Changing %s path to %s" % (side, path) if not args.test: htdoc.set_filename(side, path) if args.verbose and not args.test: print >>stderr, "Writing Hitaext document\n", fn if not args.test: htdoc.write(fn)
if args.verbose or args.test: print >> stderr, "Reading Hitaext document", fn htdoc = HitaextDoc(file=fn) for side in ("from", "to"): path = htdoc.get_filename(side) if args.verbose or args.test: print >> stderr, "Current %s path is %s" % (side, path) # a heuristic to deal with windows paths if path[0] in uppercase and path[1] == ":": # strip drive letter path = path[2:] path = path.replace("\\", "/") path = join(args.dir, basename(path)) if args.verbose or args.test: print >> stderr, "Changing %s path to %s" % (side, path) if not args.test: htdoc.set_filename(side, path) if args.verbose and not args.test: print >> stderr, "Writing Hitaext document\n", fn if not args.test: htdoc.write(fn)