Пример #1
0
void TechBot::answer() 
{
    SavePrevresponse();
    setEvent("BOT UNDERSTAND**");
    
    if(null_input())
    {
        eventManager("NULL INPUT**");
    }
    else if(null_input_repetition())
    {
        eventManager("NULL INPUT REPETITION**");
    }
    else if(isUserRepeat())
    {
        manageUserRepeat();
    }
    else if(isaskedusername())
    {
        std::cout<<"I THINK IT IS "<<user_name<<std::endl;
        return;
    }
    else
    {
        selectMatch();
    }
    
    if(user_want_to_quit())
    {
        TB_bQuitProgram = 1;
        eventManager("USER WANTS TO QUIT**");
    }
    else if(TB_Input.find("BYE")!=std::string::npos)
        return;

   else if(!isAIunderstand())
    {
        eventManager("BOT DON'T UNDERSTAND**");
       // update_unkown_input_list();
    }
    
    if(RespLISTonse.size() > 0)
    {
        chooseOutput();
        SaveAI_response();
        initPre_response();

        if(isAIRepeat())
        {
            manageRepeat();
        }
        Savelog("TechTron");
        print_response();
        //speak(TB_Response);
    }
}
Пример #2
0
void CBot::respond() 
{
	save_prev_response();
	set_event("BOT UNDERSTAND**");

	if(null_input())
	{
		handle_event("NULL INPUT**");
	}
	else if(null_input_repetition())
	{
		handle_event("NULL INPUT REPETITION**");
	}
	else if(user_repeat())
	{
		handle_user_repetition();
	}
	else
	{
		find_match();
	}

    
    if(user_want_to_quit())
	{
		m_bQuitProgram = 1;
	}

	if(!bot_understand())
	{
		handle_event("BOT DON'T UNDERSTAND**");
	}
	
	if(response_list.size() > 0) 
	{
		select_response();
		preprocess_response();

		if(bot_repeat())
		{
			handle_repetition();
		}
		print_response();
	}
}