これは奇妙なパズルです。私はgutenbergr - Alice in WonderlandとUlyssesの2つのテキストをダウンロードしました。 stop_wordsはAliceから消えますが、まだUlyssesにあります。 anti_joinを フィルタ(!word%%stop_words $ word)に置き換えても、この問題は解決されませんでした。R tidytext stop_wordsがgutenbergrから一貫してフィルタリングされないダウンロード
ユリシーズからstop_wordsを取得するにはどうすればよいですか?
ありがとうございました!
Plot of top 15 tf_idf for Alice & Ulysses
library(gutenbergr)
library(dplyr)
library(stringr)
library(tidytext)
library(ggplot2)
titles <- c("Alice's Adventures in Wonderland", "Ulysses")
books <- gutenberg_works(title %in% titles) %>%
gutenberg_download(meta_fields = c("title", "author"))
data(stop_words)
tidy_books <- books %>%
unnest_tokens(word, text) %>%
anti_join(stop_words) %>%
count(title, word, sort=TRUE) %>%
ungroup()
plot_tidy_books <- tidy_books %>%
bind_tf_idf(word, title, n) %>%
arrange(desc(tf_idf)) %>%
mutate(word = factor(word, levels = rev(unique(word)))) %>%
mutate(title = factor(title, levels = unique(title)))
plot_tidy_books %>%
group_by(title) %>%
arrange(desc(n))%>%
top_n(15, tf_idf) %>%
mutate(word=reorder(word, tf_idf)) %>%
ggplot(aes(word, tf_idf, fill=title)) +
geom_col(show.legend = FALSE) +
labs(x=NULL, y="tf-idf") +
facet_wrap(~title, ncol=2, scales="free") +
coord_flip()
は、それらのほとんどの引用符/アポストロフィはとても卑劣です!これを理解し、それを修正する方法を教えてくれてありがとう。 –
助けがあれば、それを答えとして受け入れて他の人に知らせることができます。 –
オハイオ州、オクラホマ - 私はここに新しいです - するでしょう! –