Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
|
A converter from symbols (strings) to int indices. More...
#include <symbol-table.H>
Public Member Functions | |
virtual const_iterator | begin () |
virtual const_iterator | end () |
virtual size_t | size () const |
Returns the number of symbols in this table. More... | |
virtual int | GetIndex (const string &symbol) |
Converts the specified symbol to a unique integer. More... | |
virtual const string & | GetSymbol (int index) const |
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) |
virtual void | Clear () |
Clears all symbols from this symbol table. More... | |
virtual Symbols * | Clone () const |
Creates a newly-constructed clone of this Symbols instance that has the same runtime type. More... | |
virtual ostream & | Output (ostream &os) |
Outputs the symbol table to the specified output stream in a simple format, one symbol-to-index mapping per line: More... | |
Public Member Functions inherited from reranker::Symbols | |
virtual | ~Symbols () |
Additional Inherited Members | |
Public Types inherited from reranker::Symbols | |
typedef unordered_map< string, int >::const_iterator | const_iterator |
Static Protected Attributes inherited from reranker::Symbols | |
static string | null_symbol |
A converter from symbols (strings) to int indices.
This symbol table implementation always adds symbols to its internal symbol table and never removes them.
int
’s, but underlyingly there is a static map, so multiple instances of this class are all “viewing” the same static data structure, hence the name of this Symbols implementation. Definition at line 120 of file symbol-table.H.
|
inlinevirtual |
Implements reranker::Symbols.
Definition at line 122 of file symbol-table.H.
|
inlinevirtual |
Clears all symbols from this symbol table.
Implements reranker::Symbols.
Definition at line 154 of file symbol-table.H.
|
inlinevirtual |
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.
Implements reranker::Symbols.
Definition at line 160 of file symbol-table.H.
|
inlinevirtual |
Implements reranker::Symbols.
Definition at line 123 of file symbol-table.H.
|
virtual |
Converts the specified symbol to a unique integer.
TODO(dbikel,kbhall): Protect access to static symbol table via a mutex of some kind.
symbol | the symbol to convert |
Implements reranker::Symbols.
Definition at line 54 of file symbol-table.C.
|
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.
Implements reranker::Symbols.
Definition at line 67 of file symbol-table.C.
|
inlinevirtual |
Outputs the symbol table to the specified output stream in a simple format, one symbol-to-index mapping per line:
where
os | the output stream to which to output the symbol table |
Implements reranker::Symbols.
Definition at line 165 of file symbol-table.H.
|
inlinevirtual |
Implements reranker::Symbols.
Definition at line 141 of file symbol-table.H.
|
inlinevirtual |
Returns the number of symbols in this table.
Implements reranker::Symbols.
Definition at line 126 of file symbol-table.H.