Пример #1
0
 def test_04_raw_save_not_indexed(self):
     s = Sentence(text=u'home pianokonsertto')
     s.save_base(raw=True) # prevent automatic indexing
     self.assertFalse([e.meaning for e in s.index_entries.all()])
     f=self.assertWordFrequency
     f(0, 'fi:home', 'en:home', 'en:piano', 'fi:piano', 'fi:konsertto')
     IndexEntry.objects.create_for_instance(s)
     s.delete()
Пример #2
0
    def test_06_index_instance(self):
        s = Sentence(text=u'home pianokonsertto')
        s.save_base(raw=True) # prevent automatic indexing
        result = IndexEntry.objects.create_for_instance(s)
        self.assertIndexEntries(
            s.index_entries.all(),
            1, self.mold_fungus, self.home, 2, self.piano, self.concerto)
        f=self.assertWordFrequency

        ## frequency counting currently disabled, not possible to
        ## implement consistently in the current model
        #f(1, 'fi:home', 'en:home', 'en:piano', 'fi:piano', 'fi:konsertto')
        f(0, 'fi:home', 'en:home', 'en:piano', 'fi:piano', 'fi:konsertto')

        s.delete()