Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class RefinedSoundex

    Encodes a string into a Refined Soundex value. A refined soundex code is optimized for spell checking words. Soundex method originally developed by Margaret Odell and Robert Russell.

    This class is immutable and thread-safe.
    Inheritance
    object
    RefinedSoundex
    Implements
    IStringEncoder
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Analysis.Phonetic.Language
    Assembly: Lucene.Net.Analysis.Phonetic.dll
    Syntax
    public class RefinedSoundex : IStringEncoder

    Constructors

    RefinedSoundex()

    Creates an instance of the RefinedSoundex object using the default US English mapping.

    Declaration
    public RefinedSoundex()

    RefinedSoundex(char[])

    Creates a refined soundex instance using a custom mapping. This constructor can be used to customize the mapping, and/or possibly provide an internationalized mapping for a non-Western character set.

    Declaration
    public RefinedSoundex(char[] mapping)
    Parameters
    Type Name Description
    char[] mapping

    Mapping array to use when finding the corresponding code for a given character.

    RefinedSoundex(string)

    Creates a refined Soundex instance using a custom mapping. This constructor can be used to customize the mapping, and/or possibly provide an internationalized mapping for a non-Western character set.

    Declaration
    public RefinedSoundex(string mapping)
    Parameters
    Type Name Description
    string mapping

    Mapping string to use when finding the corresponding code for a given character.

    Fields

    US_ENGLISH

    This static variable contains an instance of the RefinedSoundex using the US_ENGLISH mapping.

    Declaration
    public static readonly RefinedSoundex US_ENGLISH
    Field Value
    Type Description
    RefinedSoundex

    US_ENGLISH_MAPPING_STRING

    since 1.4

    Declaration
    public static readonly string US_ENGLISH_MAPPING_STRING
    Field Value
    Type Description
    string

    Methods

    Difference(string, string)

    Returns the number of characters in the two encoded strings that are the same. This return value ranges from 0 to the length of the shortest encoded string: 0 indicates little or no similarity, and 4 out of 4 (for example) indicates strong similarity or identical values. For refined Soundex, the return value can be greater than 4.

    See: MS T-SQL DIFFERENCE

    since 1.3
    Declaration
    public virtual int Difference(string s1, string s2)
    Parameters
    Type Name Description
    string s1

    A string that will be encoded and compared.

    string s2

    A string that will be encoded and compared.

    Returns
    Type Description
    int

    The number of characters in the two encoded strings that are the same from 0 to to the length of the shortest encoded string.

    See Also
    Difference(IStringEncoder, string, string)

    Encode(string)

    Encodes a string using the refined soundex algorithm.

    Declaration
    public virtual string Encode(string str)
    Parameters
    Type Name Description
    string str

    A string object to encode.

    Returns
    Type Description
    string

    A Soundex code corresponding to the string supplied.

    GetSoundex(string)

    Retrieves the Refined Soundex code for a given string.

    Declaration
    public virtual string GetSoundex(string str)
    Parameters
    Type Name Description
    string str

    String to encode using the Refined Soundex algorithm.

    Returns
    Type Description
    string

    A soundex code for the string supplied.

    Implements

    IStringEncoder
    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.