【发布时间】:2019-07-02 16:25:51
【问题描述】:
我正在使用 dfm_weight 查看不同的权重选项。如果我选择 scheme = 'prop' 并将 textstat_frequency 按location 分组,那么每个组中一个词的正确解释是什么?
假设在纽约,career 是 0.6,而在波士顿,team 是 4.0,我该如何解释这些数字?
corp=corpus(df,text_field = "What are the areas that need the most improvement at our company?") %>%
dfm(remove_numbers=T,remove_punct=T,remove=c(toRemove,stopwords('english')),ngrams=1:2) %>%
dfm_weight('prop') %>%
dfm_replace(pattern=as.character(lemma$first),replacement = as.character(lemma$X1)) %>%
dfm_remove(pattern = c(paste0("^", stopwords("english"), "_"), paste0("_", stopwords("english"), "$")), valuetype = "regex")
freq_weight <- textstat_frequency(corp, n = 10, groups = c("location"))
ggplot(data = freq_weight, aes(x = nrow(freq_weight):1, y = frequency)) +
geom_bar(stat='identity')+
facet_wrap(~ group, scales = "free") +
coord_flip() +
scale_x_continuous(breaks = nrow(freq_weight):1,
labels = freq_weight$feature) +
labs(x = NULL, y = "Relative frequency")
【问题讨论】: