Class Index | File Index

Classes


Namespace String.metrics

Contains methods to compute string metrics.
Defined in: string.metrics.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
String.metrics.exports.metrics.fraction(str1, str2, distance)

Compute the distance between two strings as a fraction of the length of the longer of the two strings.

<static>  
String.metrics.exports.metrics.levenshteinDistance(str1, str2)

Compute the Levenshtein distance between two strings.

<static>  
String.metrics.exports.metrics.levenshteinFraction(str1, str2)

Compute the Levenshtein distance between two strings as a fraction of the length of the longer of the two strings.

Namespace Detail
String.metrics
Method Detail
<static> {Number} String.metrics.exports.metrics.fraction(str1, str2, distance)

Compute the distance between two strings as a fraction of the length of the longer of the two strings.

Parameters:
{String} str1
One of the strings to score against.
{String} str2
One of the strings to score against.
{Number|Function} distance
An integer distance between strings, or a function to compute the distance.
Returns:
{Number} Returns the computed distance between the two argument strings as a fraction.

<static> {Number} String.metrics.exports.metrics.levenshteinDistance(str1, str2)

Compute the Levenshtein distance between two strings.

Parameters:
{String} str1
One of the strings to score against.
{String} str2
One of the strings to score against.
Returns:
{Number} Returns the computed Levenshtein distance between the two argument strings.
See:
Source: Wikibooks:Algorithm Implementation/Strings/Levenshtein distance
Wikipedia: Levenshtein distance

<static> {Number} String.metrics.exports.metrics.levenshteinFraction(str1, str2)

Compute the Levenshtein distance between two strings as a fraction of the length of the longer of the two strings. .

Parameters:
{String} str1
One of the strings to score against.
{String} str2
One of the strings to score against.
Returns:
{Number} Returns the computed distance between the two argument strings as a fraction.

Documentation generated by JsDoc Toolkit 2.4.0 on Sun Nov 18 2012 17:00:31 GMT-0500 (EST)