in function_app/bp_pii_redaction.py [0:0]
def replace_text(text: str, replacements: dict) -> str:
"""
Replace all occurrences of text in a text with replacement text.
:param text:
The text to be redacted.
:param replacements:
A dictionary of text to replace and the text to replace it with.
:returns:
The redacted text.
"""
for find_text, replace_text in replacements.items():
text = text.replace(find_text, replace_text)
return text