Package org.languagetool.language

Examples of org.languagetool.language.German


import java.io.IOException;

public class UppercaseSentenceStartRuleTest extends TestCase {

  public void testRule() throws IOException {
    final JLanguageTool lt = new JLanguageTool(new German());
    for (Rule rule : lt.getAllActiveRules()) {
      lt.disableRule(rule.getId());
    }
    lt.enableRule("UPPERCASE_SENTENCE_START");
   
View Full Code Here


public class WiederVsWiderRuleTest extends TestCase {

  private final WiederVsWiderRule rule = new WiederVsWiderRule(null);

  public void testRule() throws IOException {
    JLanguageTool lt = new JLanguageTool(new German());

    assertGood("Das spiegelt wider, wie es wieder läuft.", lt);
    assertGood("Das spiegelt die Situation gut wider.", lt);
    assertGood("Das spiegelt die Situation.", lt);
    assertGood("Immer wieder spiegelt das die Situation.", lt);
View Full Code Here

  private AgreementRule rule;
  private JLanguageTool langTool;
 
  @Override
  public void setUp() throws IOException {
    rule = new AgreementRule(null, new German());
    langTool = new JLanguageTool(new German());
  }
View Full Code Here

    //TODO: input is actually correct
    assertBadWithMessage("Bei dem Papierabzüge von Digitalbildern bestellt werden.", "bezüglich Kasus, Genus oder Numerus.");
  }
 
  public void testRegression() throws IOException {
      JLanguageTool gramCheckerEngine = new JLanguageTool(new German());
      gramCheckerEngine.activateDefaultPatternRules();
      // used to be not detected > 1.0.1:
      String str = "Und so.\r\nDie Bier.";
      List<RuleMatch> matches = gramCheckerEngine.check(str);
      assertEquals(1, matches.size());
View Full Code Here

      tokenReadings.add(new AnalyzedTokenReadings(new AnalyzedToken(token, posTag, lemma), pos++));
    }
    if (tokenReadings.size() != 2) {
      throw new RuntimeException("Size of input not yet supported: " + tokenReadings.size());
    }
    AgreementSuggestor suggestor = new AgreementSuggestor(new German().getSynthesizer(), tokenReadings.get(0), tokenReadings.get(1));
    List<String> suggestions = suggestor.getSuggestions();
    assertThat(suggestions.toString(), is(expectedSuggestions));
  }
View Full Code Here

  private VerbAgreementRule rule;
  private JLanguageTool langTool;
 
  @Override
  public void setUp() throws IOException {
    rule = new VerbAgreementRule(null, new German());
    langTool = new JLanguageTool(new German());
  }
View Full Code Here

  private GenericUnpairedBracketsRule rule;
  private JLanguageTool langTool;
 
  public void testGermanRule() throws IOException {
    German language = new German();
    rule = new GenericUnpairedBracketsRule(TestTools.getEnglishMessages(), language);
    langTool = new JLanguageTool(language);
    // correct sentences:
    assertMatches("(Das sind die Sätze, die sie testen sollen).", 0);
    assertMatches("(Das sind die «Sätze», die sie testen sollen).", 0);
View Full Code Here

  private final MissingVerbRule rule = new MissingVerbRule(TestTools.getEnglishMessages(), new German());

  @Test
  public void test() throws IOException {
    JLanguageTool lt = new JLanguageTool(new German());
   
    assertGood("Da ist ein Verb, mal so zum testen.", lt);
    assertGood("Überschrift ohne Verb aber doch nicht zu kurz", lt);
    assertGood("Sprechen Sie vielleicht zufällig Türkisch?", lt);
    assertGood("Leg den Tresor in den Koffer im Kofferraum.", lt);
View Full Code Here

public class SentenceWhitespaceRuleTest {

  @Test
  public void testMatch() throws Exception {
    SentenceWhitespaceRule rule = new SentenceWhitespaceRule(TestTools.getEnglishMessages());
    JLanguageTool languageTool = new JLanguageTool(new German());
    languageTool.addRule(rule);

    assertGood("Das ist ein Satz. Und hier der nächste.", rule, languageTool);
    assertGood("Das ist ein Satz! Und hier der nächste.", rule, languageTool);
    assertGood("Ist das ein Satz? Hier der nächste.", rule, languageTool);
View Full Code Here

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

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.