ZGen  0.2.0
a linearization system for natural language.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Friends | List of all members
ZGen::Engine::WordAlphabet Class Reference

#include <word_alphabet.h>

Inheritance diagram for ZGen::Engine::WordAlphabet:
ZGen::Engine::MutableAlphabet

Public Types

enum  SPECIAL_WORD { NONE, BEGIN, END }
 

Public Member Functions

 WordAlphabet ()
 
 ~WordAlphabet ()
 
int insert (const char *name)
 
const char * decode (int id) const
 
int encode (const char *name) const
 
bool save (std::ostream &ofs) const
 
bool load (std::istream &ifs)
 
- Public Member Functions inherited from ZGen::Engine::MutableAlphabet
 MutableAlphabet ()
 

Friends

class boost::serialization::access
 

Member Enumeration Documentation

Enumerator
NONE 
BEGIN 
END 

Constructor & Destructor Documentation

ZGen::Engine::WordAlphabet::WordAlphabet ( )
ZGen::Engine::WordAlphabet::~WordAlphabet ( )

Member Function Documentation

const char * ZGen::Engine::WordAlphabet::decode ( int  id) const
virtual

Get the name for a given index.

Parameters
[in]intThe index.
Returns
const char* Return the pointer to the name. If the index is not in legal range, NULL is returned.

Implements ZGen::Engine::MutableAlphabet.

int ZGen::Engine::WordAlphabet::encode ( const char *  name) const
virtual

Get the index of the name from the alphabet.

Parameters
[in]nameThe name string.
Returns
int The encoded index.

Implements ZGen::Engine::MutableAlphabet.

int ZGen::Engine::WordAlphabet::insert ( const char *  name)
virtual

Insert a token into the alphabet.

Parameters
[in]nameThe word string.
Returns
int Return 1 if the word doesn't exist in the alphabet, otherwise 0.

Implements ZGen::Engine::MutableAlphabet.

bool ZGen::Engine::WordAlphabet::load ( std::istream &  ifs)

Load the word engine from input file stream.

Parameters
[in]ifsThe input word stream.
bool ZGen::Engine::WordAlphabet::save ( std::ostream &  ofs) const

Friends And Related Function Documentation

friend class boost::serialization::access
friend

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