PhoneticEngine.PhonemeBuilder (Encode/Decode Utilities (Version 1.10-SNAPSHOT))
Date: 2015-09-13

org.apache.commons.codec.language.bm

## Class PhoneticEngine.PhonemeBuilder

- java.lang.Object
- - org.apache.commons.codec.language.bm.PhoneticEngine.PhonemeBuilder

- Enclosing class:
    PhoneticEngine

      static final class PhoneticEngine.PhonemeBuilder
      extends java.lang.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 Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private java.util.Set<Rule.Phoneme>` | `phonemes`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `PhoneticEngine.PhonemeBuilder(Rule.Phoneme phoneme)`
    `private` | `PhoneticEngine.PhonemeBuilder(java.util.Set<Rule.Phoneme> phonemes)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `append(java.lang.CharSequence str)` Creates a new phoneme builder containing all phonemes in this one extended by `str`.
    `void` | `apply(Rule.PhonemeExpr phonemeExpr, int maxPhonemes)` Applies the given phoneme expression to all phonemes in this phoneme builder.
    `static PhoneticEngine.PhonemeBuilder` | `empty(Languages.LanguageSet languages)` An empty builder where all phonemes must come from some set of languages.
    `java.util.Set<Rule.Phoneme>` | `getPhonemes()` Gets underlying phoneme set.
    `java.lang.String` | `makeString()` Stringifies the phoneme set.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### phonemes

          private final java.util.Set<Rule.Phoneme> phonemes

  - ### Constructor Detail

    - #### PhoneticEngine.PhonemeBuilder

          private PhoneticEngine.PhonemeBuilder(Rule.Phoneme phoneme)

    - #### PhoneticEngine.PhonemeBuilder

          private PhoneticEngine.PhonemeBuilder(java.util.Set<Rule.Phoneme> phonemes)

  - ### Method Detail

    - #### 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(java.lang.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 java.util.Set<Rule.Phoneme> getPhonemes()

      Gets underlying phoneme set. Please don't mutate.
      Returns:
        the phoneme set

    - #### makeString

          public java.lang.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

commons-codec version 1.10-SNAPSHOT - Copyright © 2002-2015 - Apache Software Foundation