Examples of German


Examples of org.languagetool.language.German

*/
public class WordCoherencyRuleTest extends TestCase {

  public void testRule() throws IOException {
    final WordCoherencyRule rule = new WordCoherencyRule(null);
    final JLanguageTool langTool = new JLanguageTool(new German());
    // correct sentences:
    assertEquals(0, rule.match(langTool.getAnalyzedSentence("Das ist aufwendig, aber nicht zu aufwendig.")).length);
    // as WordCoherencyRule keeps its state to check more than one sentence
    // we need to create a new object each time:
    rule.reset();
View Full Code Here

Examples of org.languagetool.language.German

  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

Examples of org.languagetool.language.German

import java.io.IOException;

public class WordRepeatRuleTest extends TestCase {

  public void testRuleGerman() throws IOException {
    final German german = new German();
    final WordRepeatRule rule = new GermanWordRepeatRule(TestTools.getEnglishMessages(), german);
    RuleMatch[] matches;
    final JLanguageTool langTool = new JLanguageTool(german);
    // correct sentences:
    matches = rule.match(langTool.getAnalyzedSentence("Das sind die Sätze, die die testen sollen."));
View Full Code Here

Examples of org.languagetool.language.German

public class CompoundRuleTest extends CompoundRuleTestAbs {

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

Examples of org.languagetool.language.German

    final WikipediaQuickCheck check = new WikipediaQuickCheck();
    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 MarkupAwareWikipediaResult result = check.checkWikipediaMarkup(new URL("http://fake-url.org"), wikiContent, new German());
    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

Examples of org.languagetool.language.German

  /** for manual debugging only */
  public void IGNOREtestForDebugging() throws Exception {
    // Note that the second sentence ends with "lid" instead of "lids" (the inflated one)
    createIndex("I thin so");
    final PatternRule rule = getRule("I_THIN", ruleFile);
    final SearcherResult searcherResult = errorSearcher.findRuleMatchesOnIndex(rule, new German());
    System.out.println("Matches: " + searcherResult.getMatchingSentences());
    assertEquals(1, searcherResult.getMatchingSentences().size());
  }
View Full Code Here

Examples of org.languagetool.language.German

  void runTests() throws IOException, SAXException, ParserConfigurationException {
    // no error:
    final String matchAttr = "software=\"LanguageTool\" version=\"" + JLanguageTool.VERSION + "\" buildDate=\".*?\"";
    final String emptyResultPattern = "<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n<matches " + matchAttr + ">\n<language shortname=\"de\" name=\"German\"/>\n</matches>\n";
    final German german = new German();
    final String result1 = check(german, "");
    assertTrue("Got " + result1 + ", expected " + emptyResultPattern, result1.matches(emptyResultPattern));
    final String result2 = check(german, "Ein kleiner test");
    assertTrue("Got " + result2 + ", expected " + emptyResultPattern, result2.matches(emptyResultPattern));
    // one error:
View Full Code Here

Examples of org.languagetool.language.German

    final HTTPServer server = new HTTPServer(new HTTPServerConfig(), false, new HashSet<String>());
    try {
      server.run();
      try {
        System.out.println("Testing 'access denied' check now, please ignore the exception");
        check(new German(), "no ip address allowed, so this cannot work");
        fail();
      } catch (IOException expected) {}
    } finally {
      server.stop();
    }
View Full Code Here

Examples of org.languagetool.language.German

    HTTPTools.disableCertChecks();
    final HTTPSServerConfig serverConfig = new HTTPSServerConfig(HTTPServerConfig.DEFAULT_PORT, false, getKeystoreFile(), KEYSTORE_PASSWORD, 2, 30);
    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 exception");
        check(new German(), "foo");
        fail();
      } catch (IOException expected) {}
    } finally {
      server.stop();
    }
View Full Code Here

Examples of org.languagetool.language.German

import java.io.IOException;

public class SimpleGermanPatternRuleTest extends PatternRuleTest {
 
  public void testRules() throws IOException {
    runGrammarRulesFromXmlTest(new German());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.