How to use the alephclient.services.entityextract_pb2.ExtractedEntity.IBAN function in alephclient

To help you get started, we’ve selected a few alephclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alephdata / aleph / services / extract-entities / entityextractor / result.py View on Github external
self.countries = [geocoder.region_code_for_number(number)]
            self.label = phonenumbers.format_number(number, self.FORMAT)
            self.key = self.label

    def _parse(self, number, region=None):
        try:
            num = phonenumbers.parse(number, region)
            if phonenumbers.is_possible_number(num):
                if phonenumbers.is_valid_number(num):
                    return num
        except phonenumbers.NumberParseException:
            pass


class IBANResult(Result):
    category = ExtractedEntity.IBAN

    def __init__(self, ctx, label, start, end):
        super(IBANResult, self).__init__(ctx, label, start, end)
        try:
            iban = IBAN(label)
            self.key = self.label = iban.compact
            self.countries = [iban.country_code]
        except ValueError:
            self.valid = False