# Ensure there is no duplicated text in the headers
def remove_duplicates(text):
    return re.sub(
        r"((\b\w+\b.{1,2}\w+\b)+).+\1", r"\1", text, flags=re.I
    )


df["text"] = df["text"].apply(remove_duplicates)