WordLevenshtein Class |
Namespace: Telogis.GeoBase.Indexes
The WordLevenshtein type exposes the following members.
Name | Description | |
---|---|---|
WordLevenshtein |
Creates a WordLevenshtein object
|
Name | Description | |
---|---|---|
Dispose | Releases all resources used by the WordLevenshtein | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetDistance |
Calculate the distance between this WordLevenshtein object and a test string
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
// We instantiate a WordLevenshtein object with the query string "Brown Tail", with // a maxEditDistance of 5, with a missingWordCost of 1 and with an extraWordCost of 4. // Then we calculate against four test strings. Note the matching is case insensitive. // Also note this class is IDisposable. using (var lev = new WordLevenshtein("Brown Tail", 5, 1, 4)) { // The query string has an extra word "Brown" than the test string, so the result is 4. Console.WriteLine(lev.GetDistance("Tail")); // The query string lacks a word "kangaroo" from the test string, so the result is 1. Console.WriteLine(lev.GetDistance("brown tail kangaroo")); // This is the same as the original Levenshtein algorithm with a result of 2. Console.WriteLine(lev.GetDistance("BROWNTRAIL")); // This calculation reaches the maximum edit distance, so the result is 5. Console.WriteLine(lev.GetDistance("Completely different")); }