Package org.languagetool.language

Examples of org.languagetool.language.German


    // TODO: known to fail because jWordSplitters list is not complete:
    //assertError("Testketchup und Testketschup", langTool);
  }

  public void testCallIndependence() throws IOException {
    final JLanguageTool langTool = new JLanguageTool(new German());
    assertGood("Das ist aufwendig.", langTool);
    assertGood("Aber nicht zu aufwändig.", langTool)// this won't be noticed, the calls are independent of each other
  }
View Full Code Here


  public void testRuleCompleteTexts() throws IOException {
    final JLanguageTool langTool;
    // complete texts:
    List<RuleMatch> matches;
    langTool = new JLanguageTool(new German());
    matches = langTool.check("Das ist aufwändig. Aber hallo. Es ist wirklich aufwändig.");
    assertEquals(0, matches.size());
   
    matches = langTool.check("Das ist aufwendig. Aber hallo. Es ist wirklich aufwändig.");
    assertEquals(1, matches.size());
View Full Code Here

* @author Markus Brenneis
*/
public class GermanWordRepeatBeginningRuleTest extends TestCase {

  public void testRule() throws IOException {
    JLanguageTool langTool = new JLanguageTool(new German());
    // correct sentences:
    assertEquals(0, langTool.check("Er ist nett. Er heißt Max.").size());
    assertEquals(0, langTool.check("Außerdem kommt er. Ferner kommt sie. Außerdem kommt es.").size());
    assertEquals(0, langTool.check("2011: Dieses passiert. 2011: Jenes passiert. 2011: Nicht passiert").size());
    // errors:
View Full Code Here

public class MorfologikGermanyGermanSpellerRuleTest {

  @Test
  public void testMorfologikSpeller() throws IOException {
    final MorfologikGermanyGermanSpellerRule rule =
          new MorfologikGermanyGermanSpellerRule(TestTools.getMessages("en"), new German());
    final JLanguageTool langTool = new JLanguageTool(new German());

    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Hier stimmt jedes Wort!")).length);
    assertEquals(1, rule.match(langTool.getAnalyzedSentence("Hir nicht so ganz.")).length);

    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Überall äußerst böse Umlaute!")).length);
View Full Code Here

public class CompoundRuleTest extends AbstractCompoundRuleTest {

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    langTool = new JLanguageTool(new German());
    rule = new CompoundRule(null);
  }
View Full Code Here

import java.util.List;

public class JLanguageToolTest extends TestCase {

  public void testGerman() throws IOException {
    final 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.activateDefaultPatternRules();
    tool.setListUnknownWords(true);
    // no spelling mistakes as we have not created a variant:
View Full Code Here

    //test unknown words listing
    assertEquals("[I, can, description, detailed, give, more, you]", tool.getUnknownWords().toString());
  }

  public void testPositionsWithGerman() throws IOException {
    final JLanguageTool tool = new JLanguageTool(new German());
    tool.activateDefaultPatternRules();
    final List<RuleMatch> matches = tool.check("Stundenkilometer");
    assertEquals(1, matches.size());
    final RuleMatch match = matches.get(0);
    // TODO: values should be either 0-based or 1-based, it should not be mixed up!
View Full Code Here

    HTTPTools.disableCertChecks();
    final HTTPSServerConfig serverConfig = new HTTPSServerConfig(HTTPTools.getDefaultPort(), false, getKeystoreFile(), KEYSTORE_PASSWORD, 2, 120);
    final 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 expected) {}
    } finally {
      server.stop();
    }
View Full Code Here

    final String markup = "== Beispiele ==\n\n" +
            "Eine kleine Auswahl von Fehlern.\n\n" +
            "Das Komma ist richtig, wegen dem Leerzeichen.";
    final MediaWikiContent wikiContent = new MediaWikiContent(markup, "2012-11-11T20:00:00");
    final ErrorMarker errorMarker = new ErrorMarker("<err>", "</err>");
    final MarkupAwareWikipediaResult result = check.checkWikipediaMarkup(new URL("http://fake-url.org"), wikiContent, new German(), errorMarker);
    assertThat(result.getLastEditTimestamp(), is("2012-11-11T20:00:00"));
    final List<AppliedRuleMatch> appliedMatches = result.getAppliedRuleMatches();
    // even though this error has no suggestion, there's a (pseudo) correction:
    assertThat(appliedMatches.size(), is(1));
    final AppliedRuleMatch firstAppliedMatch = appliedMatches.get(0);
View Full Code Here

  @Ignore("manual debugging only")
  public void testForDebugging() throws Exception {
    // Note that the second sentence ends with "lid" instead of "lids" (the inflated one)
    //createIndex("I thin so");
    useRealIndex();
    German language = new German();
    PatternRule rule = getFirstRule("I_THIN", language);
    SearcherResult searcherResult = errorSearcher.findRuleMatchesOnIndex(rule, language);
    System.out.println("Matches: " + searcherResult.getMatchingSentences());
  }
View Full Code Here

TOP

Related Classes of org.languagetool.language.German

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.