コード例 #1
0
    def post(self):
	self.response.headers['Content-Type'] = 'text/html'
	query_str = self.request.get('query')
	nouns = validator.nouns(query_str)
	topics = []
	names = []
	for noun in nouns:
	    topic,name = validator.topic(noun)
	    topics.append(topic)
	    names.append(name)
	score = validator.score(query_str, topics)
	template = JINJA_ENVIRONMENT.get_template('truth.jinja')
	self.response.write(template.render(
		{'query':query_str, 'topics':names, 
			'score':score, 'nouns':nouns}))
コード例 #2
0
    def get(self):
	self.response.headers['Content-Type'] = 'text/html'
	queries = lapi.til()
	logging.info(queries)
	results = []
	for query_str in queries:
	    nouns = validator.nouns(query_str)
	    topics = []
	    names = []
	    for noun in nouns:
	        topic,name = validator.topic(noun)
	        topics.append(topic)
	        names.append(name)
	    score = validator.score(query_str, topics)
	    results.append({'title':query_str,'score':score})
	logging.info('RESULTS!!!')
	logging.info(results)
	template = JINJA_ENVIRONMENT.get_template('reddit.jinja')
	self.response.write(template.render({'results':results}))