uk.ac.shef.dcs.oak.jate.core.feature
Class FeatureDocumentTermFrequency

java.lang.Object
  extended by uk.ac.shef.dcs.oak.jate.core.feature.AbstractFeature
      extended by uk.ac.shef.dcs.oak.jate.core.feature.FeatureDocumentTermFrequency

public class FeatureDocumentTermFrequency
extends AbstractFeature

A feature store that contains information of term distributions in each document. It contains following information:
- total number of occurrences of all terms found in the corpus, which is the sum of occurrences of each term
- number of occurrences of each term in each document
- existence of terms in documents


Field Summary
 
Fields inherited from class uk.ac.shef.dcs.oak.jate.core.feature.AbstractFeature
_index
 
Constructor Summary
protected FeatureDocumentTermFrequency(GlobalIndex index)
           
 
Method Summary
 void addToTermFreqInDoc(int t, int d, int freq)
          Increment term t (id) number of occurrences in d by freq
 void addToTermFreqInDoc(java.lang.String t, Document d, int freq)
          Increment term t's number of occurrences in d by freq
 int getSumTermFreqInDocs(int term)
           
 int getSumTermFreqInDocs(java.lang.String term)
           
 int[] getTermAppear(java.lang.String t)
           
 int getTermFreqInDoc(int t, int d)
           
 int getTermFreqInDoc(java.lang.String term, Document d)
           
 int getTermFreqInDoc(java.lang.String t, int d)
           
 int getTotalCorpusTermFreq()
           
 void setTotalCorpusTermFreq(int i)
          Set total number of occurrences of all terms in the corpus
 
Methods inherited from class uk.ac.shef.dcs.oak.jate.core.feature.AbstractFeature
getGlobalIndex, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FeatureDocumentTermFrequency

protected FeatureDocumentTermFrequency(GlobalIndex index)
Method Detail

setTotalCorpusTermFreq

public void setTotalCorpusTermFreq(int i)
Set total number of occurrences of all terms in the corpus

Parameters:
i -

getTotalCorpusTermFreq

public int getTotalCorpusTermFreq()

addToTermFreqInDoc

public void addToTermFreqInDoc(java.lang.String t,
                               Document d,
                               int freq)
Increment term t's number of occurrences in d by freq

Parameters:
t -
d -
freq -

addToTermFreqInDoc

public void addToTermFreqInDoc(int t,
                               int d,
                               int freq)
Increment term t (id) number of occurrences in d by freq

Parameters:
t -
d -
freq -

getTermFreqInDoc

public int getTermFreqInDoc(java.lang.String term,
                            Document d)
Parameters:
term -
d -
Returns:
number of occurrences of a term t in a document d

getTermFreqInDoc

public int getTermFreqInDoc(int t,
                            int d)
Parameters:
t -
d -
Returns:
number of occurrences of a term identified by id t in a document identified by id d

getTermFreqInDoc

public int getTermFreqInDoc(java.lang.String t,
                            int d)
Parameters:
t -
d -
Returns:
number of occurrences of a term t in a document identified by id d

getTermAppear

public int[] getTermAppear(java.lang.String t)
Parameters:
t -
Returns:
the id's of documents in which term t are found

getSumTermFreqInDocs

public int getSumTermFreqInDocs(java.lang.String term)
Parameters:
term -
Returns:
number of occurrences of a term in all documents

getSumTermFreqInDocs

public int getSumTermFreqInDocs(int term)
Parameters:
term -
Returns:
number of occurrences of a term in all documents