예제 #1
0
 @Nullable
 private String baseForThirdPersonSingularVerb(String word) throws IOException {
   List<AnalyzedTokenReadings> readings = tagger.tag(Collections.singletonList(word));
   for (AnalyzedTokenReadings reading : readings) {
     if (reading.hasPartialPosTag("VER:3:SIN:")) {
       return reading.getReadings().get(0).getLemma();
     }
   }
   return null;
 }
예제 #2
0
 @Override
 protected List<String> getAdditionalTopSuggestions(List<String> suggestions, String word) {
   String w = word.replaceFirst("\\.$", "");
   if ("unzwar".equals(w)) {
     return Collections.singletonList("und zwar");
   } else if ("desweiteren".equals(w)) {
     return Collections.singletonList("des Weiteren");
   } else if ("wieviel".equals(w)) {
     return Collections.singletonList("wie viel");
   } else if ("wieviele".equals(w)) {
     return Collections.singletonList("wie viele");
   } else if ("wievielen".equals(w)) {
     return Collections.singletonList("wie vielen");
   } else if ("vorteilen".equals(w)) {
     return Collections.singletonList("Vorteilen");
   } else if ("Trons".equals(w)) {
     return Collections.singletonList("Trance");
   } else if ("einzigste".equals(w)) {
     return Collections.singletonList("einzige");
   } else if (word.endsWith("standart")) {
     return Collections.singletonList(word.replaceFirst("standart$", "standard"));
   } else if (word.endsWith("standarts")) {
     return Collections.singletonList(word.replaceFirst("standarts$", "standards"));
   } else if (word.equals("Rolladen")) {
     return Collections.singletonList("Rollladen");
   } else if (word.equals("Maßname")) {
     return Collections.singletonList("Maßnahme");
   } else if (word.equals("Maßnamen")) {
     return Collections.singletonList("Maßnahmen");
   } else if (word.equals("nanten")) {
     return Collections.singletonList("nannten");
   } else if (!StringTools.startsWithUppercase(word)) {
     String ucWord = StringTools.uppercaseFirstChar(word);
     if (!suggestions.contains(ucWord) && !hunspellDict.misspelled(ucWord)) {
       // Hunspell doesn't always automatically offer the most obvious suggestion for compounds:
       return Collections.singletonList(ucWord);
     }
   }
   String verbSuggestion = getPastTenseVerbSuggestion(word);
   if (verbSuggestion != null) {
     return Collections.singletonList(verbSuggestion);
   }
   String participleSuggestion = getParticipleSuggestion(word);
   if (participleSuggestion != null) {
     return Collections.singletonList(participleSuggestion);
   }
   return Collections.emptyList();
 }