Beispiel #1
0
 def add2bow(self, doc):
     docbow = r.entry2bow(doc)
     self.bow = [(e, f + h) for e, f in self.bow for g, h in docbow
                 if e == g]
     es = [e for e, _ in self.bow]
     self.bow += filter(lambda (g, h): not g in es,
                        docbow) if self.bow != [] else docbow
Beispiel #2
0
 def subfrombow(self, doc):
     docbow = r.entry2bow(doc)
     self.bow = [(e, f - h) for e, f in self.bow for g, h in docbow
                 if e == g]
     self.bow = filter(lambda (e, f): f > 0, self.bow)
Beispiel #3
0
 def subfrombow(self, doc):
     docbow = r.entry2bow(doc)
     self.bow = [(e,f-h) for e,f in self.bow for g,h in docbow if e == g]
     self.bow = filter(lambda (e,f): f > 0, self.bow)
Beispiel #4
0
 def add2bow(self, doc):
     docbow = r.entry2bow(doc)
     self.bow = [(e,f+h) for e,f in self.bow for g,h in docbow if e == g]
     es = [e for e,_ in self.bow]
     self.bow += filter(lambda (g,h): not g in es, docbow) if self.bow != [] else docbow