August 2017
Intermediate to advanced
288 pages
8h 6m
English
Here is how we go about analyzing documents using tf-idf:
Pride_Prejudice_chapters <- austen_books_df %>%
group_by(book) %>%
filter(book == "Pride & Prejudice") %>%
mutate(linenumber = row_number(),
chapter = cumsum(str_detect(text, regex("^chapter [\\divxlc]", ignore_case = TRUE)))) %>%
ungroup() %>%
unnest_tokens(word, text) %>%
count(book, chapter, word, sort = TRUE) %>%
ungroup()
Read now
Unlock full access