Octane v1.01.20 - The Open Compression Toolkit for C++ http://octane.sourceforge.net/
Homepage | Main | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

ZeroOrderModeler Class Reference
[Modelers]

#include <zeroorder_modeler.hpp>

Inheritance diagram for ZeroOrderModeler:

OctaneModeler_WeightVectored OctaneModeler OctaneClass List of all members.

Detailed Description

A simple zero-order modeler, that builds its probability model by counting frequencies in a training file.

Definition at line 28 of file zeroorder_modeler.hpp.

Public Member Functions

 ZeroOrderModeler ()
 constructor

virtual ~ZeroOrderModeler ()
 destructor

virtual std::string GetName ()
 provide a unique name for the coder, used in some cases to automatically register the object with a manager

virtual std::string GetDescription ()
 optionally provide a longer (maybe 20-60 characters) description

virtual bool CreateModelUsingStream (OctaneParser *parserp, bitreader &from)
 Build a model using a stream and a parser.


Member Function Documentation

virtual std::string ZeroOrderModeler::GetName  )  [inline, virtual]
 

provide a unique name for the coder, used in some cases to automatically register the object with a manager

Returns:
a short *unique* name

Reimplemented from OctaneModeler_WeightVectored.

Definition at line 38 of file zeroorder_modeler.hpp.

00038 {return "ZeroOrderModeler";}

virtual std::string ZeroOrderModeler::GetDescription  )  [inline, virtual]
 

optionally provide a longer (maybe 20-60 characters) description

Returns:
a one line description

Reimplemented from OctaneModeler_WeightVectored.

Definition at line 39 of file zeroorder_modeler.hpp.

00039 {return "Zero-order Modeler";}

bool ZeroOrderModeler::CreateModelUsingStream OctaneParser parserp,
bitreader from
[virtual]
 

Build a model using a stream and a parser.

Returns:
true on success.

Reimplemented from OctaneModeler.

Definition at line 19 of file zeroorder_modeler.cpp.

References SymbolWeightVector::CountSymbolFrequencies(), SymbolWeightVector::EnforceZeroCountFloor(), SymbolWeightVector::NormalizeToProbabilityDistribution(), and OctaneModeler_WeightVectored::weightvector.

00020 {
00021         // build a model of frequencies
00022         bool bretv;
00023 
00024         // calculate symbol frequencies, by asking the weightvector to do our dirty work in conjunction with the parser
00025         bretv=weightvector.CountSymbolFrequencies(parserp,from);
00026 
00027         // make sure no symbol has freq count == 0 which would break huffman coder and others
00028         weightvector.EnforceZeroCountFloor(1);
00029 
00030         // normalize to probability distribution
00031         weightvector.NormalizeToProbabilityDistribution();
00032 
00033         // success
00034         return bretv;
00035 }


The documentation for this class was generated from the following files:  
Generated on 20 May 2004 by doxygen 1.3.3