Train Naive Bayes classifier (init_naive_classifer).

train_naive_classifier(model, data, text, labels)

# S3 method for naive_bayes_model
train_naive_classifier(model, data, text,
  labels)

Arguments

model

A naive Bayes classifier as returned by init_naive_classifer.

data

A data.frame containing text and labels.

text

Text to train model on labels.

labels

Bare column name containing labels.

Examples

# NOT RUN {
init_textanalysis()
classes <- factor(c("financial", "legal"))
model <- init_naive_classifer(classes)

train <- tibble::tibble(
  text = c("this is financial doc", "this is legal doc"),
  labels = factor("financial", "legal")
)

train_naive_classifier(model, train, text, labels)
# }