net.sf.classifier4J.bayesian
Class WordProbability

java.lang.Object
  |
  +--net.sf.classifier4J.bayesian.WordProbability
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class WordProbability
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

Represents the probability of a particular word. The user of this object can either:

  1. Set a specific probability for a particular word or
  2. Define the matching and non-matching counts for the particular word. This class then calculates the probability for you.

Author:
Nick Lothian, Peter Leschev
See Also:
Serialized Form

Constructor Summary
WordProbability()
           
WordProbability(java.lang.String w)
           
WordProbability(java.lang.String w, double probability)
           
WordProbability(java.lang.String w, long matchingCount, long nonMatchingCount)
           
WordProbability(java.lang.String c, java.lang.String w)
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
 java.lang.String getCategory()
           
 long getMatchingCount()
           
 long getNonMatchingCount()
           
 double getProbability()
           
 java.lang.String getWord()
           
 int hashCode()
           
 void registerMatch()
           
 void registerNonMatch()
           
 void setCategory(java.lang.String category)
           
 void setMatchingCount(long matchingCount)
           
 void setNonMatchingCount(long nonMatchingCount)
           
 void setProbability(double probability)
           
 void setWord(java.lang.String w)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WordProbability

public WordProbability()

WordProbability

public WordProbability(java.lang.String w)

WordProbability

public WordProbability(java.lang.String c,
                       java.lang.String w)

WordProbability

public WordProbability(java.lang.String w,
                       double probability)

WordProbability

public WordProbability(java.lang.String w,
                       long matchingCount,
                       long nonMatchingCount)
Method Detail

setWord

public void setWord(java.lang.String w)

setCategory

public void setCategory(java.lang.String category)

setProbability

public void setProbability(double probability)

setMatchingCount

public void setMatchingCount(long matchingCount)

setNonMatchingCount

public void setNonMatchingCount(long nonMatchingCount)

registerMatch

public void registerMatch()

registerNonMatch

public void registerNonMatch()

getProbability

public double getProbability()
Returns:

getMatchingCount

public long getMatchingCount()

getNonMatchingCount

public long getNonMatchingCount()

getWord

public java.lang.String getWord()
Returns:

getCategory

public java.lang.String getCategory()

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2003-2005 Nick Lothian. All Rights Reserved.