speech_adaptation_beta.yaml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. type: com.google.api.codegen.samplegen.v1p2.SampleConfigProto
  2. schema_version: 1.2.0
  3. samples:
  4. - region_tag: speech_adaptation_beta
  5. title: Speech Adaptation (Cloud Storage)
  6. description: Transcribe a short audio file with speech adaptation.
  7. rpc: Recognize
  8. service: google.cloud.speech.v1p1beta1.Speech
  9. request:
  10. - field: audio.uri
  11. value: "gs://cloud-samples-data/speech/brooklyn_bridge.mp3"
  12. input_parameter: storage_uri
  13. comment: URI for audio file in Cloud Storage, e.g. gs://[BUCKET]/[FILE]
  14. - field: config.speech_contexts[0].phrases[0]
  15. value: "Brooklyn Bridge"
  16. input_parameter: phrase
  17. comment: |
  18. Phrase "hints" help recognize the specified phrases from your audio.
  19. - field: config.speech_contexts[0].boost
  20. value: 20.0
  21. comment: |
  22. Hint Boost. This value increases the probability that a specific
  23. phrase will be recognized over other similar sounding phrases.
  24. The higher the boost, the higher the chance of false positive
  25. recognition as well. Can accept wide range of positive values.
  26. Most use cases are best served with values between 0 and 20.
  27. Using a binary search happroach may help you find the optimal value.
  28. - field: config.sample_rate_hertz
  29. value: 44100
  30. comment: Sample rate in Hertz of the audio data sent
  31. - field: config.language_code
  32. value: "en-US"
  33. comment: The language of the supplied audio
  34. - field: config.encoding
  35. value: MP3
  36. comment: |
  37. Encoding of audio data sent. This sample sets this explicitly.
  38. This field is optional for FLAC and WAV audio formats.
  39. response:
  40. - loop:
  41. variable: result
  42. collection: $resp.results
  43. body:
  44. - comment:
  45. - First alternative is the most probable result
  46. - define: alternative = result.alternatives[0]
  47. - print:
  48. - "Transcript: %s"
  49. - alternative.transcript