How to use presidio-analyzer - 10 common examples

To help you get started, we’ve selected a few presidio-analyzer 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 microsoft / presidio / presidio-analyzer / analyzer / __main__.py View on Github external
with ArgumentsContext(self, 'serve') as ac:
            ac.argument('env_grpc_port', default=False, required=False)
            ac.argument('grpc_port', default=3001, type=int, required=False)
        with ArgumentsContext(self, 'analyze') as ac:
            ac.argument('env_grpc_port', default=False, required=False)
            ac.argument('grpc_port', default=3001, type=int, required=False)
            ac.argument('text', required=True)
            ac.argument('fields', nargs='*', required=True)
        super(CommandsLoader, self).load_arguments(command)


presidio_cli = CLI(
    cli_name=CLI_NAME,
    config_dir=os.path.join('~', '.{}'.format(CLI_NAME)),
    config_env_var_prefix=CLI_NAME,
    commands_loader_cls=CommandsLoader,
    help_cls=PresidioCLIHelp)
exit_code = presidio_cli.invoke(sys.argv[1:])
sys.exit(exit_code)
github microsoft / presidio / presidio-analyzer / analyzer / __main__.py View on Github external
ac.argument('env_grpc_port', default=False, required=False)
            ac.argument('grpc_port', default=3001, type=int, required=False)
        with ArgumentsContext(self, 'analyze') as ac:
            ac.argument('env_grpc_port', default=False, required=False)
            ac.argument('grpc_port', default=3001, type=int, required=False)
            ac.argument('text', required=True)
            ac.argument('fields', nargs='*', required=True)
        super(CommandsLoader, self).load_arguments(command)


presidio_cli = CLI(
    cli_name=CLI_NAME,
    config_dir=os.path.join('~', '.{}'.format(CLI_NAME)),
    config_env_var_prefix=CLI_NAME,
    commands_loader_cls=CommandsLoader,
    help_cls=PresidioCLIHelp)
exit_code = presidio_cli.invoke(sys.argv[1:])
sys.exit(exit_code)
github microsoft / presidio / presidio-analyzer / analyzer / predefined_recognizers / us_phone_recognizer.py View on Github external
def __init__(self):
        patterns = [Pattern('Phone (strong)',
                            UsPhoneRecognizer.STRONG_REGEX,
                            UsPhoneRecognizer.STRONG_REGEX_SCORE),
                    Pattern('Phone (medium)',
                            UsPhoneRecognizer.MEDIUM_REGEX,
                            UsPhoneRecognizer.MEDIUM_REGEX_SCORE),
                    Pattern('Phone (weak)',
                            UsPhoneRecognizer.WEAK_REGEX,
                            UsPhoneRecognizer.WEAK_REGEX_SCORE)]
        super().__init__(supported_entity="PHONE_NUMBER",
                         patterns=patterns, context=CONTEXT)
github microsoft / presidio / presidio-analyzer / analyzer / predefined_recognizers / us_phone_recognizer.py View on Github external
def __init__(self):
        patterns = [Pattern('Phone (strong)',
                            UsPhoneRecognizer.STRONG_REGEX,
                            UsPhoneRecognizer.STRONG_REGEX_SCORE),
                    Pattern('Phone (medium)',
                            UsPhoneRecognizer.MEDIUM_REGEX,
                            UsPhoneRecognizer.MEDIUM_REGEX_SCORE),
                    Pattern('Phone (weak)',
                            UsPhoneRecognizer.WEAK_REGEX,
                            UsPhoneRecognizer.WEAK_REGEX_SCORE)]
        super().__init__(supported_entity="PHONE_NUMBER",
                         patterns=patterns, context=CONTEXT)
github microsoft / presidio / presidio-analyzer / analyzer / predefined_recognizers / us_phone_recognizer.py View on Github external
def __init__(self):
        patterns = [Pattern('Phone (strong)',
                            UsPhoneRecognizer.STRONG_REGEX,
                            UsPhoneRecognizer.STRONG_REGEX_SCORE),
                    Pattern('Phone (medium)',
                            UsPhoneRecognizer.MEDIUM_REGEX,
                            UsPhoneRecognizer.MEDIUM_REGEX_SCORE),
                    Pattern('Phone (weak)',
                            UsPhoneRecognizer.WEAK_REGEX,
                            UsPhoneRecognizer.WEAK_REGEX_SCORE)]
        super().__init__(supported_entity="PHONE_NUMBER",
                         patterns=patterns, context=CONTEXT)
github microsoft / presidio / presidio-analyzer / analyzer / predefined_recognizers / us_phone_recognizer.py View on Github external
def __init__(self):
        patterns = [Pattern('Phone (strong)',
                            UsPhoneRecognizer.STRONG_REGEX,
                            UsPhoneRecognizer.STRONG_REGEX_SCORE),
                    Pattern('Phone (medium)',
                            UsPhoneRecognizer.MEDIUM_REGEX,
                            UsPhoneRecognizer.MEDIUM_REGEX_SCORE),
                    Pattern('Phone (weak)',
                            UsPhoneRecognizer.WEAK_REGEX,
                            UsPhoneRecognizer.WEAK_REGEX_SCORE)]
        super().__init__(supported_entity="PHONE_NUMBER",
                         patterns=patterns, context=CONTEXT)
github microsoft / presidio / presidio-analyzer / analyzer / predefined_recognizers / us_phone_recognizer.py View on Github external
def __init__(self):
        patterns = [Pattern('Phone (strong)',
                            UsPhoneRecognizer.STRONG_REGEX,
                            UsPhoneRecognizer.STRONG_REGEX_SCORE),
                    Pattern('Phone (medium)',
                            UsPhoneRecognizer.MEDIUM_REGEX,
                            UsPhoneRecognizer.MEDIUM_REGEX_SCORE),
                    Pattern('Phone (weak)',
                            UsPhoneRecognizer.WEAK_REGEX,
                            UsPhoneRecognizer.WEAK_REGEX_SCORE)]
        super().__init__(supported_entity="PHONE_NUMBER",
                         patterns=patterns, context=CONTEXT)
github microsoft / presidio / presidio-analyzer / analyzer / predefined_recognizers / us_phone_recognizer.py View on Github external
def __init__(self):
        patterns = [Pattern('Phone (strong)',
                            UsPhoneRecognizer.STRONG_REGEX,
                            UsPhoneRecognizer.STRONG_REGEX_SCORE),
                    Pattern('Phone (medium)',
                            UsPhoneRecognizer.MEDIUM_REGEX,
                            UsPhoneRecognizer.MEDIUM_REGEX_SCORE),
                    Pattern('Phone (weak)',
                            UsPhoneRecognizer.WEAK_REGEX,
                            UsPhoneRecognizer.WEAK_REGEX_SCORE)]
        super().__init__(supported_entity="PHONE_NUMBER",
                         patterns=patterns, context=CONTEXT)
github microsoft / presidio / presidio-analyzer / analyzer / analyzer_engine.py View on Github external
def Apply(self, request, context):
        logging.info("Starting Apply")
        entities = AnalyzerEngine.__convert_fields_to_entities(
            request.analyzeTemplate.fields)
        language = AnalyzerEngine.get_language_from_request(request)
        results = self.analyze(request.text, entities, language,
                               request.analyzeTemplate.allFields)

        # Create Analyze Response Object
        response = analyze_pb2.AnalyzeResponse()

        # pylint: disable=no-member
        response.analyzeResults.extend(
            AnalyzerEngine.__convert_results_to_proto(results))
        logging.info("Found %d results", len(results))
        return response
github microsoft / presidio / presidio-analyzer / analyzer / analyzer_engine.py View on Github external
def Apply(self, request, context):
        logging.info("Starting Apply")
        entities = AnalyzerEngine.__convert_fields_to_entities(
            request.analyzeTemplate.fields)
        language = AnalyzerEngine.get_language_from_request(request)
        results = self.analyze(request.text, entities, language,
                               request.analyzeTemplate.allFields)

        # Create Analyze Response Object
        response = analyze_pb2.AnalyzeResponse()

        # pylint: disable=no-member
        response.analyzeResults.extend(
            AnalyzerEngine.__convert_results_to_proto(results))
        logging.info("Found %d results", len(results))
        return response

presidio-analyzer

Presidio Analyzer package

MIT
Latest version published 7 days ago

Package Health Score

94 / 100
Full package analysis

Similar packages