Vamos a trabajar con unos 340 textos de Lenin y Rosa Luxemburgo (también provenientes del dataset que Diego Koslowski escrapeó del Marxist Internet Archive).
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tidytext)
rosa_lenin <- read_csv('../data/lenin_luxemburgo.csv')
## Rows: 92 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): tipo, autor, titulo, texto
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
###
Primero cargamos el diccionario de stopwords
stop_words <- read_csv('../data/stop_words_complete.csv', col_names=FALSE) %>%
rename(word = X1) %>%
mutate(word = stringi::stri_trans_general(word, "Latin-ASCII"))
## Rows: 1767 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): X1, X2
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Ahora sí, podemos proceder a la eliminación:
###
###
###