Python to clean miswritten words with repetitive letters such as "wwwwooorrrrddss" to "words"
A simple two part solution from this site
remove any letter sequences longer than two (probably not good for welsh)
def reduce_lengthening(text):
    pattern = re.compile(r&quot;(.)\1{2,}&quot;)
    return pattern.sub(r&quot;\1\1&quot;, text)

print(reduce_lengthening( &quot;finallllllly&quot; ))

Then using pattern.en to check spelling.
from pattern.en import spelling

word = &quot;amazzziiing&quot;
word_wlf = reduce_lengthening(word) #calling function defined above
print word_wlf #word lengthening isn't being able to fix it completely

correct_word = spelling(word_wlf) 
print(correct_word)

NLTK is another common toolkit that can help with this