Exemple #1
0
 def make_index(cls, value):
   # Add whole sentence
   final_idx = [value[:x] for x in range(cls.MIN_CHARS, len(value)+1)]
   
   # Do segmenting and remove first word
   words = polish_word_segmenter.segment(value)
   words -= set([value.split()[0]])
   for word in words:
     final_idx.extend((word[:x] for x in range(cls.MIN_CHARS, len(word)+1)))
   
   return final_idx
Exemple #2
0
 def make_index(self):
   idx = polish_word_segmenter.segment(self.title)
   idx.add(self.title.lower().strip())
   
   for x in [x.product for x in RecipeIngr.all().ancestor(self).fetch(20)]:
     idx |= polish_word_segmenter.segment(x)
     idx.add(x.lower().strip())
   
   for x in self.tags:
     idx |= polish_word_segmenter.segment(x)
     idx.add(x.lower().strip())
   
   idx |= set([
     u'autor:"%s"' % self.parent_key().name(),
     u'faza:"%s"' % self.phase,
     u'kategoria:"%s"' % CATEGORIES_SV[self.category],
     u'typ:"%s"' % self.type,
     u'czas:"%s"' % self.time
   ])
   
   idx -= set([u''])
   
   return list(idx)