Package org.languagetool.rules

Examples of org.languagetool.rules.Category


      i++;
    }
  }

  public void testOverlapFilter() throws IOException {
    final Category category = new Category("test category");
    final List<Element> elements1 = Arrays.asList(new Element("one", true, false, false));
    final PatternRule rule1 = new PatternRule("id1", new English(), elements1, "desc1", "msg1", "shortMsg1");
    rule1.setSubId("1");
    rule1.setCategory(category);
View Full Code Here


  private final Set<String> requiresA;
  private final Set<String> requiresAn;
 
  public AvsAnRule(final ResourceBundle messages) throws IOException {
    if (messages != null) {
      super.setCategory(new Category(messages.getString("category_misc")));
    }
    requiresA = loadWords(JLanguageTool.getDataBroker().getFromRulesDirAsStream(FILENAME_A));
    requiresAn = loadWords(JLanguageTool.getDataBroker().getFromRulesDirAsStream(FILENAME_AN));
    setLocQualityIssueType("misspelling");
  }
View Full Code Here

   */
  public abstract String getFileName();

  public MorfologikSpellerRule(ResourceBundle messages, Language language) throws IOException {
    super(messages, language);
    super.setCategory(new Category(messages.getString("category_typo")));
    this.conversionLocale = conversionLocale != null ? conversionLocale : Locale.getDefault();
    init();
  }
View Full Code Here

  private Pattern nonWordPattern;

  public HunspellRule(final ResourceBundle messages, final Language language) {
    super(messages, language);
    super.setCategory(new Category(messages.getString("category_typo")));
  }
View Full Code Here

            messages.getString("false_friend_desc") + " "
                + tokensAsString, description, messages
                .getString("false_friend"));
        rule.setCorrectExamples(correctExamples);
        rule.setIncorrectExamples(incorrectExamples);
        rule.setCategory(new Category(messages
            .getString("category_false_friend")));
        if (defaultOff) {
          rule.setDefaultOff();
        }
        rules.add(rule);
View Full Code Here

      final String qName, final Attributes attrs) throws SAXException {
    if ("category".equals(qName)) {
      final String catName = attrs.getValue("name");
      final String priorityStr = attrs.getValue("priority");
      if (priorityStr == null) {
        category = new Category(catName);
      } else {
        category = new Category(catName, Integer.parseInt(priorityStr));
      }
      if ("off".equals(attrs.getValue(DEFAULT))) {
        category.setDefaultOff();
      }
      if (attrs.getValue("type") != null) {
View Full Code Here

         .append(" offset=\"").append(match.getFromPos()).append("\"")
         .append(" errorlength=\"").append(match.getToPos() - match.getFromPos()).append("\"");
      if (match.getRule().getUrl() != null) {
          xml.append(" url=\"").append(escapeXMLForAPIOutput(match.getRule().getUrl().toString())).append("\"");
      }
      final Category category = match.getRule().getCategory();
      if (category != null) {
        xml.append(" category=\"").append(escapeXMLForAPIOutput(category.getName())).append("\"");
      }
      final String type = match.getRule().getLocQualityIssueType();
      if (type != null) {
        xml.append(" locqualityissuetype=\"").append(escapeXMLForAPIOutput(type)).append("\"");
      }
View Full Code Here

  private static final String FILENAME_EL = "/es/el.txt";
  private final TreeSet<String> requiresEl;
 
  public ElwithFemRule(final ResourceBundle messages) throws IOException {
    if (messages != null) {
      super.setCategory(new Category(messages.getString("category_misc")));
    }
    requiresEl = loadWords(JLanguageTool.getDataBroker().getFromRulesDirAsStream(FILENAME_EL));
  }
View Full Code Here

  }

  public TopoReplaceRule(final ResourceBundle messages) throws IOException {
    super(messages);
    if (messages != null) {
      super.setCategory(new Category(messages.getString("category_misc")));
    }
    wrongWords = loadWords(JLanguageTool.getDataBroker().getFromRulesDirAsStream(getFileName()));
  }
View Full Code Here

  public void testRuleMatchesToXMLWithCategory() throws IOException {
    final List<RuleMatch> matches = new ArrayList<>();
    final String text = "This is a test sentence.";
    final List<Element> elements = Collections.emptyList();
    final Rule patternRule = new PatternRule("MY_ID", Language.DEMO, elements, "my description", "my message", "short message");
    patternRule.setCategory(new Category("MyCategory"));
    final RuleMatch match = new RuleMatch(patternRule, 8, 10, "myMessage");
    match.setColumn(99);
    match.setEndColumn(100);
    match.setLine(44);
    match.setEndLine(45);
View Full Code Here

TOP

Related Classes of org.languagetool.rules.Category

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.