31 #ifndef GUM_LEARNING_DB_TRANSLATOR_H 32 #define GUM_LEARNING_DB_TRANSLATOR_H 116 template <
template <
typename >
class ALLOC = std::allocator >
143 template <
template <
typename >
class XALLOC >
146 const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
147 const bool editable_dictionary =
true,
148 std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
166 const bool editable_dictionary =
true,
167 std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
324 ALLOC< std::pair< std::size_t, std::size_t > > >
395 ALLOC< std::pair< float, std::string > > >
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.