28 #ifndef GUM_LEARNING_DB_TRANSLATOR_H 29 #define GUM_LEARNING_DB_TRANSLATOR_H 113 template <
template <
typename >
class ALLOC = std::allocator >
140 template <
template <
typename >
class XALLOC >
143 const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
144 const bool editable_dictionary =
true,
145 std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
163 const bool editable_dictionary =
true,
164 std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
321 ALLOC< std::pair< std::size_t, std::size_t > > >
392 ALLOC< std::pair< float, std::string > > >
The union class for storing the translated values in learning databases.
Bijection< std::size_t, std::string, ALLOC< std::pair< float, std::string > > > _back_dico
the bijection relating back translated values and their original strings.
Base class for every random variable.
DBTranslatedValue operator<<(const std::string &str)
alias for method translate
ALLOC< DBTranslatedValue > allocator_type
type for the allocators passed in arguments of methods
virtual DBTranslatedValue missingValue() const =0
returns the translation of a missing value
std::size_t _max_dico_entries
the maximum number of entries that the dictionary is allowed to contain
virtual DBTranslatedValue translate(const std::string &str)=0
returns the translation of a string
virtual std::string translateBack(const DBTranslatedValue translated_val) const =0
returns the original value for a given translation
void setVariableName(const std::string &str) const
sets the name of the variable stored into the translator
virtual const Variable * variable() const =0
returns the variable stored into the translator
gum is the global namespace for all aGrUM entities
DBTranslator(DBTranslatedValueType val_type, const std::vector< std::string, XALLOC< std::string > > &missing_symbols, const bool editable_dictionary=true, std::size_t max_dico_entries=std::numeric_limits< std::size_t >::max(), const allocator_type &alloc=allocator_type())
default constructor
virtual DBTranslator< ALLOC > * clone() const =0
virtual copy constructor
The union class for storing the translated values in learning databases.
The class for generic Hash Tables.
virtual ~DBTranslator()
destructor
The base class for all the tabular databases' cell translators.
virtual bool needsReordering() const =0
indicates whether a reordering is needed to make the translations sorted
Representation of a setA Set is a structure that contains arbitrary elements.
const Set< std::string, ALLOC< std::string > > & missingSymbols() const
returns the set of missing symbols taken into account by the translator
allocator_type getAllocator() const
returns the allocator used by the translator
bool isMissingValue(const DBTranslatedValue &val) const
indicates whether a translated value corresponds to a missing value
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
Set< std::string, ALLOC< std::string > > _missing_symbols
the set of missing symbols
The base class for all the tabular database cell translators.
DBTranslator< ALLOC > & operator=(const DBTranslator< ALLOC > &from)
copy operator
virtual void setEditableDictionaryMode(bool new_mode)
sets/unset the editable dictionary mode
DBTranslatedValueType _val_type
the type of the values translated by the translator
bool _is_dictionary_dynamic
indicates whether the dictionary can be updated or not
virtual std::size_t domainSize() const =0
returns the domain size of a variable corresponding to the translations
Set of pairs of elements with fast search for both elements.
std::string operator>>(const DBTranslatedValue translated_val)
alias for method translateBack
Base class for random variable.
virtual HashTable< std::size_t, std::size_t, ALLOC< std::pair< std::size_t, std::size_t > > > reorder()=0
performs a reordering of the dictionary and returns a mapping from the old translated values to the n...
virtual bool hasEditableDictionary() const
indicates whether the translator has an editable dictionary or not
bool isMissingSymbol(const std::string &str) const
indicates whether a string corresponds to a missing symbol
void setVariableDescription(const std::string &str) const
sets the name of the variable stored into the translator
DBTranslatedValueType getValType() const
returns the type of values handled by the translator
Set of pairs of elements with fast search for both elements.