You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SpeechRecognizer recognizer = new SpeechRecognizer(speechConfig, autoDetectSourceLanguageConfig, audioConfig);
@@ -53,26 +74,49 @@ audioConfig.close();
53
74
result.close();
54
75
```
55
76
77
+
::: zone-end
78
+
56
79
## Use a custom model for automatic language detection
57
80
58
81
In addition to language detection using Speech service models, you can specify a custom model for enhanced recognition. If a custom model isn't provided, the service will use the default language model.
59
82
60
83
The snippets below illustrate how to specify a custom model in your call to the Speech service. If the detected language is `en-US`, then the default model is used. If the detected language is `fr-FR`, then the endpoint for the custom model is used:
Next, specify the source language of your audio with `SpeechRecognitionLanguage`:
30
+
In this example, the source language is provided using `SourceLanguageConfig`. Then, the `sourceLanguageConfig` is passed as a parameter to `SpeechRecognizer` construct.
If you're using a custom model for recognition, you can specify the endpoint with `EndpointId`:
37
+
In this example, the source language and custom endpoint are provided using `SourceLanguageConfig`. Then, the `sourceLanguageConfig` is passed as a parameter to `SpeechRecognizer` construct.
37
38
38
39
```csharp
39
-
speechConfig.EndpointId="The Endpoint ID for your custom model.";
40
+
varsourceLanguageConfig=SourceLanguageConfig.FromLanguage("de-DE", "The Endpoint ID for your custom model.");
> `SpeechRecognitionLanguage` and `EndpointId` set methods are deprecated from the `SpeechConfig` class in C#. The use of these methods are discouraged, and shouldn't be used when constructing a `SpeechRecognizer`.
0 commit comments