Library Python SpeechRecognition

Pemrosesan Bahasa Lisan dengan Python

Daniel Bourke

Machine Learning Engineer/YouTube Creator

Mengapa library SpeechRecognition?

Beberapa library Python yang ada

  • CMU Sphinx
  • Kaldi
  • SpeechRecognition
  • Wav2letter++ oleh Facebook
Pemrosesan Bahasa Lisan dengan Python

Mulai dengan SpeechRecognition

Instal dari PyPi:

$ pip install SpeechRecognition
  • Kompatibel dengan Python 2 dan 3
  • Kita akan pakai Python 3
Pemrosesan Bahasa Lisan dengan Python

Menggunakan kelas 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
Pemrosesan Bahasa Lisan dengan Python

Memakai Recognizer untuk mengenali ucapan

  • Kelas Recognizer punya fungsi bawaan untuk berinteraksi dengan API ucapan
    • recognize_bing()
    • recognize_google()
    • recognize_google_cloud()
    • recognize_wit()

Input: audio_file

Output: transkrip ucapan dari audio_file

Pemrosesan Bahasa Lisan dengan Python

Contoh SpeechRecognition

  • Fokus pada recognize_google()

  • Kenali ucapan dari file audio dengan SpeechRecognition:

# Import SpeechRecognition library
import speech_recognition as sr

# Instantiate Recognizer class recognizer = sr.Recognizer()
# Transcribe speech using Goole web API recognizer.recognize_google(audio_data=audio_file language="en-US")
Learning speech recognition on DataCamp is awesome!
Pemrosesan Bahasa Lisan dengan Python

Giliran Anda!

Pemrosesan Bahasa Lisan dengan Python

Preparing Video For Download...