Skip to content

Instantly share code, notes, and snippets.

@desis123
desis123 / removing_n_repetition_of_word-from_sentence.py
Last active November 6, 2022 15:03
Removing n repetition of words from sentence
text = """
<span><span>Jenny.</span></span> <span><span>Jennie comes from a wealthy family, but she has also generated her own income.</span></span> <span><span>She is the image of brands such as Calvin Klein, Hera, Samsung, adidas, Marie Claire, Vogue and Cosmopolitan.</span></span> <span><span>Her of her of her of her of her of her of her of her of her of her of her estate of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of her of it amounts to more than 10 million dollars.</span></span></p>
"""
def chunks(lst, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield " ".join(lst[i:i + n])
def removeConsecutiveDuplicateWors(s):