Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class LuceneLevenshteinDistance

    Damerau-Levenshtein (optimal string alignment) implemented in a consistent way as Lucene's FuzzyTermsEnum with the transpositions option enabled.

    Notes:

    • This metric treats full unicode codepoints as characters
    • This metric scales raw edit distances into a floating point score based upon the shortest of the two terms
    • Transpositions of two adjacent codepoints are treated as primitive edits.
    • Edits are applied in parallel: for example, "ab" and "bca" have distance 3.

    NOTE: this class is not particularly efficient. It is only intended for merging results from multiple DirectSpellCheckers.

    Inheritance
    object
    LuceneLevenshteinDistance
    Implements
    IStringDistance
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search.Spell
    Assembly: Lucene.Net.Suggest.dll
    Syntax
    public sealed class LuceneLevenshteinDistance : IStringDistance

    Constructors

    LuceneLevenshteinDistance()

    Creates a new comparer, mimicing the behavior of Lucene's internal edit distance.

    Declaration
    public LuceneLevenshteinDistance()

    Methods

    GetDistance(string, string)

    Returns a float between 0 and 1 based on how similar the specified strings are to one another.
    Returning a value of 1 means the specified strings are identical and 0 means the string are maximally different.

    Declaration
    public float GetDistance(string target, string other)
    Parameters
    Type Name Description
    string target
    string other
    Returns
    Type Description
    float

    a float between 0 and 1 based on how similar the specified strings are to one another.

    Implements

    IStringDistance
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.