Class NGramDistance
N-Gram version of edit distance based on paper by Grzegorz Kondrak,
"N-gram similarity and distance". Proceedings of the Twelfth International
Conference on String Processing and Information Retrieval (SPIRE 2005), pp. 115-126,
Buenos Aires, Argentina, November 2005.
http://www.cs.ualberta.ca/~kondrak/papers/spire05.pdf
This implementation uses the position-based optimization to compute partial
matches of n-gram sub-strings and adds a null-character prefix of size n-1
so that the first character is contained in the same number of n-grams as
a middle character. Null-character prefix matches are discounted so that
strings with no matching characters will return a distance of 0.
Inheritance
System.Object
NGramDistance
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Lucene.Net.Suggest.dll
Syntax
public class NGramDistance : IStringDistance
Constructors
|
Improve this Doc
View Source
NGramDistance()
Creates an N-Gram distance measure using n-grams of size 2.
Declaration
|
Improve this Doc
View Source
NGramDistance(Int32)
Creates an N-Gram distance measure using n-grams of the specified size.
Declaration
public NGramDistance(int size)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
The size of the n-gram to be used to compute the string distance.
|
Methods
|
Improve this Doc
View Source
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.Object.Equals(System.Object)
|
Improve this Doc
View Source
GetDistance(String, String)
Declaration
public virtual float GetDistance(string source, string target)
Parameters
Type |
Name |
Description |
System.String |
source |
|
System.String |
target |
|
Returns
Type |
Description |
System.Single |
|
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.Object.ToString()
Implements