Package org.languagetool.rules
Class AbstractStyleTooOftenUsedWordRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.TextLevelRule
org.languagetool.rules.AbstractStyleTooOftenUsedWordRule
- Direct Known Subclasses:
StyleTooOftenUsedAdjectiveRule,StyleTooOftenUsedAdjectiveRule,StyleTooOftenUsedNounRule,StyleTooOftenUsedNounRule,StyleTooOftenUsedVerbRule,StyleTooOftenUsedVerbRule
The method gives stylistic hints that a word is being used too often
when the set percentage has been exceeded.(default off).
- Since:
- 6.2.3
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractStyleTooOftenUsedWordRule(ResourceBundle messages, Language lang, UserConfig userConfig, int minPercent) AbstractStyleTooOftenUsedWordRule(ResourceBundle messages, Language lang, UserConfig userConfig, int minPercent, boolean defaultActive) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidFillWordMap(List<AnalyzedSentence> sentences) fill the map with all words and the number of occurrenceabstract Stringprotected StringgetLemmaForPosTagStartsWith(String startPos, AnalyzedTokenReadings token) protected abstract StringgetLimitMessage(int minPercent) Defines the message for hints which exceed the limitprivate intgetMinPercent(UserConfig userConfig, int minPercentDefault) give the user the possibility to configure the functionget all words that are used more often than minPercentprotected abstract booleanisException(AnalyzedTokenReadings[] tokens, int n) An exception is defined for the tokenprotected abstract booleanA token that has to be countedmatch(List<AnalyzedSentence> sentences) intGives back the minimum number of paragraphs to check to give back a correct result.voidsetWithoutDirectSpeech(boolean withoutDirectSpeech) protected abstract StringGives back the lemma that should be added to the word mapMethods inherited from class org.languagetool.rules.TextLevelRule
estimateContextForSureMatch, match, matchMethods inherited from class org.languagetool.rules.Rule
addExamplePair, addTags, addToneTags, cacheAntiPatterns, getAntiPatterns, getCategory, getCorrectExamples, getDescription, getDistanceTokens, getErrorTriggeringExamples, getFullId, getId, 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
-
OPENING_QUOTES
-
ENDING_QUOTES
-
DEFAULT_ACTIVATION
private static final boolean DEFAULT_ACTIVATION- See Also:
-
MIN_WORD_COUNT
private static final int MIN_WORD_COUNT- See Also:
-
minPercent
private final int minPercent -
defaultMinPercent
private final int defaultMinPercent -
wordMap
-
withoutDirectSpeech
private boolean withoutDirectSpeech
-
-
Constructor Details
-
AbstractStyleTooOftenUsedWordRule
public AbstractStyleTooOftenUsedWordRule(ResourceBundle messages, Language lang, UserConfig userConfig, int minPercent) -
AbstractStyleTooOftenUsedWordRule
public AbstractStyleTooOftenUsedWordRule(ResourceBundle messages, Language lang, UserConfig userConfig, int minPercent, boolean defaultActive)
-
-
Method Details
-
isToCountedWord
A token that has to be counted -
isException
An exception is defined for the token -
toAddedLemma
Gives back the lemma that should be added to the word map -
getLimitMessage
Defines the message for hints which exceed the limit -
getConfigureText
-
getMinPercent
-
getRuleOptions
give the user the possibility to configure the function- Overrides:
getRuleOptionsin classRule
-
getWordMap
-
setWithoutDirectSpeech
public void setWithoutDirectSpeech(boolean withoutDirectSpeech) -
FillWordMap
fill the map with all words and the number of occurrence -
getTooOftenUsedWords
get all words that are used more often than minPercent -
match
- Specified by:
matchin classTextLevelRule- Throws:
IOException
-
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), ...
- Specified by:
minToCheckParagraphin classTextLevelRule
-
getLemmaForPosTagStartsWith
-