Napisałem taki amatorski mały program i nie mam pojęcia dlaczego program zaznacza mi błąd :((
Program:
import speech_recognition as sr
r = sr.Recognizer()
engine = tts.init()
engine.setProperty('rate', 125)
def mow(text):
engine.say(text)
engine.runAndWait()
def getText():
with sr.Microphone() as source:
try:
print("Słucham...")
audio = r.listeb(source)
text = r.recognize_google(audio, language='pl_PL')
if text != '"':
return tezt
return 0
except:
return 0
while True:
txt = getText()
if not txt == 0:
print(txt)
mow(txt)
break
else:
print("Nie udało się rozpoznać...")
continue
Wynik:
Traceback (most recent call last):
File "C:\Users\Patryk\Descop\Training.py", line 4, in <module>
engine = tts.init()
NameError: name 'tts' is not defined
Process finished with exit code 1
Z góry bardzo dziekuje za pomoc!