filyp / autocorrect

Spelling corrector in python
GNU Lesser General Public License v3.0
459 stars 97 forks source link

second typo correction always uses english alphabet #54

Open retroflexivity opened 1 year ago

retroflexivity commented 1 year ago
def double_typos(self):
        """letter combinations two typos away from word"""
        return chain.from_iterable(
            Word(e1, only_replacements=self.only_replacements).typos()
            for e1 in self.typos()
        )

when fixing the second typo, a Word object is created, but without specifying a language. thus, the second typo correction always uses the english alphabet. so, double_typoing a word like здрйхствуйте returns corrections like здраmствуйте instead of здравствуйте, replacing one of the letters properly, and another with an english letter.