How to use bigrams and trigrams using tidy text

Viewed 4387

I'm trying to use both a bigram and a trigram using tidytext. What code could I use for the token to look for 2 and 3 words.

This is the code for using bigrams only:

library(tidytext)
library(janeaustenr)

austen_bigrams <- austen_books() %>%
  unnest_tokens(bigram, text, token = "ngrams", n = 2)

austen_bigrams
1 Answers
Related