Metaphone metaphoneCodec = new Metaphone();
List<String> encodedTokens = new ArrayList<String>();
List<String> tokens = tokenize(plainText);
for(String token : tokens) {
encodedTokens.add(metaphoneCodec.encode(token));
}
String metaphone = join(encodedTokens, " ");
byte[] base64 = Base64.encodeBase64Chunked(metaphone.getBytes());
return new String(base64);