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);
}
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());
}
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"));
}
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);
}
}
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();
}
}
Aggregations