THIS IS NOT YET AN OFFICIAL MOCHIKIT COMPONENT
MochiKit.Text-ext - various text processing algorithms
TODO: ...
Various algorithms dealing with text/strings
Extends the existing MochiKit.Text namespace
TODO: ...
levenshteinDistance(s, t, allowTransposition=false):
Computes the Levenshtein distance [1] between two strings.
returns "distance" between the two strings. The larger the number, the bigger the difference.
Human friendly string comparator. Makes 'abc9' be sorted before 'abc123'. Not case sensitive (todo: add optional flag for this?).
Based on Michael Herf's strcmp4humans [2]
returns -1, 0, +1 (comparator)
[1] | Levenshtein distance: http://en.wikipedia.org/wiki/Levenshtein_distance |
[2] | Michael Herf's strcmp4humans: http://stereopsis.com/strcmp4humans.html |
Copyright 2005-2010 Bob Ippolito <bob@redivi.com>. This program is dual-licensed free software; you can redistribute it and/or modify it under the terms of the MIT License or the Academic Free License v2.1.