Package org.languagetool.rules.en
Class AbstractEnglishSpellerRule
java.lang.Object
org.languagetool.rules.Rule
org.languagetool.rules.spelling.SpellingCheckRule
org.languagetool.rules.spelling.morfologik.MorfologikSpellerRule
org.languagetool.rules.en.AbstractEnglishSpellerRule
- Direct Known Subclasses:
MorfologikAmericanSpellerRule,MorfologikAustralianSpellerRule,MorfologikBritishSpellerRule,MorfologikCanadianSpellerRule,MorfologikNewZealandSpellerRule,MorfologikSouthAfricanSpellerRule
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final String[]private static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final org.slf4j.Loggerprivate static final Patternprivate static final Patternprivate static final intprivate static final Patternprivate static final Patternprivate static NERServiceprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate final BeoLingusTranslatorprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Patternprivate static final Pattern[]Fields inherited from class org.languagetool.rules.spelling.morfologik.MorfologikSpellerRule
conversionLocale, globalConfig, motherTongue, speller1, speller2, speller3Fields inherited from class org.languagetool.rules.spelling.SpellingCheckRule
CUSTOM_SPELLING_FILE, GLOBAL_SPELLING_FILE, HIGH_CONFIDENCE, ignoreWordsWithLength, language, languageModel, LANGUAGETOOLER, MAX_TOKEN_LENGTH, wordListLoader, wordsToBeIgnored -
Constructor Summary
ConstructorsConstructorDescriptionAbstractEnglishSpellerRule(ResourceBundle messages, Language language) AbstractEnglishSpellerRule(ResourceBundle messages, Language language, GlobalConfig globalConfig, UserConfig userConfig, List<Language> altLanguages, LanguageModel languageModel, Language motherTongue) AbstractEnglishSpellerRule(ResourceBundle messages, Language language, UserConfig userConfig, List<Language> altLanguages) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddFormsToFirstMatch(String message, AnalyzedSentence sentence, List<RuleMatch> ruleMatches, List<String> forms) protected voidaddHyphenSuggestions(String[] parts, List<SuggestedReplacement> topSuggestions) private static List<SuggestedReplacement> cleanSuggestions(RuleMatch ruleMatch) filter(RuleMatch[] matches, String sentenceText, List<NERService.Span> namedEntities, LanguageModel languageModel) protected List<SuggestedReplacement> protected List<SuggestedReplacement> filterSuggestions(List<SuggestedReplacement> suggestions) Remove prohibited words from suggestions.Get the name of additional spelling file, which lists words to be accepted and used for suggestions, even when the spell checker would not accept them.protected List<SuggestedReplacement> getAdditionalTopSuggestions(List<SuggestedReplacement> suggestions, String word) Get additional suggestions added before other suggestions (note the rule may choose to re-order the suggestions anyway).private StringgetHyphenatedWordSuggestion(String[] parts, int currentPos, String currentPostSuggestion) getIrregularFormsOrNull(String word, String wordSuffix, List<String> suffixes, String posTag, String posName, String formName) protected List<SuggestedReplacement> getOnlySuggestions(String word) Get suggestions that will replace all other suggestions.getRuleMatches(String word, int startPos, AnalyzedSentence sentence, List<RuleMatch> ruleMatchesSoFar, int idx, AnalyzedTokenReadings[] tokens) protected TranslatorgetTranslator(GlobalConfig globalConfig) protected VariantInfoisValidInOtherVariant(String word) loadWordlist(String path, int column) match(AnalyzedSentence sentence) Check whether the given sentence matches this error rule, i.e.private voidreplaceFormsOfFirstMatch(String message, AnalyzedSentence sentence, List<RuleMatch> ruleMatches, String suggestion) protected booleanMethods inherited from class org.languagetool.rules.spelling.morfologik.MorfologikSpellerRule
getDescription, getFileName, getId, getSpellingSuggestions, ignoreWord, isMisspelled, isMisspelled, orderSuggestions, setCheckCompound, setCompoundRegex, setIgnoreTaggedWords, setLocale, tokenizingPatternMethods inherited from class org.languagetool.rules.spelling.SpellingCheckRule
acceptPhrases, addIgnoreTokens, addIgnoreWords, addProhibitedWords, addSuggestionsToRuleMatch, createWrongSplitMatch, expandLine, filterDupes, getAdditionalProhibitFileNames, getAdditionalSuggestions, getAntiPatterns, getIgnoreFileName, getLanguageVariantSpellingFileName, getProhibitFileName, getSpellingFileName, ignorePotentiallyMisspelledWord, ignoreToken, ignoreWord, init, isDictionaryBasedSpellingRule, isEMail, isIgnoredNoCase, isInIgnoredSet, isLatinScript, isProhibited, isUrl, setConsiderIgnoreWords, setConvertsCase, startsWithIgnoredWordMethods inherited from class org.languagetool.rules.Rule
addExamplePair, addTags, addToneTags, cacheAntiPatterns, estimateContextForSureMatch, getCategory, getCorrectExamples, getDistanceTokens, getErrorTriggeringExamples, getFullId, getIncorrectExamples, getLocQualityIssueType, getMinPrevMatches, getPriority, getRuleOptions, getSentenceWithImmunization, getSourceFile, getSubId, getTags, getToneTags, getUrl, hasTag, hasToneTag, isDefaultOff, isDefaultTempOff, 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
-
logger
private static final org.slf4j.Logger logger -
lcDoNotSuggestWords
-
PROFILERATION
-
CEMETARY
-
CEMETARIES
-
BASICLY
-
BELEIVES
-
BELIVES
-
BIZZARE
-
COMPLETLY
-
DISSAPEARS
-
FARENHEIT
-
FREINDS
-
INCIDENTLY
-
INTERUPTS
-
LOLLYPOPS
-
OCASSIONS
-
OCCURANCES
-
PERSISTANT
-
PEICES
-
SEIGES
-
SUPERCEDES
-
THRESHHOLDS
-
TOMMORROWS
-
TOUTES
-
WIERD
-
SARGENT
-
SWIMMED
-
MISSPELT
-
JIST
-
ADHOC
-
DEACTIVE
-
HONGKONG
-
AFAIK
-
JANUARY
-
ADMITTINGLY
-
APRIL
-
SEPTEMBER
-
OCTOBER
-
NOVEMBER
-
DECEMBER
-
ENGLISH
-
SPANISH
-
GITLAB
-
BONAFIDE
-
WHEREEVER
-
WHATSAPP
-
JETLAGGED
-
MACBOOK
-
LIKELYHOOD
-
FORSEEABLE
-
UNFORSEEABLE
-
FORSEEABLY
-
UNFORSEEABLY
-
UNECESSARY
-
HUBSPOT
-
URL
-
TV
-
HTTP
-
HTTPS
-
EUROPEAN
-
EUROPEANS
-
FYI
-
MICROSOFT
-
DEVOPS
-
ALLRIGHT
-
INTRANSPARENT
-
ADDON
-
WDYT
-
UNCOMPLIANT
-
UX
-
LANGUAGETOOL
-
UNDETERMINISTIC
-
QUILLBOT_POS
-
QUILLBOT1
-
QUILLBOT1_POS
-
QUILLBOT2
-
QUILLBOT2_POS
-
translator
-
nerPipe
-
maxPatterns
private static final int maxPatterns- See Also:
-
wordPatterns
-
blogLinks
-
CONTAINS_TOKEN
-
topSuggestions
-
topSuggestionsIgnoreCase
-
-
Constructor Details
-
AbstractEnglishSpellerRule
- Throws:
IOException
-
AbstractEnglishSpellerRule
public AbstractEnglishSpellerRule(ResourceBundle messages, Language language, UserConfig userConfig, List<Language> altLanguages) throws IOException - Throws:
IOException- Since:
- 4.4
-
AbstractEnglishSpellerRule
public AbstractEnglishSpellerRule(ResourceBundle messages, Language language, GlobalConfig globalConfig, UserConfig userConfig, List<Language> altLanguages, LanguageModel languageModel, Language motherTongue) throws IOException - Throws:
IOException- Since:
- 4.5 optional: language model for better suggestions
-
-
Method Details
-
getAdditionalSpellingFileNames
Description copied from class:SpellingCheckRuleGet the name of additional spelling file, which lists words to be accepted and used for suggestions, even when the spell checker would not accept them.- Overrides:
getAdditionalSpellingFileNamesin classSpellingCheckRule
-
match
Description copied from class:RuleCheck 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 from 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). In other words, implementations must be stateless, so that a previous call to this method has no influence on later calls.- Overrides:
matchin classMorfologikSpellerRule- Parameters:
sentence- a pre-analyzed sentence- Returns:
- an array of
RuleMatchobjects - Throws:
IOException
-
filter
private List<RuleMatch> filter(RuleMatch[] matches, String sentenceText, List<NERService.Span> namedEntities, LanguageModel languageModel) -
filterNoSuggestWords
- Overrides:
filterNoSuggestWordsin classSpellingCheckRule
-
loadWordlist
-
filterSuggestions
Description copied from class:SpellingCheckRuleRemove prohibited words from suggestions.- Overrides:
filterSuggestionsin classSpellingCheckRule
-
getRuleMatches
protected List<RuleMatch> getRuleMatches(String word, int startPos, AnalyzedSentence sentence, List<RuleMatch> ruleMatchesSoFar, int idx, AnalyzedTokenReadings[] tokens) throws IOException - Overrides:
getRuleMatchesin classMorfologikSpellerRule- Throws:
IOException
-
cleanSuggestions
-
isValidInOtherVariant
- Since:
- 4.5
-
addFormsToFirstMatch
-
replaceFormsOfFirstMatch
private void replaceFormsOfFirstMatch(String message, AnalyzedSentence sentence, List<RuleMatch> ruleMatches, String suggestion) -
getIrregularFormsOrNull
-
getIrregularFormsOrNull
-
getTopSuggestionsIgnoreCase
-
getTopSuggestions
-
getAdditionalTopSuggestions
protected List<SuggestedReplacement> getAdditionalTopSuggestions(List<SuggestedReplacement> suggestions, String word) throws IOException Description copied from class:SpellingCheckRuleGet additional suggestions added before other suggestions (note the rule may choose to re-order the suggestions anyway). Only add suggestions here that you know are spelled correctly, they will not be checked again before being shown to the user.- Overrides:
getAdditionalTopSuggestionsin classSpellingCheckRule- Throws:
IOException- Since:
- 2.7
-
addHyphenSuggestions
protected void addHyphenSuggestions(String[] parts, List<SuggestedReplacement> topSuggestions) throws IOException - Overrides:
addHyphenSuggestionsin classMorfologikSpellerRule- Throws:
IOException
-
getHyphenatedWordSuggestion
-
getTranslator
- Overrides:
getTranslatorin classMorfologikSpellerRule
-
tokenizeNewWords
protected boolean tokenizeNewWords()- Overrides:
tokenizeNewWordsin classSpellingCheckRule
-
getOnlySuggestions
Description copied from class:SpellingCheckRuleGet suggestions that will replace all other suggestions. Only add suggestions here that you know are spelled correctly, they will not be checked again before being shown to the user.- Overrides:
getOnlySuggestionsin classSpellingCheckRule
-