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
If you provided your Text Analytics API credentials [to the container](#analyze-sentiment-on-the-speech-to-text-output), you can use the Speech SDK to send speech recognition requests with sentiment analysis.
417
+
418
+
> [!NOTE]
419
+
> You can configure API responses to use either a *simple* or *detailed* format.
420
+
421
+
# [Simple format](#tab/csharp)
422
+
423
+
To configure the Speech client to use a simple format, add `"Sentiment"` as a value for `Simple.Extensions`. If you want to choose a specific Text Analytics model version, replace `'latest'` in the `speechcontext-phraseDetection.sentimentAnalysis.modelversion` property configuration.
`Simple.Extensions` will return the sentiment result in root layer of the response.
439
+
440
+
```json
441
+
{
442
+
"DisplayText":"What's the weather like?",
443
+
"Duration":13000000,
444
+
"Id":"6098574b79434bd4849fee7e0a50f22e",
445
+
"Offset":4700000,
446
+
"RecognitionStatus":"Success",
447
+
"Sentiment":{
448
+
"Negative":0.03,
449
+
"Neutral":0.79,
450
+
"Positive":0.18
451
+
}
452
+
}
453
+
```
454
+
455
+
# [Detailed format](#tab/csharp)
456
+
457
+
To configure the Speech client to use a detailed format, add `"Sentiment"` as a value for `Detailed.Extensions`, `Detailed.Options`, or both. If you want to choose a specific Text Analytics model version, replace `'latest'` in the `speechcontext-phraseDetection.sentimentAnalysis.modelversion` property configuration.
`Detailed.Extensions` provides sentiment result in the root layer of the response. `Detailed.Options` provides the result in `NBest` layer of the response. They can be used separately or together.
478
+
479
+
```json
480
+
{
481
+
"DisplayText":"What's the weather like?",
482
+
"Duration":13000000,
483
+
"Id":"6a2aac009b9743d8a47794f3e81f7963",
484
+
"NBest":[
485
+
{
486
+
"Confidence":0.973695,
487
+
"Display":"What's the weather like?",
488
+
"ITN":"what's the weather like",
489
+
"Lexical":"what's the weather like",
490
+
"MaskedITN":"What's the weather like",
491
+
"Sentiment":{
492
+
"Negative":0.03,
493
+
"Neutral":0.79,
494
+
"Positive":0.18
495
+
}
496
+
},
497
+
{
498
+
"Confidence":0.9164971,
499
+
"Display":"What is the weather like?",
500
+
"ITN":"what is the weather like",
501
+
"Lexical":"what is the weather like",
502
+
"MaskedITN":"What is the weather like",
503
+
"Sentiment":{
504
+
"Negative":0.02,
505
+
"Neutral":0.88,
506
+
"Positive":0.1
507
+
}
508
+
}
509
+
],
510
+
"Offset":4700000,
511
+
"RecognitionStatus":"Success",
512
+
"Sentiment":{
513
+
"Negative":0.03,
514
+
"Neutral":0.79,
515
+
"Positive":0.18
516
+
}
517
+
}
518
+
```
519
+
520
+
If you want to completely disable sentiment analysis, add a `false` value to `sentimentanalysis.enabled`.
0 commit comments