Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class DoubleMetaphone

    Encodes a string into a double metaphone value. This Implementation is based on the algorithm by Lawrence Philips.

    This class is conditionally thread-safe. The instance field maxCodeLen is mutable MaxCodeLen but is not volatile, and accesses are not synchronized. If an instance of the class is shared between threads, the caller needs to ensure that suitable synchronization is used to ensure safe publication of the value between threads, and must not set MaxCodeLen after initial setup.

    See Original Article

    See http://en.wikipedia.org/wiki/Metaphone
    Inheritance
    object
    DoubleMetaphone
    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 DoubleMetaphone : IStringEncoder

    Constructors

    DoubleMetaphone()

    Creates an instance of this DoubleMetaphone encoder

    Declaration
    public DoubleMetaphone()

    Properties

    MaxCodeLen

    Gets or Sets the maxCodeLen.

    Declaration
    public virtual int MaxCodeLen { get; set; }
    Property Value
    Type Description
    int

    Methods

    CharAt(string, int)

    Gets the character at index index if available, otherwise it returns MinValue so that there is some sort of a default.

    Declaration
    protected virtual char CharAt(string value, int index)
    Parameters
    Type Name Description
    string value
    int index
    Returns
    Type Description
    char

    Contains(string, int, int, params string[])

    Determines whether value contains any of the criteria starting at index start and matching up to length length.

    Declaration
    protected static bool Contains(string value, int start, int length, params string[] criteria)
    Parameters
    Type Name Description
    string value
    int start
    int length
    string[] criteria
    Returns
    Type Description
    bool

    Encode(string)

    Encode the value using DoubleMetaphone.

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

    String to encode.

    Returns
    Type Description
    string

    An encoded string.

    GetDoubleMetaphone(string)

    Encode a value with Double Metaphone.

    Declaration
    public virtual string GetDoubleMetaphone(string value)
    Parameters
    Type Name Description
    string value

    String to encode.

    Returns
    Type Description
    string

    An encoded string.

    GetDoubleMetaphone(string, bool)

    Encode a value with Double Metaphone, optionally using the alternate encoding.

    Declaration
    public virtual string GetDoubleMetaphone(string value, bool alternate)
    Parameters
    Type Name Description
    string value

    String to encode.

    bool alternate

    Use alternate encode.

    Returns
    Type Description
    string

    An encoded string.

    IsDoubleMetaphoneEqual(string, string)

    Check if the Double Metaphone values of two string values are equal.

    Declaration
    public virtual bool IsDoubleMetaphoneEqual(string value1, string value2)
    Parameters
    Type Name Description
    string value1

    The left-hand side of the encoded Equals(object).

    string value2

    The right-hand side of the encoded Equals(object).

    Returns
    Type Description
    bool

    true if the encoded strings are equal; false otherwise.

    IsDoubleMetaphoneEqual(string, string, bool)

    Check if the Double Metaphone values of two string values are equal, optionally using the alternate value.

    Declaration
    public virtual bool IsDoubleMetaphoneEqual(string value1, string value2, bool alternate)
    Parameters
    Type Name Description
    string value1

    The left-hand side of the encoded Equals(object).

    string value2

    The right-hand side of the encoded Equals(object).

    bool alternate

    Use the alternate value if true.

    Returns
    Type Description
    bool

    true if the encoded strings are equal; false otherwise.

    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.