public class BerkeleyLmProvider extends Object implements FrequencyCountProvider
Constructor and Description |
---|
BerkeleyLmProvider(String binaryFile,
String language) |
Modifier and Type | Method and Description |
---|---|
long |
getFrequency(String phrase)
Get frequency for a phrase
|
String |
getID()
Returns an ID that identifies the frequency provider
|
String |
getLanguage()
Returns the language for which the frequencies are provided.
|
double |
getLogProbability(String phrase)
Get the log probability for a phrase
|
Iterator<String> |
getNgramIterator(int n)
Returns an iterator over all ngrams of a given size in the corpus.
|
long |
getNrOfDistinctNgrams(int n)
Returns the number of distinct ngrams of a given size in the corpus.
|
long |
getNrOfNgrams(int n)
Returns the number of ngrams of a given size in the corpus.
|
long |
getNrOfTokens() |
double |
getProbability(String phrase)
Get the probability (=normalized frequency) for a phrase.
The frequency count is normalized by the number of phrases in the corpus. |
public long getFrequency(String phrase)
FrequencyCountProvider
getFrequency
in interface FrequencyCountProvider
phrase
- phrase to searchpublic double getProbability(String phrase)
FrequencyCountProvider
getProbability
in interface FrequencyCountProvider
phrase
- phrase to searchpublic double getLogProbability(String phrase)
FrequencyCountProvider
getLogProbability
in interface FrequencyCountProvider
phrase
- phrase to searchpublic long getNrOfTokens()
getNrOfTokens
in interface FrequencyCountProvider
public long getNrOfNgrams(int n)
FrequencyCountProvider
getNrOfNgrams
in interface FrequencyCountProvider
n
- the ngram size.public long getNrOfDistinctNgrams(int n)
FrequencyCountProvider
getNrOfDistinctNgrams
in interface FrequencyCountProvider
n
- the ngram size.public Iterator<String> getNgramIterator(int n)
FrequencyCountProvider
getNgramIterator
in interface FrequencyCountProvider
n
- the ngram size.public String getLanguage()
FrequencyCountProvider
getLanguage
in interface FrequencyCountProvider
public String getID()
FrequencyCountProvider
getID
in interface FrequencyCountProvider
Copyright © 2007–2019 Ubiquitous Knowledge Processing (UKP) Lab, Technische Universität Darmstadt. All rights reserved.