Skip to content

Instantly share code, notes, and snippets.

@korakot
Last active June 30, 2017 15:08
Show Gist options
  • Save korakot/8708542c84c08081bcd3389039b16254 to your computer and use it in GitHub Desktop.
Save korakot/8708542c84c08081bcd3389039b16254 to your computer and use it in GitHub Desktop.
ตรวจคำสะกด โดยทำ word list เอง
# ลง hunspell + python ไม่สำเร็จ
# แต่มาเจอ pyenchant ที่ใช้ได้เหมือนกัน และมี custom word list ด้วย
>>> import enchant
>>> pwl = enchant.request_pwl_dict("royin_2542_wordlist.txt")
>>> pwl.check("กรกฎ")
True
>>> pwl.check("กรกำ")
False
>>> pwl.suggest("กรกำ")
['กรก', 'กรกฎ', 'กรกฏ', 'กรกช', 'กรำ', 'กร่ำ']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment