Package org.languagetool.rules
Class AbstractFillerWordsRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.TextLevelRule
org.languagetool.rules.AbstractStatisticStyleRule
org.languagetool.rules.AbstractFillerWordsRule
- Direct Known Subclasses:
PortugueseFillerWordsRule,RussianFillerWordsRule
A rule that gives hints about the use of filler words.
The hints are only given when the percentage of filler words per paragraph exceeds the given limit.
A limit of 0 shows all used filler words. Direct speech or citation is excluded otherwise.
This rule detects no grammar error but gives stylistic hints (default off).
- Since:
- 4.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final booleanprivate static final intprivate intstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFillerWordsRule(ResourceBundle messages, Language lang, UserConfig userConfig) AbstractFillerWordsRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean defaultActive) -
Method Summary
Modifier and TypeMethodDescriptionprotected intconditionFulfilled(AnalyzedTokenReadings[] tokens, int nAnalysedToken) Condition to generate a hint (possibly including all exceptions) Returns: < nAnalysedToken, if condition is not fulfilled >= nAnalysedToken, if condition is not fulfilled; integer is number of token which is the end hintprotected booleanCondition to generate a hint related to the sentence (possibly including all exceptions)A short description of the error this rule can detect, usually in the language of the text that is checked.getId()A string used to identify the rule in e.g.protected StringgetLimitMessage(int limit, double percent) Defines the message for hints which exceed the limitgive the user the possibility to configure the functionprotected StringDefines the message for sentence related hintsprotected booleanisException(AnalyzedTokenReadings[] tokens, int num) protected abstract booleanisFillerWord(String token) intGives back the minimum number of paragraphs to check to give back a correct result.protected booleansentenceConditionFulfilled(AnalyzedTokenReadings[] tokens, int nAnalysedToken) Condition to generate a hint related to the sentence (possibly including all exceptions)Methods inherited from class org.languagetool.rules.AbstractStatisticStyleRule
denominator, getNumberOfMatches, getWordCount, match, setWithoutDirectSpeechMethods inherited from class org.languagetool.rules.TextLevelRule
estimateContextForSureMatch, match, matchMethods inherited from class org.languagetool.rules.Rule
addExamplePair, addTags, addToneTags, cacheAntiPatterns, getAntiPatterns, getCategory, getCorrectExamples, getDistanceTokens, getErrorTriggeringExamples, getFullId, getIncorrectExamples, getLocQualityIssueType, getMinPrevMatches, getPriority, getSentenceWithImmunization, getSourceFile, getSubId, getTags, getToneTags, getUrl, hasTag, hasToneTag, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isGoalSpecific, isIncludedInHiddenMatches, isOfficeDefaultOff, isOfficeDefaultOn, isPremium, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setDistanceTokens, setErrorTriggeringExamples, setExamplePair, setGoalSpecific, setIncludedInHiddenMatches, setIncorrectExamples, setLocQualityIssueType, setMinPrevMatches, setOfficeDefaultOff, setOfficeDefaultOn, setPremium, setPriority, setTags, setToneTags, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
-
Field Details
-
RULE_ID
- See Also:
-
DEFAULT_MIN_PERCENT
private static final int DEFAULT_MIN_PERCENT- See Also:
-
DEFAULT_ACTIVATION
private static final boolean DEFAULT_ACTIVATION- See Also:
-
minPercent
private int minPercent
-
-
Constructor Details
-
AbstractFillerWordsRule
public AbstractFillerWordsRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean defaultActive) -
AbstractFillerWordsRule
-
-
Method Details
-
isFillerWord
-
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
Description copied from class:RuleA string used to identify the rule in e.g. configuration files. This string is supposed to be unique and to stay the same in all upcoming versions of LanguageTool. It's supposed to contain only the charactersA-Zand the underscore. -
getRuleOptions
give the user the possibility to configure the function- Overrides:
getRuleOptionsin classAbstractStatisticStyleRule
-
getMessage
-
isException
-
conditionFulfilled
Description copied from class:AbstractStatisticStyleRuleCondition to generate a hint (possibly including all exceptions) Returns: < nAnalysedToken, if condition is not fulfilled >= nAnalysedToken, if condition is not fulfilled; integer is number of token which is the end hint- Specified by:
conditionFulfilledin classAbstractStatisticStyleRule
-
sentenceConditionFulfilled
Description copied from class:AbstractStatisticStyleRuleCondition to generate a hint related to the sentence (possibly including all exceptions)- Specified by:
sentenceConditionFulfilledin classAbstractStatisticStyleRule
-
excludeDirectSpeech
protected boolean excludeDirectSpeech()Description copied from class:AbstractStatisticStyleRuleCondition to generate a hint related to the sentence (possibly including all exceptions)- Specified by:
excludeDirectSpeechin classAbstractStatisticStyleRule
-
getLimitMessage
Description copied from class:AbstractStatisticStyleRuleDefines the message for hints which exceed the limit- Specified by:
getLimitMessagein classAbstractStatisticStyleRule
-
getSentenceMessage
Description copied from class:AbstractStatisticStyleRuleDefines the message for sentence related hints- Specified by:
getSentenceMessagein classAbstractStatisticStyleRule
-
getConfigurePercentText
- Specified by:
getConfigurePercentTextin classAbstractStatisticStyleRule
-
getConfigureWithoutDirectSpeachText
- Specified by:
getConfigureWithoutDirectSpeachTextin classAbstractStatisticStyleRule
-
minToCheckParagraph
public int minToCheckParagraph()Description copied from class:TextLevelRuleGives back the minimum number of paragraphs to check to give back a correct result. Only used by LO office extension.- n == -1 --> need to check full text (use only if really needed / bad performance) examples: AbstractWordCoherencyRule, GenericUnpairedBracketsRule, ...
- n == 0 --> need only to check the current paragraph examples: MultipleWhitespaceRule, LongParagraphRule, ...
- n >= 1 --> need only to check n paragraphs around the current paragraph examples: ParagraphRepeatBeginningRule (n == 1), WordRepeatBeginningRule (n == 2), ...
- Overrides:
minToCheckParagraphin classAbstractStatisticStyleRule
-