Skip to content

Instantly share code, notes, and snippets.

@muhammetfaik
Created February 10, 2020 12:00
Show Gist options
  • Save muhammetfaik/41fbec52a75dc1718f94ab5ef96515f9 to your computer and use it in GitHub Desktop.
Save muhammetfaik/41fbec52a75dc1718f94ab5ef96515f9 to your computer and use it in GitHub Desktop.
spellchecker
import jamspell
corrector = jamspell.TSpellCorrector()
corrector.LoadLangModel('en.bin')
print(corrector.FixFragment('I am the begt spell cherken!'))
# u'I am the best spell checker!'
print(corrector.GetCandidates(['i', 'am', 'the', 'begt', 'spell', 'cherken'], 3))
# (u'best', u'beat', u'belt', u'bet', u'bent', ... )
print(corrector.GetCandidates(['i', 'am', 'the', 'begt', 'spell', 'cherken'], 5))
# (u'checker', u'chicken', u'checked', u'wherein', u'coherent', ...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment