Created
November 8, 2017 10:06
-
-
Save Rekyt/7d24c31239309967bba06730c9a809b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Text analysis of Proust | |
| library(proustr) | |
| library(tidytext) | |
| library(dplyr) | |
| library(stringr) | |
| proust_words = proust_books() %>% | |
| group_by(book) %>% | |
| mutate(linenumber = row_number(), | |
| chapter = cumsum(str_detect(text, regex("^chapitre [\\divxlc]", | |
| ignore_case = TRUE)))) %>% | |
| ungroup() %>% | |
| unnest_tokens(word, text) | |
| mot_avec_cedille = proust_words %>% | |
| filter(grepl("ç", word, fixed = TRUE) | | |
| grepl("Ç", word, fixed = TRUE)) %>% | |
| select(word) %>% | |
| distinct() | |
| proust_words %>% | |
| inner_join(mot_avec_cedille, by = "word") %>% | |
| count(word, sort = TRUE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment