use of org.languagetool.rules.spelling.hunspell.HunspellRule in project languagetool by languagetool-org.
the class GermanSpellerRuleTest method testRuleWithAustrianGerman.
// note: copied from HunspellRuleTest
@Test
public void testRuleWithAustrianGerman() throws Exception {
AustrianGerman language = new AustrianGerman();
HunspellRule rule = new GermanSpellerRule(TestTools.getMessages("de"), language);
JLanguageTool lt = new JLanguageTool(language);
commonGermanAsserts(rule, lt);
// umlauts
assertEquals(0, rule.match(lt.getAnalyzedSentence("Der äußere Übeltäter.")).length);
assertEquals(1, rule.match(lt.getAnalyzedSentence("Der äussere Übeltäter.")).length);
}
use of org.languagetool.rules.spelling.hunspell.HunspellRule in project languagetool by languagetool-org.
the class GermanSpellerRuleTest method testRuleWithSwissGerman.
// note: copied from HunspellRuleTest
@Test
public void testRuleWithSwissGerman() throws Exception {
SwissGerman language = new SwissGerman();
HunspellRule rule = new GermanSpellerRule(TestTools.getMessages("de"), language);
JLanguageTool lt = new JLanguageTool(language);
commonGermanAsserts(rule, lt);
// ß not allowed in Swiss
assertEquals(1, rule.match(lt.getAnalyzedSentence("Der äußere Übeltäter.")).length);
// ss is used instead of ß
assertEquals(0, rule.match(lt.getAnalyzedSentence("Der äussere Übeltäter.")).length);
}
use of org.languagetool.rules.spelling.hunspell.HunspellRule in project languagetool by languagetool-org.
the class GermanSpellerRuleTest method testDashAndHyphen.
@Test
public void testDashAndHyphen() throws Exception {
HunspellRule rule = new GermanSpellerRule(TestTools.getMessages("de"), GERMAN_DE);
JLanguageTool lt = new JLanguageTool(GERMAN_DE);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Ist doch - gut")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Ist doch -- gut")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Stil- und Grammatikprüfung gut")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Stil-, Text- und Grammatikprüfung gut")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Er liebt die Stil-, Text- und Grammatikprüfung.")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Stil-, Text- und Grammatikprüfung")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Stil-, Text- oder Grammatikprüfung")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Miet- und Zinseinkünfte")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Haupt- und Nebensatz")).length);
// compound with ignored word from spelling.txt
assertEquals(0, rule.match(lt.getAnalyzedSentence("Au-pair-Agentur")).length);
// compound with ignored word from spelling.txt
assertEquals(0, rule.match(lt.getAnalyzedSentence("Netflix-Film")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Bund-Länder-Kommission")).length);
assertEquals(0, rule.match(lt.getAnalyzedSentence("Der westperuanische Ferienort.")).length);
assertEquals(1, rule.match(lt.getAnalyzedSentence("Miet und Zinseinkünfte")).length);
assertEquals(1, rule.match(lt.getAnalyzedSentence("Stil- und Grammatik gut")).length);
assertEquals(1, rule.match(lt.getAnalyzedSentence("Flasch- und Grammatikprüfung gut")).length);
//assertEquals(1, rule.match(langTool.getAnalyzedSentence("Haupt- und Neben")).length); // hunspell accepts this :-(
}
use of org.languagetool.rules.spelling.hunspell.HunspellRule in project languagetool by languagetool-org.
the class GermanSpellerRuleTest method testRuleWithGermanyGerman.
// note: copied from HunspellRuleTest
@Test
public void testRuleWithGermanyGerman() throws Exception {
HunspellRule rule = new GermanSpellerRule(TestTools.getMessages("de"), GERMAN_DE);
JLanguageTool lt = new JLanguageTool(GERMAN_DE);
commonGermanAsserts(rule, lt);
// umlauts
assertEquals(0, rule.match(lt.getAnalyzedSentence("Der äußere Übeltäter.")).length);
assertEquals(1, rule.match(lt.getAnalyzedSentence("Der äussere Übeltäter.")).length);
// TODO: this is a false alarm:
//assertEquals(0, rule.match(langTool.getAnalyzedSentence("Die Mozart'sche Sonate.")).length);
}
use of org.languagetool.rules.spelling.hunspell.HunspellRule in project languagetool by languagetool-org.
the class GermanSpellerRuleTest method testGetSuggestionOrder.
@Test
public void testGetSuggestionOrder() throws Exception {
HunspellRule rule = new GermanSpellerRule(TestTools.getMessages("de"), GERMAN_DE);
// "heißt" should be first
assertCorrectionsByOrder(rule, "heisst", "heißt");
assertCorrectionsByOrder(rule, "heissen", "heißen");
assertCorrectionsByOrder(rule, "müßte", "müsste");
assertCorrectionsByOrder(rule, "schmohren", "schmoren");
assertCorrectionsByOrder(rule, "Fänomen", "Phänomen");
assertCorrectionsByOrder(rule, "homofob", "homophob");
assertCorrectionsByOrder(rule, "ueber", "über");
assertCorrectionsByOrder(rule, "uebel", "übel");
assertCorrectionsByOrder(rule, "Aerger", "Ärger");
assertCorrectionsByOrder(rule, "Walt", "Wald");
assertCorrectionsByOrder(rule, "Rythmus", "Rhythmus");
assertCorrectionsByOrder(rule, "Rytmus", "Rhythmus");
// 'ist' should actually be preferred...
assertCorrectionsByOrder(rule, "is", "iss", "in", "im", "ist");
}
Aggregations