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 boolean
private static final int
protected int
static 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 valueint
Overwrite 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.int
Overwrite this to define the maximum of a configurable valueint
Overwrite this to define the minimum of a configurable valueboolean
Overwrite 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: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 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:Rule
Overwrite this to get a default Integer value by option panel- Overrides:
getDefaultValue
in classRule
-
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 classRule
- 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 classRule
- 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 classRule
- Since:
- 4.2
-
getConfigureText
Description copied from class:Rule
Overwrite this to define the Text in the option panel for the configurable value- Overrides:
getConfigureText
in classRule
- Since:
- 4.2
-
getMessage
-
match
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 classRule
- Parameters:
sentence
- a pre-analyzed sentence- Returns:
- an array of
RuleMatch
objects - Throws:
IOException
-