0

使用 R 进行文本分析。

我的数据集是来自 2000 个不同调查的 2000 条评论。我创建了 Bi-gram。我检查了单词的频率,然后使用 进行单词聚类分析hclust(),然后使用 进行单词关联findAssocs,例如findAssocs(bigram_dtm,"long time",0.2)

例如,我看到“长时间”与“感觉等待”的关联度为 0.66。

我试图在网上找到它,但还没有成功...... 问题:有什么办法可以打印出这个 bi_gram 在一起的评论吗?有什么办法可以打印“长时间”的评论吗?

谢谢,

4

1 回答 1

0

我认为您正在寻找的是grep. 您可以使用它来获取您正在寻找的评论的索引或使用这些索引来获取评论本身。

Comments = c("I haven't seen you in a long time.",
    "There is no U in TEAM, but it does contain ME.",
    "In extreme cases, read the documentation.",
    "A big computer, a complex algorithm and a long time does not equal science.",
    "Use the source, Luke!")

grep("long time", Comments)
[1] 1 4
Comments[grep("long time", Comments)]
[1] "I haven't seen you in a long time."                                         
[2] "A big computer, a complex algorithm and a long time does not equal science."

(部分评论被盗fortune()

于 2018-10-25T12:18:33.190 回答