def retrieve_target(self, entity): combinedField = ' . '.join([ utils.translate(entity._getattr(field, ""), ' . ') for field in self.fields ]) logger.debug('combinedField {0}'.format(combinedField)) result = [t for r, t in self.p.iteritems() if r.search(combinedField)] return result
def predict(self, entity, fields): total = 0 for field in fields: value = translate(getattr(entity, field, '')) if not value: continue allTokens = self._process(value) entity._raws.update(allTokens) entity._features.update([self._get_or_new_panda(t) for t in allTokens]) total += len(allTokens) return total
def predict(self, entity, fields): total = 0 for field in fields: value = translate(getattr(entity, field, '')) if not value: continue allTokens = self._process(value) entity._raws.update(allTokens) entity._features.update( [self._get_or_new_panda(t) for t in allTokens]) total += len(allTokens) return total
def retrieve_target(self, entity): combinedField = ' . '.join([utils.translate(entity._getattr(field, ""), ' . ') for field in self.fields]) logger.debug('combinedField {0}'.format(combinedField)) result = [t for r, t in self.p.iteritems() if r.search(combinedField)] return result