def provide_response(query): response = "" print('received json: ' + query) # while "computer" in clean_string: clean_string = query['data'].replace("computer", "") print clean_string wit_response = speech_response.wit_call(clean_string) print wit_response response = speech_response.choose_response(recipe, wit_response, None) print response emit('saythis', {'data': response})
def find_response(json): global recipe response = "" try: print('received json: ' + json['data']) # while "computer" in clean_string: clean_string = json['data'].replace("computer", "") print clean_string wit_response = speech_response.wit_call(clean_string) print wit_response response = speech_response.choose_response(recipe, wit_response, None) print response emit('saythis', {'data': response}) except: print "too fast too furious"