Examples of disableRule()


Examples of org.languagetool.JLanguageTool.disableRule()

    }
  }

  private JLanguageTool getLanguageTool() throws IOException {
    JLanguageTool langTool = getLanguageTool(new GermanyGerman());
    langTool.disableRule("DE_CASE");
    return langTool;
  }

  private JLanguageTool getLanguageTool(Language language) throws IOException {
    JLanguageTool langTool = new JLanguageTool(language);
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

    assertEquals("[boss, chief]", matches2.get(0).getSuggestedReplacements().toString());
  }

  public void testHintsForDemoLanguage() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool langTool1 = new JLanguageTool(new BritishEnglish(), new German());
    langTool1.disableRule(MorfologikBritishSpellerRule.RULE_ID);
    langTool1.activateDefaultFalseFriendRules();
    final List<RuleMatch> matches1 = assertErrors(1, "And forDemoOnly.", langTool1);
    assertEquals("DEMO_ENTRY", matches1.get(0).getRule().getId());

    final JLanguageTool langTool2 = new JLanguageTool(new English(), new German());
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

    langTool1.activateDefaultFalseFriendRules();
    final List<RuleMatch> matches1 = assertErrors(1, "And forDemoOnly.", langTool1);
    assertEquals("DEMO_ENTRY", matches1.get(0).getRule().getId());

    final JLanguageTool langTool2 = new JLanguageTool(new English(), new German());
    langTool2.disableRule(MorfologikBritishSpellerRule.RULE_ID);
    langTool2.activateDefaultFalseFriendRules();
    final List<RuleMatch> matches2 = assertErrors(1, "And forDemoOnly.", langTool2);
    assertEquals("DEMO_ENTRY", matches2.get(0).getRule().getId());

    final JLanguageTool langTool3 = new JLanguageTool(new AmericanEnglish(), new German());
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

    langTool2.activateDefaultFalseFriendRules();
    final List<RuleMatch> matches2 = assertErrors(1, "And forDemoOnly.", langTool2);
    assertEquals("DEMO_ENTRY", matches2.get(0).getRule().getId());

    final JLanguageTool langTool3 = new JLanguageTool(new AmericanEnglish(), new German());
    langTool3.disableRule(MorfologikAmericanSpellerRule.RULE_ID);
    langTool3.activateDefaultFalseFriendRules();
    assertErrors(0, "And forDemoOnly.", langTool3);
  }

  public void testHintsForEnglishSpeakers() throws IOException, ParserConfigurationException, SAXException {
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

  public void testIgnoreSuggestionsWithDynamicHunspellRule() throws IOException {
    final JLanguageTool langTool = new JLanguageTool(new GermanyGerman());
    final SpellingCheckRule rule = new HunspellNoSuggestionRule(TestTools.getEnglishMessages(), new GermanyGerman());
    langTool.addRule(rule);
    langTool.disableRule(GermanSpellerRule.RULE_ID);
    final List<RuleMatch> matches = langTool.check("Das ist ein Tibbfehla.");
    assertEquals(1, matches.size());
    assertEquals(HunspellNoSuggestionRule.RULE_ID, matches.get(0).getRule().getId());

    final PatternRule ruleWithSuggestion = new PatternRule("TEST_ID", new GermanyGerman(),
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

            "Meinten Sie <suggestion>Tibbfehla</suggestion>?", null);
    langTool.addRule(ruleWithSuggestion);
    final List<RuleMatch> matches2 = langTool.check("Das ist ein Tibbfehla.");
    assertEquals(0, matches2.size());   // no error anymore, as this is a suggestion

    langTool.disableRule("TEST_ID");
    final List<RuleMatch> matches3 = langTool.check("Das ist ein Tibbfehla.");
    assertEquals(1, matches3.size());   // an error again
  }

}
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

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");
   
    assertEquals(2, lt.check("etwas beginnen. und der auch nicht").size());
   
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

    int matches = CommandLineTools.checkText("Foo.", tool);
    String output = new String(this.out.toByteArray());
    assertEquals(0, output.indexOf("Time:"));
    assertEquals(0, matches);

    tool.disableRule("test_unification_with_negation");
    tool.addRule(new WordRepeatRule(getMessages("en"), TestTools.getDemoLanguage()));
    matches = CommandLineTools.checkText("To jest problem problem.", tool);
    output = new String(this.out.toByteArray());
    assertTrue(output.contains("Rule ID: WORD_REPEAT_RULE"));
    assertEquals(1, matches);
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

  private JLanguageTool getLanguageTool(Language lang) throws IOException {
    final JLanguageTool langTool = new MultiThreadedJLanguageTool(lang);
    langTool.activateDefaultPatternRules();
    enableWikipediaRules(langTool);
    for (String disabledRuleId : disabledRuleIds) {
      langTool.disableRule(disabledRuleId);
    }
    disableSpellingRules(langTool);
    return langTool;
  }
View Full Code Here

Examples of org.languagetool.JLanguageTool.disableRule()

  }

  private JLanguageTool getLanguageToolWithOneRule(Language lang, PatternRule patternRule) {
    final JLanguageTool langTool = new JLanguageTool(lang);
    for (Rule rule : langTool.getAllActiveRules()) {
      langTool.disableRule(rule.getId());
    }
    langTool.addRule(patternRule);
    langTool.enableDefaultOffRule(patternRule.getId()); // rule might be off by default
    return langTool;
  }
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.