หลายคนคงเคยใช้งาน Speech to Text กันมาบ้างแล้ว ในการแปลงเสียงเป็นข้อความ เช่น Google Translate ซึ่งทาง Google เองก็มี API ให้ใช้งาน มีทั้งแบบฟรีและไม่ฟรีให้ได้ลองเล่นกัน ถ้าไม่เกิน 60 นาที สามารถใช้งานได้ฟรี แต่ถ้าเกินก็จะเสียตัง
Requirement
Get Started
เข้าไปที่หน้าเว็บ แล้วคลิก Set up a project
ทำการ Create project คลิก Next แล้วคลิก Download private key a JSON
ทำการติดตั้ง Google Cloud SDK แล้วกำหนดค่า Environment Variable
C:\>
set GOOGLE_APPLICATION_CREDENTIALS="path"
C:\>
gcloud ml speech recognize gs://cloud-samples-tests/speech/brooklyn.flac --language-code="en-US"
{
"results": [
{
"alternatives": [
{
"confidence": 0.9835046,
"transcript": "how old is the Brooklyn Bridge"
}
]
}
]
}
C:\>
gcloud ml speech recognize-long-running gs://natthasath/input.flac --language-code="th-TH" --async
Check operation [operations/1267314263370035202] for status.
{
"name": "1267314263370035202"
}
Waiting for operation [operations/1267314263370035202] to complete...
ทำการรัน Google Speech to Text API โดยขึ้นอยู่กับ ที่ Support
ทำการรัน Google Speech to Text API โดยทำการ Upload ไฟล์ไปไว้ใน ของตัวเอง เมื่อรันคำสั่งจะ Return ค่า Operation ID กรณีที่ไฟล์มีความยาวเกิน 1 นาทีให้ใช้คำสั่ง recognize-long-running