Skip to contents

Extracts per-sentence linguistic features (valence, length, lexical diversity, punctuation density) and a global emotional arc from text read by syn_read_text(), returning a prosody_score object that drives both syn_paint() and syn_play(). The result is deterministic: the same text and seed always yield an identical score.

Usage

syn_score(text, seed = 1L, call = rlang::caller_env())

Arguments

text

A tibble from syn_read_text().

seed

Integer seed stored on the score for reproducible downstream mapping and rendering. Default 1L.

call

The calling environment, for error reporting. Experts only.

Value

A prosody_score object: a list with features (a per-sentence tibble of sentence_id, sentence, valence, length, lex_diversity, punct_density), arc (smoothed valence trajectory), lang, seed, and meta.

See also

syn_read_text() for input, syn_paint() and syn_play() for output.

Examples

txt <- syn_read_text(syn_example_text("en"), lang = "en")
syn_score(txt)
#> <prosody_score> — 6 sentences, lang "en"