机器人语音问题

问题描述

我正在开发一个包含聊天机器人的项目,我正在使用“ Sapi.h”。 该代码会在屏幕上显示一条合适的消息,然后让机器人说出来,当然还要输入类似的信息,例如,机器人在激活时将执行以下操作: “您好,我该如何帮助您” --->最近的语音留言->用户输入。 但是会发生什么,当前两个语句运行时,它们不是同时运行的,我希望用户在机器人正在拼写他应该说的短语的同时键入他的问题。 BotActivationFunction:

    void ChatBotActivate(Pharmacy P)
{
    srand(time(0));
    //This Is The Opening message
    string Greeting_Message = Sentences[0][rand() % 2];
    cout << Greeting_Message << endl;
    //the object bot_voice which will basically call the function speakphrase who's responsible on spelling the phrase
    Bot_Voice->SpeakPhrase(Conv(Greeting_Message));
    //while the customer didn't finish with all his questions
    while (true)
    {
        string CustomerQuestion;
        //the GetLine is not showing inputed words until the bot has finished speaking
        getline(cin,CustomerQuestion);
        std::vector<string> Tmp = SliceString(CustomerQuestion);
        auto Thank_Search = std::find_if(Tmp.begin(),Tmp.end(),[](string S) {return InSensitiveComparison(S,"Thank"); });
        auto Thanks_Search = std::find_if(Tmp.begin(),"Thanks"); });
        if (Thank_Search != Tmp.end() || Thanks_Search != Tmp.end())
        {
            cout << Sentences[2][0] << endl;
            Bot_Voice->SpeakPhrase(Conv(Sentences[2][0]));
            break;
        }
        //won't include answer customer because it's pretty long
        AnswerCustomer(CustomerQuestion,P);
    }
}

尝试使用std :: thread进行操作,但即使我尝试使用std :: thread(Constructor)从一个lambda调用成员函数,它似乎也不适用于对象成员函数。

无论如何,我可以使用std :: getline或std :: thread来解决此问题

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...