Nikhil0987 commited on
Commit
10c452e
1 Parent(s): c910970
Files changed (2) hide show
  1. getvalues.py +58 -56
  2. 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 findTime(input):
6
- time = re.search(r'\d{1,2}:\d{2}', input)
7
- meridiem = re.search(r'\b(am|pm)\b', input)
8
- if time:
9
- tvalue = f"{time.group()} {meridiem.group()}"
10
- return tvalue
11
- else:
12
- return "notime"
13
-
14
- # find number in the string input provided by the user
15
- def findNumber(input):
16
- number = re.search(r'\d+', input)
17
- if number:
18
- return number.group()
19
- else:
20
- return "nonumber"
21
-
22
- # # find date in the string input provided by the user
23
- # def findDate(input):
24
- # date = re.search(r'\d{1,2}/\d{1,2}/\d{4}', input)
25
- # if date:
26
- # return date.group()
27
- # else:
28
- # return "nodate"
 
29
 
30
- # find month in the string input provided by the user
31
- def findMonth(input):
32
- month = re.search(r'\b(january|february|march|april|may|june|july|august|september|october|november|december|next month)\b', input)
33
- if month:
34
- return month.group()
35
- else:
36
- return "nomonth"
37
-
38
- # find day in the string input provided by the user
39
- def findDay(input):
40
- day = re.search(r'\b(monday|tuesday|wednesday|thursday|friday|saturday|sunday|tomorrow|day after tomorrow)\b', input)
41
- if day:
42
- return day.group()
43
- else:
44
- return "noday"
45
-
46
- def findrepeat(input):
47
- repeat = re.search(r'\b(daily|everyday)\b', input)
48
- if repeat:
49
- return repeat.group()
50
-
51
-
52
- def getValues(query):
53
- time = findTime(query)
54
- num = findNumber(query)
55
- reps = findrepeat(query)
56
- # date = findDate(query)
57
- month = findMonth(query)
58
- day = findDay(query)
59
- message = query.lower().replace(time, "").replace(num, "").replace(month, "").replace(day, "").replace("create a reminder", "").replace("remind me to", "").replace(" ", "")
60
- return message, time, day, reps, num, month
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
- findNumber()
31
 
32
 
33
 
 
27
  st.session_state["user"] = "visitor"
28
  st.experimental_rerun()
29
  elif selected == "Remainder":
30
+ find()
31
 
32
 
33