def med(X, Y): # computes a matching by calculating the pairwise edit distance filename = IO.getEditDistFilename(X, Y) if os.path.isfile(filename): print 'found file', filename D = IO.readNumpyArray(filename) else: print 'file', filename, 'not found' D = strings.pweditdist(X, Y) IO.writeNumpyArray(filename, D) (cost, pi, edge_cost) = MU.ApproxMatch(D) # TODO: # 3. set up an initial matching based on edit distance. return cost, pi, edge_cost