Analyze Speech and Language with Google APIs

๋ชฉ๋ก
- Cloud Natural Language API: Qwik Start
- Speech-to-Text API: Qwik Start โฌ ๏ธ ์ค๋์ Lab!
- Entity and Sentiment Analysis with the Natural Language API
- Analyze Speech and Language with Google APIs: Challenge Lab
Speech-to-Text API๋ฅผ ์ฌ์ฉํ๋ฉด Google ์์ฑ ์ธ์ ๊ธฐ์ ์ ๊ฐ๋ฐ์ ์ ํ๋ฆฌ์ผ์ด์
์ ๊ฐํธํ๊ฒ ํตํฉ์ด ๊ฐ๋ฅํ๋ค. Speech-to-Text API๋ฅผ ํธ์ถํด๋ณด์!


โก๏ธ Cloud Speech-to-Text API ์ ํ

API_KEY๋ฅผ ํ๊ฒฝ ๋ณ์๋ก ๋ฑ๋ก
์ฐธ๊ณ
Cloud Storage์์ ์ ๊ณต๋ ํ์ผ์ ์ฌ์ฉํ์ฌ ์งํ!
๐gs://cloud-samples-tests/speech/brooklyn.flac
request.json ํ์ผ ์์ฑ
touch request.json
request.json ํ์ผ ์ด๊ธฐโก๏ธ ์ด๋ฒ ์ค์ต์์๋ nano๋ฅผ ํ์ฉํ์๋ค!
nano request.json


{
"config": {
"encoding":"FLAC",
"languageCode": "en-US"
},
"audio": {
"uri":"gs://cloud-samples-tests/speech/brooklyn.flac"
}
}
nano๋ฅผ ์ฌ์ฉํ์ฌ ํ์ผ ๋ด์ฉ ์์ ๋ฐ ์ ์ฅ ๋ฐฉ๋ฒ ๐
1)
Ctrl+x->y๋ฅผ ๋๋ฌ ์ ์ฅ
2) Enter ํค๋ฅผ ๋๋ฌrequest.jsonํ์ผ ๋ซ๊ธฐ!
๋ด์ฉ ๋ถ์
config: ์์ฒญ์ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ์ Speech-to-Text API์ ์๋ ค์ค๋ค.encoding: API๋ก ํ์ผ์ด ์ ์ก๋๋ ๋์ ๊ฐ๋ฐ์๊ฐ ์ฌ์ฉํ๋ ์ค๋์ค ์ธ์ฝ๋ฉ ์ ํ์ API์ ์๋ ค์ค๋ค. (config๊ฐ์ฒด์ ํ์ ํ๋ผ๋ฏธํฐ!)

curl -s -X POST -H "Content-Type: application/json" --data-binary @request.json \
"https://speech.googleapis.com/v1/speech:recognize?key=${API_KEY}"
๋ด์ฉ ๋ถ์
trasnscript: API๊ฐ ์ค๋์ค ํ์ผ์ ๋ณํํ์ฌ ์์ฑํ ํ ์คํธ ์คํฌ๋ฆฝํธconfidence: API๊ฐ ์ค๋์ค ํ์ผ๋ก ์คํฌ๋ฆฝํธ๋ฅผ ์ผ๋ง๋ ์ ํํ๊ฒ ์์ฑํ๋ ์ง ๋ํ๋ด๋ ์์น
result.json ํ์ผ์ ์ ์ฅ
curl -s -X POST -H "Content-Type: application/json" --data-binary @request.json \
"https://speech.googleapis.com/v1/speech:recognize?key=${API_KEY}" > result.json