-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssistant.py
More file actions
75 lines (63 loc) · 1.97 KB
/
Assistant.py
File metadata and controls
75 lines (63 loc) · 1.97 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
74
75
from Output.OutputFuncs import Output
from Speech import Speech
from Databank import Databank
from Processing import Processing
# general base modules
from dataclasses import dataclass
from typing import List
class Assistant:
speech: Speech
processing: Processing
output: Output
databank: Databank
__lastCommand: List[str]
__lastInput: str
debugMode: bool
def __init__(self, debugMode=False):
self.databank = Databank()
self.speech = Speech()
self.processing = Processing(self.databank)
self.output = Output(self)
self.debugMode = debugMode
def __del__(self):
if not self.debugMode:
self.databank.getDbConn().commit()
self.databank.getDbConn().close()
def getLastCommand(self):
return self.__lastCommand
def getLastInput(self):
return self.__lastInput
def assistVoice(self):
self.assistText(self.speech.stt())
#input = self.speech.stt().replace("'", "")
#cmd = self.processing.inputProcessor(input)
#self.speech.tts(self.output.callFunc(cmd))
#self.__lastCommand = cmd
#self.__lastInput = input
def assistText(self, input: str):
input = input.lower().replace("'", "")
cmd = self.processing.inputProcessor(input)
output = self.output.callFunc(cmd)
print(output)
if not self.debugMode:
self.speech.tts(output)
self.__lastCommand = cmd
self.__lastInput = input
# weather plotten
# reminder, alarm etc
# calendar
# elaborate on more commands
# play podcasts
# translate
# news
# moodle?
# outlook working?
# teams
# wikipedia data object
# detailed daily weather graph
# add task features, sorted by priority/time remaining
# star wars jokes
# play music with pyglet
assistant = Assistant(False)
#assistant.databank.addCommand("triviaStarWars", "who is in star wars|what is in star wars", "{}")
assistant.assistText("who is obi wan kenobi in star wars")