public static class SynonymMap.Builder extends Object
Call add() until you have added all the mappings, then call build() to get an FSTSynonymMap
Constructor and Description |
---|
Builder()
Default constructor, passes
dedup=true . |
Builder(boolean dedup)
If dedup is true then identical rules (same input,
same output) will be added only once.
|
Modifier and Type | Method and Description |
---|---|
void |
add(CharsRef input,
CharsRef output,
boolean includeOrig)
Add a phrase->phrase synonym mapping.
|
SynonymMap |
build()
Builds an
SynonymMap and returns it. |
static CharsRef |
join(String[] words,
CharsRefBuilder reuse)
Sugar: just joins the provided terms with
SynonymMap.WORD_SEPARATOR . |
public Builder()
dedup=true
.public Builder(boolean dedup)
public static CharsRef join(String[] words, CharsRefBuilder reuse)
SynonymMap.WORD_SEPARATOR
. reuse and its chars
must not be null.public void add(CharsRef input, CharsRef output, boolean includeOrig)
input
- input phraseoutput
- output phraseincludeOrig
- true if the original should be includedpublic SynonymMap build() throws IOException
SynonymMap
and returns it.IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.