Ejemplo n.º 1
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();
	}
}
Ejemplo n.º 2
0
string ofxEliza::ask(string _inputString){
    // gets input from the user
    save_prev_input();
    m_sInput = _inputString;
    saveLog("USER");
    
    // Finds and display a response
    // to the current input of the user.
    // removes punctuation from the input
    // and do some more preprocessing
    if(m_sInput.length() > 0) {
		tok.cleanString(m_sInput, " ?!,;");
		trimRight(m_sInput, '.');
		UpperCase(m_sInput);
		m_sInput.insert(0, " ");
		m_sInput.append(" ");
	}
    
    save_prev_responses();
    save_prev_response();
    
    if(null_input()) {
        handle_null_input();
    } else if(user_repeat()) {
        handle_user_repetition();
    } else if(short_input()) {
        handle_short_input();
    }
    else {
        reset_repeat_count();
        reset_short_input_count();
        find_response();
    }
    
    select_response();
    preProcessResponse();
    handle_repetition();
    
    saveLog("ELIZA");
    
    return m_sResponse;
}
Ejemplo n.º 3
0
// these function finds and display a response 
// to the current input of the user.
void Eliza::respond() {
	preProcessInput();

	save_prev_responses();
	save_prev_response();

	if(null_input()) {
		handle_null_input();
	} else if(user_repeat()) {
		handle_user_repetition();
	} else {
		reset_repeat_count();
		find_response();
	}
	
	select_response();
	preProcessResponse();
	check_quit_message();
	handle_repetition();
	
	print_response();
	save_log("ELIZA");
}