Skip to content

Commit 3e652e3

Browse files
committed
breaking SDK changes for LID mode
1 parent 71f7b50 commit 3e652e3

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

articles/cognitive-services/Speech-Service/language-identification.md

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Code snippets are included with the concepts described next. Complete samples fo
4242

4343
### Candidate languages
4444

45-
You provide candidate languages, at least one of which is expected to be in the audio. You can include up to four languages for [at-start LID](#at-start-and-continuous-language-identification) or up to 10 languages for [continuous LID](#at-start-and-continuous-language-identification). The Speech service returns one of the candidate languages provided even if those languages weren't in the audio. For example, if `fr-FR` (French) and `en-US` (English) are provided as candidates, but German is spoken, either `fr-FR` or `en-US` would be returned.
45+
You provide candidate languages with the `AutoDetectSourceLanguageConfig` object, at least one of which is expected to be in the audio. You can include up to four languages for [at-start LID](#at-start-and-continuous-language-identification) or up to 10 languages for [continuous LID](#at-start-and-continuous-language-identification). The Speech service returns one of the candidate languages provided even if those languages weren't in the audio. For example, if `fr-FR` (French) and `en-US` (English) are provided as candidates, but German is spoken, either `fr-FR` or `en-US` would be returned.
4646

4747
You must provide the full locale with dash (`-`) separator, but language identification only uses one locale per base language. Don't include multiple locales (for example, "en-US" and "en-GB") for the same language.
4848

@@ -106,7 +106,7 @@ Speech supports both at-start and continuous language identification (LID).
106106
- At-start LID identifies the language once within the first few seconds of audio. Use at-start LID if the language in the audio won't change. With at-start LID, a single language is detected and returned in less than 5 seconds.
107107
- Continuous LID can identify multiple languages for the duration of the audio. Use continuous LID if the language in the audio could change. Continuous LID doesn't support changing languages within the same sentence. For example, if you're primarily speaking Spanish and insert some English words, it will not detect the language change per word. With Continuous LID, a language is detected every 2 seconds for the duration of the audio.
108108
109-
You implement at-start LID or continuous LID by calling methods for [recognize once or continuous](#recognize-once-or-continuous).
109+
You implement at-start LID or continuous LID by calling methods for [recognize once or continuous](#recognize-once-or-continuous). Continuous LID is only supported with continuous recognition.
110110
111111
### Recognize once or continuous
112112
@@ -117,7 +117,7 @@ Language identification is completed with recognition objects and operations. Yo
117117
118118
You'll either call the "recognize once" method, or the start and stop continuous recognition methods. You choose from:
119119
120-
- Recognize once with at-start LID
120+
- Recognize once with At-start LID. Continuous LID isn't supported for recognize once.
121121
- Continuous recognition with at-start LID
122122
- Continuous recognition with continuous LID
123123
@@ -126,7 +126,7 @@ The `SpeechServiceConnection_LanguageIdMode` property is only required for conti
126126
::: zone pivot="programming-language-csharp"
127127
128128
```csharp
129-
// Recognize once with At-start LID
129+
// Recognize once with At-start LID. Continuous LID isn't supported for recognize once.
130130
var result = await recognizer.RecognizeOnceAsync();
131131

132132
// Start and stop continuous recognition with At-start LID
@@ -143,7 +143,7 @@ await recognizer.StopContinuousRecognitionAsync();
143143
::: zone pivot="programming-language-cpp"
144144
145145
```cpp
146-
// Recognize once with At-start LID
146+
// Recognize once with At-start LID. Continuous LID isn't supported for recognize once.
147147
auto result = recognizer->RecognizeOnceAsync().get();
148148

149149
// Start and stop continuous recognition with At-start LID
@@ -160,7 +160,7 @@ recognizer->StopContinuousRecognitionAsync().get();
160160
::: zone pivot="programming-language-java"
161161
162162
```java
163-
// Recognize once with At-start LID
163+
// Recognize once with At-start LID. Continuous LID isn't supported for recognize once.
164164
SpeechRecognitionResult result = recognizer->RecognizeOnceAsync().get();
165165

166166
// Start and stop continuous recognition with At-start LID
@@ -177,7 +177,7 @@ recognizer.stopContinuousRecognitionAsync().get();
177177
::: zone pivot="programming-language-python"
178178
179179
```python
180-
# Recognize once with At-start LID
180+
# Recognize once with At-start LID. Continuous LID isn't supported for recognize once.
181181
result = recognizer.recognize_once()
182182
183183
# Start and stop continuous recognition with At-start LID
@@ -213,9 +213,6 @@ using Microsoft.CognitiveServices.Speech.Audio;
213213
214214
var speechConfig = SpeechConfig.FromSubscription("YourSubscriptionKey","YourServiceRegion");
215215
216-
// Only at-start LID is supported when you use RecognizeOnceAsync, so this line isn't required.
217-
speechConfig.SetProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, "AtStart");
218-
219216
var autoDetectSourceLanguageConfig =
220217
AutoDetectSourceLanguageConfig.FromLanguages(
221218
new string[] { "en-US", "de-DE", "zh-CN" });
@@ -336,9 +333,6 @@ using namespace Microsoft::CognitiveServices::Speech::Audio;
336333
337334
auto speechConfig = SpeechConfig::FromSubscription("YourSubscriptionKey","YourServiceRegion");
338335
339-
// Only at-start LID is supported when you use RecognizeOnceAsync, so this line isn't required.
340-
speechConfig->SetProperty(PropertyId::SpeechServiceConnection_LanguageIdMode, "AtStart");
341-
342336
auto autoDetectSourceLanguageConfig =
343337
AutoDetectSourceLanguageConfig::FromLanguages({ "en-US", "de-DE", "zh-CN" });
344338
@@ -614,9 +608,6 @@ public static async Task RecognizeOnceSpeechTranslationAsync()
614608
615609
var config = SpeechTranslationConfig.FromEndpoint(endpointUrl, "YourSubscriptionKey");
616610
617-
// Only at-start LID is supported when you use RecognizeOnceAsync, so this line isn't required.
618-
speechTranslationConfig.SetProperty(PropertyId.SpeechServiceConnection_LanguageIdMode, "AtStart");
619-
620611
// Source language is required, but currently ignored.
621612
string fromLanguage = "en-US";
622613
speechTranslationConfig.SpeechRecognitionLanguage = fromLanguage;
@@ -774,8 +765,6 @@ auto region = "YourServiceRegion";
774765
auto endpointString = std::format("wss://{}.stt.speech.microsoft.com/speech/universal/v2", region);
775766
auto config = SpeechTranslationConfig::FromEndpoint(endpointString, "YourSubscriptionKey");
776767
777-
// Only at-start LID is supported when you use RecognizeOnceAsync, so this line isn't required.
778-
config->SetProperty(PropertyId::SpeechServiceConnection_LanguageIdMode, "AtStart");
779768
auto autoDetectSourceLanguageConfig = AutoDetectSourceLanguageConfig::FromLanguages({ "en-US", "de-DE" });
780769
781770
// Sets source and target languages
@@ -953,9 +942,6 @@ translation_config = speechsdk.translation.SpeechTranslationConfig(
953942
target_languages=('de', 'fr'))
954943
audio_config = speechsdk.audio.AudioConfig(filename=weatherfilename)
955944
956-
# Only at-start LID is supported when you use RecognizeOnceAsync, so this line isn't required.
957-
translation_config.set_property(property_id=speechsdk.PropertyId.SpeechServiceConnection_LanguageIdMode, value='AtStart')
958-
959945
# Specify the AutoDetectSourceLanguageConfig, which defines the number of possible languages
960946
auto_detect_source_language_config = speechsdk.languageconfig.AutoDetectSourceLanguageConfig(languages=["en-US", "de-DE", "zh-CN"])
961947

0 commit comments

Comments
 (0)