Enum Class LanguageIdentifierService

java.lang.Object
java.lang.Enum<LanguageIdentifierService>
org.languagetool.language.identifier.LanguageIdentifierService
All Implemented Interfaces:
Serializable, Comparable<LanguageIdentifierService>, Constable

public enum LanguageIdentifierService extends Enum<LanguageIdentifierService>
  • Enum Constant Details

  • Field Details

  • Constructor Details

    • LanguageIdentifierService

      private LanguageIdentifierService()
  • Method Details

    • values

      public static LanguageIdentifierService[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LanguageIdentifierService valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getDefaultLanguageIdentifier

      public LanguageIdentifier getDefaultLanguageIdentifier(int maxLength, @Nullable File ngramLangIdentData, @Nullable File fasttextBinary, @Nullable File fasttextModel)
      Parameters:
      maxLength - - the maximum of characters that will be considered - can help with performance. If 0 the default value of 1000 is used. Don't use values between 1-100, as this would decrease accuracy.
      ngramLangIdentData - - the ngramLangIdentData file, if null ngram will not be initialized.
      fasttextBinary - - the fasttext binary file, if null fasttext will not be initialized.
      fasttextModel - - the fasttext model file, if null fasttext will not be initialized.
      Returns:
      new LanguageIdentifier or existing if already initialized.
      Since:
      5.8
    • getSimpleLanguageIdentifier

      public LanguageIdentifier getSimpleLanguageIdentifier(@Nullable List<String> preferredLangCodes)
      Parameters:
      preferredLangCodes - - a list of language codes for that a spellchecker will be initialized. If null all spellcheckers will be used.
      Returns:
      new LanguageIdentifier or existing if already initialized.
      Since:
      5.8
    • getInitialized

      @Nullable public LanguageIdentifier getInitialized()
      Try to get an already initialized LanguageIdentifier
      Returns:
      defaultIdentifier or if null simpleIdentifier or null
    • canLanguageBeDetected

      public boolean canLanguageBeDetected(String langCode, List<String> additionalLanguageCodes)
    • clearLanguageIdentifier

      @TestOnly public LanguageIdentifierService clearLanguageIdentifier(String type)
      Parameters:
      type - - option: "default", "simpel, or both to clear the identifiers
      Returns:
      LanguageIdentifierService instance