<-- Previous || Up || Next -->

Meta Phone Function
String Words Class

Public Function MetaPhone( _
      ByVal vPhrase As Variant _
    , Optional ByVal vMaxLength As Variant _
    ) As Variant

Returns the MetaPhone equivalent of an English word or phrase.
The MetaPhone algorithm reduces words to their phonetic equivalent in many cases.

    MetaPhone("Stephen") = "STFN"
    MetaPhone("Steven") = "STFN"
    MetaPhone("Steve") = "STF"
See also:
    Soundex Function
    SoundexExtended Function
    StringSimilarity Function
    HashString Function
vPhrase: The string containing the word or phrase which is to be converted to its sound-alike equivalent. Function returns Null if vPhrase is Null or cannot be fixed up to a String.

Function returns an empty string if the string vPhrase is an empty string.

vMaxLength: The maximum length of the MetaPhone phrase that will be returned. vMaxLength defaults to the maximum length of a long integer number (in other words, there is no maximum length and the MetaPhone result will not be truncated) if it is missing or Null or cannot be fixed up to a number.

The string vPhrase is first converted to upper case and its non-alphabetic characters are removed.

    Remove the first character if the word starts with one of the two-letter combinations "AE", "GN", "KN", "PN", or "WR".
    "WH" at the beginning of a word becomes "W".
    "X" at beginning of a word becomes "S".
    If first character is a vowel, add it to the output.
    "CC" becomes "C".
    "B" stays the same except for "MB".
    "C" is silent if preceded by "S" and followed by front vowel.
    "D" becomes "T" except in "DGE", etc.
    "F", "J", "L", "M", "N", and "R" stay the same.
    "G" can be silent or it can become "J" or "K".
    "H" is pronounced if only followed by vowel and not preceded by a VarsOn.
    "K" is silent if preceded by "C" (already covered).
    "P" stays as "P" except "PH" becomes "F".
    "Q" becomes "K".
    "S" becomes "X" if followed by I[AO] or "H" , otherwise "S".
    "T" becomes "X" in "TIO" or "TIA" or "0" (theta) in "TH" or may remain "T".
    0 (theta) preceding "H"
    "V" becomes "F".
    "W" and "Y" are vowels (not expressed) unless followed by vowel.
    "X" becomes "KS" unless that would overflow the allocated limit.
    "Z" becomes "S".

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.