print >> sys.stderr, "%d sentence pairs matched." % len(pre_alignment) forced_rungs = sorted(set(forced_rungs)) try: a = None a = make_composed_alignment(t1, t2, forced_rungs) a = Alignment(a) finally: output_filename = '%s/%s-%s.my' % (args.folder, args.lang1, args.lang2) if not a: raise SystemExit with open(output_filename, 'w') as f: for i, j, c in a.data: f.write("%d\t%d\t%.2f\n" % (i, j, c)) print >> sys.stderr, "Wrote alignment to %s." % output_filename c = a.summed_cost() print >> sys.stderr, "Total cost", c, "avg", c/len(a.data) if args.plot: import plot plot.plot_cost_matrix(cost, a.as_ladder(), plot_filename=args.plot) if args.plot_sim: import plot c = [[0 for s2 in t2] for s1 in t1] _i, _j = 0, 0 for i, j, _ in forced_rungs + [(len(t1), len(t2), 0)]: for mi in range(_i, i):