Class PhoneticEngine.PhonemeBuilder
java.lang.Object
org.apache.commons.codec.language.bm.PhoneticEngine.PhonemeBuilder
- Enclosing class:
PhoneticEngine
Utility for manipulating a set of phonemes as they are being built up. Not intended for use outside
this package, and probably not outside the
PhoneticEngine
class.- Since:
- 1.6
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
PhonemeBuilder
(Set<Rule.Phoneme> phonemes) private
PhonemeBuilder
(Rule.Phoneme phoneme) -
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(CharSequence str) Creates a new phoneme builder containing all phonemes in this one extended bystr
.void
apply
(Rule.PhonemeExpr phonemeExpr, int maxPhonemes) Applies the given phoneme expression to all phonemes in this phoneme builder.empty
(Languages.LanguageSet languages) An empty builder where all phonemes must come from some set of languages.Gets underlying phoneme set.Stringifies the phoneme set.
-
Field Details
-
phonemes
-
-
Constructor Details
-
PhonemeBuilder
-
PhonemeBuilder
-
-
Method Details
-
empty
An empty builder where all phonemes must come from some set of languages. This will contain a single phoneme of zero characters. This can then be appended to. This should be the only way to create a new phoneme from scratch.- Parameters:
languages
- the set of languages- Returns:
- a new, empty phoneme builder
-
append
Creates a new phoneme builder containing all phonemes in this one extended bystr
.- Parameters:
str
- the characters to append to the phonemes
-
apply
Applies the given phoneme expression to all phonemes in this phoneme builder.This will lengthen phonemes that have compatible language sets to the expression, and drop those that are incompatible.
- Parameters:
phonemeExpr
- the expression to applymaxPhonemes
- the maximum number of phonemes to build up
-
getPhonemes
Gets underlying phoneme set. Please don't mutate.- Returns:
- the phoneme set
-
makeString
Stringifies the phoneme set. This produces a single string of the strings of each phoneme, joined with a pipe. This is explicitly provided in place of toString as it is a potentially expensive operation, which should be avoided when debugging.- Returns:
- the stringified phoneme set
-