No don't know how to use reprex on this web site, but i try to write all the code. I think that this error derives from the package.
library(pdftools)
library(tidyverse)
library(tidytext)
texto = pdf_text("/home/y---p---/Downloads/morel.pdf")
for (i in 1:length(texto)) {
texto[i] = str_replace_all(texto[i],"\n", "")
}
texto_token = texto[1] %>%
unnest_tokens(ngram, txt, token = "ngrams", n = 2)
The book that i analyze is morel.pdf (454.6 KB)