Пример #1
0
def ask(request):
	if request.method=='GET':
		return render_to_response('ask.html')
	else:
		question = request.POST.get('question').replace("'s", "")
		key = md5.new(question).hexdigest()
		parse = phoenix.parse(question, dir="nlu/lib/Phoenix/FamilyGrammar", net="REL.net")
		cache.set(key, parse, 60*60)
		return render_to_response('ask.html', 
			{'message':pprint.pformat(parse), 'key':key,
			 'payload':simplejson.dumps(parse), 'question':request.POST.get('question','')}
		)
Пример #2
0
def ask(request):
    if request.method == 'GET':
        return render_to_response('ask.html')
    else:
        question = request.POST.get('question').replace("'s", "")
        key = md5.new(question).hexdigest()
        parse = phoenix.parse(question,
                              dir="nlu/lib/Phoenix/FamilyGrammar",
                              net="REL.net")
        cache.set(key, parse, 60 * 60)
        return render_to_response(
            'ask.html', {
                'message': pprint.pformat(parse),
                'key': key,
                'payload': simplejson.dumps(parse),
                'question': request.POST.get('question', '')
            })
Пример #3
0
import phoenix
import pprint

pprint.pprint( phoenix.parse("i want to go from denver to logan airport the morning of july second", "../Grammar/") )