public abstract class FrequencyCountResourceBase extends org.apache.uima.fit.component.Resource_ImplBase implements FrequencyCountProvider
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_SCALE_DOWN_FACTOR
Scales down the frequencies by the given factor.
|
protected FrequencyCountProvider |
provider |
protected String |
scaleDownFactor |
Constructor and Description |
---|
FrequencyCountResourceBase() |
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. |
protected abstract void |
initializeProvider() |
afterResourcesInitialized, getLogger, getResourceName, initialize
public static final String PARAM_SCALE_DOWN_FACTOR
protected String scaleDownFactor
protected FrequencyCountProvider provider
public long getFrequency(String phrase) throws IOException
FrequencyCountProvider
getFrequency
in interface FrequencyCountProvider
phrase
- phrase to searchIOException
- if the information cannot be retrieved.public double getProbability(String phrase) throws IOException
FrequencyCountProvider
getProbability
in interface FrequencyCountProvider
phrase
- phrase to searchIOException
- if the information cannot be retrieved.public double getLogProbability(String phrase) throws IOException
FrequencyCountProvider
getLogProbability
in interface FrequencyCountProvider
phrase
- phrase to searchIOException
- if the information cannot be retrieved.public long getNrOfTokens() throws IOException
getNrOfTokens
in interface FrequencyCountProvider
IOException
- if the information cannot be retrieved.public long getNrOfNgrams(int n) throws IOException
FrequencyCountProvider
getNrOfNgrams
in interface FrequencyCountProvider
n
- the ngram size.IOException
- if the information cannot be retrieved.public long getNrOfDistinctNgrams(int n) throws IOException
FrequencyCountProvider
getNrOfDistinctNgrams
in interface FrequencyCountProvider
n
- the ngram size.IOException
- if the information cannot be retrieved.public Iterator<String> getNgramIterator(int n) throws IOException
FrequencyCountProvider
getNgramIterator
in interface FrequencyCountProvider
n
- the ngram size.IOException
- if the information cannot be retrieved.public String getLanguage() throws IOException
FrequencyCountProvider
getLanguage
in interface FrequencyCountProvider
IOException
- if the information cannot be retrieved.public String getID()
FrequencyCountProvider
getID
in interface FrequencyCountProvider
Copyright © 2007–2018 Ubiquitous Knowledge Processing (UKP) Lab, Technische Universität Darmstadt. All rights reserved.