#include <include/EST_simplestats.h>
Public Member Functions | |
| EST_Discrete (const EST_Discrete &d) | |
| EST_Discrete (const EST_StrList &vocab) | |
| Initialise discrete class from given list of strings. | |
| void | copy (const EST_Discrete &d) |
| bool | init (const EST_StrList &vocab) |
| (re-)initialise | |
| const int | length (void) const |
| The number of members in the discrete. | |
| const int | index (const EST_String &n) const |
| const EST_String & | name (const int n) const |
| The name given the index. | |
| void | def_val (const EST_String &v) |
| set the default value when a name isn't found (-1 by default) | |
| int | name (const EST_String &n) const |
| An alternative method for getting the int form the name. | |
| bool | operator== (const EST_Discrete &d) |
| bool | operator!= (const EST_Discrete &d) |
| EST_String | print_to_string (int quote=0) |
| EST_Discrete & | operator= (const EST_Discrete &a) |
Friends | |
| ostream & | operator<< (ostream &s, const EST_Discrete &d) |
A class for managing mapping string names to integers and back again, mainly used for representing alphabets in n-grams and grammars etc.
This offers an efficient way of mapping a known set of string names to integers. It is initialised from a list of names and builds a index of those names to a set of integers.
Definition at line 61 of file EST_simplestats.h.
|
inline |
The int assigned to the given name, if it doesn't exists p_def_val is returned (which is -1 by default)
Definition at line 88 of file EST_simplestats.h.