Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Protected Attributes | List of all members
reranker::Symbols Class Referenceabstract

An interface specifying a converter from symbols (strings) to int indices. More...

#include <symbol-table.H>

Inheritance diagram for reranker::Symbols:
reranker::LocalSymbolTable reranker::StaticSymbolTable

Public Types

typedef unordered_map< string,
int >::const_iterator 
const_iterator
 

Public Member Functions

virtual ~Symbols ()
 
virtual const_iterator begin ()=0
 
virtual const_iterator end ()=0
 
virtual size_t size () const =0
 Returns the number of symbols in this table. More...
 
virtual int GetIndex (const string &symbol)=0
 Converts the specified symbol to a unique integer. More...
 
virtual const string & GetSymbol (int index) const =0
 Returns the unique symbol for the specified index, or the empty string if the specified index does not map to any symbol in this symbol table. More...
 
virtual void SetIndex (const string &symbol, int index)=0
 
virtual void Clear ()=0
 Clears all symbols from this symbol table. More...
 
virtual SymbolsClone () const =0
 Creates a newly-constructed clone of this Symbols instance that has the same runtime type. More...
 
virtual ostream & Output (ostream &os)=0
 Outputs the symbol table to the specified output stream in a simple format, one symbol-to-index mapping per line: More...
 

Static Protected Attributes

static string null_symbol
 

Detailed Description

An interface specifying a converter from symbols (strings) to int indices.

Definition at line 57 of file symbol-table.H.

Member Typedef Documentation

typedef unordered_map<string, int>::const_iterator reranker::Symbols::const_iterator

Definition at line 60 of file symbol-table.H.

Constructor & Destructor Documentation

virtual reranker::Symbols::~Symbols ( )
inlinevirtual

Definition at line 59 of file symbol-table.H.

Member Function Documentation

virtual const_iterator reranker::Symbols::begin ( )
pure virtual
virtual void reranker::Symbols::Clear ( )
pure virtual

Clears all symbols from this symbol table.

Implemented in reranker::LocalSymbolTable, and reranker::StaticSymbolTable.

virtual Symbols* reranker::Symbols::Clone ( ) const
pure virtual

Creates a newly-constructed clone of this Symbols instance that has the same runtime type.

The caller will be responsible for destroying the returned instance.

Returns
a clone of this Symbols instance that has the same runtime type

Implemented in reranker::LocalSymbolTable, and reranker::StaticSymbolTable.

virtual const_iterator reranker::Symbols::end ( )
pure virtual
virtual int reranker::Symbols::GetIndex ( const string &  symbol)
pure virtual

Converts the specified symbol to a unique integer.

The behavior of this class is undefined if the specified symbol is the empty string.

Parameters
symbolthe symbol to convert
Returns
a unique integer for the specified symbol

Implemented in reranker::LocalSymbolTable, and reranker::StaticSymbolTable.

virtual const string& reranker::Symbols::GetSymbol ( int  index) const
pure virtual

Returns the unique symbol for the specified index, or the empty string if the specified index does not map to any symbol in this symbol table.

Implemented in reranker::LocalSymbolTable, and reranker::StaticSymbolTable.

virtual ostream& reranker::Symbols::Output ( ostream &  os)
pure virtual

Outputs the symbol table to the specified output stream in a simple format, one symbol-to-index mapping per line:

<symbol> <tab> <index>

where

<symbol> ::= an indexed string symbol
<tab> ::= a tab character, '\t'
<index> ::= a unique integer for <symbol>
Parameters
osthe output stream to which to output the symbol table
Returns
the specified output stream

Implemented in reranker::LocalSymbolTable, and reranker::StaticSymbolTable.

virtual void reranker::Symbols::SetIndex ( const string &  symbol,
int  index 
)
pure virtual
virtual size_t reranker::Symbols::size ( ) const
pure virtual

Returns the number of symbols in this table.

Implemented in reranker::LocalSymbolTable, and reranker::StaticSymbolTable.

Member Data Documentation

string reranker::Symbols::null_symbol
staticprotected

Definition at line 106 of file symbol-table.H.


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