MebhiChokiDAR – Tweet sentiment analysis and more using Microsoft flow

Microsoft Flow provides various templates to achieve your goal and Twitter Sentiment analysis is one of them.

In this tutorial we will see how to do sentiment analysis using few clicks and see live graphical representation using Power BI live feed.

As in India currently, #Mebhichokidar has tag is very viral. So,we are using this hashtag to cross check how it is going.

Prerequisites :

There are 3 basic prerequisites to complete this task

1) You should have Microsoft flow account if you don’t have that then you can create via link https://flow.microsoft.com

2) You should have Microsoft Power BI account if you don’t have then you can create via link  https://powerbi.microsoft.com/en-us/

3) You should have  Microsoft Azure Portal account for cognitive services if you don’t have then don’t worry you can create via link https://Portal.azure.com

Once, you have all the 3 accounts available then proceed step by step as suggest below

Step 1:-  Just open the Microsoft flow and select the template “Run Sentiment Analysis on tweets and push Result to a Power BI dataset” as shown in below figure.

Indiandotnet_Twitter_1

Step 2: When you select the option you will find below screen as shown in below

Indiandotnet_Twitter_2

Step 3:-  We have to configure 3 connection as expected  text analytics connection (Azure cognitive service) , Power BI (live dashboard) connection and last but not the least Twitter connection.

Here, As I am using an office 365 common account so my power BI already authenticated using that.

Indiandotnet_Twitter_3

Step 4:- Now,let me connect with My twitter account first. Which can be done by clicking Sign In.  In this you need to authorize the flow to access your twitter account.

Indiandotnet_Twitter_6

Step 5: In the next step you have to define text analysis connection for which you have to first login into Azure and search for cognitive service. If not exists then create  by clicking Add  button

Indiandotnet_Cognitive_Service

When you click add button you will find below link as you can see. Search Text Analytics and select the option highlighted as below

Indiandotnet_Cognitive_Service_2

Provide proper Resource Name and select  pricing tier as per your convenient. I am choosing free tier for this example.

Indiandot_Net_Vision_API_1

Step 6: Once you created the account. You need to copy the Key from Get your Keys option . and copy the Web API option from 2b as shown in below.

Indiandotnet_Cognitive_Service_3

Step 7: So, far so  good , we have created cognitive service and now moving back to Microsoft Flow  and Configure the Text analytics. Give any name in connection name and provide Account key which we copied earlier and also copy the Web API.

Indiandotnet_Twitter_4

Step 8:  Now, we are done with the connection next step is configure the steps. So, when a new tweet is posted we will provide that tweet to our Cognitive service using detect sentiment which will provide  sentiment score. The sentiment score will be given to Power BI.

Indiandotnet_Twitter_8

Step 9:   Now, click on twitter option here you can add multiple text option. For example you can see in below search text we have added NarendraModi, Chokidar or MaybheeChokidar

Indiandotnet_Twitter_9

Step 11:- Now, delete Detect Sentiment action  and add again by searching the sentiment 

Indiandotnet_Twitter_10

Step 12:  Here we will configure the sentiment option as you can see. We are giving  Tweet Text and Language (we are selecting  English Language)Indiandotnet_Twitter_13

Indiandotnet_Twitter_11

Step 13:-  Now, in the next step  we will configure the Power BI.  For which we will login http://app.powerBi.com  and click on  Streaming Dataset option  because we are  going to providing .

Indiandotnet_Twitter_12

Step 14:  Now, click on API as shown in below image.

Indiandotnet_Twitter_14

Step 15: Now, define the dataset as shown.  below here we are defining the fields. So, in the fields we are adding SentimentScore (which will given by cognitive service) , TwitterDate (when tweet posted), username (who posted the tweet),  tweetText (What is the tweet)

Indiandotnet_Twitter_15

Once, you define the dataset click on Create.

Step 16: Now, save the Report and configure the report as per your need.

Indiandotnet_Twitter_16

Step 17: Here now configure, Power BI dashboard and remove the payload. as shown in below figure.

Indiandotnet_Twitter_17

Step 18:  See the below configuration which configured.

Indiandotnet_Twitter_18

Here if you see, we defined workplace which we have created and dataset defined just above and mapped the fields.

Indiandotnet_Twitter_21

Step 19: Now, Save  the  flow and configuration and try to run it. If everything works perfectly. You will get all the checkbox.

Indiandotnet_Twitter_20

Step 20: Now, you can see the Power BI dashboard you will get the graph updating per minute with the new tweet text whenever a post with specific tag.

Below you can find sentiment score  graph.

Indiandotnet_Twitter_22

In Next post I will share the detail of this sentiment analysis data.

Hope you might like this easy way of sentiment analysis.

Happy learning.