笼斗第二回合!负面评价
在两家公司里,人们都会提到 "culture" 和 "smart people",说明两家公司在一些积极方面是相似的。不过,通过金字塔图,您可以开始比较两家公司工作环境中积极特征的程度差异。
现在请把注意力转向负面评价,并制作同样的可视化。这一次,您的工作区中已经有 common_words 数据框。不过,本练习中的常见 bigram 来自员工的「负面」评价。
本练习是课程的一部分
使用 R 的 Bag-of-Words 进行文本挖掘
练习说明
- 在
common_words上使用slice_max(),针对diff列获取排名前5的 bigram。新对象的结果会打印到控制台。 - 创建
pyramid.plot()。传入top5_df$AmazonNeg、top5_df$GoogleNeg,以及labels = top5_df$terms。为获得更好的标注效果,设置:- 将
gap设为12。 - 将
top.labels设为c("Amzn", "Neg Words", "Goog")
- 将
main 和 unit 参数已为您设置好。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Extract top 5 common bigrams
(top5_df <- ___ %>% ___(___, n = ___))
# Create a pyramid plot
___(
# Amazon on the left
top5_df$___,
# Google on the right
top5_df$___,
# Use terms for labels
labels = top5_df$___,
# Set the gap to 12
___ = ___,
# Set top.labels to "Amzn", "Neg Words" & "Goog"
___ = ___,
main = "Words in Common",
unit = NULL
)