Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
start,
nlp_artifacts.tokens,
nlp_artifacts.tokens_indices)
# index i belongs to the PII entity, take the preceding n words
# and the successing m words into a context string
context_str = ''
context_str = \
self.__add_n_words_backward(token_index,
EntityRecognizer.CONTEXT_PREFIX_COUNT,
nlp_artifacts.lemmas,
lemmatized_keywords,
context_str)
context_str = \
self.__add_n_words_forward(token_index,
EntityRecognizer.CONTEXT_SUFFIX_COUNT,
nlp_artifacts.lemmas,
lemmatized_keywords,
context_str)
self.logger.debug('Context sentence is: %s', context_str)
return context_str