forked from x4nth055/pythoncode-tutorials
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecognizer.py
More file actions
Latest commit
15 lines (12 loc) · 358 Bytes
/
Copy pathrecognizer.py
File metadata and controls
15 lines (12 loc) · 358 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
importspeech_recognitionassr
importsys
filename=sys.argv[1]
# initialize the recognizer
r=sr.Recognizer()
# open the file
withsr.AudioFile(filename) assource:
# listen for the data (load audio to memory)
audio_data=r.record(source)
# recognize (convert from speech to text)
text=r.recognize_google(audio_data)
print(text)