SpeechRecognition के साथ ऑडियो फ़ाइलें पढ़ना

Python में Spoken Language Processing

Daniel Bourke

Machine Learning Engineer/YouTube Creator

AudioFile क्लास

import speech_recognition as sr

# Setup recognizer instance recognizer = sr.Recognizer()
# Read in audio file clean_support_call = sr.AudioFile("clean-support-call.wav")
# Check type of clean_support_call type(clean_support_call)
<class 'speech_recognition.AudioFile'>
Python में Spoken Language Processing

AudioFile से AudioData तक

recognizer.recognize_google(audio_data=clean_support_call)
AssertionError: ``audio_data`` must be audio data
# Convert from AudioFile to AudioData
with clean_support_call as source:

# Record the audio clean_support_call_audio = recognizer.record(source)
# Check the type type(clean_support_call_audio)
<class 'speech_recognition.AudioData'>
Python में Spoken Language Processing

हमारे AudioData का ट्रांसक्रिप्शन

# Transcribe clean support call
recognizer.recognize_google(audio_data=clean_support_call_audio)
hello I'd like to get some help setting up my account please
Python में Spoken Language Processing

Duration और offset

  • duration और offset दोनों का डिफ़ॉल्ट None है
# duration और offset डिफ़ॉल्ट पर रखें
with clean_support_call as source:
    clean_support_call_audio = recognizer.record(source,
                                                 duration=None,
                                                 offset=None)
# clean support call के पहले 2 सेकंड लें
with clean_support_call as source:
    clean_support_call_audio = recognizer.record(source,
                                                 duration=2.0)
hello I'd like to get
Python में Spoken Language Processing

अभ्यास करते हैं!

Python में Spoken Language Processing

Preparing Video For Download...