corpustools.symbolsim.edit_distance.edit_distance(word1, word2, sequence_type, max_distance=None)[source]

Returns the Levenshtein edit distance between a string from two words word1 and word2, code drawn from http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#Python. The number is the number of operations needed to transform word1 into word2, three operations are possible: insert, delete, substitute

word1: Word

the first word object to be compared

word2: Word

the second word object to be compared

string_type : string

String specifying what attribute of the Word objects to compare, can be “spelling”, “transcription” or a tier


the edit distance between two words