250x250
반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- youtube data
- hadoop
- requests
- integrated gradient
- subdag
- 유튜브 API
- BigQuery
- UDF
- session 유지
- API Gateway
- grad-cam
- correlation
- Retry
- tensorflow text
- TensorFlow
- GCP
- gather_nd
- 공분산
- top_k
- chatGPT
- Airflow
- XAI
- airflow subdag
- Counterfactual Explanations
- spark udf
- GenericGBQException
- 상관관계
- API
- login crawling
- flask
Archives
- Today
- Total
데이터과학 삼학년
Speech to text (Speech Recognition API and PyAudio library) 본문
Machine Learning
Speech to text (Speech Recognition API and PyAudio library)
Dan-k 2020. 6. 18. 16:59반응형
음성을 문자로 변환하는 api를 소개한다.
보통 음성은 대표적인 커뮤니케이션 수단이지만, 분석을 할 때는 제약이 있다.
이에 음성을 텍스트로 변환하는 방법에 대해 알아보고자 한다.
(Hidden Markov Model (HMM), deep neural network models are used to convert the audio into text.)
Hidden Markov Model 을 이용하여 보통 음성을 텍스트로 변환한다.
대표적인 speech to text api로 Speech Recognition api와 pyaudio를 소개하려 한다.
Speech Recognition
Speech Recognition api 는 여러개의 api가 있는데 konlpy처럼... 여기서는 Google에서 제공해주는 api를 사용한다.
지원 언어가 매우 다양하다 (한국어도 물론 포함).
설치
!pip install SpeechRecognition
변환 코드
#import library
import speech_recognition as sr
# Initialize recognizer class (for recognizing the speech)
r = sr.Recognizer()
# Reading Audio file as source
# listening the audio file and store in audio_text variable
with sr.AudioFile('I-dont-know.wav') as source:
audio_text = r.listen(source)
# recoginize_() method will throw a request error if the API is unreachable, hence using exception handling
try:
# using google speech recognition
text = r.recognize_google(audio_text)
print('Converting audio transcripts into text ...')
print(text)
except:
print('Sorry.. run again...')
#import library
import speech_recognition as sr
# Initialize recognizer class (for recognizing the speech)
r = sr.Recognizer()
# Reading Microphone as source
# listening the speech and store in audio_text variable
with sr.Microphone() as source:
print("Talk")
audio_text = r.listen(source)
print("Time over, thanks")
# recoginize_() method will throw a request error if the API is unreachable, hence using exception handling
try:
# using google speech recognition
print("Text: "+r.recognize_google(audio_text))
except:
print("Sorry, I did not get that")
https://cloud.google.com/speech-to-text/docs/languages
728x90
반응형
LIST
'Machine Learning' 카테고리의 다른 글
Text classification using GCP ai-platform (0) | 2020.06.26 |
---|---|
tf.keras.callbacks.LearningRateScheduler (1) | 2020.06.24 |
Sequence Model (RNN, LSTM) (0) | 2020.06.02 |
Going Faster and Deeper (0) | 2020.06.02 |
Dealing with Data Scarcity (0) | 2020.06.02 |
Comments