Search in sources :

Example 6 with German

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

the class HunspellRuleTest method testRuleWithSwissGerman.

@Test
public void testRuleWithSwissGerman() throws Exception {
    HunspellRule rule = new HunspellRule(TestTools.getMessages("de"), new SwissGerman());
    JLanguageTool langTool = new JLanguageTool(new German());
    commonGermanAsserts(rule, langTool);
    // ß not allowed in Swiss
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("Der äußere Übeltäter.")).length);
    // ss is used instead of ß
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Der äussere Übeltäter.")).length);
}
Also used : SwissGerman(org.languagetool.language.SwissGerman) JLanguageTool(org.languagetool.JLanguageTool) SwissGerman(org.languagetool.language.SwissGerman) AustrianGerman(org.languagetool.language.AustrianGerman) German(org.languagetool.language.German) GermanyGerman(org.languagetool.language.GermanyGerman) Test(org.junit.Test)

Example 7 with German

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

the class JLanguageToolTest method testGerman.

@Test
public void testGerman() throws IOException {
    JLanguageTool tool = new JLanguageTool(new German());
    assertEquals(0, tool.check("Ein Test, der keine Fehler geben sollte.").size());
    assertEquals(1, tool.check("Ein Test Test, der Fehler geben sollte.").size());
    tool.setListUnknownWords(true);
    // no spelling mistakes as we have not created a variant:
    assertEquals(0, tool.check("I can give you more a detailed description").size());
    //test unknown words listing
    assertEquals("[I, can, description, detailed, give, more, you]", tool.getUnknownWords().toString());
}
Also used : German(org.languagetool.language.German) GermanyGerman(org.languagetool.language.GermanyGerman) Test(org.junit.Test)

Example 8 with German

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

the class CompoundRuleTest method setUp.

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

Example 9 with German

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

the class CommonCrawlToNgramTest method testIndexing.

@Test
@Ignore("Interactive use only, has not assertions")
public void testIndexing() throws IOException {
    File tempDir = new File(FileUtils.getTempDirectory(), "common-crawl-test");
    try {
        tempDir.mkdir();
        String filename = CommonCrawlToNgramTest.class.getResource("/org/languagetool/dev/bigdata/ngram-input.txt.xz").getFile();
        try (CommonCrawlToNgram prg = new CommonCrawlToNgram(new German(), new File(filename), tempDir, null)) {
            prg.setCacheLimit(1);
            prg.indexInputFile();
        }
    } finally {
        FileUtils.deleteDirectory(tempDir);
    }
}
Also used : German(org.languagetool.language.German) File(java.io.File) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 10 with German

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

the class HTTPSServerTest method runRequestLimitationTest.

@Test
public void runRequestLimitationTest() throws Exception {
    HTTPTools.disableCertChecks();
    HTTPSServerConfig serverConfig = new HTTPSServerConfig(HTTPTools.getDefaultPort(), false, getKeystoreFile(), KEYSTORE_PASSWORD, 2, 120);
    HTTPSServer server = new HTTPSServer(serverConfig, false, HTTPServerConfig.DEFAULT_HOST, null);
    try {
        server.run();
        check(new German(), "foo");
        check(new German(), "foo");
        try {
            System.out.println("=== Testing too many requests now, please ignore the following error ===");
            String result = check(new German(), "foo");
            fail("Expected exception not thrown, got this result instead: '" + result + "'");
        } catch (IOException ignored) {
        }
    } finally {
        server.stop();
    }
}
Also used : German(org.languagetool.language.German) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

German (org.languagetool.language.German)26 Test (org.junit.Test)19 JLanguageTool (org.languagetool.JLanguageTool)16 GermanyGerman (org.languagetool.language.GermanyGerman)5 Before (org.junit.Before)3 AustrianGerman (org.languagetool.language.AustrianGerman)3 SwissGerman (org.languagetool.language.SwissGerman)3 Ignore (org.junit.Ignore)2 RuleMatch (org.languagetool.rules.RuleMatch)2 File (java.io.File)1 IOException (java.io.IOException)1 URL (java.net.URL)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 Dictionary (morfologik.stemming.Dictionary)1 DictionaryLookup (morfologik.stemming.DictionaryLookup)1 WordData (morfologik.stemming.WordData)1 BeforeClass (org.junit.BeforeClass)1 AnalyzedToken (org.languagetool.AnalyzedToken)1