def gen_ad_vec(self, ads, choice=CHOICE): # check self is ad_union # generates a vector of ads from AdVector vec = [0]*self.size() for ad in self.data: for lad in ads.data: if(ad.identical_ad(lad, choice)): vec[self.index(ad)] += 1. return vec
def gen_temp_ad_vec(self, ads, choice=CHOICE): # self is ad_union vec = [0] * ads.size() i = 0 j = 0 for ad in ads.data: for lad in self.data: if (ad.identical_ad(lad, choice)): vec[i] = self.index(lad) i += 1 return vec
def gen_temp_ad_vec(self, ads, choice=CHOICE): # self is ad_union vec = [0]*ads.size() i = 0 j = 0 for ad in ads.data: for lad in self.data: if(ad.identical_ad(lad, choice)): vec[i] = self.index(lad) i += 1 return vec
def unique(self): uniq = AdVector() for ad in self.data: present = False for un_ad in uniq.data: if (ad.identical_ad(un_ad, CHOICE)): present = True break if (not present): uniq.add(ad) return uniq
def unique(self): uniq = AdVector() for ad in self.data: present = False for un_ad in uniq.data: if(ad.identical_ad(un_ad, CHOICE)): present = True break if(not present): uniq.add(ad) return uniq