Halaman ini menjelaskan cara mendapatkan tanda baca otomatis dalam hasil transkripsi dari Speech-to-Text. Saat Anda mengaktifkan fitur ini, Speech-to-Text akan secara otomatis menyimpulkan adanya titik, koma, dan tanda tanya dalam data audio Anda dan menambahkannya ke transkrip.
Secara default, Speech-to-Text tidak menyertakan tanda baca dalam hasil dari pengenalan ucapan. Namun, Anda dapat meminta agar Speech-to-Text mendeteksi dan memasukkan tanda baca secara otomatis dalam hasil transkripsi. Saat Anda mengaktifkan tanda baca otomatis, Speech-to-Text akan otomatis menggunakan huruf besar pada huruf pertama setelah setiap titik dan tanda tanya.
Sebelum memulai
- Login ke akun Google Cloud Anda. Jika Anda baru menggunakan Google Cloud, buat akun untuk mengevaluasi performa produk kami dalam skenario dunia nyata. Pelanggan baru juga mendapatkan kredit gratis senilai $300 untuk menjalankan, menguji, dan men-deploy workload.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Speech-to-Text APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
Make sure that you have the following role or roles on the project: Cloud Speech Administrator
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
Instal Google Cloud CLI.
-
Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
-
Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:
gcloud init -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Speech-to-Text APIs.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
Make sure that you have the following role or roles on the project: Cloud Speech Administrator
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the project.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- Click Select a role, then search for the role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
-
-
Instal Google Cloud CLI.
-
Jika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
-
Untuk melakukan inisialisasi gcloud CLI, jalankan perintah berikut:
gcloud init -
Jika Anda menggunakan shell lokal, buat kredensial autentikasi lokal untuk akun pengguna Anda:
gcloud auth application-default login
Anda tidak perlu melakukan langkah ini jika menggunakan Cloud Shell.
Jika error autentikasi ditampilkan, dan Anda menggunakan penyedia identitas (IdP) eksternal, konfirmasi bahwa Anda telah login ke gcloud CLI dengan identitas gabungan Anda.
Library klien dapat menggunakan Kredensial Default Aplikasi untuk dengan mudah melakukan autentikasi dengan Google API dan mengirim permintaan ke API tersebut. Dengan Kredensial Default Aplikasi, Anda dapat menguji aplikasi secara lokal dan men-deploy aplikasi tanpa mengubah kode yang mendasarinya. Untuk mengetahui informasi selengkapnya, lihat Melakukan autentikasi untuk menggunakan library klien.
Selain itu, pastikan Anda telah menginstal library klien.
Membuat permintaan transkripsi dengan tanda baca otomatis
Contoh kode berikut menunjukkan cara mendapatkan detail tanda baca otomatis dalam permintaan transkripsi.
Python
Lihat dokumentasi referensi RecognitionFeatures
untuk mengetahui informasi selengkapnya tentang cara mengonfigurasi berbagai fitur.
Pembersihan
Agar akun Google Cloud Anda tidak dikenai biaya untuk resource yang digunakan di halaman ini, ikuti langkah-langkah berikut.
-
Opsional: Cabut kredensial autentikasi yang Anda buat, dan hapus file kredensial lokal.
gcloud auth application-default revoke
-
Opsional: Cabut kredensial dari gcloud CLI.
gcloud auth revoke
Konsol
gcloud
Menghapus Google Cloud project:
gcloud projects delete PROJECT_ID
Langkah berikutnya
- Pelajari cara mentranskripsikan file audio pendek.
- Pelajari cara mentranskripsikan audio streaming.
- Pelajari cara mentranskripsikan file audio panjang.
- Untuk performa terbaik, akurasi, dan tips lainnya, lihat dokumentasi praktik terbaik.