Search in sources :

Example 1 with GermanyGerman

use of org.languagetool.language.GermanyGerman in project languagetool by languagetool-org.

the class HunspellRuleTest method testRuleWithGerman.

@Test
public void testRuleWithGerman() throws Exception {
    HunspellRule rule = new HunspellRule(TestTools.getMessages("de"), new GermanyGerman());
    JLanguageTool langTool = new JLanguageTool(new German());
    commonGermanAsserts(rule, langTool);
    // umlauts
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Der äußere Übeltäter.")).length);
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("Der äussere Übeltäter.")).length);
    // ignore URLs:
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Unter http://foo.org/bar steht was.")).length);
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("dasdassda http://foo.org/bar steht was.")).length);
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("Unter http://foo.org/bar steht dasdassda.")).length);
}
Also used : JLanguageTool(org.languagetool.JLanguageTool) SwissGerman(org.languagetool.language.SwissGerman) AustrianGerman(org.languagetool.language.AustrianGerman) German(org.languagetool.language.German) GermanyGerman(org.languagetool.language.GermanyGerman) GermanyGerman(org.languagetool.language.GermanyGerman) Test(org.junit.Test)

Example 2 with GermanyGerman

use of org.languagetool.language.GermanyGerman in project languagetool by languagetool-org.

the class SpellingCheckRuleTest method testIgnoreSuggestionsWithHunspell.

@Test
public void testIgnoreSuggestionsWithHunspell() throws IOException {
    JLanguageTool lt = new JLanguageTool(new GermanyGerman());
    // no error, as this word is in ignore.txt
    assertThat(lt.check("Das ist ein einPseudoWortFürLanguageToolTests").size(), is(0));
    List<RuleMatch> matches = lt.check("Das ist ein Tibbfehla");
    assertThat(matches.size(), is(1));
    assertThat(matches.get(0).getRule().getId(), is(GermanSpellerRule.RULE_ID));
}
Also used : RuleMatch(org.languagetool.rules.RuleMatch) JLanguageTool(org.languagetool.JLanguageTool) GermanyGerman(org.languagetool.language.GermanyGerman) Test(org.junit.Test)

Example 3 with GermanyGerman

use of org.languagetool.language.GermanyGerman in project languagetool by languagetool-org.

the class JLanguageToolTest method testCleanOverlappingWithGerman.

@Test
public void testCleanOverlappingWithGerman() throws IOException {
    JLanguageTool tool = new JLanguageTool(new GermanyGerman());
    // Juxtaposed errors in "TRGS - Technische" should not be removed.
    List<RuleMatch> matches = tool.check("TRGS - Technische Regeln für Gefahrstoffe");
    assertEquals(3, matches.size());
}
Also used : RuleMatch(org.languagetool.rules.RuleMatch) GermanyGerman(org.languagetool.language.GermanyGerman) Test(org.junit.Test)

Example 4 with GermanyGerman

use of org.languagetool.language.GermanyGerman in project languagetool by languagetool-org.

the class AgreementRuleTest method testRegression.

@Test
public void testRegression() throws IOException {
    JLanguageTool lt = new JLanguageTool(new GermanyGerman());
    // used to be not detected > 1.0.1:
    String str = "Und so.\r\nDie Bier.";
    List<RuleMatch> matches = lt.check(str);
    assertEquals(1, matches.size());
}
Also used : RuleMatch(org.languagetool.rules.RuleMatch) JLanguageTool(org.languagetool.JLanguageTool) GermanyGerman(org.languagetool.language.GermanyGerman) Test(org.junit.Test)

Example 5 with GermanyGerman

use of org.languagetool.language.GermanyGerman in project languagetool by languagetool-org.

the class AgreementRuleTest method setUp.

@Before
public void setUp() throws IOException {
    rule = new AgreementRule(TestTools.getMessages("de"), new GermanyGerman());
    lt = new JLanguageTool(new GermanyGerman());
}
Also used : JLanguageTool(org.languagetool.JLanguageTool) GermanyGerman(org.languagetool.language.GermanyGerman) Before(org.junit.Before)

Aggregations

GermanyGerman (org.languagetool.language.GermanyGerman)10 Test (org.junit.Test)8 JLanguageTool (org.languagetool.JLanguageTool)7 RuleMatch (org.languagetool.rules.RuleMatch)4 Before (org.junit.Before)2 GermanSpellerRule (org.languagetool.rules.de.GermanSpellerRule)2 InputStream (java.io.InputStream)1 List (java.util.List)1 Locale (java.util.Locale)1 ResourceBundle (java.util.ResourceBundle)1 Ignore (org.junit.Ignore)1 AustrianGerman (org.languagetool.language.AustrianGerman)1 German (org.languagetool.language.German)1 SwissGerman (org.languagetool.language.SwissGerman)1 Rule (org.languagetool.rules.Rule)1 SpellingCheckRule (org.languagetool.rules.spelling.SpellingCheckRule)1