Class PhoneticEngine
- java.lang.Object
 - 
- org.apache.commons.codec.language.bm.PhoneticEngine
 
 
- 
public class PhoneticEngine extends java.lang.ObjectConverts words into potential phonetic representations.This is a two-stage process. Firstly, the word is converted into a phonetic representation that takes into account the likely source language. Next, this phonetic representation is converted into a pan-European 'average' representation, allowing comparison between different versions of essentially the same word from different languages.
This class is intentionally immutable and thread-safe. If you wish to alter the settings for a PhoneticEngine, you must make a new one with the updated settings.
Ported from phoneticengine.php
- Since:
 - 1.6
 
 
- 
- 
Constructor Summary
Constructors Constructor Description PhoneticEngine(NameType nameType, RuleType ruleType, boolean concatenate)Generates a new, fully-configured phonetic engine.PhoneticEngine(NameType nameType, RuleType ruleType, boolean concatenate, int maxPhonemes)Generates a new, fully-configured phonetic engine. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringencode(java.lang.String input)Encodes a string to its phonetic representation.java.lang.Stringencode(java.lang.String input, Languages.LanguageSet languageSet)Encodes an input string into an output phonetic representation, given a set of possible origin languages.LanggetLang()Gets the Lang language guessing rules being used.intgetMaxPhonemes()Gets the maximum number of phonemes the engine will calculate for a given input.NameTypegetNameType()Gets the NameType being used.RuleTypegetRuleType()Gets the RuleType being used.booleanisConcat()Gets if multiple phonetic encodings are concatenated or if just the first one is kept. 
 - 
 
- 
- 
Constructor Detail
- 
PhoneticEngine
public PhoneticEngine(NameType nameType, RuleType ruleType, boolean concatenate)
Generates a new, fully-configured phonetic engine.- Parameters:
 nameType- the type of names it will useruleType- the type of rules it will applyconcatenate- if it will concatenate multiple encodings
 
- 
PhoneticEngine
public PhoneticEngine(NameType nameType, RuleType ruleType, boolean concatenate, int maxPhonemes)
Generates a new, fully-configured phonetic engine.- Parameters:
 nameType- the type of names it will useruleType- the type of rules it will applyconcatenate- if it will concatenate multiple encodingsmaxPhonemes- the maximum number of phonemes that will be handled- Since:
 - 1.7
 
 
 - 
 
- 
Method Detail
- 
encode
public java.lang.String encode(java.lang.String input)
Encodes a string to its phonetic representation.- Parameters:
 input- the String to encode- Returns:
 - the encoding of the input
 
 
- 
encode
public java.lang.String encode(java.lang.String input, Languages.LanguageSet languageSet)Encodes an input string into an output phonetic representation, given a set of possible origin languages.- Parameters:
 input- String to phoneticise; a String with dashes or spaces separating each wordlanguageSet- set of possible origin languages- Returns:
 - a phonetic representation of the input; a String containing '-'-separated phonetic representations of the input
 
 
- 
getLang
public Lang getLang()
Gets the Lang language guessing rules being used.- Returns:
 - the Lang in use
 
 
- 
getMaxPhonemes
public int getMaxPhonemes()
Gets the maximum number of phonemes the engine will calculate for a given input.- Returns:
 - the maximum number of phonemes
 - Since:
 - 1.7
 
 
- 
getNameType
public NameType getNameType()
Gets the NameType being used.- Returns:
 - the NameType in use
 
 
- 
getRuleType
public RuleType getRuleType()
Gets the RuleType being used.- Returns:
 - the RuleType in use
 
 
- 
isConcat
public boolean isConcat()
Gets if multiple phonetic encodings are concatenated or if just the first one is kept.- Returns:
 - true if multiple phonetic encodings are returned, false if just the first is
 
 
 - 
 
 -