Spaces:
Sleeping
Sleeping
Nikhil0987
commited on
Commit
•
dbddfad
1
Parent(s):
cf9b250
- database/data.json +4 -0
- getvalues.py +57 -57
database/data.json
CHANGED
@@ -25,5 +25,9 @@
|
|
25 |
"password": "123",
|
26 |
"id": "b1da28ad-8ee5-406a-9474-6055803ef3d2"
|
27 |
}
|
|
|
|
|
|
|
|
|
28 |
]
|
29 |
}
|
|
|
25 |
"password": "123",
|
26 |
"id": "b1da28ad-8ee5-406a-9474-6055803ef3d2"
|
27 |
}
|
28 |
+
],
|
29 |
+
"reminders":[
|
30 |
+
|
31 |
+
|
32 |
]
|
33 |
}
|
getvalues.py
CHANGED
@@ -2,64 +2,64 @@ import re
|
|
2 |
# from listen import *
|
3 |
|
4 |
# find time in the string input provided by the user
|
5 |
-
def find():
|
6 |
-
def findTime(input):
|
7 |
-
time = re.search(r'\d{1,2}:\d{2}', input)
|
8 |
-
meridiem = re.search(r'\b(am|pm)\b', input)
|
9 |
-
if time:
|
10 |
-
tvalue = f"{time.group()} {meridiem.group()}"
|
11 |
-
return tvalue
|
12 |
-
else:
|
13 |
-
return "notime"
|
14 |
-
|
15 |
-
# find number in the string input provided by the user
|
16 |
-
def findNumber(input):
|
17 |
-
number = re.search(r'\d+', input)
|
18 |
-
if number:
|
19 |
-
return number.group()
|
20 |
-
else:
|
21 |
-
return "nonumber"
|
22 |
-
|
23 |
-
# # find date in the string input provided by the user
|
24 |
-
# def findDate(input):
|
25 |
-
# date = re.search(r'\d{1,2}/\d{1,2}/\d{4}', input)
|
26 |
-
# if date:
|
27 |
-
# return date.group()
|
28 |
-
# else:
|
29 |
-
# return "nodate"
|
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 |
# query = "remind me to work on my portfolio at 5:00 pm tomorrow"
|
65 |
# print(getValues(query))
|
|
|
2 |
# from listen import *
|
3 |
|
4 |
# find time in the string input provided by the user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
def findTime(input):
|
7 |
+
time = re.search(r'\d{1,2}:\d{2}', input)
|
8 |
+
meridiem = re.search(r'\b(am|pm)\b', input)
|
9 |
+
if time:
|
10 |
+
tvalue = f"{time.group()} {meridiem.group()}"
|
11 |
+
return tvalue
|
12 |
+
else:
|
13 |
+
return "notime"
|
14 |
+
|
15 |
+
# find number in the string input provided by the user
|
16 |
+
def findNumber(input):
|
17 |
+
number = re.search(r'\d+', input)
|
18 |
+
if number:
|
19 |
+
return number.group()
|
20 |
+
else:
|
21 |
+
return "nonumber"
|
22 |
+
|
23 |
+
# # find date in the string input provided by the user
|
24 |
+
# def findDate(input):
|
25 |
+
# date = re.search(r'\d{1,2}/\d{1,2}/\d{4}', input)
|
26 |
+
# if date:
|
27 |
+
# return date.group()
|
28 |
+
# else:
|
29 |
+
# return "nodate"
|
30 |
+
|
31 |
+
# find month in the string input provided by the user
|
32 |
+
def findMonth(input):
|
33 |
+
month = re.search(r'\b(january|february|march|april|may|june|july|august|september|october|november|december|next month)\b', input)
|
34 |
+
if month:
|
35 |
+
return month.group()
|
36 |
+
else:
|
37 |
+
return "nomonth"
|
38 |
+
|
39 |
+
# find day in the string input provided by the user
|
40 |
+
def findDay(input):
|
41 |
+
day = re.search(r'\b(monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|day after tomorrow)\b', input)
|
42 |
+
if day:
|
43 |
+
return day.group()
|
44 |
+
else:
|
45 |
+
return "noday"
|
46 |
+
|
47 |
+
def findrepeat(input):
|
48 |
+
repeat = re.search(r'\b(daily|everyday)\b', input)
|
49 |
+
if repeat:
|
50 |
+
return repeat.group()
|
51 |
+
|
52 |
+
|
53 |
+
def getValues(query):
|
54 |
+
time = findTime(query)
|
55 |
+
num = findNumber(query)
|
56 |
+
reps = findrepeat(query)
|
57 |
+
# date = findDate(query)
|
58 |
+
month = findMonth(query)
|
59 |
+
day = findDay(query)
|
60 |
+
message = query.lower().replace(time, "").replace(num, "").replace(month, "").replace(day, "").replace("create a reminder", "").replace("remind me to", "").replace(" ", "")
|
61 |
+
return message, time, day, reps, num, month
|
62 |
+
|
63 |
|
64 |
# query = "remind me to work on my portfolio at 5:00 pm tomorrow"
|
65 |
# print(getValues(query))
|