Package org.languagetool.languagemodel
Class BaseLanguageModel
- java.lang.Object
-
- org.languagetool.languagemodel.BaseLanguageModel
-
- All Implemented Interfaces:
AutoCloseable
,LanguageModel
- Direct Known Subclasses:
LuceneLanguageModel
,LuceneSingleIndexLanguageModel
public abstract class BaseLanguageModel extends Object implements LanguageModel
The algorithm of a language model, independent of the way data is stored (see sub classes for that).- Since:
- 3.2
-
-
Field Summary
-
Fields inherited from interface org.languagetool.languagemodel.LanguageModel
GOOGLE_SENTENCE_END, GOOGLE_SENTENCE_START
-
-
Constructor Summary
Constructors Constructor Description BaseLanguageModel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract long
getCount(String token1)
Get the occurrence count fortoken
.abstract long
getCount(List<String> tokens)
Get the occurrence count for the given token sequence.Probability
getPseudoProbability(List<String> context)
This is not always guaranteed to be a real probability (0.0 to 1.0).Probability
getPseudoProbabilityStupidBackoff(List<String> context)
abstract long
getTotalTokenCount()
-
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
-
-
-
-
Method Detail
-
getPseudoProbabilityStupidBackoff
public Probability getPseudoProbabilityStupidBackoff(List<String> context)
-
getPseudoProbability
public Probability getPseudoProbability(List<String> context)
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
public abstract long getCount(String token1)
Get the occurrence count fortoken
.
-
getCount
public abstract long getCount(List<String> tokens)
Get the occurrence count for the given token sequence.
-
getTotalTokenCount
public abstract long getTotalTokenCount()
-
-