์๋ ํ์ธ์. ์ค๋์ ์ ๋ง ์ ๊ธฐํ๊ณ ์ฌ๋ฏธ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค.
์ ๊ฐ ์์ฆ ๋ฅ๋ฌ๋์ ์ํด ํ์ด์ฌ์ผ๋ก ์ฌ๋ฌ๊ฐ์ง๋ฅผ ๋ง๋ค์ด ๋ณด๊ณ ์๋๋ฐ, ์์ฑ์ชฝ์ ์ฐพ๋ค๋ณด๋ ๋ฐ๊ฒฌํ์์ต๋๋ค.
๋จ, 6์ค๋ก ๊ตฌํํ๋ ๊ตฌ๊ธ ์์ฑ ์ธ๊ณต์ง๋ฅ API!
์ ๋ ๊ตฌํ์ ๊ทธ๋ ๋ค์น๋๋ผ๋ ๊ณผ์ฐ ์๋ ๊น? ๋ผ๋ ๊ณ ๋ฏผ์ ํ์ง๋ง,
๊ณผ์ฐ ์ฐ๋ฆฌ์ ์ฌ๋ ๋ง์ ์ธ์ํด์ ๊ธ๋ก ํํํ ์ ์์๊น?
์์ ์ด์์ผ๋ก ์๋์ด ๊น์ง๋๋์ต๋๋ค.
๋ฐ๋ก ์ค์ตํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
ํ์ด์ฐธ์ ํค๊ณ ์ค์น๋ฅผ ์ค๋นํฉ๋๋ค.
speechRecognition์ ๊ฒ์ํฉ๋๋ค.
์ค์น๊ฐ ์๋ฃ๋์๋ค์.
๋ง์ฝ pycharm์ด ์๋์๋ผ๋ฉด, cmd์
python -m pip install speechrecognition
์ค๋์ ๊ธฐ์ค์ผ๋ก 3.8.1 ์ต์ ๋ฒ์ ผ๊ธฐ์ค์ ๋๋ค.
์ฝ๋ฉ์ด ์์ฒญ ์งง์ผ๋ ํ ๋ฒ์ ์ฌ๋ฆฌ๋๋ก ํ๊ฒ ์ต๋๋ค.
import speech_recognition as sr
r = sr.Recognizer()
harvard = sr.AudioFile('test.wav')
with harvard as source:
audio = r.record(source)
print(r.recognize_google(audio))
์ ๊ฐ ์ค์ตํ ์์ฑ์ ๋๋ค. ํ ๋ฒ ์ด ์์ฑ์ ๋ง๊ฒ ์ธ์ํ๋์ง printํด๋ณด๊ฒ ์ต๋๋ค.
์... ์ด ์คํ ์์ฑ์ด ํ๋ฅผ ๋๋ฌด ๊ตด๋ ค์ ๋ฌด์จ๋ง์ธ์ง ๋ชฐ๋๋๋ฐ, ๊ตฌ๊ธ api๋ ์ ๋ณด๋ค ํ์คํ ์์๋ ๋๋ค.
์์ฑํ์ผ์ 4๊ฐ์ง๊ฐ ๊ฐ๋ฅํฉ๋๋ค.
- WAV: must be in PCM/LPCM format
- AIFF
- AIFF-C
- FLAC: must be native FLAC format; OGG-FLAC is not supported
google API๋ฟ๋ง ์๋๋ผ
- recognize_bing(): Microsoft Bing Speech
- recognize_google(): Google Web Speech API
- recognize_google_cloud(): Google Cloud Speech - requires installation of the google-cloud-speech package
- recognize_houndify(): Houndify by SoundHound
- recognize_ibm(): IBM Speech to Text
- recognize_sphinx(): CMU Sphinx - requires installing PocketSphinx
- recognize_wit(): wit.ai
7๊ฐ์ง๋ ์ ๊ณตํฉ๋๋ค... ์ด์ผ...
ํ์ง๋ง... sphinx๋ฅผ ์ ์ธํ ๋๋จธ์ง 6๊ฐ๋ ์ธํฐ๋ท์ด ์ฐ๊ฒฐ๋์ด ์์ด์ผ ํฉ๋๋ค.
์ ๊ฐ ๋๋ง์นจ ์์ฑ์ filterํ๋ก๊ทธ๋จ์ ๋ง๋ค๊ณ ์๋๋ฐ... ๋ ธ์ด์ฆ๊ฐ ์๋ฉ ๋ ์์ฑ์ ํํฐ๋งํ ์ด ํ์ ์ธ๊ณต์ง๋ฅ์ ๋๋ ค๋ด๋ ์ฌ๋ฐ์ ๊ฒ ๊ฐ์ต๋๋ค.
๊ตฌ๊ฐ์ ์ง์ ํ ์๋ ์์ต๋๋ค.
์ด๋ฐ ์์ผ๋ก ๊ตฌ๊ฐ์ 1์ด์ฉ ์ชผ๊ฐ๋ฉด ์ด๋ป๊ฒ ๋ ๊น์?
์ด ๋จ์๋ก ๋จ์ด๋ฅผ ์ชผ๊ฐ๊ฒ ๋๋ฉด ๋จ์ด ๋ํ ํจ๊ป ์ชผ๊ฐ์ง๊ฒ ๋ฉ๋๋ค.
๋ น์๋ ํ์ผ๋ฟ๋ง ์๋๋ผ ์ค์๊ฐ์ผ๋ก ์์ฑ์ ์ธ์ํด Text๋ฅผ ๋ฝ์๋ด๋ ๋ฐฉ๋ฒ๋ ์์ต๋๋ค.
https://pythonspot.com/speech-recognition-using-google-speech-api/
Speech Recognition using Google Speech API
Speech Recognition using Google Speech API Google has a great Speech Recognition API. This API converts spoken text (microphone) into written text (Python strings), briefly Speech to Text. You can simply speak in a microphone and Google API will translate
pythonspot.com
์ค์๊ฐ์ผ๋ก ์์ฑ์ ํ ์คํธ๋ก ๋ณํํ๊ณ ์ถ์ผ์๋ค๋ฉด ์ ์ฌ์ดํธ๋ก ์ฌ๋ผ๊ฐ์๋ฉด ๋ฉ๋๋ค.