-
Notifications
You must be signed in to change notification settings - Fork 0
/
ai.py
49 lines (35 loc) · 1.02 KB
/
ai.py
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
import sys
import unicodedata
import yaml
from brain import brain
from grey_matter.ears import listen
from grey_matter.voice_module import speak
profile = open('profile.yaml')
profile_data = yaml.safe_load(profile)
profile.close()
# Functioning Variables
name = profile_data['name']
speak('Welcome, {}, systems are ready'.format(name))
def strip_accents(s):
return ''.join(c for c in unicodedata.normalize('NFD', s)
if unicodedata.category(c) != 'Mn')
def main():
while True:
speech_text = ''
for arg in sys.argv:
if arg == '-t':
speech_text = raw_input("What can I help you with?\n")
if speech_text is '':
speech_text = strip_accents(listen())
if speech_text != '':
brain(name, speech_text.lower(), profile_data)
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
main()