Class PhoneticEngine.PhonemeBuilder

java.lang.Object
org.apache.commons.codec.language.bm.PhoneticEngine.PhonemeBuilder
Enclosing class:
PhoneticEngine

static final class PhoneticEngine.PhonemeBuilder extends Object
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 Details

  • Constructor Details

  • Method Details

    • empty

      public static PhoneticEngine.PhonemeBuilder empty(Languages.LanguageSet languages)
      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

      public void append(CharSequence str)
      Creates a new phoneme builder containing all phonemes in this one extended by str.
      Parameters:
      str - the characters to append to the phonemes
    • apply

      public void apply(Rule.PhonemeExpr phonemeExpr, int maxPhonemes)
      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 apply
      maxPhonemes - the maximum number of phonemes to build up
    • getPhonemes

      public Set<Rule.Phoneme> getPhonemes()
      Gets underlying phoneme set. Please don't mutate.
      Returns:
      the phoneme set
    • makeString

      public String 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