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
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Phonetic.Language
Assembly: Lucene.Net.Analysis.Phonetic.dll
Syntax
public class RefinedSoundex : IStringEncoder
Constructors
| Improve this Doc View SourceRefinedSoundex()
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 |
---|---|---|
System.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 |
---|---|---|
System.String | mapping | Mapping string to use when finding the corresponding code for a given character. |
Fields
| Improve this Doc View SourceUS_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 |
---|---|
System.String |
Methods
| Improve this Doc View SourceDifference(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 |
---|---|---|
System.String | s1 | A string that will be encoded and compared. |
System.String | s2 | A string that will be encoded and compared. |
Returns
Type | Description |
---|---|
System.Int32 | 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
Encode(String)
Encodes a string using the refined soundex algorithm.
Declaration
public virtual string Encode(string str)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | A string object to encode. |
Returns
Type | Description |
---|---|
System.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 |
---|---|---|
System.String | str | String to encode using the Refined Soundex algorithm. |
Returns
Type | Description |
---|---|
System.String | A soundex code for the string supplied. |