MochiKit Back to docs index

Name

THIS IS NOT YET AN OFFICIAL MOCHIKIT COMPONENT

MochiKit.Text-ext - various text processing algorithms

Availability:
Available in MochiKit 1.5+

Synopsis

TODO: ...

Description

Various algorithms dealing with text/strings

Dependencies

Overview

Text extensions

Extends the existing MochiKit.Text namespace

TODO: ...

API Reference

Functions

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.

humanStringCompare(a, b):

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)

See Also

[1]Levenshtein distance: http://en.wikipedia.org/wiki/Levenshtein_distance
[2]Michael Herf's strcmp4humans: http://stereopsis.com/strcmp4humans.html

Authors