Class LongSentenceRule

java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.LongSentenceRule

public class LongSentenceRule extends Rule
A rule that warns on long sentences. Note that this rule is off by default.
  • Field Details

  • Constructor Details

    • LongSentenceRule

      public LongSentenceRule(ResourceBundle messages, UserConfig userConfig, int defaultWords, boolean defaultActive)
      Since:
      4.2
    • LongSentenceRule

      public LongSentenceRule(ResourceBundle messages, UserConfig userConfig, int defaultWords)
      Creates a rule with default inactive
      Since:
      4.2
    • LongSentenceRule

      public LongSentenceRule(ResourceBundle messages, UserConfig userConfig)
      Creates a rule with default values can be overwritten by configuration settings
      Since:
      4.2
  • Method Details

    • getDescription

      public String getDescription()
      Description copied from class: Rule
      A short description of the error this rule can detect, usually in the language of the text that is checked.
      Specified by:
      getDescription in class Rule
    • getId

      public String getId()
      Override this ID by adding a language acronym (e.g. TOO_LONG_SENTENCE_DE) to use adjustment of maxWords by option panel
      Specified by:
      getId in class Rule
      Since:
      4.1
    • getDefaultValue

      public int getDefaultValue()
      Description copied from class: Rule
      Overwrite this to get a default Integer value by option panel
      Overrides:
      getDefaultValue in class Rule
    • hasConfigurableValue

      public boolean hasConfigurableValue()
      Description copied from class: Rule
      Overwrite this to return true, if a value may be configured by option panel
      Overrides:
      hasConfigurableValue in class Rule
      Since:
      4.2
    • getMinConfigurableValue

      public int getMinConfigurableValue()
      Description copied from class: Rule
      Overwrite this to define the minimum of a configurable value
      Overrides:
      getMinConfigurableValue in class Rule
      Since:
      4.2
    • getMaxConfigurableValue

      public int getMaxConfigurableValue()
      Description copied from class: Rule
      Overwrite this to define the maximum of a configurable value
      Overrides:
      getMaxConfigurableValue in class Rule
      Since:
      4.2
    • getConfigureText

      public String getConfigureText()
      Description copied from class: Rule
      Overwrite this to define the Text in the option panel for the configurable value
      Overrides:
      getConfigureText in class Rule
      Since:
      4.2
    • getMessage

      public String getMessage()
    • match

      public RuleMatch[] match(AnalyzedSentence sentence) throws IOException
      Description copied from class: Rule
      Check whether the given sentence matches this error rule, i.e. whether it contains the error detected by this rule. Note that the order in which this method is called is not always guaranteed, i.e. the sentence order in the text may be different than the order in which you get the sentences (this may be the case when LanguageTool is used as a LibreOffice/OpenOffice add-on, for example).
      Specified by:
      match in class Rule
      Parameters:
      sentence - a pre-analyzed sentence
      Returns:
      an array of RuleMatch objects
      Throws:
      IOException