Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import intentparser # อิมพอร์ตตัวไลบรารี่เข้ามาก่อน
- intent = intentparser.intentParser({ #ประกาศตัวแปร intent
- 'description' : {
- "type" : 'ByeIntent', #ประเภท ByeIntent
- "args" : [], # เราไม่ต้องการ args เลยว่างไว้
- "keyword" : [
- (0, "bye_keyword"), #Keyword ของเราเก็บไว้ใน dict คีย์ 'bye_keyword' เลข 0 แปลว่าต้องมีในประโยคนั้นๆครับ
- ]},
- 'bye_keyword' : ['bye'], # ใส่ คีเวิร์ดของเราลงไป
- })
- intent.teachWords(["Good bye, Watson.", "Bye, Josh.", "Good bye, Be safe."]) # บรรทัดใช้สอนข้อความให้ intent ของเรา
- print(intent.getResult("Good bye, Watson. Be safe!")) # สอนเสร็จก็ลองใช้ซักหน่อย
- print(intent.getResult("Good bye, Josh."))
Advertisement
Add Comment
Please, Sign In to add comment