Recognition result normalization
Written by
Updated at November 14, 2024
Normalization is converting (post-processing) the text that results from running a Yandex SpeechKit speech recognition model. It is carried out based on the parameters specified in the API requests.
Note
Normalization is not done in auto language (auto
language code) recognition mode.
You can use the following normalization levels:
- Representing dates and time in numeric format.
- Converting numbers from dictionary to numeric format.
- Capitalizing the beginning of a sentence and proper nouns.
- Profanity masking.
- Formatting phone numbers, e.g.,
7(999)123-45-67
instead of7 999 123 45 67
. - Adding punctuation marks.
Warning
Rules for the presentation of normalized text may change. Please consider this during integration and stay tuned for updates.
Managing normalization parameters
API v1
Normalization level | API parameter |
---|---|
Profanity masking | profanityFilter=true |
Converting numbers from dictionary to numeric format | Enabled by default. To disable, set rawResults=true |
API v2
Normalization level | API parameter |
---|---|
Profanity masking | config.specification.profanityFilter=true |
Converting numbers from dictionary to numeric format | Enabled by default. To disable, set config.specification.rawResults=true |
Normalization level | API parameter |
---|---|
Profanity masking | config.specification.profanityFilter=true |
Converting numbers from dictionary to numeric format | Enabled by default. To disable, set config.specification.rawResults=true |
Capitalizing the beginning of a sentence and proper nouns. Adding punctuation marks | config.specification.literature_text=true |
API v3
To enable normalization, set the text_normalization=TEXT_NORMALIZATION_ENABLED
parameter in the API. Some options are activated by additional parameters if you set text_normalization=TEXT_NORMALIZATION_ENABLED
.
Normalization level | API parameter |
---|---|
Representing dates and time in numeric format | text_normalization=TEXT_NORMALIZATION_ENABLED |
Converting numbers from dictionary to numeric format | text_normalization=TEXT_NORMALIZATION_ENABLED |
Formatting phone numbers | text_normalization=TEXT_NORMALIZATION_ENABLED . To disable this level only, additionally specify phone_formatting_mode=PHONE_FORMATTING_MODE_DISABLED . |
Profanity masking | profanity_filter=true with text_normalization enabled |
Capitalizing the beginning of a sentence and proper nouns. Adding punctuation marks | literature_text=true with text_normalization enabled |