SlideShare a Scribd company logo
1 of 25
Download to read offline
Speech-to-Text API
ประสบการณ์ หัดใช้เพื่อถอดเทป ภาษาไทย
Outline
• ทฤษฎี
• Speech-to-Text API
• ปัญหาการถอดเทป
• ปฏิบัติ - Colab
• Libraries & Data
• pydub, SpeechClient()
• config, response
• Interface design
ทฤษฎี

Theory
Google Speech-to-Text
• เดิมชื่อ Speech API เปลี่ยนเป็น Speech-to-Text
• กลุ่ม Cloud ML แบบเรียกใช้สำเร็จ
• ASR: Automatic Speech Recognition
• รองรับ 120 ภาษา (มากที่สุด)
• ตัวเลือกอื่น: Nuance, AmiVoice, Tellvoice

(MS, AWS ไม่มีภาษาไทย)
ความสามารถ
• แปลงเสียง เป็น Text ใน 3 mode
• Synchronous (สั้น)
• Asynchronous (ยาว)
• Streaming (real-time)
• ใช้ผ่าน Library, gcloud, curl
Advanced Features
• Alternatives
• Timestamps
• Separate Speakers
• Identify Language
• Enhanced Models (เฉพาะ English)
• Word-level Confidence
ราคา
• ฟรี 60 นาที/เดือน
• เสียงพูด $0.006 = 0.20฿ ต่อ 15 sec
• วิดีโอ x2 เท่า
• เช่น ถอดเทป 1 ชั่วโมง ≈ 50 บาท
การถอดเทป
• ทำไมต้องถอดเทป (transcribe)
• เพื่อ search
• ทำ และแปล sub-title (accessibility)
• text mining หา insight
• แปลง unstructured data เป็น structured
• ปัญหา: กินแรงคนมาก=แพง
Requirement
• ระบบถอดเทป โดยใช้ Speech-to-Text API
• ไม่แพงเกินไป
• แม่นยำพอ และสามารถตรวจคำผิดได้
• มี time-stamp เพื่อแปลงเป็น subtitle ได้
ปฏิบัติ

Practice
Google Colab
• https://colab.research.google.com
• Free cloud instance
• CPU: Xeon 2.3 Ghz.
• RAM: 12.6 GB
• Disk: 33 GB
• GPU Tesla K80, 2496 cores, 12GB VRAM
• idle cutoff 90 นาที (max 12 ชั่วโมง)
Import & Install
• from IPython.display import HTML, Audio
• !pip install youtube-dl
• !pip install pydub !apt install ffmpeg
• !pip install google-cloud-speech
• from google.cloud import 

speech_v1p1beta1 as speech
youtube-dl
• Download from YouTube in many formats
• !youtube-dl -F [youtube_url] ดู formats
• !youtube-dl -f bestaudio -o ‘audio.%(ext)s’ [url]
pydub
librosa, peaks.js
• Librosa
• waveform
• spectrogram
• CQT
• Peaks.js
• interaction
Cloud Authentication
• Register Google Cloud (free $200 credit)
• Create a new project
• Enable Speech API for the project
• Download credential file, save to Google Drive
• Load credential file into Colab, set environment
gcloud speech recognize
• For command line, you can also use ‘curl’
Python Library
• เรียก API ด้วย audio และ config
แบบง่ายสุด
หลาย alternatives
• ระบุ config เป็น max_alternatives=n
Time offset, word confidence
python property()
Click & Play
Next
• client.long_running_recognize()
• คำยากๆ ที่สะกดผิด เก็บสถิติแล้ว correct
• context hint ด้วย speechContexts phrases 

(500 คำ)
• speech analysis (waveform, spectrogram) เพื่อ
correct boundary
• เอา label ไป train ASR เช่น KALDI, Deep Speech
Thank you!

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Speech-to-Text API - Thai NLP Meetup #2