Model with dynamic data added at runtime. More...
Public Member Functions | |
virtual | ~DynamicModel ()=default |
auto | name () const -> std::string const & |
Name of this particular instance. More... | |
void | addData (std::string const &slotName, std::string value, std::vector< std::string > phoneticTranscriptions={}) |
Adds data to slot slotName . More... | |
void | addData (std::string const &slotName, char const *value, std::vector< std::string > phoneticTranscriptions={}) |
template<typename T > | |
void | addData (std::string const &slotName, T &&t, std::vector< std::string > phoneticTranscriptions={}) |
Overload that takes any value that's convertible to std::string through std::to_string() More... | |
void | removeData (std::string const &slotName, std::string const &exactValue) |
Removes the value exactValue from slot slotName . More... | |
void | removeData (std::string const &slotName, std::function< bool(std::string const &)> predicate) |
Removes every value that matches predicate from slot slotName . More... | |
void | clearData () |
Removes all values for every slot. More... | |
virtual void | compile ()=0 |
Mandatory step before applying the model on a recognizer. More... | |
Protected Member Functions | |
DynamicModel (std::string name) noexcept | |
virtual void | configure (nlohmann::json const &) |
Protected Attributes | |
std::string | _name |
std::unordered_map< std::string, std::vector< std::vector< std::string > > > | _data |
Model with dynamic data added at runtime.
|
explicitprotectednoexcept |
|
virtualdefault |
auto DynamicModel::name | ( | ) | const -> std::string const & |
Name of this particular instance.
void DynamicModel::addData | ( | std::string const & | slotName, |
std::string | value, | ||
std::vector< std::string > | phoneticTranscriptions = {} |
||
) |
Adds data to slot slotName
.
Combining all data for a given slot is equivalent to writing the following rule in your grammar:
void DynamicModel::addData | ( | std::string const & | slotName, |
char const * | value, | ||
std::vector< std::string > | phoneticTranscriptions = {} |
||
) |
void Vsdk::Asr::DynamicModel::addData | ( | std::string const & | slotName, |
T && | t, | ||
std::vector< std::string > | phoneticTranscriptions = {} |
||
) |
Overload that takes any value that's convertible to std::string
through std::to_string()
void DynamicModel::removeData | ( | std::string const & | slotName, |
std::string const & | exactValue | ||
) |
Removes the value exactValue
from slot slotName
.
void DynamicModel::removeData | ( | std::string const & | slotName, |
std::function< bool(std::string const &)> | predicate | ||
) |
Removes every value that matches predicate
from slot slotName
.
void DynamicModel::clearData | ( | ) |
Removes all values for every slot.
|
pure virtual |
Mandatory step before applying the model on a recognizer.
|
protectedvirtual |
|
protected |
|
protected |