Class DoubleMetaphone
Encodes a string into a double metaphone value. This Implementation is based on the algorithm by Lawrence
Philips
.
Implements
Inherited Members
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 |
|
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 |
Returns
Type | Description |
---|---|
bool |
|