mirror of
https://github.com/MarkParker5/STARK.git
synced 2024-11-24 08:12:13 +02:00
Upgrade to python 3.8, fix bugs
This commit is contained in:
parent
d75f1cb626
commit
9752fc7aa0
@ -5,7 +5,7 @@ r = sr.Recognizer()
|
||||
m = sr.Microphone(device_index=1)
|
||||
|
||||
class SpeechToText:
|
||||
def __init__(this, device = 1, language = "ru-RU", pause_threshold = 0.5):
|
||||
def __init__(this, device = 1, language = "ru-RU", pause_threshold = 0.4):
|
||||
this.device = 1
|
||||
this.language = language
|
||||
this.m = sr.Microphone(device_index = this.device)
|
||||
|
9
main.py
9
main.py
@ -28,11 +28,9 @@ while True: # main loop
|
||||
print('\nYou: ', end='')
|
||||
speech = listener.listen()
|
||||
text = speech['text']
|
||||
speech['status'] = 'ok' if text else 'void'
|
||||
if speech['status'] == 'ok':
|
||||
print(text)
|
||||
if set(config.names) & set(text.split(' ')): online = True
|
||||
if online:
|
||||
if online := set(config.names) & set(text.split(' ')):
|
||||
voids = 0
|
||||
cmd, params = Command.reg_find(text).values()
|
||||
responce = cmd.start(text)
|
||||
@ -49,5 +47,6 @@ while True: # main loop
|
||||
voice.generate(responce['voice']).speak()
|
||||
else:
|
||||
if speech['status'] == 'error': print('Отсутсвует подключение к интернету');
|
||||
elif speech['status'] == 'void': voids += 1
|
||||
if voids >= 3: online = False; voids = 0
|
||||
elif online and speech['status'] == 'void': voids += 1;
|
||||
if online and voids >= 3: online = False; voids = 0
|
||||
if not online: listener.listen_noise()
|
||||
|
Loading…
Reference in New Issue
Block a user