presidio-analyzer/analyzer/matcher.py
def __extract_context(self, doc, start, end):
        """Extract context for a specified match

        Args:
          doc: spacy document to analyze
          start: match start offset
          end: match end offset
        """

        prefix = doc.text[0:start].split()
        suffix = doc.text[end + 1:].split()
        context = ''

        context += ' '.join(
            prefix[max(0,
                       len(prefix) - CONTEXT_PREFIX_COUNT):len(prefix)])
        context += ' '
        context += ' '.join(suffix[0:min(CONTEXT_SUFFIX_COUNT, len(suffix))])

        return context
Extract context for a specified match

        Args:
          doc: spacy document to analyze
          start: match start offset
          end: match end offset
        
Extract context for a specified match
Extract context for a specified match
def __extract_context(self, doc, start, end):
        prefix = doc.text[0:start].split()
        suffix = doc.text[end + 1:].split()
        context = ''
        context += ' '.join(
            prefix[max(0,
                       len(prefix) - CONTEXT_PREFIX_COUNT):len(prefix)])
        context += ' '
        context += ' '.join(suffix[0:min(CONTEXT_SUFFIX_COUNT, len(suffix))])
        return context
def __extract_context ( self , doc , start , end ) : prefix = doc . text [ 0 : start ] . split ( ) suffix = doc . text [ end + 1 : ] . split ( ) context = '' context += ' ' . join ( prefix [ max ( 0 , len ( prefix ) - CONTEXT_PREFIX_COUNT ) : len ( prefix ) ] ) context += ' ' context += ' ' . join ( suffix [ 0 : min ( CONTEXT_SUFFIX_COUNT , len ( suffix ) ) ] ) return context
Extract context for a specified match
Extract context for a specified match
"""Extract context for a specified match

        Args:
          doc: spacy document to analyze
          start: match start offset
          end: match end offset
        """
self
doc
spacy document to analyze
spacy document to analyze
start
match start offset
match start offset
end
match end offset
match end offset