Package org.languagetool.rules.en
Class AvsAnRule
- java.lang.Object
-
- org.languagetool.rules.Rule
-
- org.languagetool.rules.en.AvsAnRule
-
public class AvsAnRule extends org.languagetool.rules.RuleCheck if the determiner (if any) preceding a word is:- an if the next word starts with a vowel
- a if the next word does not start with a vowel
det_a.txtanddet_an.txt(e.g. for an hour).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classAvsAnRule.Determiner
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatterncleanupPattern
-
Constructor Summary
Constructors Constructor Description AvsAnRule(java.util.ResourceBundle messages)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intestimateContextForSureMatch()(package private) AvsAnRule.DeterminergetCorrectDeterminerFor(org.languagetool.AnalyzedTokenReadings token)java.lang.StringgetDescription()java.lang.StringgetId()private booleanisVowel(char c)org.languagetool.rules.RuleMatch[]match(org.languagetool.AnalyzedSentence sentence)java.lang.StringsuggestAorAn(java.lang.String origWord)Adds "a" or "an" to the English noun.-
Methods inherited from class org.languagetool.rules.Rule
addExamplePair, getAntiPatterns, getCategory, getConfigureText, getCorrectExamples, getDefaultValue, getErrorTriggeringExamples, getIncorrectExamples, getLocQualityIssueType, getMaxConfigurableValue, getMinConfigurableValue, getSentenceWithImmunization, getUrl, hasConfigurableValue, isDefaultOff, isDefaultTempOff, isDictionaryBasedSpellingRule, isOfficeDefaultOff, isOfficeDefaultOn, makeAntiPatterns, setCategory, setCorrectExamples, setDefaultOff, setDefaultOn, setDefaultTempOff, setErrorTriggeringExamples, setIncorrectExamples, setLocQualityIssueType, setOfficeDefaultOff, setOfficeDefaultOn, setUrl, supportsLanguage, toRuleMatchArray, useInOffice
-
-
-
-
Method Detail
-
getId
public java.lang.String getId()
- Specified by:
getIdin classorg.languagetool.rules.Rule
-
getDescription
public java.lang.String getDescription()
- Specified by:
getDescriptionin classorg.languagetool.rules.Rule
-
estimateContextForSureMatch
public int estimateContextForSureMatch()
- Overrides:
estimateContextForSureMatchin classorg.languagetool.rules.Rule
-
match
public org.languagetool.rules.RuleMatch[] match(org.languagetool.AnalyzedSentence sentence)
- Specified by:
matchin classorg.languagetool.rules.Rule
-
suggestAorAn
public java.lang.String suggestAorAn(java.lang.String origWord)
Adds "a" or "an" to the English noun. Used for suggesting the proper form of the indefinite article. For the rare cases where both "a" and "an" are considered okay (e.g. for "historical"), "a" is returned.- Parameters:
origWord- Word that needs an article.- Returns:
- String containing the word with a determiner, or just the word if the word is an abbreviation.
-
getCorrectDeterminerFor
AvsAnRule.Determiner getCorrectDeterminerFor(org.languagetool.AnalyzedTokenReadings token)
-
isVowel
private boolean isVowel(char c)
-
-