nonkung51

time_intent.py

May 11th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. import intentparser
  2.  
  3. intent = intentparser.intentParser({
  4.     'description' : {
  5.                     "type" : 'TimeIntent', #ประเภท
  6.                     "args" : [(1, "scopes")], # aregument ที่ต้องการ 1 แปลว่าต้องการหรือไม่ต้องการก็ได้
  7.                     "keyword" : [ #มีคีย์เวิร์ดเพิ่มขึ้นมา
  8.                     (0, "time_keyword"),
  9.                     (1, "scopes")
  10.                     ]},
  11.     'time_keyword' : ['is', 'are', 'what', 'how', 'clock', 'how\'s'], #อันนี้คีย์เวิร์ดหลัก
  12.     'scopes' : [ # สโคปของเรา
  13.         "day",
  14.         "time"
  15.         ]
  16. })
  17. intent.teachWords(["What time is it?", "How's the clock", "What is this day"]) # สอนประโยคเหมือนเดิม
  18.  
  19. print(intent.getResult("What time is it?")) #ทดลองเหมือนเดิม
  20. print(intent.getResult("How's the clock"))
Advertisement
Add Comment
Please, Sign In to add comment