50#ifndef GUM_LEARNING_DB_TRANSLATOR_H
51#define GUM_LEARNING_DB_TRANSLATOR_H
157 const bool is_lossless,
158 const std::vector< std::string >& missing_symbols,
159 const bool editable_dictionary =
true,
160 std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max());
174 const bool is_lossless,
175 const bool editable_dictionary =
true,
176 std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max());
The union class for storing the translated values in learning databases.
The base class for all the tabular databases' cell translators.
Set of pairs of elements with fast search for both elements.
The class for generic Hash Tables.
Base class for every random variable.
DBTranslator(DBTranslatedValueType val_type, const bool is_lossless, const std::vector< std::string > &missing_symbols, const bool editable_dictionary=true, std::size_t max_dico_entries=std::numeric_limits< std::size_t >::max())
default constructor
virtual std::string translateBack(const DBTranslatedValue translated_val) const =0
returns the original value for a given translation
Bijection< std::size_t, std::string > back_dico_
the bijection relating back translated values and their original strings.
virtual const Variable * variable() const =0
returns the variable stored into the translator
virtual std::size_t domainSize() const =0
returns the domain size of a variable corresponding to the translations
bool is_lossless_
indicates whether the translation is lossless (e.g., ranges) or not
void setVariableName(const std::string &str) const
sets the name of the variable stored into the translator
virtual bool needsReordering() const =0
indicates whether a reordering is needed to make the translations sorted
std::size_t max_dico_entries_
the maximum number of entries that the dictionary is allowed to contain
bool isMissingValue(const DBTranslatedValue &val) const
indicates whether a translated value corresponds to a missing value
DBTranslatedValueType val_type_
the type of the values translated by the translator
DBTranslator(const DBTranslator &from)
copy constructor
virtual DBTranslatedValue translate(const std::string &str)=0
returns the translation of a string
virtual void setEditableDictionaryMode(bool new_mode)
sets/unset the editable dictionary mode
virtual DBTranslator * clone() const =0
virtual copy constructor
std::string operator>>(const DBTranslatedValue translated_val)
alias for method translateBack
Set< std::string > missing_symbols_
the set of missing symbols
bool isMissingSymbol(const std::string &str) const
indicates whether a string corresponds to a missing symbol
virtual const Bijection< std::size_t, std::string > & getDictionary() const
returns the translation from database indices to input strings
const Set< std::string > & missingSymbols() const
returns the set of missing symbols taken into account by the translator
DBTranslatedValue operator<<(const std::string &str)
alias for method translate
DBTranslator(DBTranslator &&from)
move constructor
bool isLossless() const
returns a Boolean indicating whether the translation is lossless or not
virtual HashTable< 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 ~DBTranslator()
destructor
virtual bool hasEditableDictionary() const
indicates whether the translator has an editable dictionary or not
void setVariableDescription(const std::string &str) const
sets the name of the variable stored into the translator
bool is_dictionary_dynamic_
indicates whether the dictionary can be updated or not
virtual DBTranslatedValue missingValue() const =0
returns the translation of a missing value
DBTranslatedValueType getValType() const
returns the type of values handled by the translator
DBTranslator & operator=(const DBTranslator &from)
copy operator
DBTranslator(DBTranslatedValueType val_type, const bool is_lossless, const bool editable_dictionary=true, std::size_t max_dico_entries=std::numeric_limits< std::size_t >::max())
default constructor without missing symbols
DBTranslator & operator=(DBTranslator &&from)
move operator
DBTranslatedValueType
The nature of the elements handled by translators (discrete, continuous).
include the inlined functions if necessary
gum is the global namespace for all aGrUM entities
The union class for storing the translated values in learning databases.
Base class for random variable.