Recognizing speech using the IBM Speech-to-Text API

Hi, Habr. As part of the course "Machine Learning. Advanced" we have prepared for you a translation of interesting material.



We also invite everyone to watch an open lesson on the topic
"Multi-armed bandits for optimizing AB testing."






, Python.





, IBM Speech to Text API . API, , , , . API . .





, , Β« Β» . , , β€” .





β€” , , - . . - . , , . .





. . , .





:





  • 1 -





  • 2 -





  • 3 -





  • 4 -





  • -





. , . API- , . , , . , Microsoft Azure.





:





  • Google Cloud





  • IBM Watson





  • Microsoft Azure





  • Amazon Transcribe





1 β€”

. SpeechRecognition



. SpeechRecognition



. API. ; Microsoft Azure Speech, Google Cloud Speech, API IBM Watson Speech to Text . IBM Watson Speech to Text API. SpeechRecognition .





. pip, Python.





pip install SpeechRecognition
      
      



. Jupyter Notebook.





import speech_recognition as s_r
      
      



2 -

. m4a, m4a. wav .





audio_file = s_r.AudioFile('my_clip.wav')
      
      



3 -

, , . . .





rcgnzr = s_r.Recognizer()
      
      



4 -

! IBM speech to text . , β€œadjust_for_ambient_noise



” β€œrecord



”, . , .





with audio_file as source: 
   rcgnzr.adjust_for_ambient_noise(source) 
   clean_audio = rcgnzr.record(source)
      
      



, . IBM. ( , , IBM Speech-to-Text API Python SpeechRecogniton



). API:





recognized_speech_ibm = r.recognize_ibm(clean_audio, username="apkikey", password= "your API Key")
      
      



: API IBM API-. IBM Watson. Speech-to-Text . IBM, , 500 , , .





-

. . . , . , .





, :





print(recognized_speech_ibm)
      
      



. . . , . , ​​ , .





. Β«ready!Β» .





with open('recognized_speech.txt',mode ='w') as file:    
   file.write("Recognized Speech:") 
   file.write("\n") 
   file.write(recognized) 
   print("ready!")
      
      



! , . , - . β€” . , . , .





. YouTube, . .






"Machine Learning. Advanced".





Β«Multi-armed bandits AB Β».








All Articles