Skip to content

Commit 5b5696a

Browse files
committed
Update docs
1 parent 9cdd6cc commit 5b5696a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

pythainlp/chat/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def chat(self, text:str)->str:
7171
:Example:
7272
::
7373
74-
from pythainlp.chat.core import ChatBotModel
74+
from pythainlp.chat import ChatBotModel
7575
import torch
7676
7777
chatbot = ChatBotModel()

pythainlp/cls/param_free.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,26 @@ def predict(self, x1: str, k: int = 1) -> str:
4343
:param str k: k
4444
:return: label
4545
:rtype: str
46+
47+
:Example:
48+
::
49+
50+
from pythainlp.cls import GzipModel
51+
52+
training_data = [
53+
("รายละเอียดตามนี้เลยค่าา ^^", "Neutral"),
54+
("กลัวพวกมึงหาย อดกินบาบิก้อน", "Neutral"),
55+
("บริการแย่มากก เป็นหมอได้ไง😤", "Negative"),
56+
("ขับรถแย่มาก", "Negative"),
57+
("ดีนะครับ", "Positive"),
58+
("ลองแล้วรสนี้อร่อย... ชอบๆ", "Positive"),
59+
("ฉันรู้สึกโกรธ เวลามือถือแบตหมด", "Negative"),
60+
("เธอภูมิใจที่ได้ทำสิ่งดี ๆ และดีใจกับเด็ก ๆ", "Positive"),
61+
("นี่เป็นบทความหนึ่ง", "Neutral")
62+
]
63+
model = GzipModel(training_data)
64+
print(model.predict("ฉันดีใจ", k=1))
65+
# output: Positive
4666
"""
4767
Cx1 = len(gzip.compress(x1.encode("utf-8")))
4868
disance_from_x1 = []

0 commit comments

Comments
 (0)