Class SynonymMap.Builder
- java.lang.Object
-
- org.apache.lucene.analysis.synonym.SynonymMap.Builder
-
- Direct Known Subclasses:
SynonymMap.Parser
- Enclosing class:
- SynonymMap
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(CharsRef input, CharsRef output, boolean includeOrig)Add a phrase->phrase synonym mapping.SynonymMapbuild()Builds anSynonymMapand returns it.static CharsRefjoin(String[] words, CharsRefBuilder reuse)Sugar: just joins the provided terms withSynonymMap.WORD_SEPARATOR.
-
-
-
Method Detail
-
join
public static CharsRef join(String[] words, CharsRefBuilder reuse)
Sugar: just joins the provided terms withSynonymMap.WORD_SEPARATOR. reuse and its chars must not be null.
-
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!- Parameters:
input- input phraseoutput- output phraseincludeOrig- true if the original should be included
-
build
public SynonymMap build() throws IOException
Builds anSynonymMapand returns it.- Throws:
IOException
-
-