Skip to content

Instantly share code, notes, and snippets.

@wannaphong
Last active November 7, 2018 09:02
Show Gist options
  • Save wannaphong/1e862583051bf0464b6ef4ed592f739c to your computer and use it in GitHub Desktop.
Save wannaphong/1e862583051bf0464b6ef4ed592f739c to your computer and use it in GitHub Desktop.
ใช้ dict ตัวเองในการตัดคำใน PyThaiNLP 1.7
คน
เล่น
แกม
ตา
จน
from pythainlp.tokenize import dict_word_tokenize,create_custom_dict_trie
text="คนเล่นโอเคนะ"
data=create_custom_dict_trie("dict.txt")
print(dict_word_tokenize(text=text,custom_dict_trie=data,engine="newmm"))
@wannaphong
Copy link
Author

ผลลัพธ์
['คน', 'เล่น', 'โอเ', 'คน', 'ะ']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment