stylest (version 0.1.0)

stylest_fit: Fit speaker_model to a corpus

Description

The main function in stylest, stylest_fit fits a model using a corpus of texts labeled by speaker.

Usage

stylest_fit(x, speaker, terms = NULL, filter = NULL, smooth = 0.5)

Arguments

x

Text vector. May be a corpus_frame object

speaker

Vector of speaker labels. Should be the same length as x

terms

If not NULL, terms to be used in the model. If NULL, use all terms

filter

If not NULL, a text filter to specify the tokenization. See corpus for more information about specifying filter

smooth

Numeric value used smooth term frequencies instead of the default of 0.5

Value

A S3 stylest_model object containing: speakers Vector of unique speakers, filter text_filter used, terms terms used in fitting the model, ntoken Vector of number of tokens per speaker, smooth Smoothing value, rate Matrix of speaker rates for each term in vocabulary

Details

The user may specify only one of terms or cutoff. If neither is specified, all terms will be used.

Examples

Run this code
# NOT RUN {
data(novels_excerpts)
speaker_mod <- stylest_fit(novels_excerpts$text, novels_excerpts$author)

# }

Run the code above in your browser using DataLab