Skip to content

Commit b1b0aa5

Browse files
committed
initial draft
1 parent 666f145 commit b1b0aa5

File tree

5 files changed

+155
-64
lines changed

5 files changed

+155
-64
lines changed

articles/cognitive-services/Speech-Service/captioning-concepts.md

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Captioning can accompany real time or pre-recorded speech. Whether you're showin
4040

4141
The Speech service supports output formats such as SRT (SubRip Text) and WebVTT (Web Video Text Tracks). These can be loaded onto most video players such as VLC, automatically adding the captions on to your video.
4242

43+
> [!TIP]
44+
> The Speech service provides [profanity filter](display-text-format.md#profanity-filter) options. You can specify whether to mask, remove, or show profanity.
45+
4346
The [SRT](https://docs.fileformat.com/video/srt/) (SubRip Text) timespan output format is `hh:mm:ss,fff`.
4447

4548
```srt
@@ -161,68 +164,6 @@ RECOGNIZING: Text=welcome to applied mathematics
161164
RECOGNIZED: Text=Welcome to applied Mathematics course 201.
162165
```
163166

164-
## Profanity filter
165-
166-
You can specify whether to mask, remove, or show profanity in recognition results.
167-
168-
> [!NOTE]
169-
> 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.
170-
171-
The profanity filter options are:
172-
- `Masked`: Replaces letters in profane words with asterisk (*) characters. This is the default option.
173-
- `Raw`: Include the profane words verbatim.
174-
- `Removed`: Removes profane words.
175-
176-
For example, to remove profane words from the speech recognition result, set the profanity filter to `Removed` as shown here:
177-
178-
::: zone pivot="programming-language-csharp"
179-
```csharp
180-
speechConfig.SetProfanity(ProfanityOption.Removed);
181-
```
182-
::: zone-end
183-
::: zone pivot="programming-language-cpp"
184-
```cpp
185-
speechConfig->SetProfanity(ProfanityOption::Removed);
186-
```
187-
::: zone-end
188-
::: zone pivot="programming-language-go"
189-
```go
190-
speechConfig.SetProfanity(common.Removed)
191-
```
192-
::: zone-end
193-
::: zone pivot="programming-language-java"
194-
```java
195-
speechConfig.setProfanity(ProfanityOption.Removed);
196-
```
197-
::: zone-end
198-
::: zone pivot="programming-language-javascript"
199-
```javascript
200-
speechConfig.setProfanity(sdk.ProfanityOption.Removed);
201-
```
202-
::: zone-end
203-
::: zone pivot="programming-language-objectivec"
204-
```objective-c
205-
[self.speechConfig setProfanityOptionTo:SPXSpeechConfigProfanityOption.SPXSpeechConfigProfanityOption_ProfanityRemoved];
206-
```
207-
::: zone-end
208-
::: zone pivot="programming-language-swift"
209-
```swift
210-
self.speechConfig!.setProfanityOptionTo(SPXSpeechConfigProfanityOption_ProfanityRemoved)
211-
```
212-
::: zone-end
213-
::: zone pivot="programming-language-python"
214-
```python
215-
speech_config.set_profanity(speechsdk.ProfanityOption.Removed)
216-
```
217-
::: zone-end
218-
::: zone pivot="programming-language-cli"
219-
```console
220-
spx recognize --file caption.this.mp4 --format any --profanity masked --output vtt file - --output srt file -
221-
```
222-
::: zone-end
223-
224-
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.
225-
226167
## Language identification
227168

228169
If the language in the audio could change, use continuous [language identification](language-identification.md). Language identification is used to identify languages spoken in audio when compared against a list of [supported languages](language-support.md?tabs=language-identification). You provide up to 10 candidate languages, at least one of which is expected be in the audio. The Speech service returns the most likely language in the audio.
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
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)

articles/cognitive-services/Speech-Service/includes/quickstarts/captioning/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Here are details about the optional arguments from the previous command:
6363
- `--output vtt file -` and `--output srt file -`: Outputs WebVTT and SRT captions to standard output. For more information about SRT and WebVTT caption file formats, see [Caption output format](~/articles/cognitive-services/speech-service/captioning-concepts.md#caption-output-format). For more information about the `--output` argument, see [Speech CLI output options](~/articles/cognitive-services/speech-service/spx-output-options.md).
6464
- `@output.each.detailed`: Outputs event results with text, offset, and duration. For more information, see [Get speech recognition results](~/articles/cognitive-services/speech-service/get-speech-recognition-results.md).
6565
- `--property SpeechServiceResponse_StablePartialResultThreshold=5`: You can request that the Speech service return fewer `Recognizing` events that are more accurate. In this example, the Speech service must affirm recognition of a word at least five times before returning the partial results to you. For more information, see [Get partial results](~/articles/cognitive-services/speech-service/captioning-concepts.md#get-partial-results) concepts.
66-
- `--profanity masked`: You can specify whether to mask, remove, or show profanity in recognition results. For more information, see [Profanity filter](~/articles/cognitive-services/speech-service/captioning-concepts.md#profanity-filter) concepts.
66+
- `--profanity masked`: You can specify whether to mask, remove, or show profanity in recognition results. For more information, see [Profanity filter](~/articles/cognitive-services/speech-service/display-text-format.md#profanity-filter) concepts.
6767
- `--phrases "Constoso;Jessie;Rehaan"`: You can specify a list of phrases to be recognized, such as Contoso, Jessie, and Rehaan. For more information, see [Improve recognition with phrase list](~/articles/cognitive-services/speech-service/improve-accuracy-phrase-list.md).
6868

6969
## Clean up resources

articles/cognitive-services/Speech-Service/includes/quickstarts/captioning/usage-arguments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ Output options include:
3434
- `--output FILE`: Output captions to the specified `file`. This flag is required.
3535
- `--srt`: Output captions in SRT (SubRip Text) format. The default format is WebVTT (Web Video Text Tracks). For more information about SRT and WebVTT caption file formats, see [Caption output format](~/articles/cognitive-services/speech-service/captioning-concepts.md#caption-output-format).
3636
- `--quiet`: Suppress console output, except errors.
37-
- `--profanity OPTION`: Valid values: raw, remove, mask. For more information, see [Profanity filter](~/articles/cognitive-services/speech-service/captioning-concepts.md#profanity-filter) concepts.
37+
- `--profanity OPTION`: Valid values: raw, remove, mask. For more information, see [Profanity filter](~/articles/cognitive-services/speech-service/display-text-format.md#profanity-filter) concepts.
3838
- `--threshold NUMBER`: Set stable partial result threshold. The default value with this code example is `3`. For more information, see [Get partial results](~/articles/cognitive-services/speech-service/captioning-concepts.md#get-partial-results) concepts.

articles/cognitive-services/Speech-Service/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ items:
5858
href: how-to-recognize-speech.md
5959
- name: Get speech recognition results
6060
href: get-speech-recognition-results.md
61+
- name: Display text formatting
62+
href: display-text-format.md
6163
- name: How to use batch transcription
6264
href: batch-transcription.md
6365
- name: Improve recognition with Custom Speech

0 commit comments

Comments
 (0)