Learn R Programming

quickSentiment (version 0.1.0)

BOW_train: Train a Bag-of-Words Model

Description

Train a Bag-of-Words Model

Usage

BOW_train(doc, weighting_scheme = "bow", ngram_size = 1)

Value

An object of class "qs_bow_fit" containing:

  • dfm_template: a quanteda dfm template

  • weighting_scheme: the weighting used

  • ngram_size: the n-gram size used

#'

Arguments

doc

A character vector of documents to be processed.

weighting_scheme

A string specifying the weighting to apply. Must be one of "bow", "binary", "tf", or "tfidf". Defaults to "bow".

ngram_size

An integer specifying the maximum n-gram size. For example, `ngram_size = 1` will create unigrams only; `ngram_size = 2` will create unigrams and bigrams. Defaults to 1.

Examples

Run this code
txt <- c("text one", "text two text")
fit <- BOW_train(txt, weighting_scheme = "bow")
fit$dfm_template

Run the code above in your browser using DataLab