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
Copy file name to clipboardExpand all lines: articles/stream-analytics/stream-analytics-twitter-sentiment-analysis-trends.md
+15-83Lines changed: 15 additions & 83 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,25 +197,12 @@ To compare the number of mentions among topics, you can use a [Tumbling window](
197
197
5. Change the query in the code editor to the following and select **Test query**:
198
198
199
199
```sql
200
-
SELECTSystem.TimestampasTime, Topic, COUNT(*)
201
-
FROM TwitterStream TIMESTAMP BY CreatedAt
202
-
GROUP BY TUMBLINGWINDOW(s, 5), Topic
203
-
```
204
-
205
-
6.
206
-
207
-
## Experiment using different fields from the stream
208
-
209
-
The following table lists the fields that are part of the JSON streaming data. Feel free to experiment in the query editor.
210
-
211
-
|JSON property | Definition|
212
-
|--- | ---|
213
-
|CreatedAt | The time that the tweet was created|
214
-
|Topic | The topic that matches the specified keyword|
215
-
|SentimentScore | The sentiment score from Sentiment140|
216
-
|Author | The Twitter handle that sent the tweet|
217
-
|Text | The full body of the tweet|
200
+
SELECTSystem.TimestampasTime, text
201
+
FROM TwitterStream
202
+
WHEREtextLIKE'%Azure%'
203
+
```
218
204
205
+
6. This query returns all tweets that include the keyword *Azure*.
219
206
220
207
## Create an output sink
221
208
@@ -225,81 +212,26 @@ In this how-to guide, you write the aggregated tweet events from the job query t
225
212
226
213
## Specify the job output
227
214
228
-
1. In the **Job Topology** section, click the **Output**box.
215
+
1.Under the **Job Topology** section on the left navigation menu, select **Outputs**.
229
216
230
-
2. In the **Outputs**blade, click **+ Add**andthen fill out the blade with these values:
217
+
2. In the **Outputs**page, click **+ Add** and **Blob storage/Data Lake Storage Gen2**:
231
218
232
219
***Output alias**: Use the name `TwitterStream-Output`.
233
-
***Sink**: Select**Blob storage**.
234
-
***Import options**: Select**Use blob storage from current subscription**.
235
-
***Storage account**. Select**Create a new storage account.**
236
-
***Storage account** (second box). Enter `YOURNAMEsa`, where`YOURNAME` is your name or another unique string. The name can use only lowercase letters and numbers, and it must be unique across Azure.
237
-
***Container**. Enter `socialtwitter`.
238
-
The storage account name and container name are used together to provide a URI for the blob storage, like this:

243
-
244
-
4. Click **Create**.
245
-
246
-
Azure creates the storage account and generates a key automatically.
247
-
248
-
5. Close the **Outputs** blade.
249
-
220
+
***Import options**: Select **Select storage from your subscriptions**.
221
+
***Storage account**. Select your storage account.
222
+
***Container**. Select **Create new** and enter `socialtwitter`.
223
+
224
+
4. Select **Save**.
250
225
251
226
## Start the job
252
227
253
228
A job input, query, and output are specified. You are ready to start the Stream Analytics job.
254
229
255
-
1. Make sure that the TwitterWpfClient application is running.
256
-
257
-
2. In the job blade, click **Start**.
258
-
259
-

260
-
261
-
3. In the **Start job** blade, for **Job output start time**, select**Now**and then click **Start**.
262
-
263
-

264
-
265
-
Azure notifies you when the job has started, andin the job blade, the status is displayed as**Running**.
After your job has started running and is processing the real-time Twitter stream, you can view the output for sentiment analysis.
272
-
273
-
You can use a tool like [Azure Storage Explorer](https://storageexplorer.com/) or [Azure Explorer](https://www.cerebrata.com/products/azure-explorer/introduction) to view your job output inrealtime. From here, you can use [Power BI](https://powerbi.com/) to extend your application to include a customized dashboard like the one shown in the following screenshot:
## Create another query to identify trending topics
279
-
280
-
Another query you can use to understand Twitter sentiment is based on a [Sliding Window](https://docs.microsoft.com/stream-analytics-query/sliding-window-azure-stream-analytics). To identify trending topics, you look for topics that cross a threshold value for mentions in a specified amount of time.
281
-
282
-
For the purposes of this how-to, you check for topics that are mentioned more than 20timesin the last 5 seconds.
283
-
284
-
1. In the job blade, click **Stop** to stop the job.
285
-
286
-
2. In the **Job Topology** section, click the **Query**box.
287
-
288
-
3. Change the query to the following:
289
-
290
-
```
291
-
SELECTSystem.TimestampasTime, Topic, COUNT(*) as Mentions
292
-
FROM TwitterStream TIMESTAMP BY CreatedAt
293
-
GROUP BY SLIDINGWINDOW(s, 5), topic
294
-
HAVINGCOUNT(*) >20
295
-
```
296
-
297
-
4. Click **Save**.
298
-
299
-
5. Make sure that the TwitterWpfClient application is running.
230
+
1. Make sure the TwitterClientCore application is running.
300
231
301
-
6. Click **Start** to restart the job using the new query.
232
+
2. In the job overview, select **Start**.
302
233
234
+
3. On the **Start job** page, for **Job output start time**, select **Now** and then select **Start**.
303
235
304
236
## Get support
305
237
For further assistance, try our [Azure Stream Analytics forum](https://social.msdn.microsoft.com/Forums/azure/home?forum=AzureStreamAnalytics).
0 commit comments