Examples of activateDefaultPatternRules()


Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    }
  }

  private void initExpectedResults() throws IOException {
    JLanguageTool lt = new JLanguageTool(LANG);
    lt.activateDefaultPatternRules();
    for (String sentence : sentences) {
      List<RuleMatch> matches = lt.check(sentence);
      expectedResults.put(sentence, matches.toString());
    }
  }
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    @Override
    public void run() {
      try {
        JLanguageTool lt = new JLanguageTool(lang);
        lt.activateDefaultPatternRules();
        List<RuleMatch> matches = lt.check(sentence);
        //System.out.println("=>" + matches);
        String expected = expectedResults.get(sentence);
        String real = matches.toString();
        if (!expectedResults.get(sentence).equals(real)) {
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

  public void testBitextCheck() throws IOException, ParserConfigurationException, SAXException {
    final English english = new English();
    final JLanguageTool srcTool = new JLanguageTool(english);
    final Polish polish = new Polish();
    final JLanguageTool trgTool = new JLanguageTool(polish);
    trgTool.activateDefaultPatternRules();
   
    final List<BitextRule> rules = Tools.getBitextRules(english, polish);
   
    int matches1 = Tools.checkBitext(
        "This is a perfectly good sentence.",
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    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

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    new PatternRule("-1", language, Collections.<Element>emptyList(), "", "", "");
  }

  public void testMakeSuggestionUppercase() throws IOException {
    final JLanguageTool langTool = new JLanguageTool(language);
    langTool.activateDefaultPatternRules();

    final Element element = new Element("Were", false, false, false);
    final String message = "Did you mean: <suggestion>where</suggestion> or <suggestion>we</suggestion>?";
    final PatternRule rule = new PatternRule("MY_ID", language, Collections.singletonList(element), "desc", message, "msg");
    final RuleMatch[] matches = rule.match(langTool.getAnalyzedSentence("Were are in the process of ..."));
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

      lock.unlock();

      for (int i = 0; i < this.testRuns; i++) {
        try {
          JLanguageTool tool = new JLanguageTool(this.language);
          tool.activateDefaultPatternRules();
          tool.activateDefaultFalseFriendRules();
         
          Assert.assertNotNull(tool.check(this.sampleText));
        } catch (Exception e) {         
          failedTests += 1;
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    System.setErr(this.stderr);
  }

  public void testCheck() throws IOException, ParserConfigurationException, SAXException {
    final JLanguageTool tool = new JLanguageTool(TestTools.getDemoLanguage());
    tool.activateDefaultPatternRules();
    tool.activateDefaultFalseFriendRules();

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

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    }
  }

  private void initExampleSentences(Language language) throws IOException {
    final JLanguageTool lt = new JLanguageTool(language);
    lt.activateDefaultPatternRules();
    final List<Rule> rules = lt.getAllActiveRules();
    final List<ExampleSentence> sentences = new ArrayList<>();
    for (Rule rule : rules) {
      if (rule instanceof PatternRule && !rule.isDefaultOff()) {
        final List<IncorrectExample> incorrectExamples = rule.getIncorrectExamples();
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

    return new MediaWikiContent(handler.getRevisionContent(), handler.getTimestamp());
  }

  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);
View Full Code Here

Examples of org.languagetool.JLanguageTool.activateDefaultPatternRules()

  }

  List<PatternRule> getRuleById(String ruleId, Language language) throws IOException {
    List<PatternRule> rules = new ArrayList<>();
    JLanguageTool langTool = new JLanguageTool(language);
    langTool.activateDefaultPatternRules();
    for (Rule rule : langTool.getAllRules()) {
      if (rule.getId().equals(ruleId) && rule instanceof PatternRule) {
        rules.add((PatternRule) rule);
      }
    }
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.