Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

lemur::dictionary::DictEntryVector Class Reference

Vector of dictionary entries, supports sorting on the prob attribute. More...

#include <PDict.hpp>

List of all members.

Public Member Functions

 DictEntryVector ()
 DictEntryVector (char *buffer, DictEntryFilter *filter)
void sortScores ()
 sort the scores in descending order

bool addEntry (DictEntry &entry, double(*compose)(double, double)=NULL)
 Add an entry, overwriting if it already exists.

bool removeEntry (DictEntry &entry)
 Remove an entry.

char * toBytes (int &numBytes) const
 Encode for binary writing.

void toBytes (char *buffer) const
 Initialize from an array of bytes Encode for binary writing.

void fromBytes (char *buffer, DictEntryFilter *filter)
int numEntries () const
 Number of active entries. May be <= size().

void normalize ()
 Normalize probabilities of entries to sum to one.


Static Private Attributes

DictEntryProbDescending cmpFn


Detailed Description

Vector of dictionary entries, supports sorting on the prob attribute.


Constructor & Destructor Documentation

lemur::dictionary::DictEntryVector::DictEntryVector  )  [inline]
 

lemur::dictionary::DictEntryVector::DictEntryVector char *  buffer,
DictEntryFilter filter
 


Member Function Documentation

bool lemur::dictionary::DictEntryVector::addEntry DictEntry entry,
double(*  compose)(double, double) = NULL
 

Add an entry, overwriting if it already exists.

Parameters:
entry the new entry to add
compose the function to use to combine this entries probability/frequency value with if there is an existing entry in the dictionary. Default is to sum.
Returns:
true if this is a new entry, false if overwriting an existing entry.

void lemur::dictionary::DictEntryVector::fromBytes char *  buffer,
DictEntryFilter filter
 

void lemur::dictionary::DictEntryVector::normalize  ) 
 

Normalize probabilities of entries to sum to one.

int lemur::dictionary::DictEntryVector::numEntries  )  const
 

Number of active entries. May be <= size().

Returns:
number of active entries in the vector.

bool lemur::dictionary::DictEntryVector::removeEntry DictEntry entry  ) 
 

Remove an entry.

Parameters:
entry the entry to remove
Returns:
true if the entry is removed, false if not found.

void lemur::dictionary::DictEntryVector::sortScores  )  [inline]
 

sort the scores in descending order

void lemur::dictionary::DictEntryVector::toBytes char *  buffer  )  const
 

Initialize from an array of bytes Encode for binary writing.

Parameters:
buffer to encode into. Used by normalize to update values.

char * lemur::dictionary::DictEntryVector::toBytes int &  numBytes  )  const
 

Encode for binary writing.

Parameters:
numBytes returns length of return value.
Returns:
this entry encoded as an array of bytes.


Member Data Documentation

DictEntryProbDescending lemur::dictionary::DictEntryVector::cmpFn [static, private]
 


The documentation for this class was generated from the following files:
Generated on Tue Jun 15 11:03:05 2010 for Lemur by doxygen 1.3.4