public class DetectorFactory extends Object
Detector
.
Before using language detection library,
load profiles with loadProfile(String)
method
and set initialization parameters.
When the language detection,
construct Detector instance via create()
.
See also Detector
's sample code.
Detector
Modifier and Type | Field and Description |
---|---|
ArrayList<String> |
langlist |
Long |
seed |
HashMap<String,double[]> |
wordLangProbMap |
Modifier and Type | Method and Description |
---|---|
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 List<String> |
getLangList() |
static void |
loadProfile(File profileDirectory)
Load profiles from specified directory.
|
static void |
loadProfile(List<String> json_profiles)
Load profiles from specified directory.
|
static void |
loadProfile(String profileDirectory)
Load profiles from specified directory.
|
static void |
setSeed(long seed) |
public Long seed
public static void loadProfile(String profileDirectory) throws LangDetectException
profileDirectory
- profile directory pathLangDetectException
- Can't open profiles(error code = ErrorCode.FileLoadError
)
or profile's format is wrong (error code = ErrorCode.FormatError
)public static void loadProfile(File profileDirectory) throws LangDetectException
profileDirectory
- profile directory pathLangDetectException
- Can't open profiles(error code = ErrorCode.FileLoadError
)
or profile's format is wrong (error code = ErrorCode.FormatError
)public static void loadProfile(List<String> json_profiles) throws LangDetectException
LangDetectException
- Can't open profiles(error code = ErrorCode.FileLoadError
)
or profile's format is wrong (error code = ErrorCode.FormatError
)public static void clear()
public static Detector create() throws LangDetectException
LangDetectException
public static Detector create(double alpha) throws LangDetectException
alpha
- smoothing parameter (default value = 0.5)LangDetectException
public static void setSeed(long seed)
Copyright © 2016. All rights reserved.