Package org.languagetool.languagemodel
Class BaseLanguageModel
java.lang.Object
org.languagetool.languagemodel.BaseLanguageModel
- All Implemented Interfaces:
AutoCloseable
,LanguageModel
- Direct Known Subclasses:
LuceneLanguageModel
,LuceneSingleIndexLanguageModel
The algorithm of a language model, independent of the way data
is stored (see sub classes for that).
- Since:
- 3.2
-
Field Summary
FieldsFields inherited from interface org.languagetool.languagemodel.LanguageModel
GOOGLE_SENTENCE_END, GOOGLE_SENTENCE_START
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
abstract long
Get the occurrence count fortoken
.abstract long
Get the occurrence count for the given token sequence.getPseudoProbability
(List<String> context) This is not always guaranteed to be a real probability (0.0 to 1.0).getPseudoProbabilityStupidBackoff
(List<String> context) abstract long
private long
tryGetCount
(List<String> context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.languagetool.languagemodel.LanguageModel
close
-
Field Details
-
DEBUG
private static final boolean DEBUG- See Also:
-
totalTokenCount
-
-
Constructor Details
-
BaseLanguageModel
public BaseLanguageModel()
-
-
Method Details
-
tryGetCount
-
getPseudoProbabilityStupidBackoff
-
getPseudoProbability
Description copied from interface:LanguageModel
This is not always guaranteed to be a real probability (0.0 to 1.0). Throws exception if context is longer than the ngram index supports.- Specified by:
getPseudoProbability
in interfaceLanguageModel
-
getCount
Get the occurrence count fortoken
. -
getCount
Get the occurrence count for the given token sequence. -
getTotalTokenCount
public abstract long getTotalTokenCount() -
debug
-