Class Metaphone
Encodes a string into a Metaphone value.
Initial Java implementation byWilliam 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)
 
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Phonetic.Language
Assembly: Lucene.Net.Analysis.Phonetic.dll
Syntax
public class Metaphone : IStringEncoder
  Constructors
Metaphone()
Creates an instance of the Metaphone encoder
Declaration
public Metaphone()
  Properties
MaxCodeLen
Gets or Sets maxCodeLen.
Declaration
public virtual int MaxCodeLen { get; set; }
  Property Value
| Type | Description | 
|---|---|
| int | 
Methods
Encode(string)
Encodes a string using the Metaphone algorithm.
Declaration
public virtual string Encode(string str)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | str | String to encode.  | 
      
Returns
| Type | Description | 
|---|---|
| string | 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 | 
|---|---|---|
| string | txt | String to find the metaphone code for.  | 
      
Returns
| Type | Description | 
|---|---|
| string | 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 | 
|---|---|---|
| string | str1 | First of two strings to compare.  | 
      
| string | str2 | Second of two strings to compare.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
  |