开始使用免费开始使用

笼斗第二回合!负面评价

在两家公司里,人们都会提到 "culture" 和 "smart people",说明两家公司在一些积极方面是相似的。不过,通过金字塔图,您可以开始比较两家公司工作环境中积极特征的程度差异。

现在请把注意力转向负面评价,并制作同样的可视化。这一次,您的工作区中已经有 common_words 数据框。不过,本练习中的常见 bigram 来自员工的「负面」评价。

本练习是课程的一部分

使用 R 的 Bag-of-Words 进行文本挖掘

查看课程

练习说明

  • common_words 上使用 slice_max(),针对 diff 列获取排名前 5 的 bigram。新对象的结果会打印到控制台。
  • 创建 pyramid.plot()。传入 top5_df$AmazonNegtop5_df$GoogleNeg,以及 labels = top5_df$terms。为获得更好的标注效果,设置:
    • gap 设为 12
    • top.labels 设为 c("Amzn", "Neg Words", "Goog")

mainunit 参数已为您设置好。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# 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
)
编辑并运行代码