private void addTo(SynonymMap.Builder builder, String[] from, String[] to) {
   for (String input : from) {
     for (String output : to) {
       builder.add(new CharsRef(input), new CharsRef(output), false);
     }
   }
 }
Exemplo n.º 2
0
 public static SynonymMap buildAcronymsMergingMap() throws IOException {
   SynonymMap.Builder synonymMap = new SynonymMap.Builder(true);
   synonymMap.add(new CharsRef("אף על פי כן"), new CharsRef("אעפ\"כ"), false);
   synonymMap.add(new CharsRef("אף על פי"), new CharsRef("אע\"פ"), false);
   synonymMap.add(new CharsRef("כמו כן"), new CharsRef("כמו\"כ"), false);
   synonymMap.add(new CharsRef("על ידי"), new CharsRef("ע\"י"), false);
   synonymMap.add(new CharsRef("על פי"), new CharsRef("ע\"פ"), false);
   synonymMap.add(new CharsRef("כל כך"), new CharsRef("כ\"כ"), false);
   synonymMap.add(new CharsRef("בדרך כלל"), new CharsRef("בד\"כ"), false);
   return synonymMap.build();
 }
 /**
  * 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!
  *
  * @param input input phrase
  * @param output output phrase
  * @param includeOrig true if the original should be included
  */
 public void add(CharsRef input, CharsRef output, boolean includeOrig) {
   add(input, countWords(input), output, countWords(output), includeOrig);
 }