de.aitools.ie.languagedetection
Class LanguageModel
java.lang.Object
de.aitools.ie.languagedetection.LanguageModel
- All Implemented Interfaces:
- java.io.Serializable
public class LanguageModel
- extends java.lang.Object
- implements java.io.Serializable
This class represents a language model as a collection of the frequencies of
the most frequent trigrams of a language.
- Author:
- fabian.loose@uni-weimar.de, martin.potthast@uni-weimar.de
- See Also:
- Serialized Form
Field Summary |
static java.io.File |
modelDir
This is the directory where all the .model files can be found. |
Constructor Summary |
LanguageModel(java.util.Locale language,
java.util.Map<java.lang.String,java.lang.Double> trigrams)
|
Method Summary |
java.util.Locale |
getLanguage()
|
java.util.Map<java.lang.String,java.lang.Double> |
getTrigrams()
|
static LanguageModel |
read(java.util.Locale language)
Reads a language model from the locale's .model file. |
static void |
write(LanguageModel lm)
Writes a language model to the models directory. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
modelDir
public static final java.io.File modelDir
- This is the directory where all the .model files can be found.
LanguageModel
public LanguageModel(java.util.Locale language,
java.util.Map<java.lang.String,java.lang.Double> trigrams)
read
public static LanguageModel read(java.util.Locale language)
- Reads a language model from the locale's .model file.
write
public static void write(LanguageModel lm)
throws java.io.IOException
- Writes a language model to the models directory.
- Throws:
java.io.IOException
getLanguage
public java.util.Locale getLanguage()
getTrigrams
public java.util.Map<java.lang.String,java.lang.Double> getTrigrams()