flow使用_使用Microsoft Flow进行文本分析


Twitter is a very popular social media platform which generates millions of tweets a day. These tweets include very valuable data for marketers or social media analyzers because they can analyze these tweets with specific algorithms and find out the sense of social media users.

Twitter是一个非常流行的社交媒体平台,每天产生数百万条推文。 这些推文包含对营销人员或社交媒体分析人员非常有价值的数据,因为他们可以使用特定算法分析这些推文并找出社交媒体用户的意识。

Sentiment analysis is the indispensable part of social media monitoring. For example, you can do a general sentiment analysis about your brand and define it with a certain score and follow it regularly in monthly, weekly or quarterly time periods. Nowadays, social sentiment analysis is as significant as measuring customer satisfaction, so it is equally important to follow this score correctly. Apart from the general sentiment analysis that you can do for your brand, you can even measure the sentiment analysis of a product or your brand, or even an advertising filename that you simply do. In this way, you can closely observe the effect of social media and take the right steps when necessary.

情感分析是社交媒体监控中不可或缺的部分。 例如,您可以对品牌进行一般的情绪分析,并以一定的分数对其进行定义,并在每月,每周或每季度定期进行跟踪。 如今,社交情绪分析与衡量客户满意度同样重要,因此正确地遵循此评分也同样重要。 除了可以对品牌进行一般的情感分析之外,您甚至可以衡量产品或品牌的情感分析,甚至可以简单地衡量广告名称。 这样,您可以密切观察社交媒体的效果,并在必要时采取正确的步骤。

You can take these advantages from Sentiment Analysis


  • It can be used among the basic success criteria of your campaigns or products

  • As well as used to monitor your situation against your competitors

  • It allows you to intervene quickly in crisis times and predict where the crisis is going

  • It shows how healthy your brand is on social media


In social sensitive analysis, comments on social media are classified as positive, negative, ineffective, even slightly positive, very positive, slightly negative, and very negative. On this page, you will find a distribution of all these comments according to these categories.

在社会敏感性分析中,对社交媒体的评论分为正面,负面,无效,甚至略微正面,非常正面,略微负面和非常负面。 在此页面上,您会根据这些类别找到所有这些评论的分布。

After all this brief explanation of sentiment analyses, we will mention about the intent of this article. The goal of this article is to insert the new tweets text and details to SQL Server database when someone posts it on Twitter and also these tweets hashtags equal to sentiment analysis criteria. In this article demonstration, we will use another tool which name is Microsoft Flow.

在对情感分析进行所有这些简短的解释之后,我们将提及本文的意图。 本文的目的是当有人在Twitter上发布新的推文文本和详细信息到SQL Server数据库时,这些推文标签也等于情绪分析标准。 在本文的演示中,我们将使用另一个名为Microsoft Flow的工具。

什么是Microsoft Flow? (What is Microsoft Flow?)

According to TechTarget


“Microsoft Flow is a cloud-based software tool that allows employees to create and automate workflows across multiple applications and services without the need for developer help. Automated workflows are called flows. To create a flow, the user specifies what action should take place when a specific event occurs.

“ Microsoft Flow是一个基于云的软件工具,使员工无需开发人员的帮助即可创建和自动化跨多个应用程序和服务的工作流。 自动化的工作流程称为流程。 要创建流,用户指定在发生特定事件时应采取什么措施。

The most common use of Microsoft Flow is to trigger notifications. When a new lead is added to Microsoft Dynamics CRM, for example, an automated workflow can send sales representatives an email or text message with details about the lead.”

Microsoft Flow的最常见用途是触发通知。 例如, 当将新的潜在 客户 添加到 Microsoft Dynamics CRM时 ,自动化的工作流程可以向销售代表发送一封电子邮件或短信,其中包含有关潜在客户的详细信息。”

Microsoft Flow helps us to create a communication bridge between Twitter and SQL Server. And we will use Azure Cognitive Service. This service provides different type of machine learning API’s and services to us useful for emotion and video detection, speech and vision recognition and etc. In this demonstration, we will use text analytics service and it aids about text sentiment analysis.

Microsoft Flow帮助我们在Twitter和SQL Server之间建立通信桥梁。 我们将使用Azure认知服务 。 该服务向我们提供了不同类型的机器学习API和服务,可用于情感和视频检测,语音和视觉识别等。在此演示中,我们将使用文本分析服务,它有助于进行文本情感分析。

Now we will illustrate the architecture diagram of this Microsoft Flow demonstration in the below image.

现在,我们将在下图中说明此Microsoft Flow演示的体系结构图。

The short explanation of this diagram is; when someone posts a new tweet which includes particular hashtag we want to track and analyze it. Workflow handles this tweet and sends to text sentiment analysis and get the result of this process. And then workflow inserts this tweet and other details to SQL database.

该图的简短说明是: 当某人发布包含特定主题标签的新推文时,我们要对其进行跟踪和分析。 工作流处理此推文,并将其发送到文本情感分析并获取此过程的结果。 然后,工作流将此推文和其他详细信息插入SQL数据库。

创建工作流程 (Create workflow)

We will open the Microsoft Workflow portal and log in. Click My Flows. In this screen, we can create blank workflow or we can use the workflow templates. We will use a template which is suited to our architecture.

我们将打开Microsoft Workflow门户并登录。单击“我的流程”。 在此屏幕中,我们可以创建空白工作流程,也可以使用工作流程模板。 我们将使用适合我们架构的模板。

When we search Twitter Sentiment double keyword, we will find a template which is explained as Process Tweets with Sentiment Analysis.

当我们搜索Twitter Sentiment double关键字时,我们将找到一个模板,该模板解释为带有Sentiment Analysis的Process Tweets

We will select Process Tweets with Sentiment Analysis template. The explanation of template describes every thing about this template. This template provides a twitter connection, sentiment analysis and insert all details of sentiment analysis results to SQL Server tables. It requires two tables in SQL Server database. The first one is to store tweet details and second one for key phrases. This phrases help us to understand trend keywords in the tweets.

我们将选择带有情感分析模板的处理推文。 模板的说明描述了有关此模板的所有内容。 该模板提供了Twitter连接,情感分析,并将情感分析结果的所有详细信息插入SQL Server表。 它需要SQL Server数据库中的两个表。 第一个是存储推文详细信息,第二个是存储关键短语。 这些短语有助于我们了解推文中的趋势关键字。

In the first step of this template settings, we will log in Twitter with twitter account. And then we will configure SQL Server connection settings. For this demonstration, we will use Azure SQL database and configure connection settings. Click Create and then set the connection settings of SQL Azure.

在此模板设置的第一步中,我们将使用Twitter帐户登录Twitter。 然后,我们将配置SQL Server连接设置。 对于此演示,我们将使用Azure SQL数据库并配置连接设置。 单击“ 创建” ,然后设置SQL Azure的连接设置。

The second step of database configuration is to create two tables which store the tweet details. You can use the below script to generate the Tweet and TweetKeywords tables in SQL Server.

数据库配置的第二步是创建两个存储推文详细信息的表。 您可以使用以下脚本在SQL Server中生成Tweet和TweetKeywords表。

DROP TABLE [dbo].[Tweets]
/****** Object:  Table [dbo].[Tweets]    Script Date: 10.09.2018 08:55:10 ******/
CREATE TABLE [dbo].[Tweets](
	[TweetText] [varchar](3000) NULL,
	[TweetedBy] [varchar](50) NULL,
	[CreatedAt] [varchar](100) NULL,
	[TwitterID] [bigint] NULL,
	[Favorited] [varchar](20) NULL,
	[USERID] [bigint] NULL,
	[Username] [varchar](50) NULL,
	[SentimentScore] [float] NULL
/****** Object:  Table [dbo].[TweetsKeywords]    Script Date: 10.09.2018 08:55:59 ******/
DROP TABLE [dbo].[TweetsKeywords]
/****** Object:  Table [dbo].[TweetsKeywords]    Script Date: 10.09.2018 08:55:59 ******/
CREATE TABLE [dbo].[TweetsKeywords](
	[TweetId] [bigint] NULL,
	[Keyword] [varchar](50) NULL

In the last step of connection setting, we need to Text Analytics connector. We can create this service in Azure Portal.

在连接设置的最后一步,我们需要使用Text Analytics连接器。 我们可以在Azure Portal中创建此服务。

We will connect to Azure Portal and find the Cognitive Services.


We will find Text Analytics and click Create.

我们将找到Text Analytics,然后单击创建

And we will find the text analytics and click create. For workflow connection, we need Account Key and Site URL of created text analytics. We can find URL and Account Key in the Overview tab of text analytics. When you click the Show access keys the Manage keys tabs will appear and you can copy/paste this keys to workflow connection settings.

我们将找到文本分析,然后单击创建。 对于工作流程连接,我们需要创建文本分析的帐户密钥和站点URL。 我们可以在文本分析的“概述”标签中找到URL和帐户密钥。 当您单击显示访问键时,将显示“管理键”选项卡,您可以将该键复制/粘贴到工作流连接设置。

And the finally connections icons have to be green. And then we can continue.

最后的连接图标必须为绿色。 然后我们可以继续。

Now we will manage the workflow, in my thought, this screen is very handy. In the When a new tweet is posted step we will write the hashtag which we want to perform sentiment analysis. For this demonstration, I will select #BMW you can select any topic or title.

现在,我们将管理工作流程,我认为此屏幕非常方便。 在发布新推文的步骤中,我们将编写我们要执行情感分析的主题标签。 对于此演示,我将选择#BMW,您可以选择任何主题或标题。

In the Add Tweet to Tweets Table, we will select a table which stores the new tweets. We have to match tweet detail and table columns.

在“ 将推文添加到推文”表中,我们将选择一个表来存储新推文。 我们必须匹配推特详细信息和表格列。

In the For each Key Phrase step, we will select the table to store Key Phrases.

在“ 每个关键短语”步骤中,我们将选择表以存储关键短语。

We will click the Save and navigate the My Flows page. In this page, we can find out the workflow RUN HISTORY this menu helps us to review the workflow transaction status and details.

我们将单击“保存”并浏览“我的流程”页面。 在此页面中,我们可以找到工作流程的运行历史记录。此菜单可帮助我们查看工作流程的交易状态和详细信息。

When we look at the Tweets table we can find details about Tweets which were processed and inserted by the workflow.


SELECT [TweetText]
  FROM [dbo].[Tweets]

The SentimentScore columns defines the numerical presentation of tweet emotion. This score range in 0 to 1. If values close to 0.5 it defines neutrality and if values close to 1 it defines positive results.

SentimentScore列定义推特情感的数字表示。 该分数范围是0到1。如果值接近0.5,则表示中性;如果值接近1,则表示正值。

The TweetsKeywords table includes key phrases. If we convert this table data to WordCloud analyze it we can find out most used keywords.

TweetsKeywords表包含关键短语。 如果将表数据转换为WordCloud进行分析,我们可以找出最常用的关键字。

摘要 (Summary)

In this article, we demonstrated sentiment analysis in the simplest form in Microsoft flow. We converted tweet details more meaningful and inserted to SQL Server database. We can use this stored data in various analyses and reports. Such as we can analyze this data in BI tools and produce actionable information for decision making.

在本文中,我们以Microsoft流中最简单的形式演示了情感分析。 我们将推文详细信息转换为更有意义的内容,并插入到SQL Server数据库中。 我们可以在各种分析和报告中使用此存储的数据。 例如,我们可以在BI工具中分析此数据并生成可操作的信息以进行决策。

翻译自: https://www.sqlshack.com/text-analytics-with-microsoft-flow/


  • 0
  • 0
  • 0
  • 扫一扫,分享海报

参与评论 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:编程工作室 设计师:CSDN官方博客 返回首页
钱包余额 0