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 Lucene.Net.Analysis.Phonetic.Language.DoubleMetaphone.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
    System.Object
    DoubleMetaphone
    Implements
    IStringEncoder
    Namespace: Lucene.Net.Analysis.Phonetic.Language
    Assembly: Lucene.Net.Analysis.Phonetic.dll
    Syntax
    public class DoubleMetaphone : object, IStringEncoder

    Constructors

    | Improve this Doc View Source

    DoubleMetaphone()

    Creates an instance of this DoubleMetaphone encoder

    Declaration
    public DoubleMetaphone()

    Properties

    | Improve this Doc View Source

    MaxCodeLen

    Gets or Sets the maxCodeLen.

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

    Methods

    | Improve this Doc View Source

    CharAt(String, Int32)

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

    Declaration
    protected virtual char CharAt(string value, int index)
    Parameters
    Type Name Description
    System.String value
    System.Int32 index
    Returns
    Type Description
    System.Char
    | Improve this Doc View Source

    Contains(String, Int32, Int32, 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
    System.String value
    System.Int32 start
    System.Int32 length
    System.String[] criteria
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Encode(String)

    Encode the value using DoubleMetaphone.

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

    String to encode.

    Returns
    Type Description
    System.String

    An encoded string.

    | Improve this Doc View Source

    GetDoubleMetaphone(String)

    Encode a value with Double Metaphone.

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

    String to encode.

    Returns
    Type Description
    System.String

    An encoded string.

    | Improve this Doc View Source

    GetDoubleMetaphone(String, Boolean)

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

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

    String to encode.

    System.Boolean alternate

    Use alternate encode.

    Returns
    Type Description
    System.String

    An encoded string.

    | Improve this Doc View Source

    IsDoubleMetaphoneEqual(String, String)

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

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

    The left-hand side of the encoded .

    System.String value2

    The right-hand side of the encoded .

    Returns
    Type Description
    System.Boolean

    true if the encoded s are equal; false otherwise.

    | Improve this Doc View Source

    IsDoubleMetaphoneEqual(String, String, Boolean)

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

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

    The left-hand side of the encoded .

    System.String value2

    The right-hand side of the encoded .

    System.Boolean alternate

    Use the alternate value if true.

    Returns
    Type Description
    System.Boolean

    true if the encoded s are equal; false otherwise.

    Implements

    IStringEncoder
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)