Package org.languagetool.rules
Class LongSentenceRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.LongSentenceRule
A rule that warns on long sentences. Note that this rule is off by default.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprivate static final intprotected intstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionLongSentenceRule(ResourceBundle messages, UserConfig userConfig) Creates a rule with default values can be overwritten by configuration settingsLongSentenceRule(ResourceBundle messages, UserConfig userConfig, int defaultWords) Creates a rule with default inactiveLongSentenceRule(ResourceBundle messages, UserConfig userConfig, int defaultWords, boolean defaultActive) -
Method Summary
Modifier and TypeMethodDescriptionOverwrite this to define the Text in the option panel for the configurable valueintOverwrite this to get a default Integer value by option panelA short description of the error this rule can detect, usually in the language of the text that is checked.getId()Override this ID by adding a language acronym (e.g.intOverwrite this to define the maximum of a configurable valueintOverwrite this to define the minimum of a configurable valuebooleanOverwrite this to return true, if a value may be configured by option panelmatch(AnalyzedSentence sentence) Check whether the given sentence matches this error rule, i.e.Methods inherited from class org.languagetool.rules.Rule
addExamplePair, estimateContextForSureMatch, getAntiPatterns, getCategory, getCorrectExamples, getErrorTriggeringExamples, getIncorrectExamples, getLocQualityIssueType, getSentenceWithImmunization, getUrl, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isOfficeDefaultOff, isOfficeDefaultOn, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setErrorTriggeringExamples, setIncorrectExamples, setLocQualityIssueType, setOfficeDefaultOff, setOfficeDefaultOn, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
-
Field Details
-
RULE_ID
- See Also:
-
DEFAULT_MAX_WORDS
private static final int DEFAULT_MAX_WORDS- See Also:
-
DEFAULT_ACTIVATION
private static final boolean DEFAULT_ACTIVATION- See Also:
-
maxWords
protected int maxWords
-
-
Constructor Details
-
LongSentenceRule
public LongSentenceRule(ResourceBundle messages, UserConfig userConfig, int defaultWords, boolean defaultActive) - Since:
- 4.2
-
LongSentenceRule
Creates a rule with default inactive- Since:
- 4.2
-
LongSentenceRule
Creates a rule with default values can be overwritten by configuration settings- Since:
- 4.2
-
-
Method Details
-
getDescription
Description copied from class:RuleA short description of the error this rule can detect, usually in the language of the text that is checked.- Specified by:
getDescriptionin classRule
-
getId
Override this ID by adding a language acronym (e.g. TOO_LONG_SENTENCE_DE) to use adjustment of maxWords by option panel -
getDefaultValue
public int getDefaultValue()Description copied from class:RuleOverwrite this to get a default Integer value by option panel- Overrides:
getDefaultValuein classRule
-
hasConfigurableValue
public boolean hasConfigurableValue()Description copied from class:RuleOverwrite this to return true, if a value may be configured by option panel- Overrides:
hasConfigurableValuein classRule- Since:
- 4.2
-
getMinConfigurableValue
public int getMinConfigurableValue()Description copied from class:RuleOverwrite this to define the minimum of a configurable value- Overrides:
getMinConfigurableValuein classRule- Since:
- 4.2
-
getMaxConfigurableValue
public int getMaxConfigurableValue()Description copied from class:RuleOverwrite this to define the maximum of a configurable value- Overrides:
getMaxConfigurableValuein classRule- Since:
- 4.2
-
getConfigureText
Description copied from class:RuleOverwrite this to define the Text in the option panel for the configurable value- Overrides:
getConfigureTextin classRule- Since:
- 4.2
-
getMessage
-
match
Description copied from class:RuleCheck 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:
matchin classRule- Parameters:
sentence- a pre-analyzed sentence- Returns:
- an array of
RuleMatchobjects - Throws:
IOException
-