langchain_experimental.data_anonymizer.deanonymizer_matching_strategies.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 – text to deanonymize

  • deanonymizer_mapping – mapping between anonymized entities and original ones

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

Examples of matching:

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