广告专业用词
Sentiment analysis is the process of determining whether a piece of text is positive or negative. It allows businesses to identify their customer’s sentiments towards products or services through reviews and online feedback.
情感分析是确定一段文字是肯定的还是否定的过程。 它使企业可以通过评论和在线反馈来识别客户对产品或服务的情感。
For Example:
例如:
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/11aa17aca9ec00300cf68ba00d5b0242.png)
In other words, sentiment analysis gives an opportunity to explore the mindset of your customers and study the state of your product or service from your customer’s point of view.
换句话说,情感分析使您有机会探索客户的心态,并从客户的角度研究产品或服务的状态。
This makes sentiment analysis a great tool for
这使得情绪分析成为
- Product reviews产品评论
- Market research市场调查
- Customer service客户服务
- Social media monitoring社交媒体监控
- Reputation management etc.,声誉管理等
Sentiment analysis is a filed of Natural language processing(NLP).
情感分析属于自然语言处理(NLP)。
INTRODUCTION
介绍
The dataset which we are using contains, restaurant reviews and we are going to use sentiment analysis to find wheater a particular review is positive or negative. If the review is negative we will display the following message.
我们正在使用的数据集包含餐厅评论,我们将使用情感分析来查找特定评论为正面还是负面的小麦。 如果评论是否定的,我们将显示以下消息。
Thank you <customer first name> for taking out the time to write a review. we apologize for the inconvenience caused. We hope we will get a chance to serve you better in the near future.
感谢<客户的名字>抽出宝贵的时间写评论。 不便之处,敬请原谅。 希望我们在不久的将来有机会为您提供更好的服务。
If the review is positive we will display the following message.
如果评论为肯定,我们将显示以下消息。
<Customer first name>, Thank you so much for that awesome review. We look forward to serving you again in the near future.
<客户的名字>,非常感谢您的好评。 我们期待在不久的将来再次为您服务。
应遵循的步骤 (Steps to be Followed)
- Importing the libraries.导入库。
- Importing the dataset. 导入数据集。
- Cleaning the data. 清理数据。
- Creating the Bag of words. 创建单词袋。
- Training and classification. 培训和分类。
- Confusion matrix. 混淆矩阵。
- Predicting a customer review. 预测客户评论。
Step1: Importing the Libraries
步骤1:导入库
![Image for post](https://miro.medium.com/max/9999/1*ee6Cq7t-PfxvjPXi9Z72Eg.png)
Step2: Importing the Dataset
步骤2:导入数据集
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/d64483de9f73bcfd0c9c76cb54dcee25.png)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/4b3f7bd2928072393a5db85ba8a7eb59.png)
Step3: Cleaning the data
步骤3:清除资料
From the above dataset output, we will find some information that does not help in determining whether a review is positive or negative.
从上面的数据集输出中,我们将发现一些信息,这些信息无助于确定评论是肯定的还是否定的。
For example, words like a, an, the, was, on, etc, doesn't have any impact on the decision. These words are called Stopwords. We also have words like loved, stopped, loving, etc, we will have to convert them to its root form.
例如,诸如“ a”,“ an”,“ the”,“ was”,“ on”等之类的词对决策没有任何影响。 这些单词称为停用词。 我们也有喜欢,停止,爱等词语,我们将不得不将其转换为其根形式。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/49e7852487cffd4ab6e9c3e895b53085.png)
Step4: Creating a bag of words
第4步:创建一袋文字
The bag of words is the simplest form of text representation in numbers. To learn more about bag of words — click here
单词袋是最简单的数字表示形式。 要了解有关单词袋的更多信息,请单击此处
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/63feaabeee3616f6154233562ac3a263.png)
Step5: Training and Classification
步骤5:培训和分类
We have to split our dataset into training and testing sets, and then we have to apply the classification model.
我们必须将数据集分为训练和测试集,然后再应用分类模型。
Classification Algorithms
分类算法
- Linear classifier: Logistic regression, Naive Bayes classifier线性分类器:逻辑回归,朴素贝叶斯分类器
- Nearest neighbors.最近的邻居。
- Support vector machine. 支持向量机。
- Decision tree. 决策树。
- Random forest etc.., 随机森林等。,
We can use any one of them, I tried all and surprisingly Naive Bayes gives the best accuracy.
我们可以使用其中的任何一个,我都尝试了所有,令人惊讶的是,朴素的贝叶斯给出了最好的准确性。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/a1fc4692e7792a3de12f36e1f6f6838f.png)
Step6: Classification model
步骤6:分类模型
It is a tool, used for evaluation of the performance of a classification model. If you want to learn more about this — Click here.
它是一种工具,用于评估分类模型的性能。 如果您想了解更多有关此信息—单击此处。
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/4950860a9a49dfc6befa47b68d6e369f.png)
The accuracy of our model is 73%, which means 73% of the predictions are accurate.
我们模型的准确性为73%,这意味着73%的预测是准确的。
Step7: Final step - Predicting a customer review
步骤7:最后一步-预测客户评论
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/bbc5ab43abf0b93370a1f61ee0a39952.png)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/0c3a6696a684496c7813a8ccc08854da.png)
翻译自: https://medium.com/@subhani1/sentiment-analysis-with-bag-of-words-4b9786e967ca
广告专业用词