|
| 1 | +--- |
| 2 | +title: Display text formatting with speech to text - Speech service |
| 3 | +titleSuffix: Azure Cognitive Services |
| 4 | +description: An overview of key concepts for display text formatting with speech to text. |
| 5 | +services: cognitive-services |
| 6 | +author: eric-urban |
| 7 | +manager: nitinme |
| 8 | +ms.service: cognitive-services |
| 9 | +ms.subservice: speech-service |
| 10 | +ms.topic: conceptual |
| 11 | +ms.date: 09/09/2022 |
| 12 | +ms.author: eur |
| 13 | +zone_pivot_groups: programming-languages-speech-sdk-cli |
| 14 | +--- |
| 15 | + |
| 16 | +# Display text formatting with speech to text |
| 17 | + |
| 18 | +Speech-to-text offers an array of formatting features to ensure that the transcribed text is clear and legible. Below is an overview of these features and how each one is used to improve the overall clarity of the final text output. |
| 19 | + |
| 20 | +## Standard formatting |
| 21 | + |
| 22 | +### ITN |
| 23 | + |
| 24 | +Inverse Text Normalization (ITN) is a process that converts spoken words into their written form. For example, the spoken word "four" is converted to the written form "4". This process is performed by the speech-to-text service and is not configurable by the user. Some of the supported text formats include dates, times, decimals, currencies, addresses, emails, and phone numbers. This allows Speech users to speak naturally into their device, and the service formats text as expected. The following table shows the ITN rules that are applied to the text output. |
| 25 | + |
| 26 | +|Spoken Form|Display Text| |
| 27 | +|---|---| |
| 28 | +|"that will cost nine hundred dollars"|That will cost $900.| |
| 29 | +|"my phone number is one eight hundred, four five six, eight nine ten"|My phone number is 1-800-456-8910.| |
| 30 | +|"the time is six forty five p m"|The time is 6:45 PM.| |
| 31 | +|"I live on thirty five lexington avenue"|I live on 35 Lexington Ave.| |
| 32 | +|"the answer is six point five"|The answer is 6.5.| |
| 33 | +|"send it to support at help dot com" |Send it to [email protected]. | |
| 34 | + |
| 35 | + |
| 36 | +### Capitalization |
| 37 | + |
| 38 | +Speech-to-text’s model knows which words should be capitalized and automatically does so in order to make the text more readable. It will capitalize proper nouns and words at the beginning of a sentence, as well as anywhere else where it makes the overall text more grammatically correct. Some examples are listed below: |
| 39 | + |
| 40 | +|Spoken Form|Display Text| |
| 41 | +|---|---| |
| 42 | +|"i got an iphone x r"|I got an iPhone XR.| |
| 43 | +|"my name is jennifer smith"|My name is Jennifer Smith.| |
| 44 | +|"i want to visit new york city"|I want to visit New York City.| |
| 45 | +|"i need to service my toyota"|I need to service my Toyota.| |
| 46 | + |
| 47 | + |
| 48 | +### Disfluency removal |
| 49 | + |
| 50 | +When speaking, it is common for someone to stutter, duplicate words, and say filler words like "uhm" or "uh". Speech-to-text can recognize these disfluencies and remove them from the transcribed text so that it is cleaner. This is great for transcribing live unscripted speeches to read them back later. Some examples are shown in this table. |
| 51 | + |
| 52 | +|Spoken Form|Display Text| |
| 53 | +|---|---| |
| 54 | +|"i uh said that we can go to the uhmm movies"|I said that we can go to the movies.| |
| 55 | +|"its its not that big of uhm a deal"|It's not that big of a deal.| |
| 56 | +|"umm i think tomorrow should work"|I think tomorrow should work.| |
| 57 | + |
| 58 | + |
| 59 | +## Configurable formatting options |
| 60 | + |
| 61 | +### Explicit Punctuation |
| 62 | + |
| 63 | +When using Speech-to-text, you have the option to speak aloud any punctuation you may want to use in order to make your text more legible. This is especially useful in a situation where you need to use complex punctuation or want your transcribed text to be read by someone else, as it allows you to include grammar with your voice rather than having to retroactively input it later. Some examples are shown in this table. |
| 64 | + |
| 65 | +|Spoken Form|Display Text| |
| 66 | +|---|---| |
| 67 | +|"they entered the room dot dot dot"|They entered the room...| |
| 68 | +|"i heart emoji you period"|I <3 you.| |
| 69 | +|"the options are apple forward slash banana forward slash orange period"|The options are apple/banana/orange.| |
| 70 | +|"are you sure question mark"|Are you sure?| |
| 71 | + |
| 72 | + |
| 73 | +### Auto Punctuation |
| 74 | + |
| 75 | +Sometimes it may seem tedious to have to speak every punctuation mark out loud, so Speech-to-text also offers the ability to automatically punctuate your text and improve clarity. This is great option when you want to transcribe a call or conversation to read it later. Some examples are shown in this table. |
| 76 | + |
| 77 | +|Spoken Form|Display Text| |
| 78 | +|---|---| |
| 79 | +|"how are you"|How are you?| |
| 80 | +|"we can go to the mall park or beach"|We can go to the mall, park, or beach.| |
| 81 | + |
| 82 | +### Profanity filter |
| 83 | + |
| 84 | +You can specify whether to mask, remove, or show profanity in the final transcribed text. Masking replaces profane words with asterisk (*) characters so that you can keep the original sentiment of your text while making it more appropriate for certain situations |
| 85 | + |
| 86 | +> [!NOTE] |
| 87 | +> Microsoft also reserves the right to mask or remove any word that is deemed inappropriate. Such words will not be returned by the Speech service, whether or not you enabled profanity filtering. |
| 88 | +
|
| 89 | +The profanity filter options are: |
| 90 | +- `Masked`: Replaces letters in profane words with asterisk (*) characters. This is the default option. |
| 91 | +- `Raw`: Include the profane words verbatim. |
| 92 | +- `Removed`: Removes profane words. |
| 93 | + |
| 94 | +For example, to remove profane words from the speech recognition result, set the profanity filter to `Removed` as shown here: |
| 95 | + |
| 96 | +::: zone pivot="programming-language-csharp" |
| 97 | +```csharp |
| 98 | +speechConfig.SetProfanity(ProfanityOption.Removed); |
| 99 | +``` |
| 100 | +::: zone-end |
| 101 | +::: zone pivot="programming-language-cpp" |
| 102 | +```cpp |
| 103 | +speechConfig->SetProfanity(ProfanityOption::Removed); |
| 104 | +``` |
| 105 | +::: zone-end |
| 106 | +::: zone pivot="programming-language-go" |
| 107 | +```go |
| 108 | +speechConfig.SetProfanity(common.Removed) |
| 109 | +``` |
| 110 | +::: zone-end |
| 111 | +::: zone pivot="programming-language-java" |
| 112 | +```java |
| 113 | +speechConfig.setProfanity(ProfanityOption.Removed); |
| 114 | +``` |
| 115 | +::: zone-end |
| 116 | +::: zone pivot="programming-language-javascript" |
| 117 | +```javascript |
| 118 | +speechConfig.setProfanity(sdk.ProfanityOption.Removed); |
| 119 | +``` |
| 120 | +::: zone-end |
| 121 | +::: zone pivot="programming-language-objectivec" |
| 122 | +```objective-c |
| 123 | +[self.speechConfig setProfanityOptionTo:SPXSpeechConfigProfanityOption.SPXSpeechConfigProfanityOption_ProfanityRemoved]; |
| 124 | +``` |
| 125 | +::: zone-end |
| 126 | +::: zone pivot="programming-language-swift" |
| 127 | +```swift |
| 128 | +self.speechConfig!.setProfanityOptionTo(SPXSpeechConfigProfanityOption_ProfanityRemoved) |
| 129 | +``` |
| 130 | +::: zone-end |
| 131 | +::: zone pivot="programming-language-python" |
| 132 | +```python |
| 133 | +speech_config.set_profanity(speechsdk.ProfanityOption.Removed) |
| 134 | +``` |
| 135 | +::: zone-end |
| 136 | +::: zone pivot="programming-language-cli" |
| 137 | +```console |
| 138 | +spx recognize --file caption.this.mp4 --format any --profanity masked --output vtt file - --output srt file - |
| 139 | +``` |
| 140 | +::: zone-end |
| 141 | + |
| 142 | +Profanity filter is applied to the result `Text` and `MaskedNormalizedForm` properties. Profanity filter isn't applied to the result `LexicalForm` and `NormalizedForm` properties. Neither is the filter applied to the word level results. |
| 143 | + |
| 144 | + |
| 145 | +## Next steps |
| 146 | + |
| 147 | +* [Speech-to-text quickstart](get-started-speech-to-text.md) |
| 148 | +* [Get speech recognition results](get-speech-recognition-results.md) |
0 commit comments