将特征同现与重要同现进行比较
Compare feature co-Occurrence against significant co-occurrences
我想了解以下情况的实际差异:
- 使用函数
fcm(objectname # generate feature co-occurrence matrix
计算绝对频率。最后用函数 textplot_network()
. 绘制
- 我阅读了 tidytextmining 之类的教程或由使用 igraph 或 widyr 包的 Andreas Niekler 和 Gregor Wiedemann 编写的教程。我想绘制相关的词对。
受使用 phi 系数的 tidytextmining 教程的启发,我将根据 lambda 系数绘制这种相关性。
我不知道如何用包 quanteda 绘制相关词对。
我的想法是(也许不是一种有效的方法)来计算
textstat_collocations()
并将其转换为 tibble 对象并使用 widyr 包的函数绘制它。
我的未决问题是:
如何将列搭配拆分为两个单独的列,如 item1 item2 和
添加 select 列 lambda 并保存并分配给 tibble 对象?
> head(sotu_collocations,1)
collocation count count_nested length lambda z
1 smart city 229 0 2 9.846542 51.78172
像这样?如果您希望保留所有列,请删除 select()
命令。
library("quanteda")
## Package version: 2.1.2
colls <- textstat_collocations(data_corpus_inaugural[1:5], size = 2)
head(colls)
## collocation count count_nested length lambda z
## 1 of the 98 0 2 1.494207 11.89704
## 2 has been 9 0 2 5.691667 11.61596
## 3 i have 15 0 2 3.754144 11.51091
## 4 may be 14 0 2 4.072366 11.43632
## 5 have been 10 0 2 4.679873 10.94315
## 6 we have 9 0 2 4.458284 10.35023
as.data.frame(colls) %>%
tidyr::separate("collocation", into = c("word1", "word2"), sep = " ") %>%
dplyr::select(word1, word2, lambda) %>%
tibble::tibble()
## # A tibble: 678 x 3
## word1 word2 lambda
## <chr> <chr> <dbl>
## 1 of the 1.49
## 2 has been 5.69
## 3 i have 3.75
## 4 may be 4.07
## 5 have been 4.68
## 6 we have 4.46
## 7 foreign nations 6.32
## 8 it is 3.50
## 9 my country 4.49
## 10 united states 7.22
## # … with 668 more rows
我想了解以下情况的实际差异:
- 使用函数
fcm(objectname # generate feature co-occurrence matrix
计算绝对频率。最后用函数textplot_network()
. 绘制
- 我阅读了 tidytextmining 之类的教程或由使用 igraph 或 widyr 包的 Andreas Niekler 和 Gregor Wiedemann 编写的教程。我想绘制相关的词对。 受使用 phi 系数的 tidytextmining 教程的启发,我将根据 lambda 系数绘制这种相关性。
我不知道如何用包 quanteda 绘制相关词对。
我的想法是(也许不是一种有效的方法)来计算
textstat_collocations()
并将其转换为 tibble 对象并使用 widyr 包的函数绘制它。
我的未决问题是:
如何将列搭配拆分为两个单独的列,如 item1 item2 和
添加 select 列 lambda 并保存并分配给 tibble 对象?
> head(sotu_collocations,1)
collocation count count_nested length lambda z
1 smart city 229 0 2 9.846542 51.78172
像这样?如果您希望保留所有列,请删除 select()
命令。
library("quanteda")
## Package version: 2.1.2
colls <- textstat_collocations(data_corpus_inaugural[1:5], size = 2)
head(colls)
## collocation count count_nested length lambda z
## 1 of the 98 0 2 1.494207 11.89704
## 2 has been 9 0 2 5.691667 11.61596
## 3 i have 15 0 2 3.754144 11.51091
## 4 may be 14 0 2 4.072366 11.43632
## 5 have been 10 0 2 4.679873 10.94315
## 6 we have 9 0 2 4.458284 10.35023
as.data.frame(colls) %>%
tidyr::separate("collocation", into = c("word1", "word2"), sep = " ") %>%
dplyr::select(word1, word2, lambda) %>%
tibble::tibble()
## # A tibble: 678 x 3
## word1 word2 lambda
## <chr> <chr> <dbl>
## 1 of the 1.49
## 2 has been 5.69
## 3 i have 3.75
## 4 may be 4.07
## 5 have been 4.68
## 6 we have 4.46
## 7 foreign nations 6.32
## 8 it is 3.50
## 9 my country 4.49
## 10 united states 7.22
## # … with 668 more rows