marf.Stats
Class ProbabilityTable

java.lang.Object
  extended by marf.Stats.ProbabilityTable
All Implemented Interfaces:
java.io.Serializable

public class ProbabilityTable
extends java.lang.Object
implements java.io.Serializable

Probabilities Table for N-grams. The class is properly synchronized as of 0.3.0.5.

$Id: ProbabilityTable.java,v 1.41 2007/12/18 21:57:14 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.41 $
Author:
Serguei Mokhov
See Also:
Serialized Form

Constructor Summary
ProbabilityTable(java.lang.String pstrLanguage)
          Constructor with the language parameter other than default.
 
Method Summary
 void dumpCSV()
          Allows dumping the contents of the table in the CSV format.
 java.lang.String getLang()
          Retrieves current language.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 double getOccurrence(int piX)
          Allows getting an occurrence given the x coordinate.
 double getOccurrence(int piX, int piY)
          Allows getting an occurrence given x and y coordinates.
 double getOccurrence(int piX, int piY, int piZ)
          Allows getting an occurrence given x, y, and z coordinates.
 double getOccurrence(java.util.Vector poObservationList)
          Allows getting the occurrence of a list of observations.
 int incFrequency(java.util.Vector poObservationList)
          Increments the frequency of occurrences of a list of observations.
 boolean normalize()
          Not implemented.
 double p(Observation poObservationCause, Observation poObservationEffect)
          Not implemented.
 double p(Observation poObservationCause, java.util.Vector poObservationList)
          Not implemented.
 double p(java.util.Vector poObservationList)
          Retrieves the probability of a list of observations as a number of occurrences.
 void setLang(java.lang.String pstrLang)
          Allows setting a natural language associated with this table.
 void setOccurrence(int piX, double pdOccurence)
          Allows setting an occurrence given the x coordinate.
 void setOccurrence(int piX, int piY, double pdOccurrence)
          Allows setting an occurrence given the x and y coordinates.
 void setOccurrence(int piX, int piY, int piZ, double pdOccurrence)
          Allows setting an occurrence given the x, y, and z coordinates.
 void setOccurrence(java.util.Vector poObservationList, double pdOccurrence)
          Allows setting an occurrence of a list of observations.
 int size()
          Retrieves the size of the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProbabilityTable

public ProbabilityTable(java.lang.String pstrLanguage)
Constructor with the language parameter other than default.

Parameters:
pstrLanguage - the language this table is for
See Also:
strLang
Method Detail

p

public final double p(Observation poObservationCause,
                      Observation poObservationEffect)
Not implemented.

Parameters:
poObservationCause - unused
poObservationEffect - unused
Returns:
0

p

public final double p(Observation poObservationCause,
                      java.util.Vector poObservationList)
Not implemented.

Parameters:
poObservationCause - unused
poObservationList - unused
Returns:
0

p

public final double p(java.util.Vector poObservationList)
Retrieves the probability of a list of observations as a number of occurrences.

Parameters:
poObservationList - a collection of observations
Returns:
the probability

size

public final int size()
Retrieves the size of the table.

Returns:
the size (as the index size)

setOccurrence

public final void setOccurrence(int piX,
                                double pdOccurence)
Allows setting an occurrence given the x coordinate. An unigram model is assumed.

Parameters:
piX - the x index
pdOccurence - the occurrence
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the coordinate is out of range

setOccurrence

public final void setOccurrence(int piX,
                                int piY,
                                double pdOccurrence)
Allows setting an occurrence given the x and y coordinates. A bigram model is assumed.

Parameters:
piX - the x index
piY - the y index
pdOccurrence - the occurrence
Throws:
java.lang.ArrayIndexOutOfBoundsException - if either of the coordinates is out of range

setOccurrence

public final void setOccurrence(int piX,
                                int piY,
                                int piZ,
                                double pdOccurrence)
Allows setting an occurrence given the x, y, and z coordinates. A trigram model is assumed.

Parameters:
piX - the x index
piY - the y index
piZ - the z index
pdOccurrence - the occurrence
Throws:
java.lang.ArrayIndexOutOfBoundsException - if either of the coordinates is out of range

getOccurrence

public final double getOccurrence(int piX)
Allows getting an occurrence given the x coordinate. An unigram model is assumed.

Parameters:
piX - the x index
Returns:
the number of occurrences of the item at the coordinates.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the coordinate is out of range

getOccurrence

public final double getOccurrence(int piX,
                                  int piY)
Allows getting an occurrence given x and y coordinates. A bigram model is assumed.

Parameters:
piX - the x index
piY - the y index
Returns:
the number of occurrences of the item at the coordinates.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if either of the coordinates is out of range

getOccurrence

public final double getOccurrence(int piX,
                                  int piY,
                                  int piZ)
Allows getting an occurrence given x, y, and z coordinates. A trigram model is assumed.

Parameters:
piX - the x index
piY - the y index
piZ - the z index
Returns:
the number of occurrences of the item at the coordinates.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if either of the coordinates is out of range

setOccurrence

public final void setOccurrence(java.util.Vector poObservationList,
                                double pdOccurrence)
Allows setting an occurrence of a list of observations. Works with uni-, bi-, and trigram models.

Parameters:
poObservationList - the list
pdOccurrence - the desired occurrence

getOccurrence

public final double getOccurrence(java.util.Vector poObservationList)
Allows getting the occurrence of a list of observations. Works with uni-, bi-, and trigram models.

Parameters:
poObservationList - the list
Returns:
the number of occurrences

incFrequency

public final int incFrequency(java.util.Vector poObservationList)
Increments the frequency of occurrences of a list of observations.

Parameters:
poObservationList - the list to work with
Returns:
the new frequency

normalize

public final boolean normalize()
Not implemented.

Returns:
false

dumpCSV

public void dumpCSV()
Allows dumping the contents of the table in the CSV format.


setLang

public final void setLang(java.lang.String pstrLang)
Allows setting a natural language associated with this table.

Parameters:
pstrLang - the language

getLang

public final java.lang.String getLang()
Retrieves current language.

Returns:
the associated natural language for this table

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Returns source code revision information.

Returns:
revision string


SourceForge Logo