SpeechRecognition Python 라이브러리

Python으로 배우는 음성 언어 처리

Daniel Bourke

Machine Learning Engineer/YouTube Creator

SpeechRecognition 라이브러리를 사용하는 이유는?

기존 Python 라이브러리 몇 가지

  • CMU Sphinx
  • Kaldi
  • SpeechRecognition
  • Facebook의 Wav2letter++
Python으로 배우는 음성 언어 처리

SpeechRecognition 시작하기

PyPi에서 설치:

$ pip install SpeechRecognition
  • Python 2와 3 모두 호환
  • 여기서는 Python 3을 사용합니다
Python으로 배우는 음성 언어 처리

Recognizer 클래스 사용하기

# 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
Python으로 배우는 음성 언어 처리

Recognizer 클래스로 음성 인식하기

  • Recognizer 클래스에는 음성 API와 상호작용하는 내장 함수가 있습니다
    • recognize_bing()
    • recognize_google()
    • recognize_google_cloud()
    • recognize_wit()

입력: audio_file

출력: audio_file에서 변환된 음성 텍스트

Python으로 배우는 음성 언어 처리

SpeechRecognition 예제

  • 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으로 배우는 음성 언어 처리

직접 해보세요!

Python으로 배우는 음성 언어 처리

Preparing Video For Download...