mark.nlp.features
Class BagCorpusCounter

java.lang.Object
  |
  +--mark.nlp.features.CorpusCounter
        |
        +--mark.nlp.features.BagCorpusCounter

public class BagCorpusCounter
extends CorpusCounter

A corpus counter implemented as a collection of bags. The big bag contains counts in the entire corpus. Each cbag contains the counts with a single category.


Constructor Summary
BagCorpusCounter(Bag bigBag, Bag[] cBags)
          Initializes the BagCorpusCounter with the given bags.
 
Method Summary
 Bag bigBag()
          Returns the big bag.
 Bag cBag(int c)
          Returns a c bag.
 int CLength()
          Returns the number of values C can assume.
 double num()
          Returns the total number of samples.
 double numC(int c)
          Returns #(C = c).
 double numCW(int c, java.lang.Object w)
          Returns #(C = c, W = w).
 double numW(java.lang.Object w)
          Returns #(W = w).
 java.util.Iterator WIterator()
          Returns an iterator over the values W can assume.
 java.util.Iterator WIterator(int c)
          Returns an iterator over the values W assumes in conjunction with a given value of C.
 int WLength()
          Returns the number of values W can assume.
 
Methods inherited from class mark.nlp.features.CorpusCounter
countTable, countTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BagCorpusCounter

public BagCorpusCounter(Bag bigBag,
                        Bag[] cBags)
Initializes the BagCorpusCounter with the given bags.

Parameters:
bigBag - the entire bag of samples.
cBags - an array of bags, one for each value of C.
Method Detail

bigBag

public Bag bigBag()
Returns the big bag.

Returns:
the big bag.

cBag

public Bag cBag(int c)
Returns a c bag.

Parameters:
c - the index of the c bag.
Returns:
the c bag.

WIterator

public java.util.Iterator WIterator()
Returns an iterator over the values W can assume.

Specified by:
WIterator in class CorpusCounter
Returns:
the iterator.

WIterator

public java.util.Iterator WIterator(int c)
Returns an iterator over the values W assumes in conjunction with a given value of C.

Specified by:
WIterator in class CorpusCounter
Parameters:
c - the C value.
Returns:
the iterator.

CLength

public int CLength()
Returns the number of values C can assume.

Specified by:
CLength in class CorpusCounter
Returns:
l(C).

WLength

public int WLength()
Returns the number of values W can assume.

Specified by:
WLength in class CorpusCounter
Returns:
l(W).

numCW

public double numCW(int c,
                    java.lang.Object w)
Returns #(C = c, W = w).

Specified by:
numCW in class CorpusCounter
Parameters:
c - the C value.
w - the W value.
Returns:
the count.

numC

public double numC(int c)
Returns #(C = c).

Specified by:
numC in class CorpusCounter
Parameters:
c - the C value.
Returns:
the count.

numW

public double numW(java.lang.Object w)
Returns #(W = w).

Specified by:
numW in class CorpusCounter
Parameters:
w - the W value.
Returns:
the count.

num

public double num()
Returns the total number of samples.

Specified by:
num in class CorpusCounter
Returns:
the count.