pronoun-o-matic/pronoun_update.py
2022-06-05 21:50:55 +02:00

13 lines
297 B
Python

import re
PRONOUN_REPLACE_REGEX = re.compile(r"\[\S*\]")
class PronounUpdate:
pronouns: str
def __init__(self, pronouns: str):
self.pronouns = pronouns
def replace_pronouns_in_bio(self, bio: str) -> str:
return PRONOUN_REPLACE_REGEX.sub(f"[{self.pronouns}]", bio)