com.cybozu.labs.langdetect

## Class DetectorFactory

- java.lang.Object
- - com.cybozu.labs.langdetect.DetectorFactory

-     public class DetectorFactory
      extends java.lang.Object

  Language Detector Factory Class This class manages an initialization and constructions of `Detector`. Before using language detection library, load profiles with `loadProfiles(List profiles)` method and set initialization parameters. When the language detection, construct Detector instance via `create()`. See also `Detector`'s sample code.
  - 4x faster improvement based on Elmer Garduno's code. Thanks!
  Author:
    Nakatani Shuyo
  See Also:
    `Detector`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.util.ArrayList<java.lang.String>` | `langlist`
    `java.lang.Long` | `seed`
    `java.util.HashMap<java.lang.String,double[]>` | `wordLangProbMap`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) static void` | `addProfile(LangProfile profile, int index, int langsize)`
    `static void` | `clear()` Clear loaded language profiles (reinitialization to be available)
    `static Detector` | `create()` Construct Detector instance
    `static Detector` | `create(double alpha)` Construct Detector instance with smoothing parameter
    `static java.util.List<java.lang.String>` | `getLangList()`
    `protected static CLangProfile` | `getLanguageProfile(java.lang.String profileName)` Instantiate a language profile class.
    `static void` | `loadProfiles(java.util.List<LangProfile> profiles)`
    `static void` | `loadProfilesByName(java.util.List<java.lang.String> profileNames)` Load language profiles by name.
    `static void` | `setSeed(long seed)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### wordLangProbMap

          public java.util.HashMap<java.lang.String,double[]> wordLangProbMap

    - #### langlist

          public java.util.ArrayList<java.lang.String> langlist

    - #### seed

          public java.lang.Long seed

  - ### Method Detail

    - #### loadProfiles

          public static void loadProfiles(java.util.List<LangProfile> profiles)

    - #### loadProfilesByName

          public static void loadProfilesByName(java.util.List<java.lang.String> profileNames)

      Load language profiles by name.
      Parameters:
        `profileNames` - String list of profile names.

        The list of loaded language profiles is set to those specified in the profile names list.

    - #### addProfile

          static void addProfile(LangProfile profile,
                        int index,
                        int langsize)

      Parameters:
        `profile` -
        `langsize` -
        `index` -
      Throws:
        `LangDetectException`

    - #### clear

          public static void clear()

      Clear loaded language profiles (reinitialization to be available)

    - #### create

          public static Detector create()

      Construct Detector instance
      Returns:
        Detector instance
      Throws:
        `LangDetectException`

    - #### create

          public static Detector create(double alpha)
                                 throws LangDetectException

      Construct Detector instance with smoothing parameter
      Parameters:
        `alpha` - smoothing parameter (default value = 0.5)
      Returns:
        Detector instance
      Throws:
        `LangDetectException`

    - #### setSeed

          public static void setSeed(long seed)

    - #### getLangList

          public static final java.util.List<java.lang.String> getLangList()

    - #### getLanguageProfile

          protected static CLangProfile getLanguageProfile(java.lang.String profileName)

      Instantiate a language profile class.
      Parameters:
        `profileName` - Language profile name.
      Returns:
        Language profile class. Null if not found or could not be instantiated.