bit::ArpaReader Class Reference

Reads ARPA language model file. More...

#include <ArpaReader.hh>

List of all members.

Public Member Functions

 ArpaReader (FILE *file=NULL)
 Construct a reader associated with a possible file.
void reset (FILE *file)
 Reset the structure and prepare reading from file.
void read_header ()
 Read the header of the ARPA file.
bool read_ngram ()
 Read next ngram from the ARPA file.
bool read_order_ngrams (bool sort=false)
 Read all ngrams of the next order.

Public Attributes

bit::ArpaReader::Options opt
 Configurable options.
bit::ArpaReader::Header header
 Information in the ARPA header.
bit::ArpaReader::Ngram ngram
 The ngram read at the last call of read_ngram().
std::vector< Ngramorder_ngrams
 Ngrams read with read_order_ngrams().
std::vector< int > sorted_order
 Indices of sorted ngrams.
SymbolMap< std::string, int > symbol_map
 The symbols in the model.
bool end_reached
 Have we reached the \ keyword.

Private Attributes

FILE * m_file
 The file to read from.
int m_current_order
 The order ngram just read from the file.
int m_ngrams_read
 The number of ngrams read for current order.

Classes

struct  Header
 Information in the ARPA header. More...
struct  Ngram
 The ngram read at the last call of read_ngram(). More...
struct  Options
 Configurable options. More...


Detailed Description

Reads ARPA language model file.

The following events are treated as error:

The following events are accepted silently:


Constructor & Destructor Documentation

bit::ArpaReader::ArpaReader FILE *  file = NULL  ) 
 

Construct a reader associated with a possible file.


Member Function Documentation

void bit::ArpaReader::read_header  ) 
 

Read the header of the ARPA file.

bool bit::ArpaReader::read_ngram  ) 
 

Read next ngram from the ARPA file.

Returns:
false if no more ngrams on this order. Next call will start reading next order. See end_reached to check end of file.

bool bit::ArpaReader::read_order_ngrams bool  sort = false  ) 
 

Read all ngrams of the next order.

Returns:
false if could not read more ngrams

void bit::ArpaReader::reset FILE *  file  ) 
 

Reset the structure and prepare reading from file.


Member Data Documentation

bool bit::ArpaReader::end_reached
 

Have we reached the \ keyword.

struct bit::ArpaReader::Header bit::ArpaReader::header
 

Information in the ARPA header.

int bit::ArpaReader::m_current_order [private]
 

The order ngram just read from the file.

FILE* bit::ArpaReader::m_file [private]
 

The file to read from.

int bit::ArpaReader::m_ngrams_read [private]
 

The number of ngrams read for current order.

struct bit::ArpaReader::Ngram bit::ArpaReader::ngram
 

The ngram read at the last call of read_ngram().

struct bit::ArpaReader::Options bit::ArpaReader::opt
 

Configurable options.

std::vector<Ngram> bit::ArpaReader::order_ngrams
 

Ngrams read with read_order_ngrams().

std::vector<int> bit::ArpaReader::sorted_order
 

Indices of sorted ngrams.

SymbolMap<std::string, int> bit::ArpaReader::symbol_map
 

The symbols in the model.


The documentation for this class was generated from the following files:
Generated on Mon Jan 8 15:51:04 2007 for bit by  doxygen 1.4.6