Class SynonymMap.Builder

  • Direct Known Subclasses:
    Enclosing class:

    public static class SynonymMap.Builder
    extends Object
    Builds an FSTSynonymMap.

    Call add() until you have added all the mappings, then call build() to get an FSTSynonymMap

    WARNING: This API is experimental and might change in incompatible ways in the next release.
    • Constructor Detail

      • Builder

        public Builder()
        Default constructor, passes dedup=true.
      • Builder

        public Builder​(boolean dedup)
        If dedup is true then identical rules (same input, same output) will be added only once.
    • Method Detail

      • add

        public void add​(CharsRef input,
                        CharsRef output,
                        boolean includeOrig)
        Add a phrase->phrase synonym mapping. Phrases are character sequences where words are separated with character zero (U+0000). Empty words (two U+0000s in a row) are not allowed in the input nor the output!
        input - input phrase
        output - output phrase
        includeOrig - true if the original should be included