Core Function Metaphone

From Sputnik Wiki
Jump to: navigation, search
Metaphone( <string>, <phonemes> )

Contents

Description

Calculate the metaphone key of a string.

Parameters

string

The input string.

phonemes

Optional; This parameter restricts the returned metaphone key to phonemes characters in length.

The default value of 0 means no restriction.

Return Value

Success: Returns the metaphone key as a string.

Failure: Returns empty string.

Remarks

Similar to Soundex(); Metaphone() creates the same key for similar sounding words. It's more accurate than Soundex() as it knows the basic rules of English pronunciation. The metaphone generated keys are of variable length.

Metaphone was developed by Lawrence Philips <lphilips at verity dot com>. It is described in ["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995].

Example

echo Metaphone("programming"); // PRKRMNK
echo("\n");
echo Metaphone("programmer"); // PRKRMR
 
echo("\n");
 
echo metaphone('programming', 5); // PRKRM
echo("\n");
echo metaphone('programmer', 5); // PRKRM
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox