|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.aitools.ir.fingerprinting.refactored.PrefixDistribution
public abstract class PrefixDistribution
A class to represent a prefix distribution. A prefix distribution is a collection of a-priori probabilities of word prefixes of a certain language and/or document corpus. Furthermore this class is responsible to serialize its content into an external file and vice-versa.
Constructor Summary | |
---|---|
PrefixDistribution(java.lang.String file)
The explicit constructor. |
Method Summary | |
---|---|
java.lang.Integer |
getIndex(java.lang.String prefix)
Returns the index of the given prefix (not case sensitive). |
java.util.Locale |
getLocale()
Returns the prefix distribution's localization information. |
double[] |
getProbabilities(int prefixLength)
Returns the double vector of prefix probabilities. |
void |
load(java.io.InputStream in)
|
void |
save(java.io.OutputStream out)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PrefixDistribution(java.lang.String file) throws java.lang.NumberFormatException, java.io.IOException, java.net.URISyntaxException
file
- a text file containing a prefix distribution.
java.lang.NumberFormatException
java.io.IOException
java.net.URISyntaxException
Method Detail |
---|
public java.util.Locale getLocale()
Locale.ROOT
by default.
public double[] getProbabilities(int prefixLength)
getIndex(String)
.
prefixLength
- the length of prefixes to get the distribution for.
public java.lang.Integer getIndex(java.lang.String prefix)
getProbabilities(int)
. Note that the
index is only valid for the correct prefix length argument. If the prefix
is unknown, which means that there is no probability available, the
method returns null
.
prefix
- the string of the prefix to get the index for.
null
if unknown.public void load(java.io.InputStream in) throws java.lang.NumberFormatException, java.io.IOException
java.lang.NumberFormatException
java.io.IOException
public void save(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |