Metaphone Support

These functions provide a means to implement Double Metaphone or Metaphone 3 phonetic encoding or fuzzy-match algorithms which return a primary code, a secondary code, or both for a given string.

Primary

STD.Metaphone.Primary( source )

STD.Metaphone3.Primary( source )

sourceThe string to process.
Return: Primary returns a STRING value.

The Primary function returns a textual representation of the source data, similar to a Soundex code. This function returns the first return value from the Double Metaphone algorithm.

The Metaphone3.Primary function uses the newer Metaphone 3 libraries which improve phonetic encoding of English words, non-English words familiar to Americans, and first and last names commonly found in the United States (Enterprise Edition only).

Example:

r := RECORD 
  STRING source; 
  STRING M1; 
  STRING M2; 
  STRING Mboth;
END;

r XF(ProgGuide.Person.File L) := TRANSFORM 
  SELF.source := L.LastName;
  SELF.M1     := STD.Metaphone.Primary( L.LastName ); 
  SELF.M2     := STD.Metaphone.Secondary( L.LastName ); 
  SELF.Mboth  := STD.Metaphone.Double( L.LastName );
END;

// Example using Metaphone 3 (available in Enterprise Edition)
/* 
r XF(ProgGuide.Person.File L) := TRANSFORM 
     SELF.source := L.LastName;
     SELF.M1     := STD.Metaphone3.Primary( L.LastName ); 
     SELF.M2     := STD.Metaphone3.Secondary( L.LastName ); 
     SELF.Mboth  := STD.Metaphone3.Double( L.LastName );
   END;
*/

ds := PROJECT(ProgGuide.Person.File,XF(LEFT)); 

COUNT(ds);
COUNT(ds(M1 <> M2)); 
OUTPUT(ds); 
OUTPUT(ds(M1 <> M2));