This repository was archived by the owner on Nov 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,28 @@ function RecognizerStop(SDK, recognizer) {
9595}
9696```
9797
98+ ## ES6 Module Usage
99+ ``` javascript
100+ import * as SDK from ' microsoft-speech-browser-sdk' ;
101+
102+ function RecognizerSetup (recognitionMode , language , format , subscriptionKey ) {
103+ let recognizerConfig = new SDK.RecognizerConfig (
104+ new SDK.SpeechConfig (
105+ new SDK.Context (
106+ new SDK.OS (navigator .userAgent , " Browser" , null ),
107+ new SDK.Device (" SpeechSample" , " SpeechSample" , " 1.0.00000" ))),
108+ recognitionMode, // SDK.RecognitionMode.Interactive
109+ language, // Supported laguages are specific to each recognition mode. Refer to docs.
110+ format); // SDK.SpeechResultFormat.Simple (Options - Simple/Detailed)
111+
112+ // Alternatively use SDK.CognitiveTokenAuthentication(fetchCallback, fetchOnExpiryCallback)
113+ let authentication = new SDK.CognitiveSubscriptionKeyAuthentication (subscriptionKey);
114+
115+ // return SDK.Recognizer.Create(recognizerConfig, authentication);
116+ return SDK .CreateRecognizer (recognizerConfig, authentication);
117+ }
118+ ```
119+
98120## Try the sample out
99121What to try the sample ? All you need is a subscription key. [ Sign up] ( https://www.microsoft.com/cognitive-services/en-us/sign-up ) to get one.
100122
You can’t perform that action at this time.
0 commit comments