create_ngrams: Create ngrams from tidy data

Description Usage Arguments Value Examples

Description

A function to create an n-gram model from a tidy data frame. It is a convenience function based around tidytext functions

Usage

1
create_ngrams(corpus, ngram_size, stopwords)

Arguments

corpus

A data frame containing columns for title and text

ngram_size

An character string denoting the size of n-gram (unigram, bigram or trigram)

stopwords

A data frame containing stop words

Value

A data frame of ngrams

Examples

1
2
3
4
library(janeaustenr)
library(tidytext)
unigrams <- create_ngrams(austen_books(),"unigram")
stopped <- create_ngrams(austen_books(),"unigram",stopwords=stop_words)

cldatascience/tidygramr documentation built on May 10, 2019, 1:09 a.m.