Skip to content

Commit e6df2be

Browse files
committed
moving text analytics content
1 parent dc74fb7 commit e6df2be

File tree

2 files changed

+21
-57
lines changed

2 files changed

+21
-57
lines changed

articles/cognitive-services/Speech-Service/includes/speech-to-text-container-query-endpoint.md

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -42,60 +42,3 @@ speech_config = speechsdk.SpeechConfig(
4242
```
4343

4444
---
45-
46-
#### Analyze sentiment on the speech-to-text output
47-
48-
Starting in v2.2.0 of the speech-to-text container, you can analyze sentiment on the output using the Text Analytics API. To call sentiment analysis, you will need a Text Analytics resource endpoint. For example:
49-
* `https://westus2.api.cognitive.microsoft.com/text/analytics/v3.0-preview.1/sentiment`
50-
* `https://localhost:5000/text/analytics/v3.0-preview.1/sentiment`
51-
52-
If you're accessing a Text analytics endpoint in the cloud, you will need a key. If you're running Text Analytics locally, you may not need to provide this.
53-
54-
The key and endpoint are passed to the Speech container as arguments, as in the following example.
55-
56-
```bash
57-
docker run -it --rm -p 5000:5000 \
58-
containerpreview.azurecr.io/microsoft/cognitive-services-speech-to-text:latest \
59-
Eula=accept \
60-
Billing={ENDPOINT_URI} \
61-
ApiKey={API_KEY} \
62-
CloudAI:SentimentAnalysisSettings:TextAnalyticsHost={TEXT_ANALYTICS_HOST} \
63-
CloudAI:SentimentAnalysisSettings:SentimentAnalysisApiKey={SENTIMENT_APIKEY}
64-
```
65-
66-
to this call using the container [host](https://docs.microsoft.com/python/api/azure-cognitiveservices-speech/azure.cognitiveservices.speech.speechconfig?view=azure-python):
67-
68-
```python
69-
speech_config = speechsdk.SpeechConfig(
70-
host="ws://localhost:5000")
71-
```
72-
73-
To call sentiment analysis:
74-
75-
> [!NOTE]
76-
> You can send requests for either "detailed" or "simple" responses.
77-
78-
```python
79-
speech_config.set_service_property(
80-
name='speechcontext-PhraseOutput.Detailed.Extensions',
81-
value='["Sentiment"]',
82-
channel=speechsdk.ServicePropertyChannel.UriQueryParameter
83-
)
84-
speech_config.set_service_property(
85-
name='speechcontext-phraseDetection.sentimentAnalysis.modelversion',
86-
value='latest',
87-
channel=speechsdk.ServicePropertyChannel.UriQueryParameter
88-
)
89-
```
90-
91-
To disable sentiment analysis from appearing in the API response, regardless of other properties specified:
92-
93-
```python
94-
speech_config.set_service_property(
95-
name='speechcontext-phraseDetection.sentimentanalysis.enabled',
96-
value='false',
97-
channel=speechsdk.ServicePropertyChannel.UriQueryParameter
98-
)
99-
```
100-
101-
***

articles/cognitive-services/Speech-Service/speech-container-howto.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,27 @@ Billing={ENDPOINT_URI} \
247247
ApiKey={API_KEY}
248248
```
249249

250+
251+
#### Analyze sentiment on the speech-to-text output
252+
253+
Starting in v2.2.0 of the speech-to-text container, you can call the [sentiment analysis v3 API](../text-analytics/how-tos/text-analytics-how-to-sentiment-analysis.md) on the output. To call sentiment analysis, you will need a Text Analytics API resource endpoint. For example:
254+
* `https://westus2.api.cognitive.microsoft.com/text/analytics/v3.0-preview.1/sentiment`
255+
* `https://localhost:5000/text/analytics/v3.0-preview.1/sentiment`
256+
257+
If you're accessing a Text analytics endpoint in the cloud, you will need a key. If you're running Text Analytics locally, you may not need to provide this.
258+
259+
The key and endpoint are passed to the Speech container as arguments, as in the following example.
260+
261+
```bash
262+
docker run -it --rm -p 5000:5000 \
263+
containerpreview.azurecr.io/microsoft/cognitive-services-speech-to-text:latest \
264+
Eula=accept \
265+
Billing={ENDPOINT_URI} \
266+
ApiKey={API_KEY} \
267+
CloudAI:SentimentAnalysisSettings:TextAnalyticsHost={TEXT_ANALYTICS_HOST} \
268+
CloudAI:SentimentAnalysisSettings:SentimentAnalysisApiKey={SENTIMENT_APIKEY}
269+
```
270+
250271
This command:
251272

252273
* Runs a *Speech-to-text* container from the container image.

0 commit comments

Comments
 (0)