NGramCounter Class Reference

Class for storing counts for a set of n-grams. More...

#include <util.H>

List of all members.

Public Member Functions

 NGramCounter ()
 Ctor; initializes object to be empty.
void write (ostream &outStrm, const SymbolTable &symTable=SymbolTable()) const
 Writes all counts to stream outStrm in a text format.
void clear ()
 Clears object; deletes all n-grams in table.
unsigned size () const
 Returns number of n-grams in table.
bool empty () const
 Returns whether object is empty.
unsigned incr_count (const vector< int > &ngram)
 Increments count of an n-gram; returns new count.
void set_count (const vector< int > &ngram, unsigned val)
 Sets count of an n-gram to val.
unsigned get_count (const vector< int > &ngram) const
 Returns count of an n-gram, or 0 if not present.


Detailed Description

Class for storing counts for a set of n-grams.

N-grams are represented as vectors of integers. The main access methods are incr_count(), set_count(), and get_count().


Constructor & Destructor Documentation

NGramCounter::NGramCounter (  )  [inline]

Ctor; initializes object to be empty.


Member Function Documentation

void NGramCounter::write ( ostream &  outStrm,
const SymbolTable symTable = SymbolTable() 
) const

Writes all counts to stream outStrm in a text format.

Uses symTable to map integer indices to strings, if present.

void NGramCounter::clear (  )  [inline]

Clears object; deletes all n-grams in table.

unsigned NGramCounter::size (  )  const [inline]

Returns number of n-grams in table.

bool NGramCounter::empty (  )  const [inline]

Returns whether object is empty.

unsigned NGramCounter::incr_count ( const vector< int > &  ngram  )  [inline]

Increments count of an n-gram; returns new count.

void NGramCounter::set_count ( const vector< int > &  ngram,
unsigned  val 
) [inline]

Sets count of an n-gram to val.

If val is 0, n-gram is removed from table.

unsigned NGramCounter::get_count ( const vector< int > &  ngram  )  const [inline]

Returns count of an n-gram, or 0 if not present.


The documentation for this class was generated from the following file:

Generated on Thu Nov 5 09:26:37 2009 for asr_lib by  doxygen 1.5.5