Python 的口語語言處理
Daniel Bourke
Machine Learning Engineer/YouTube Creator
常見的 Python 語音函式庫
從 PyPi 安裝:
$ pip install SpeechRecognition
# Import the SpeechRecognition library import speech_recognition as sr# Create an instance of Recognizer recognizer = sr.Recognizer()# Set the energy threshold recognizer.energy_threshold = 300
Recognizer 類別提供可與語音 API 互動的內建函式recognize_bing()recognize_google()recognize_google_cloud()recognize_wit()輸入:audio_file
輸出:從 audio_file 轉寫的語音
本段聚焦 recognize_google()
用 SpeechRecognition 從音訊檔進行語音識別:
# Import SpeechRecognition library import speech_recognition as sr# Instantiate Recognizer class recognizer = sr.Recognizer()# Transcribe speech using Google web API recognizer.recognize_google(audio_data=audio_file, language="en-US")
Learning speech recognition on DataCamp is awesome!
Python 的口語語言處理