Package org.languagetool.language
Class LanguageBuilder.ExtendedLanguage
- java.lang.Object
-
- org.languagetool.Language
-
- org.languagetool.language.LanguageBuilder.ExtendedLanguage
-
- Enclosing class:
- LanguageBuilder
static class LanguageBuilder.ExtendedLanguage extends Language
-
-
Field Summary
Fields Modifier and Type Field Description private LanguagebaseLanguageprivate java.lang.Stringnameprivate java.io.FileruleFile
-
Constructor Summary
Constructors Constructor Description ExtendedLanguage(Language baseLanguage, java.lang.String name, java.io.File ruleFile)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable ChunkergetChunker()Get this language's chunker implementation ornull.java.lang.String[]getCountries()Get this language's country options , e.g.java.util.List<java.lang.String>getDefaultDisabledRulesForVariant()Get disabled rules different from the default ones for this language variant.java.util.List<java.lang.String>getDefaultEnabledRulesForVariant()Get enabled rules different from the default ones for this language variant.@Nullable LanguagegetDefaultLanguageVariant()Languages that have country variants need to overwrite this to select their most common variant.DisambiguatorgetDisambiguator()Get this language's part-of-speech disambiguator implementation.@Nullable LanguageModelgetLanguageModel(java.io.File indexDir)java.util.LocalegetLocale()Get this language's Java locale, not considering the country code.java.util.LocalegetLocaleWithCountryAndVariant()Get this language's Java locale, considering language code and country code (if any).Contributor[]getMaintainers()Get the name(s) of the maintainer(s) for this language ornull.java.lang.StringgetName()Get this language's name in English, e.g.@Nullable ChunkergetPostDisambiguationChunker()Get this language's chunker implementation ornull.java.util.List<Rule>getRelevantLanguageModelRules(java.util.ResourceBundle messages, LanguageModel languageModel)Get a list of rules that require aLanguageModel.java.util.List<Rule>getRelevantRules(java.util.ResourceBundle messages, UserConfig userConfig, Language motherTongue, java.util.List<Language> altLanguages)Get the rules classes that should run for texts in this language.java.util.List<Rule>getRelevantWord2VecModelRules(java.util.ResourceBundle messages, Word2VecModel word2vecModel)Get a list of rules that require aWord2VecModel.java.util.List<java.lang.String>getRuleFileNames()Get the location of the rule file(s) in a form like/org/languagetool/rules/de/grammar.xml, i.e.SentenceTokenizergetSentenceTokenizer()Get this language's sentence tokenizer implementation.java.lang.StringgetShortCode()Get this language's character code, e.g.@Nullable SynthesizergetSynthesizer()Get this language's part-of-speech synthesizer implementation ornull.TaggergetTagger()Get this language's part-of-speech tagger implementation.@Nullable java.lang.StringgetVariant()Get this language's variant, e.g.TokenizergetWordTokenizer()Get this language's word tokenizer implementation.booleanisExternal()For internal use only.-
Methods inherited from class org.languagetool.Language
equals, equalsConsiderVariantsIfSpecified, getCommonWordsPath, getDisambiguationUnifier, getDisambiguationUnifierConfiguration, getIgnoredCharactersRegex, getMaintainedState, getPatternRules, getPriorityForId, getRelevantLanguageModelCapableRules, getRelevantNeuralNetworkModels, getRelevantRulesGlobalConfig, getShortCodeWithCountryAndVariant, getTranslatedName, getUnifier, getUnifierConfiguration, getWord2VecModel, hashCode, hasNGramFalseFriendRule, hasVariant, initLanguageModel, isHiddenFromGui, isSpellcheckOnlyLanguage, isVariant, toString
-
-
-
-
Field Detail
-
baseLanguage
private final Language baseLanguage
-
name
private final java.lang.String name
-
ruleFile
private final java.io.File ruleFile
-
-
Constructor Detail
-
ExtendedLanguage
ExtendedLanguage(Language baseLanguage, java.lang.String name, java.io.File ruleFile)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:LanguageGet this language's name in English, e.g.EnglishorGerman (Germany).
-
getRuleFileNames
public java.util.List<java.lang.String> getRuleFileNames()
Description copied from class:LanguageGet the location of the rule file(s) in a form like/org/languagetool/rules/de/grammar.xml, i.e. a path in the classpath. The files must exist or an exception will be thrown, unless the filename contains the string-test-.- Overrides:
getRuleFileNamesin classLanguage
-
isExternal
public boolean isExternal()
Description copied from class:LanguageFor internal use only. Overwritten to returntruefor languages that have been loaded from an external file after start up.- Overrides:
isExternalin classLanguage
-
getLocale
public java.util.Locale getLocale()
Description copied from class:LanguageGet this language's Java locale, not considering the country code.
-
getMaintainers
public Contributor[] getMaintainers()
Description copied from class:LanguageGet the name(s) of the maintainer(s) for this language ornull.- Specified by:
getMaintainersin classLanguage
-
getShortCode
public java.lang.String getShortCode()
Description copied from class:LanguageGet this language's character code, e.g.enfor 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.- Specified by:
getShortCodein classLanguage
-
getCountries
public java.lang.String[] getCountries()
Description copied from class:LanguageGet this language's country options , e.g.US(as inen-US) orPL(as inpl-PL).- Specified by:
getCountriesin classLanguage- Returns:
- String[] - array of country options for the language.
-
getRelevantRules
public java.util.List<Rule> getRelevantRules(java.util.ResourceBundle messages, UserConfig userConfig, Language motherTongue, java.util.List<Language> altLanguages) throws java.io.IOException
Description copied from class:LanguageGet the rules classes that should run for texts in this language.- Specified by:
getRelevantRulesin classLanguage- Throws:
java.io.IOException
-
getVariant
@Nullable public @Nullable java.lang.String getVariant()
Description copied from class:LanguageGet this language's variant, e.g.valencia(as inca-ES-valencia) ornull. Attention: not to be confused with "country" option- Overrides:
getVariantin classLanguage- Returns:
- variant for the language or
null
-
getDefaultEnabledRulesForVariant
public java.util.List<java.lang.String> getDefaultEnabledRulesForVariant()
Description copied from class:LanguageGet enabled rules different from the default ones for this language variant.- Overrides:
getDefaultEnabledRulesForVariantin classLanguage- Returns:
- enabled rules for the language variant.
-
getDefaultDisabledRulesForVariant
public java.util.List<java.lang.String> getDefaultDisabledRulesForVariant()
Description copied from class:LanguageGet disabled rules different from the default ones for this language variant.- Overrides:
getDefaultDisabledRulesForVariantin classLanguage- Returns:
- disabled rules for the language variant.
-
getLanguageModel
@Nullable public @Nullable LanguageModel getLanguageModel(java.io.File indexDir) throws java.io.IOException
- Overrides:
getLanguageModelin classLanguage- Parameters:
indexDir- directory with a '3grams' sub directory which contains a Lucene index with 3gram occurrence counts- Returns:
- a LanguageModel or
nullif this language doesn't support one - Throws:
java.io.IOException
-
getRelevantLanguageModelRules
public java.util.List<Rule> getRelevantLanguageModelRules(java.util.ResourceBundle messages, LanguageModel languageModel) throws java.io.IOException
Description copied from class:LanguageGet a list of rules that require aLanguageModel. Returns an empty list for languages that don't have such rules.- Overrides:
getRelevantLanguageModelRulesin classLanguage- Throws:
java.io.IOException
-
getRelevantWord2VecModelRules
public java.util.List<Rule> getRelevantWord2VecModelRules(java.util.ResourceBundle messages, Word2VecModel word2vecModel) throws java.io.IOException
Description copied from class:LanguageGet a list of rules that require aWord2VecModel. Returns an empty list for languages that don't have such rules.- Overrides:
getRelevantWord2VecModelRulesin classLanguage- Throws:
java.io.IOException
-
getLocaleWithCountryAndVariant
public java.util.Locale getLocaleWithCountryAndVariant()
Description copied from class:LanguageGet this language's Java locale, considering language code and country code (if any).- Overrides:
getLocaleWithCountryAndVariantin classLanguage
-
getDefaultLanguageVariant
@Nullable public @Nullable Language getDefaultLanguageVariant()
Description copied from class:LanguageLanguages that have country variants need to overwrite this to select their most common variant.- Overrides:
getDefaultLanguageVariantin classLanguage- Returns:
- default country variant or
null
-
getDisambiguator
public Disambiguator getDisambiguator()
Description copied from class:LanguageGet this language's part-of-speech disambiguator implementation.- Overrides:
getDisambiguatorin classLanguage
-
getTagger
public Tagger getTagger()
Description copied from class:LanguageGet this language's part-of-speech tagger implementation. The tagger must not benull, but it can be a trivial pseudo-tagger that only assignsnulltags.
-
getSentenceTokenizer
public SentenceTokenizer getSentenceTokenizer()
Description copied from class:LanguageGet this language's sentence tokenizer implementation.- Overrides:
getSentenceTokenizerin classLanguage
-
getWordTokenizer
public Tokenizer getWordTokenizer()
Description copied from class:LanguageGet this language's word tokenizer implementation.- Overrides:
getWordTokenizerin classLanguage
-
getChunker
@Nullable public @Nullable Chunker getChunker()
Description copied from class:LanguageGet this language's chunker implementation ornull.- Overrides:
getChunkerin classLanguage
-
getPostDisambiguationChunker
@Nullable public @Nullable Chunker getPostDisambiguationChunker()
Description copied from class:LanguageGet this language's chunker implementation ornull.- Overrides:
getPostDisambiguationChunkerin classLanguage
-
getSynthesizer
@Nullable public @Nullable Synthesizer getSynthesizer()
Description copied from class:LanguageGet this language's part-of-speech synthesizer implementation ornull.- Overrides:
getSynthesizerin classLanguage
-
-