Model with dynamic data added at runtime.
More...
#include <DynamicModel.hpp>
|
virtual | ~DynamicModel ()=default |
|
auto | name () const -> std::string const & |
| Name of this particular instance.
|
|
void | addData (std::string const &slotName, std::string value, std::vector< std::string > phoneticTranscriptions={}) |
| Adds data to slot slotName .
|
|
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()
|
|
void | removeData (std::string const &slotName, std::string const &exactValue) |
| Removes the value exactValue from slot slotName .
|
|
void | removeData (std::string const &slotName, std::function< bool(std::string const &)> predicate) |
| Removes every value that matches predicate from slot slotName .
|
|
void | clearData () |
| Removes all values for every slot.
|
|
virtual void | compile ()=0 |
| Mandatory step before applying the model on a recognizer.
|
|
|
std::string | _name |
|
std::unordered_map< std::string, std::vector< std::vector< std::string > > > | _data |
|
Model with dynamic data added at runtime.
◆ DynamicModel()
DynamicModel::DynamicModel |
( |
std::string |
name | ) |
|
|
explicitprotectednoexcept |
◆ ~DynamicModel()
virtual Vsdk::Asr::DynamicModel::~DynamicModel |
( |
| ) |
|
|
virtualdefault |
◆ name()
auto DynamicModel::name |
( |
| ) |
const -> std::string const & |
Name of this particular instance.
◆ addData() [1/2]
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:
<slotName>: "value_1" | "value_2" | ...;
- Note
- Adding the same value twice will overwrite the previous value and phonetic transcriptions. Empty values are ignored altogether.
- Warning
- Some engines do not support custom phonetic (either one or multiple), refer to the particular engine documentation for more information.
◆ addData() [2/2]
template<typename T >
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()
◆ removeData() [1/2]
void DynamicModel::removeData |
( |
std::string const & |
slotName, |
|
|
std::string const & |
exactValue |
|
) |
| |
Removes the value exactValue
from slot slotName
.
◆ removeData() [2/2]
void DynamicModel::removeData |
( |
std::string const & |
slotName, |
|
|
std::function< bool(std::string const &)> |
predicate |
|
) |
| |
Removes every value that matches predicate
from slot slotName
.
◆ clearData()
void DynamicModel::clearData |
( |
| ) |
|
Removes all values for every slot.
◆ compile()
virtual void Vsdk::Asr::DynamicModel::compile |
( |
| ) |
|
|
pure virtual |
Mandatory step before applying the model on a recognizer.
◆ configure()
virtual void Vsdk::Asr::DynamicModel::configure |
( |
nlohmann::json const & |
| ) |
|
|
protectedvirtual |
◆ _name
std::string Vsdk::Asr::DynamicModel::_name |
|
protected |
◆ _data
std::unordered_map<std::string, std::vector<std::vector<std::string> > > Vsdk::Asr::DynamicModel::_data |
|
protected |