fuzzy_matching_strategy#

langchain_experimental.data_anonymizer.deanonymizer_matching_strategies.fuzzy_matching_strategy(text: str, deanonymizer_mapping: Dict[str, Dict[str, str]], max_l_dist: int = 3) str[source]#

Fuzzy matching strategy for deanonymization.

It uses fuzzy matching to find the position of the anonymized entity in the text. It replaces all the anonymized entities with the original ones.

Parameters:
  • text (str) – text to deanonymize

  • deanonymizer_mapping (Dict[str, Dict[str, str]]) – mapping between anonymized entities and original ones

  • max_l_dist (int) – maximum Levenshtein distance between the anonymized entity and the text segment to consider it a match

Return type:

str

Examples of matching:

Kaenu Reves -> Keanu Reeves John F. Kennedy -> John Kennedy