tools for weighted edit distance