def index(request): r = Result(request.body) print "request.body : %s" % request.body t = Tropo() answer = r.getInterpretation() value = r.getValue() t.say("You said " + answer + ", which is a " + value) actions_options_array = ['name', 'attempts', 'disposition', 'confidence', 'interpretation', 'utterance', 'value', 'concept', 'xml', 'uploadStatus'] actions = r.getActions() if (type (actions) is list): for item in actions: for opt in actions_options_array: print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % {'actionfieldname':opt, "vaalue":item.get(opt,'NoValue')} print '------------------------------' else: dict = actions for opt in actions_options_array: print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % {'actionfieldname':opt, "vaalue":dict.get(opt,'NoValue')} json = t.RenderJson() print json return json
def index(request): r = Result(request.body) print "request.body : %s" % request.body t = Tropo() answer = r.getInterpretation() value = r.getValue() answer1 = r.getNamedActionInterpretation("directory") value1 = r.getNamedActionValue("directory") t.say("You said " + answer1 + ", which is a " + value1) answer2 = r.getNamedActionInterpretation("color") value2 = r.getNamedActionValue("color") t.say("You also said " + answer2 + ", which is a " + value2) count = r.getActionsCount() t.say("actions count is " + str(count)) for i in range(count): answer = r.getIndexdedInterpretation(i) value = r.getIndexedValue(i) t.say("You said " + answer + ", which is a " + value) actions_options_array = [ 'name', 'attempts', 'disposition', 'confidence', 'interpretation', 'utterance', 'value', 'concept', 'xml', 'uploadStatus' ] actions = r.getActions() if (type(actions) is list): for item in actions: for opt in actions_options_array: print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % { 'actionfieldname': opt, "vaalue": item.get(opt, 'NoValue') } print '------------------------------' else: dict = actions for opt in actions_options_array: print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % { 'actionfieldname': opt, "vaalue": dict.get(opt, 'NoValue') } json = t.RenderJson() print json return json
def index(request): r = Result(request.body) print "request.body : %s" % request.body t = Tropo() answer = r.getInterpretation() value = r.getValue() answer1 = r.getNamedActionInterpretation("directory") value1 = r.getNamedActionValue("directory") t.say("You said " + answer1 + ", which is a " + value1) answer2 = r.getNamedActionInterpretation("color") value2 = r.getNamedActionValue("color") t.say("You also said " + answer2 + ", which is a " + value2) count= r.getActionsCount() t.say("actions count is " + str(count)) for i in range(count): answer = r.getIndexdedInterpretation(i) value = r.getIndexedValue(i) t.say("You said " + answer + ", which is a " + value) actions_options_array = ['name', 'attempts', 'disposition', 'confidence', 'interpretation', 'utterance', 'value', 'concept', 'xml', 'uploadStatus'] actions = r.getActions() if (type (actions) is list): for item in actions: for opt in actions_options_array: print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % {'actionfieldname':opt, "vaalue":item.get(opt,'NoValue')} print '------------------------------' else: dict = actions for opt in actions_options_array: print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % {'actionfieldname':opt, "vaalue":dict.get(opt,'NoValue')} json = t.RenderJson() print json return json
def index(request): r = Result(request.body) print "request.body : %s" % request.body t = Tropo() answer = r.getInterpretation() value = r.getValue() t.say("You said " + answer + ", which is a " + value) actions_options_array = [ 'name', 'attempts', 'disposition', 'confidence', 'interpretation', 'utterance', 'value', 'concept', 'xml', 'uploadStatus' ] actions = r.getActions() if (type(actions) is list): for item in actions: for opt in actions_options_array: print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % { 'actionfieldname': opt, "vaalue": item.get(opt, 'NoValue') } print '------------------------------' else: dict = actions for opt in actions_options_array: print 'action object filed %(actionfieldname)s\'s value is %(vaalue)s' % { 'actionfieldname': opt, "vaalue": dict.get(opt, 'NoValue') } json = t.RenderJson() print json return json