Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

DictEntryVector Class Reference

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

#include <PDict.hpp>

List of all members.

Public Methods

 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.


Detailed Description

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


Constructor & Destructor Documentation

DictEntryVector::DictEntryVector   [inline]
 

DictEntryVector::DictEntryVector char *    buffer,
DictEntryFilter   filter
 


Member Function Documentation

bool 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 DictEntryVector::fromBytes char *    buffer,
DictEntryFilter   filter
 

void DictEntryVector::normalize  
 

Normalize probabilities of entries to sum to one.

int DictEntryVector::numEntries  
 

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

Returns:
number of active entries in the vector.

bool 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 DictEntryVector::sortScores   [inline]
 

sort the scores in descending order

void 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 * 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.


The documentation for this class was generated from the following files:
Generated on Wed Nov 3 12:59:30 2004 for Lemur Toolkit by doxygen1.2.18