Пример #1
0
 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
Пример #2
0
    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
Пример #3
0
    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
Пример #4
0
 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