Package org.languagetool.rules.pt
Class PortugueseReadabilityRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.TextLevelRule
org.languagetool.rules.ReadabilityRule
org.languagetool.rules.pt.PortugueseReadabilityRule
A rule that checks the readability of Portuguese text (using the Flesch-Reading-Ease Formula)
If tooEasyTest == true, the rule tests if paragraph level > level (readability is too easy)
If tooEasyTest == false, the rule tests if paragraph level < level (readability is too difficult)
- Since:
- 4.4
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPortugueseReadabilityRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean tooEasyTest) PortugueseReadabilityRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean tooEasyTest, boolean defaultOn) PortugueseReadabilityRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean tooEasyTest, int level) PortugueseReadabilityRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean tooEasyTest, int level, boolean defaultOn) -
Method Summary
Modifier and TypeMethodDescriptionA short description of the error this rule can detect, usually in the language of the text that is checked.doublegetFleschReadingEase(double asl, double asw) get Flesch-Reading-Ease (Formula for readability) for English the formula dependence on the language and has to be overridden for every supported languagegetId()A string used to identify the rule in e.g.getId(boolean tooEasyTest) protected StringgetMessage(int level, int fre, int asl, int asw) private static booleanisVowel(char c) printMessageLevel(int level) protected intsimpleSyllablesCount(String word) A simple method to count the Syllables of a word TODO: further improvement of the method A hyphenation service should be used if available (e.g.Methods inherited from class org.languagetool.rules.ReadabilityRule
getAllSentences, getAllSyllables, getAllWords, getRuleOptions, match, minToCheckParagraphMethods 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
-
tooEasyTest
private final boolean tooEasyTest
-
-
Constructor Details
-
PortugueseReadabilityRule
public PortugueseReadabilityRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean tooEasyTest) -
PortugueseReadabilityRule
public PortugueseReadabilityRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean tooEasyTest, int level) -
PortugueseReadabilityRule
public PortugueseReadabilityRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean tooEasyTest, boolean defaultOn) -
PortugueseReadabilityRule
public PortugueseReadabilityRule(ResourceBundle messages, Language lang, UserConfig userConfig, boolean tooEasyTest, int level, boolean defaultOn)
-
-
Method Details
-
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.- Overrides:
getIdin classReadabilityRule
-
getId
- Overrides:
getIdin classReadabilityRule
-
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.- Overrides:
getDescriptionin classReadabilityRule
-
printMessageLevel
- Overrides:
printMessageLevelin classReadabilityRule
-
getMessage
- Overrides:
getMessagein classReadabilityRule
-
getConfigureText
- Overrides:
getConfigureTextin classReadabilityRule
-
getFleschReadingEase
public double getFleschReadingEase(double asl, double asw) Description copied from class:ReadabilityRuleget Flesch-Reading-Ease (Formula for readability) for English the formula dependence on the language and has to be overridden for every supported language- Overrides:
getFleschReadingEasein classReadabilityRule
-
isVowel
private static boolean isVowel(char c) -
simpleSyllablesCount
Description copied from class:ReadabilityRuleA simple method to count the Syllables of a word TODO: further improvement of the method A hyphenation service should be used if available (e.g. from LO extension) Has to be overridden for every language- Overrides:
simpleSyllablesCountin classReadabilityRule
-