-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsounder_test.py
More file actions
73 lines (55 loc) · 2.34 KB
/
sounder_test.py
File metadata and controls
73 lines (55 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from sounder import Sounder
dataset = [
["SystemModule@MeaningOfLife", ["meaning", "life"]],
["SystemModule@TimeRightNow",["time","right","now"]],
["SystemModule@DateToday",["date","today"]],
["SystemModule@WakeUp",["wake","up"]],
["SystemModule@GoToSleep",["go","sleep"]],
["SystemModule@Quit",["youre","fired"]],
["SystemModule@TellSystemStatus",["system","status"]],
["AlphaSearchModule@DoASearch",["alpha","search"]],
["WikipediaModule@GiveASummary",["information","wikipedia"]],
["MovieInformationModule@GiveSomeInformation",["movie","information"]],
["WeatherReportModule@WeatherReportToday",["weather","today"]],
["WeatherReportModule@WeatherReportTomorrow",["weather","forecast","tomorrow"]],
["WeatherReportModule@WeatherReportWeekly",["weather","forecast","week"]],
["TwitterModule@GetTrending",["trending","twitter"]],
["TwitterModule@StatusUpdate",["tweet","something","twitter"]],
["TwitterModule@GetNotifications",["twitter","notifications"]],
["EvernoteModule@WriteNote",["note","something"]],
["GoogleCalendarModule@AddEvent",["add","calendar","event"]],
["GoogleCalendarModule@GetEventsToday",["calendar","events","today"]],
["GoogleCalendarModule@GetEventsTomorrow",["calendar","events","tomorrow"]],
["GmailModule@handle",["unread","emails"]],
["ReporterModule@GetNews",["get","news","detailed"]],
["ReporterModule@handle",["read","latest","news"]],
["FootballModule@handle",["football","information"]],
["FacebookModule@GetBirthdayReminders",["birthday","reminders"]],
["FacebookModule@StatusUpdate",["facebook","status","update"]],
["ZomatoModule@handle",["feeling","hungry","restaurant"]]
]
print("\n")
print("Kindly input your command.")
print("\n")
user_string = input()
print("\n")
print("Your command: %s" % user_string)
key_words_array = []
for a in dataset:
key_words_array.append(a[1])
s = Sounder(key_words_array)
def get_user_words_array(user_string):
user_array = user_string.split()
for user_word in user_array:
if user_word in s.get_reserved_sub_words():
user_array.remove(user_word)
return user_array
user_keywords = get_user_words_array(user_string)
print("\n")
index = s.search(user_keywords)
print("Intent Predicted: %s" % dataset[index])
print("\n")
status = s.probability(user_keywords, prediction=True)
print("Status Report: %s" % status)
# https://goo.gl/HZfTWF
print("\n")