Class Metaphone
Encodes a string into a Metaphone value.
Initial Java implementation by William B. Brogden. December, 1997
.
Permission given by wbrogden
for code to be used anywhere.
Hanging on the Metaphone
by Lawrence Philips
in Computer Language of Dec. 1990,
p 39.
Note, that this does not match the algorithm that ships with PHP, or the algorithm found in the Perl implementations:
- Text:Metaphone-1.96 (broken link 4/30/2013)
- Text:Metaphone-1.96 (link checked 4/30/2013)
They have had undocumented changes from the originally published algorithm. For more information, see CODEC-57.
This class is conditionally thread-safe.
The instance field Lucene.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Phonetic.Language
Assembly: Lucene.Net.Analysis.Phonetic.dll
Syntax
public class Metaphone : IStringEncoder
Constructors
| Improve this Doc View SourceMetaphone()
Creates an instance of the Metaphone encoder
Declaration
public Metaphone()
Properties
| Improve this Doc View SourceMaxCodeLen
Gets or Sets Lucene.
Declaration
public virtual int MaxCodeLen { get; set; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceEncode(String)
Encodes a string using the Metaphone algorithm.
Declaration
public virtual string Encode(string str)
Parameters
Type | Name | Description |
---|---|---|
System. |
str | String to encode. |
Returns
Type | Description |
---|---|
System. |
The metaphone code corresponding to the string supplied. |
GetMetaphone(String)
Find the metaphone value of a string. This is similar to the soundex algorithm, but better at finding similar sounding words. All input is converted to upper case. Limitations: Input format is expected to be a single ASCII word with only characters in the A - Z range, no punctuation or numbers.
Declaration
public virtual string GetMetaphone(string txt)
Parameters
Type | Name | Description |
---|---|---|
System. |
txt | String to find the metaphone code for. |
Returns
Type | Description |
---|---|
System. |
A metaphone code corresponding to the string supplied. |
IsMetaphoneEqual(String, String)
Tests is the metaphones of two strings are identical.
Declaration
public virtual bool IsMetaphoneEqual(string str1, string str2)
Parameters
Type | Name | Description |
---|---|---|
System. |
str1 | First of two strings to compare. |
System. |
str2 | Second of two strings to compare. |
Returns
Type | Description |
---|---|
System. |
|