Class MatchRatingApproachEncoder
java.lang.Object
org.apache.commons.codec.language.MatchRatingApproachEncoder
- All Implemented Interfaces:
Encoder
,StringEncoder
Match Rating Approach Phonetic Algorithm Developed by Western Airlines in 1977.
This class is immutable and thread-safe.
- Since:
- 1.8
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal Object
Encodes an Object using the Match Rating Approach algorithm.final String
Encodes a String using the Match Rating Approach (MRA) algorithm.boolean
isEncodeEquals
(String name1, String name2) Determines if two names are homophonous via Match Rating Approach (MRA) algorithm.
-
Constructor Details
-
MatchRatingApproachEncoder
public MatchRatingApproachEncoder()
-
-
Method Details
-
encode
Encodes an Object using the Match Rating Approach algorithm. Method is here to satisfy the requirements of the Encoder interface Throws an EncoderException if input object is not of typeString
.- Specified by:
encode
in interfaceEncoder
- Parameters:
pObject
- Object to encode- Returns:
- An object (or type
String
) containing the Match Rating Approach code which corresponds to the String supplied. - Throws:
EncoderException
- if the parameter supplied is not of typeString
-
encode
Encodes a String using the Match Rating Approach (MRA) algorithm.- Specified by:
encode
in interfaceStringEncoder
- Parameters:
name
- String object to encode- Returns:
- The MRA code corresponding to the String supplied
-
isEncodeEquals
Determines if two names are homophonous via Match Rating Approach (MRA) algorithm. It should be noted that the strings are cleaned in the same way asencode(String)
.- Parameters:
name1
- First of the 2 strings (names) to comparename2
- Second of the 2 names to compare- Returns:
true
if the encodings are identicalfalse
otherwise.
-