
Sentiment analysis codebook for movie reviews
data_codebook_sentiment.RdA qlm_codebook object defining instructions for sentiment analysis of movie
reviews. Designed to work with data_corpus_LMRDsample but with an expanded
polarity scale that includes a "mixed" category.
Format
A qlm_codebook object containing:
- name
Task name: "Movie Review Sentiment"
- instructions
Coding instructions for analyzing movie review sentiment
- schema
Response schema with two fields:
polarity(Enum of "neg", "mixed", or "pos") andrating(Integer from 1 to 10)- role
Expert film critic persona
- input_type
"text"
Examples
# View the codebook
data_codebook_sentiment
#> quallmer codebook: Sentiment analysis
#> Input type: text
#> Role: You are a political communication analyst evaluating public ...
#> Instructions: Analyze the sentiment of this text, on both a 1-10 scale and...
#> Output schema:ellmer::TypeObject
#> Levels:
#> sentiment: nominal
#> rating: ordinal
if (FALSE) { # \dontrun{
# Use with movie review corpus (requires API key)
coded <- qlm_code(data_corpus_LMRDsample[1:10],
data_codebook_sentiment,
model = "openai")
# Create multiple coded versions for comparison
coded1 <- qlm_code(data_corpus_LMRDsample[1:20],
data_codebook_sentiment,
model = "openai/gpt-4o-mini")
coded2 <- qlm_code(data_corpus_LMRDsample[1:20],
data_codebook_sentiment,
model = "openai/gpt-4o")
# Compare inter-rater reliability
comparison <- qlm_compare(coded1, coded2, by = "rating", level = "interval")
print(comparison)
} # }