edu.udo.cs.wvtool.wordlist
Class WVTWord

java.lang.Object
  extended by edu.udo.cs.wvtool.wordlist.WVTWord

 class WVTWord
extends java.lang.Object

Class, which represents an individual word and its occurances (class and document frequencies). It is also used as counter to count word occurances in a currently processed document.

Version:
$Id: WVTWord.java,v 1.2 2006/06/06 11:45:24 mjwurst Exp $
Author:
Michael Wurst

Field Summary
private  int[] classCount
          counter for the class frequencies
private  int documentCount
          counter for the document frequencies
private  int localCount
          counter for the term frequencies in the currently processed document
private  java.lang.String word
          the word
 
Constructor Summary
WVTWord(java.lang.String word)
          Create a new instance of Word, not supporting class values.
WVTWord(java.lang.String word, int numClasses)
          Create a new instance of Word.
 
Method Summary
 void addOccurance()
          Add an occurance of the word for the document currently processed.
 void closeDocument(boolean onlyReset)
          Close the processing of the current document, no class value is provided for this document.
 void closeDocument(int classValue, boolean onlyReset)
          Close the processing of the current document, if a class value is provided.
 int getClassFrequency(int classValue)
          Return the class frequency of this word for a given class.
 int getDocumentFrequency()
          Return the document frequency for this word.
 int getLocalFrequency()
          Return the frequency for the current document.
 java.lang.String getWord()
          Returns the word.
 void setClassFrequency(int index, int v)
          Set the class frequency
 void setDocumentFrequency(int v)
          Set the document frequency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

word

private final java.lang.String word
the word


classCount

private int[] classCount
counter for the class frequencies


documentCount

private int documentCount
counter for the document frequencies


localCount

private int localCount
counter for the term frequencies in the currently processed document

Constructor Detail

WVTWord

public WVTWord(java.lang.String word,
               int numClasses)
Create a new instance of Word.

Parameters:
word - the word as a String
numClasses - the number of possible class values


WVTWord

public WVTWord(java.lang.String word)
Create a new instance of Word, not supporting class values.

Parameters:
word - the word as a String

Method Detail

addOccurance

public void addOccurance()
Add an occurance of the word for the document currently processed.


closeDocument

public void closeDocument(boolean onlyReset)
Close the processing of the current document, no class value is provided for this document.

Parameters:
onlyReset - should only the local counter be reseted (without changing the other frequencies)


closeDocument

public void closeDocument(int classValue,
                          boolean onlyReset)
Close the processing of the current document, if a class value is provided.

Parameters:
classValue - the class value for the document, which has been just processed
onlyReset - should only the local counter be reseted (without changing the other frequencies)


getLocalFrequency

public int getLocalFrequency()
Return the frequency for the current document.

Returns:
the frequency for the current document


getDocumentFrequency

public int getDocumentFrequency()
Return the document frequency for this word.

Returns:
the document frequency


setDocumentFrequency

public void setDocumentFrequency(int v)
Set the document frequency

Parameters:
v - the value


setClassFrequency

public void setClassFrequency(int index,
                              int v)
Set the class frequency

Parameters:
index - the index of the class value
v - the value to set


getClassFrequency

public int getClassFrequency(int classValue)
Return the class frequency of this word for a given class.

Parameters:
classValue - the class value
Returns:
the class frequency or 0,if classes are not supported or the class value is out of range


getWord

public java.lang.String getWord()
Returns the word.

Returns:
a String