Beispiel #1
0
	def get(self, word): 
		#data = self.db.hgetall(word)				
		self.cur.execute("select l.id lemma_id, w.value Word, w.english as English, s.value speechpart, l.value Lemma, p.value Person, t.value Tense, v.value Voice, m.value Mood, c.value \"case\", n.value Number, g.value Gender from word w left join person p on w.person_id = p.id left join tense t on w.tense_id = t.id left join voice v on w.voice_id = v.id left join mood m on w.mood_id = m.id left join \"case\" c on w.case_id = c.id left join number n on w.number_id = n.id left join gender g on w.gender_id = g.id join speechpart s on w.speechpart_id = s.id join lemma l on w.lemma_id = l.id where w.value = '%s'" % word)
		data = self.cur.fetchone()		
		data = dict(data)
		data['domains'] = set()
		sql = "select sd.value subdomain, d.value as domain from wordsindomain wd join subdomain sd on wd.subdomain_id = sd.id join domain d on sd.domainid = d.id where lemma_id = %s" % data['lemma_id']
		self.cur.execute(sql)
		results = self.cur.fetchall()
		if results:
			for result in results:
				data['domains'].update([result['domain'] + ": " + result['subdomain']])
		#data = dict(data)
		#locations = search.search(word)
		locations = lucenesearch.search(word)
		lemmaloc = lucenesearch.search_lemma(data['lemma'])
		locations = [location['hit'] for location in locations]
		lemmaloc = [location['hit'] for location in lemmaloc]
		
		self.render('word.html', word = data, locations = locations, lemmaloc = lemmaloc)
Beispiel #2
0
	def get(self, word): 
		results = lucenesearch.search(word)
		self.write(unicode(results, 'utf-8'))