How to use the alephclient.services.entityextract_pb2.ExtractedEntity.EMAIL 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
class IPAddressResult(Result):
    """Pull IPv4, IPv6 - and validate using on-board Python tools."""
    category = ExtractedEntity.IPADDRESS

    def __init__(self, ctx, label, start, end):
        super(IPAddressResult, self).__init__(ctx, label, start, end)
        try:
            ip = ip_address(label)
            self.key = self.label = str(ip)
        except ValueError:
            self.valid = False


class EmailResult(Result):
    category = ExtractedEntity.EMAIL

    def __init__(self, ctx, label, start, end):
        super(EmailResult, self).__init__(ctx, label, start, end)
        self.key = self.label_key(self.label)
        self.valid = self.key is not None
        # TODO: do we want to do TLD -> country?


class PhoneResult(Result):
    FORMAT = phonenumbers.PhoneNumberFormat.E164
    category = ExtractedEntity.PHONE

    def __init__(self, ctx, label, start, end):
        super(PhoneResult, self).__init__(ctx, label, start, end)
        number = self._parse(label)
        for country in ctx.countries: