我使用try异常块,它将管理异常,但不会从语音转换为文本。
import pandas as pd
import matplotlib.pyplot as plt
for name, group in df.groupby('ID'):
plt.scatter(group.X, group.Y, label=name)
plt.legend()
plt.show()
import speech_recognition as sr # recognise speech
import pyaudio
r = sr.Recognizer()
with sr.Microphone() as source:
print('Say Something')
audio = r.listen(source)
voice_data = r.recognize_google(audio)
print(voice_data)
Output: