12using namespace
yarp::dev;
15 m_fallback{
"Sorry, I did not get that. Can you repeat?"},
16 m_noInput{
"I heard nothing. Can you please speak up?"},
17 m_status{
"greetings"},
20 {{
"Hello!",
"Hello there."},{
"Who are you?",
"I am just a fake chatbot"},
21 {
"Goodbye!",
"Already? Ok... bye."}}
24 {{
"Hello!",
"Hello again."},{
"Who are you?",
"I am just a fake chatbot"},
25 {
"Goodbye!",
"Bye bye!"}}
34 messageOut = m_noInput;
37 if(m_qAndA[m_status].count(messageIn) < 1)
39 messageOut = m_fallback;
43 messageOut = m_qAndA[m_status][messageIn];
45 if(m_status == std::string(
"greetings"))
47 m_status =
"chatting";
55 if (language !=
"eng")
58 return ReturnValue::return_code::return_value_error_method_failed;
79 m_status =
"greetings";
const yarp::os::LogComponent & FAKECHATBOTDEVICE()
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
fakeChatBotDevice : a fake device which implements the IChatBot interface for testing purposes.
yarp::dev::ReturnValue getStatus(std::string &status) override
Gets the current status of the bot.
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue getLanguage(std::string &language) override
Gets the current chatbot language.
yarp::dev::ReturnValue interact(const std::string &messageIn, std::string &messageOut) override
Sends a message to the chatbot.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::dev::ReturnValue setLanguage(const std::string &language) override
Sets the chat bot language.
yarp::dev::ReturnValue resetBot() override
Resets the chatbot.
A base class for nested structures that can be searched.
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
The main, catch-all namespace for YARP.