Skip to main content
QUICK REVIEW

[论文解读] Sentiment Analysis with R: Natural Language Processing for Semi-Automated Assessments of Qualitative Data

Dennis Klinkhammer|arXiv (Cornell University)|Jun 25, 2022
Computational and Text Analysis Methods被引用 4
一句话总结

本教程介绍了一套实用且可复现的R语言半自动情感分析工作流程,结合自然语言处理(NLP)技术,使研究人员能够高效地对定性文本数据(如社交媒体评论、政治演讲和书籍)进行情感与情绪状态分类。该方法利用情感词典及R包(如tidytext、dplyr和ggplot2),实证结果表明其具备一致的评分者间信度,并能检测话语随时间推移的情感变化。

ABSTRACT

Sentiment analysis is a sub-discipline in the field of natural language processing and computational linguistics and can be used for automated or semi-automated analyses of text documents. One of the aims of these analyses is to recognize an expressed attitude as positive or negative as it can be contained in comments on social media platforms or political documents and speeches as well as fictional and nonfictional texts. Regarding analyses of comments on social media platforms, this is an extension of the previous tutorial on semi-automated screenings of social media network data. A longitudinal perspective regarding social media comments as well as cross-sectional perspectives regarding fictional and nonfictional texts, e.g. entire books and libraries, can lead to extensive text documents. Their analyses can be simplified and accelerated by using sentiment analysis with acceptable inter-rater reliability. Therefore, this tutorial introduces the basic functions for performing a sentiment analysis with R and explains how text documents can be analysed step by step - regardless of their underlying formatting. All prerequisites and steps are described in detail and associated codes are available on GitHub. A comparison of two political speeches illustrates a possible use case.

研究动机与目标

  • 提供一份可复现的、分步式的教程,指导研究人员使用R对定性文本数据进行情感分析。
  • 使研究人员能够将基础与高级情感分析技术应用于多种文本格式,包括社交媒体、政治演讲和书籍。
  • 展示情感分析如何通过可接受的评分者间信度,提升定性数据编码的效率与可靠性。
  • 通过GitHub提供完整的R代码和包依赖关系,支持方法论的透明性。
  • 说明实际应用场景,例如检测政治话语中随时间推移的情感与情绪状态变化。

提出的方法

  • 以R Markdown和R编程语言作为情感分析的主要环境。
  • 使用tidytext包将文本数据分词并处理为可分析的单位。
  • 应用情感词典——特别是NRC词-情绪关联词典——将词语分类为情感极性(正面、负面)和八种情绪状态(如恐惧、愤怒、信任、喜悦)。
  • 使用dplyr进行数据操作,包括过滤、分组和汇总文本段落中的情感得分。
  • 使用ggplot2可视化情感趋势,以追踪情感分布、条件均值及随时间或文本部分的情感得分变化。
  • 通过将非TXT格式(如PDF、HTML)转换为TXT格式,确保预处理的一致性,再进行分析。

实验结果

研究问题

  • RQ1如何利用R进行半自动情感分析,以评估社交媒体评论和政治演讲等多样化定性文本数据中的情感与情绪状态?
  • RQ2与人工编码相比,半自动情感分析在多大程度上能达到可接受的评分者间信度?
  • RQ3在政治演讲的不同部分中,情感与情绪状态的分布如何变化?这些变化表明了什么?
  • RQ4情感分析能否在长篇文本(如书籍或整个图书馆)中识别出有意义的模式?与社交媒体等短篇内容相比有何差异?
  • RQ5情感分析在识别数字话语中的社会问题(如极端化、政治情绪或公共卫生问题)方面具有何种实际应用价值?

主要发现

  • 半自动情感分析的评分者间信度最高可达70%,考虑到人工编码中研究人员之间约20%的分歧,该结果被视为可接受。
  • 对两份政治演讲的比较显示,尽管正面与负面情感使用相对均衡,但恐惧与愤怒情绪突出,表明整体情感基调偏负面。
  • 信任情绪被发现可抵消恐惧与愤怒等负面情绪,表明政治话语中存在复杂的情感图景。
  • 情感得分在政治演讲的中段略有上升,表明语气或诉求可能存在策略性转变。
  • 该方法成功识别出情感趋势中的转折点与鞍点,使研究人员能够对关键句段进行更深层次的定性验证。
  • 该工作流程显著加快了大规模文本语料的分析速度,同时保持了分析的严谨性,适用于纵向与横断面文本分析。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。