Spaces:
Sleeping
Sleeping
Nikhil0987
commited on
Commit
•
10c452e
1
Parent(s):
c910970
HELLOI
Browse files- getvalues.py +58 -56
- home.py +1 -1
getvalues.py
CHANGED
@@ -2,63 +2,65 @@ import re
|
|
2 |
# from listen import *
|
3 |
|
4 |
# find time in the string input provided by the user
|
5 |
-
def
|
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 |
-
# find month in the string input provided by the user
|
31 |
-
def findMonth(input):
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
# find day in the string input provided by the user
|
39 |
-
def findDay(input):
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
def findrepeat(input):
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
def getValues(query):
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
62 |
# query = "remind me to work on my portfolio at 5:00 pm tomorrow"
|
63 |
# print(getValues(query))
|
64 |
|
|
|
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 |
+
# 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 |
+
find()
|
63 |
+
|
64 |
# query = "remind me to work on my portfolio at 5:00 pm tomorrow"
|
65 |
# print(getValues(query))
|
66 |
|
home.py
CHANGED
@@ -27,7 +27,7 @@ def dashboard():
|
|
27 |
st.session_state["user"] = "visitor"
|
28 |
st.experimental_rerun()
|
29 |
elif selected == "Remainder":
|
30 |
-
|
31 |
|
32 |
|
33 |
|
|
|
27 |
st.session_state["user"] = "visitor"
|
28 |
st.experimental_rerun()
|
29 |
elif selected == "Remainder":
|
30 |
+
find()
|
31 |
|
32 |
|
33 |
|