Class PhraseSet (2.35.0)

PhraseSet(mapping=None,*,ignore_unknown_fields=False,**kwargs)

Provides "hints" to the speech recognizer to favor specificwords and phrases in the results.

Attributes

NameDescription
namestr
The resource name of the phrase set.
phrasesMutableSequence[google.cloud.speech_v1.types.PhraseSet.Phrase]
A list of word and phrases.
boostfloat
Hint Boost. Positive value will increase the probability that a specific phrase will be recognized over other similar sounding phrases. The higher the boost, the higher the chance of false positive recognition as well. Negative boost values would correspond to anti-biasing. Anti-biasing is not enabled, so negative boost will simply be ignored. Thoughboost can accept a wide range of positive values, most use cases are best served with values between 0 (exclusive) and 20. We recommend using a binary search approach to finding the optimal value for your use case as well as adding phrases both with and without boost to your requests.

Classes

Phrase

Phrase(mapping=None,*,ignore_unknown_fields=False,**kwargs)

A phrases containing words and phrase "hints" so that the speechrecognition is more likely to recognize them. This can be used toimprove the accuracy for specific words and phrases, for example, ifspecific commands are typically spoken by the user. This can also beused to add additional words to the vocabulary of the recognizer.Seeusagelimits <https://cloud.google.com/speech-to-text/quotas#content>__.

List items can also include pre-built or custom classes containinggroups of words that represent common concepts that occur in naturallanguage. For example, rather than providing a phrase hint for everymonth of the year (e.g. "i was born in january", "i was born infebuary", ...), use the pre-built$MONTH class improves thelikelihood of correctly transcribing audio that includes months(e.g. "i was born in $month"). To refer to pre-built classes, usethe class' symbol prepended with$ e.g.$MONTH. To refer tocustom classes that were defined inline in the request, set theclass'scustom_class_id to a string unique to all classresources and inline classes. Then use the class' id wrapped in$\{...} e.g. "${my-months}". To refer to custom classesresources, use the class' id wrapped in${} (e.g.${my-months}).

Speech-to-Text supports three locations:global,us (USNorth America), andeu (Europe). If you are calling thespeech.googleapis.com endpoint, use theglobal location. Tospecify a region, use aregionalendpoint <https://cloud.google.com/speech-to-text/docs/endpoints>__with matchingus oreu location value.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-18 UTC.