public class English extends Language implements AutoCloseable
BritishEnglish
, AmericanEnglish
,
etc. if you need spell checking.
Make sure to call close()
after using this (currently only relevant if you make
use of EnglishConfusionProbabilityRule
).Modifier and Type | Field and Description |
---|---|
protected static com.google.common.cache.LoadingCache<String,List<Rule>> |
cache |
Constructor and Description |
---|
English()
Deprecated.
use
AmericanEnglish or BritishEnglish etc. instead -
they have rules for spell checking, this class doesn't (deprecated since 3.2) |
Modifier and Type | Method and Description |
---|---|
List<RuleMatch> |
adaptSuggestions(List<RuleMatch> ruleMatches,
Set<String> enabledRules) |
void |
close()
Closes the language model, if any.
|
Chunker |
createDefaultChunker()
Creates language specific chunker.
|
Disambiguator |
createDefaultDisambiguator()
Creates language specific disambiguator.
|
SentenceTokenizer |
createDefaultSentenceTokenizer()
Creates language specific sentence tokenizer.
|
SpellingCheckRule |
createDefaultSpellingRule(ResourceBundle messages) |
Synthesizer |
createDefaultSynthesizer()
Creates language specific part-of-speech synthesizer.
|
Tagger |
createDefaultTagger()
Creates language specific part-of-speech tagger.
|
Tokenizer |
createDefaultWordTokenizer()
Creates language specific word tokenizer.
|
String |
getClosingDoubleQuote() |
String |
getClosingSingleQuote() |
String[] |
getCountries()
Get this language's country options , e.g.
|
Language |
getDefaultLanguageVariant()
Languages that have country variants need to overwrite this to select their most common variant.
|
LanguageModel |
getLanguageModel(File indexDir) |
LanguageMaintainedState |
getMaintainedState()
Information about whether the support for this language in LanguageTool is actively maintained.
|
Contributor[] |
getMaintainers()
Get the name(s) of the maintainer(s) for this language or
null . |
String |
getName()
Get this language's name in English, e.g.
|
String |
getOpeningDoubleQuote() |
String |
getOpeningSingleQuote() |
protected int |
getPriorityForId(String id)
Returns a priority for Rule or Category Id (default: 0).
|
List<Rule> |
getRelevantLanguageModelCapableRules(ResourceBundle messages,
LanguageModel lm,
GlobalConfig globalConfig,
UserConfig userConfig,
Language motherTongue,
List<Language> altLanguages)
Get a list of rules that can optionally use a
LanguageModel . |
List<Rule> |
getRelevantLanguageModelRules(ResourceBundle messages,
LanguageModel languageModel,
UserConfig userConfig)
Get a list of rules that require a
LanguageModel . |
List<Rule> |
getRelevantRules(ResourceBundle messages,
UserConfig userConfig,
Language motherTongue,
List<Language> altLanguages)
Get the rules classes that should run for texts in this language.
|
Function<Rule,Rule> |
getRemoteEnhancedRules(ResourceBundle messageBundle,
List<RemoteRuleConfig> configs,
UserConfig userConfig,
Language motherTongue,
List<Language> altLanguages,
boolean inputLogging)
For rules whose results are extended using some remote service, e.g.
|
int |
getRulePriority(Rule rule)
Returns a priority for Rule (default: 0).
|
String |
getShortCode()
Get this language's character code, e.g.
|
boolean |
hasMinMatchesRules() |
boolean |
hasNGramFalseFriendRule(Language motherTongue)
Return true if language has ngram-based false friend rule returned by
Language.getRelevantLanguageModelCapableRules(java.util.ResourceBundle, org.languagetool.languagemodel.LanguageModel, org.languagetool.GlobalConfig, org.languagetool.UserConfig, org.languagetool.Language, java.util.List<org.languagetool.Language>) . |
boolean |
isAdvancedTypographyEnabled() |
adaptSuggestion, adjustMatch, createDefaultJLanguageTool, createDefaultPostDisambiguationChunker, equals, equalsConsiderVariantsIfSpecified, getChunker, getCommonWordsPath, getConsistencyRulePrefix, getDefaultDisabledRulesForVariant, getDefaultEnabledRulesForVariant, getDefaultSpellingRule, getDefaultSpellingRule, getDisambiguationUnifier, getDisambiguationUnifierConfiguration, getDisambiguator, getIgnoredCharactersRegex, getLocale, getLocaleWithCountryAndVariant, getPatternRules, getPostDisambiguationChunker, getRelevantRemoteRules, getRelevantRulesGlobalConfig, getRuleFileNames, getSentenceTokenizer, getShortCodeWithCountryAndVariant, getSynthesizer, getTagger, getTranslatedName, getUnifier, getUnifierConfiguration, getVariant, getWordTokenizer, hashCode, hasVariant, initLanguageModel, isExternal, isHiddenFromGui, isSpellcheckOnlyLanguage, isVariant, mergeSuggestions, setChunker, setDisambiguator, setPostDisambiguationChunker, setSentenceTokenizer, setSynthesizer, setTagger, setWordTokenizer, toAdvancedTypography, toString
@Deprecated public English()
AmericanEnglish
or BritishEnglish
etc. instead -
they have rules for spell checking, this class doesn't (deprecated since 3.2)public Language getDefaultLanguageVariant()
Language
getDefaultLanguageVariant
in class Language
public SentenceTokenizer createDefaultSentenceTokenizer()
Language
Language.getSentenceTokenizer()
if sentence tokenizer is not set.createDefaultSentenceTokenizer
in class Language
public String getName()
Language
English
or
German (Germany)
.public String getShortCode()
Language
en
for English.
For most languages this is a two-letter code according to ISO 639-1,
but for those languages that don't have a two-letter code, a three-letter
code according to ISO 639-2 is returned.
The country parameter (e.g. "US"), if any, is not returned.getShortCode
in class Language
public String[] getCountries()
Language
US
(as in en-US
) or
PL
(as in pl-PL
).getCountries
in class Language
@NotNull public Tagger createDefaultTagger()
Language
null
,
but it can be a trivial pseudo-tagger that only assigns null
tags.
This function will be called each time in Language.getTagger()
()} if tagger is not set.createDefaultTagger
in class Language
@Nullable public Chunker createDefaultChunker()
Language
Language.getChunker()
if chunker is not set.createDefaultChunker
in class Language
@Nullable public Synthesizer createDefaultSynthesizer()
Language
Language.getSynthesizer()
if synthesizer is not set.createDefaultSynthesizer
in class Language
public Disambiguator createDefaultDisambiguator()
Language
Language.getDisambiguator()
if disambiguator is not set.createDefaultDisambiguator
in class Language
public Tokenizer createDefaultWordTokenizer()
Language
Language.getWordTokenizer()
if word tokenizer is not set.createDefaultWordTokenizer
in class Language
public LanguageModel getLanguageModel(File indexDir) throws IOException
getLanguageModel
in class Language
indexDir
- directory with a '3grams' sub directory which contains a Lucene index with 3gram occurrence countsnull
if this language doesn't support oneIOException
public Contributor[] getMaintainers()
Language
null
.getMaintainers
in class Language
public LanguageMaintainedState getMaintainedState()
Language
getMaintainedState
in class Language
public List<Rule> getRelevantRules(ResourceBundle messages, UserConfig userConfig, Language motherTongue, List<Language> altLanguages) throws IOException
Language
getRelevantRules
in class Language
IOException
public List<Rule> getRelevantLanguageModelRules(ResourceBundle messages, LanguageModel languageModel, UserConfig userConfig) throws IOException
Language
LanguageModel
. Returns an empty list for
languages that don't have such rules.getRelevantLanguageModelRules
in class Language
IOException
public List<Rule> getRelevantLanguageModelCapableRules(ResourceBundle messages, @Nullable LanguageModel lm, GlobalConfig globalConfig, UserConfig userConfig, Language motherTongue, List<Language> altLanguages) throws IOException
Language
LanguageModel
. Returns an empty list for
languages that don't have such rules.getRelevantLanguageModelCapableRules
in class Language
lm
- null if no language model is availableIOException
public boolean hasNGramFalseFriendRule(Language motherTongue)
Language
Language.getRelevantLanguageModelCapableRules(java.util.ResourceBundle, org.languagetool.languagemodel.LanguageModel, org.languagetool.GlobalConfig, org.languagetool.UserConfig, org.languagetool.Language, java.util.List<org.languagetool.Language>)
.hasNGramFalseFriendRule
in class Language
public String getOpeningDoubleQuote()
getOpeningDoubleQuote
in class Language
public String getClosingDoubleQuote()
getClosingDoubleQuote
in class Language
public String getOpeningSingleQuote()
getOpeningSingleQuote
in class Language
public String getClosingSingleQuote()
getClosingSingleQuote
in class Language
public boolean isAdvancedTypographyEnabled()
isAdvancedTypographyEnabled
in class Language
public void close() throws Exception
close
in interface AutoCloseable
Exception
public int getRulePriority(Rule rule)
Language
getRulePriority
in class Language
protected int getPriorityForId(String id)
Language
getPriorityForId
in class Language
public Function<Rule,Rule> getRemoteEnhancedRules(ResourceBundle messageBundle, List<RemoteRuleConfig> configs, UserConfig userConfig, Language motherTongue, List<Language> altLanguages, boolean inputLogging) throws IOException
Language
BERTSuggestionRanking
getRemoteEnhancedRules
in class Language
IOException
public boolean hasMinMatchesRules()
hasMinMatchesRules
in class Language
public SpellingCheckRule createDefaultSpellingRule(ResourceBundle messages) throws IOException
createDefaultSpellingRule
in class Language
IOException