def process_input(self, *args, **kwargs): """ Read the user's input from the terminal. """ print '>>> User :' user_input = input_function() return Statement(user_input)
def get_feedback(): text = input_function() if 'yes' in text.lower(): return False elif 'no' in text.lower(): return True else: print('Please type either "Yes" or "No"') return get_feedback
def get_feedback(): from chatterbot.utils import input_function text = input_function() if 'y' in text.lower(): return True elif 'n' in text.lower(): return False else: print('Please type either "Y" or "N"') return get_feedback()
def get_feedback(): from chatterbot.utils import input_function text = input_function() if 'yes' in text.lower(): return True elif 'no' in text.lower(): return False else: return get_feedback()
def get_feedback(): from chatterbot.utils import input_function text = input_function() if 'yes' in text.lower(): return False elif 'no' in text.lower(): return True else: print('Please type either "Yes" or "No"') return get_feedback()
def get_feedback(): from chatterbot.utils import input_function text = input_function() if 'Yes' in text: return True elif 'No' in text: return False else: print('Please type either "Yes" or "No"') return get_feedback()
def get_feedback(): from chatterbot.utils import input_function text = input_function() if 'yes' in text.lower(): return True elif 'no' in text.lower(): return False else: print("Please type either 'Yes' or 'No'") return get_feedback()
def get_feedback(): """Get feedback about new conversation.""" from chatterbot.utils import input_function text = input_function() if 'yes' in text.lower(): return False elif 'no' in text.lower(): return True else: print("Please type either 'yes' or 'no' ") return get_feedback()
def process_input(self, *args, **kwargs): user_input = input_function() connection = pika.BlockingConnection() channel = connection.channel() channel.queue_declare(queue='Input') channel.basic_publish(exchange='', routing_key='Input', body=user_input) connection.close() print('[QUESTION] {}'.format(user_input)) return Statement(user_input)
def get_feedback(): from chatterbot.utils import input_function text = input_function() if 'yes' in text.lower(): return False elif 'no' in text.lower(): return True elif 'maybe' in text.lower(): print('ok') else: print('Please type either "Yes" or "No"') return get_feedback()
def get_betterResponse(input_statement, CONVERSATION_ID): from chatterbot.utils import input_function print('\n What would be a better response?\n') betterResponse = input_function() if len(betterResponse) > 1: betterResponse1 = chatbot.input.process_input_statement(betterResponse) chatbot.learn_response(betterResponse1, input_statement) # Update the conversation history for the bot chatbot.storage.add_to_conversation(CONVERSATION_ID, input_statement, betterResponse1) print('conv_id', CONVERSATION_ID, 'input', input_statement, 'Response', betterResponse, '\n') chatbot.output.process_response(betterResponse1) return True else: return False
def get_feedback(): from chatterbot.utils import input_function text = input_function() if 'Yes' in text: return True elif 'No' in text: return False else: print('Please type either "Yes" or "No"') return get_feedback print('Type something to begin...') # 每次用户有输入内容,这个循环就会开始执行 while True: try: input_statement = bot.input.process_input_statement() statement,response = bot.generate_response(input_statement,DEFAULT_SESSION_ID) print('\n Is "{}" this a cohetent response to "{}"? \n'.format(response,input_statement)) if get_feedback(): bot.learn_response(response,input_statement) bot.output.process_response(response) #更新chatbot的历史聊天数据 bot.conversation_sessions.update( bot.default_session.id_string, (statement,response, ) ) #直到按ctrl-c 或者 ctrl-d 才会退出 except (KeyboardInterrupt, EOFError, SystemExit): break
def process_input(self, *args, **kwargs): """ Read the user's input from the terminal. """ user_input = input_function() return Statement(user_input)
def process_input(self, *args, **kwargs): sys.stdout.write('[' + self.user + '] : ') sys.stdout.flush() user_input = input_function() return Statement(user_input)