create_tfidf: Calculate tf-idf

Description Usage Arguments Value Examples

Description

A function to calculate tf-idf for an n-gram ngram_model (stop words not removed). It is a convenience function based around tidytext::bind_tf_idf

Usage

1
create_tfidf(ngram_model, doc_title = "title")

Arguments

ngram_model

A data frame containing an n-gram ngram_model

doc_title

The column name containing document title

Value

A data frame of n-grams with tf-idf information.

Examples

1
2
3
4
library(janeaustenr)
library(tidytext)
bigrams <- create_ngrams(austen_books(),"bigram",stopwords=stop_words)
bigram_tfidf <- create_tfidf(bigrams,doc_title="book")

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