use of org.languagetool.rules.spelling.hunspell.HunspellRule in project languagetool by languagetool-org.
the class GermanSpellerRuleTest method testGetSuggestions.
@Test
public void testGetSuggestions() throws Exception {
HunspellRule rule = new GermanSpellerRule(TestTools.getMessages("de"), GERMAN_DE);
assertCorrection(rule, "Hauk", "Haus", "Haut");
assertCorrection(rule, "Eisnbahn", "Einbahn", "Eisbahn", "Eisenbahn");
assertCorrection(rule, "Rechtschreipreform", "Rechtschreibreform");
assertCorrection(rule, "Theatrekasse", "Theaterkasse");
assertCorrection(rule, "Traprennen", "Trabrennen");
assertCorrection(rule, "Autuverkehr", "Autoverkehr");
assertCorrection(rule, "Rechtschreibprüfun", "Rechtschreibprüfung");
assertCorrection(rule, "Rechtschreib-Prüfun", "Rechtschreib-Prüfung");
assertCorrection(rule, "bw.", "bzw.");
assertCorrection(rule, "kan", "kann", "an");
assertCorrection(rule, "kan.", "kann.", "an.");
assertCorrection(rule, "Einzahlungschein", "Einzahlungsschein");
assertCorrection(rule, "Arbeitamt", "Arbeitet", "Arbeitsamt");
assertCorrection(rule, "Ordnungshütter", "Ordnungshüter");
//TODO: requires morfologik-speller change (suggestions for known words):
//assertCorrection(rule, "Arbeitamt", "Arbeitsamt");
assertCorrection(rule, "Autoverkehrr", "Autoverkehr");
assertCorrection(rule, "hasslich", "hässlich", "fasslich");
assertCorrection(rule, "Struße", "Strauße", "Straße", "Sträuße");
assertCorrection(rule, "gewohnlich", "gewöhnlich");
assertCorrection(rule, "gawöhnlich", "gewöhnlich");
assertCorrection(rule, "gwöhnlich", "gewöhnlich");
assertCorrection(rule, "geewöhnlich", "gewöhnlich");
assertCorrection(rule, "gewönlich", "gewöhnlich");
assertCorrection(rule, "außergewöhnkich", "außergewöhnlich");
assertCorrection(rule, "agressiv", "aggressiv");
assertCorrection(rule, "agressivster", "aggressivster");
assertCorrection(rule, "agressiver", "aggressiver");
assertCorrection(rule, "agressive", "aggressive");
assertCorrection(rule, "Algorythmus", "Algorithmus");
assertCorrection(rule, "Algorhythmus", "Algorithmus");
assertCorrection(rule, "Amalgan", "Amalgam");
assertCorrection(rule, "Amaturenbrett", "Armaturenbrett");
assertCorrection(rule, "Aquise", "Akquise");
assertCorrection(rule, "Artzt", "Arzt");
assertCorrection(rule, "aufgrunddessen", "aufgrund dessen");
assertCorrection(rule, "barfuss", "barfuß");
assertCorrection(rule, "Batallion", "Bataillon");
// use to work with jwordsplitter 3.4: too many other suggestions with Levenshtein=2
//assertCorrection(rule, "Handselvertreter", "Handelsvertreter");
//assertCorrection(rule, "Handselvertretertreffen", "Handelsvertretertreffen");
assertCorrection(rule, "aul", "auf");
// only "ich" (lowercase) is in the lexicon
assertCorrection(rule, "Icj", "Ich");
//assertCorrection(rule, "Ihj", "Ich"); // only "ich" (lowercase) is in the lexicon - does not work because of the limit
// three part compounds:
assertCorrection(rule, "Handelsvertretertrffen", "Handelsvertretertreffen");
assertCorrection(rule, "Handelsvartretertreffen", "Handelsvertretertreffen");
assertCorrection(rule, "Handelsvertretertriffen", "Handelsvertretertreffen");
// this won't work as jwordsplitter splits into Handelsvertrter + Treffen but
// the Hunspell dict doesn't contain "Handelsvertreter", thus it's a known limitation
// because jwordsplitter doesn't use the same dictionary as Hunspell:
// assertCorrection(rule, "Handelsvertrtertreffen", "Handelsvertretertreffen");
// TODO: compounds with errors in more than one part
// totally wrong jwordsplitter split: Hands + elvertretertreffn:
//assertCorrection(rule, "Handselvertretertreffn", "Handelsvertretertreffen");
}
Aggregations