presidio-analyzer/analyzer/matcher.py
def __calculate_context_similarity(self, context, field):
        """Context similarity is 1 if there's exact match between a keyword in
           context and any keyword in field.context

        Args:
          context: words prefix of specified pattern
          field: current field type (pattern)
        """

        context_keywords = self.__context_to_keywords(context)

        # TODO: remove after supporting keyphrases (instead of keywords)
        if 'card' in field.context:
            field.context.remove('card')
        if 'number' in field.context:
            field.context.remove('number')

        similarity = 0.0
        for context_keyword in context_keywords:
            if context_keyword in field.context:
                similarity = 1
                break

        return similarity
Context similarity is 1 if there's exact match between a keyword in
           context and any keyword in field.context

        Args:
          context: words prefix of specified pattern
          field: current field type (pattern)
        
Context similarity is 1 if there's exact match between a keyword in
context and any keyword in field.context
Context similarity is 1 if there ' s exact match between a keyword in context and any keyword in field . context
def __calculate_context_similarity(self, context, field):
        context_keywords = self.__context_to_keywords(context)
        if 'card' in field.context:
            field.context.remove('card')
        if 'number' in field.context:
            field.context.remove('number')
        similarity = 0.0
        for context_keyword in context_keywords:
            if context_keyword in field.context:
                similarity = 1
                break
        return similarity
def __calculate_context_similarity ( self , context , field ) : context_keywords = self . __context_to_keywords ( context ) if 'card' in field . context : field . context . remove ( 'card' ) if 'number' in field . context : field . context . remove ( 'number' ) similarity = 0.0 for context_keyword in context_keywords : if context_keyword in field . context : similarity = 1 break return similarity
Context similarity is 1 if there's exact match between a keyword in
context and any keyword in field.context
Context similarity is 1 if there ' s exact match between a keyword in context and any keyword in field . context
"""Context similarity is 1 if there's exact match between a keyword in
           context and any keyword in field.context

        Args:
          context: words prefix of specified pattern
          field: current field type (pattern)
        """ # TODO: remove after supporting keyphrases (instead of keywords)
self
context
words prefix of specified pattern
words prefix of specified pattern
field
current field type (pattern)
current field type ( pattern )