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