get_zipf_metric: Get Zipf Metric

View source: R/chatRater.R

get_zipf_metricR Documentation

Get Zipf Metric

Description

Uses an LLM to estimate a Zipf-based metric (slope) for the given stimulus.

Usage

get_zipf_metric(
  stimulus,
  model = "gpt-3.5-turbo",
  api_key = "",
  top_p = 1,
  temp = 0
)

Arguments

stimulus

A character string representing the language material.

model

A character string specifying the LLM model (default "gpt-3.5-turbo").

api_key

API key as a character string.

top_p

Numeric value (default 1).

temp

Numeric value (default 0).

Details

Default definition: "Zipf's law states that word frequency is inversely proportional to its rank; the Zipf metric is the slope of the log-log frequency vs. rank plot."

Value

A numeric value representing the Zipf metric.

Examples

## Not run: 
  zipf_metric <- get_zipf_metric("The quick brown fox jumps over the lazy dog",
                                 model = "gpt-3.5-turbo",
                                 api_key = "your_api_key")
  cat("Zipf Metric:", zipf_metric, "\n")

## End(Not run)

chatRater documentation built on April 4, 2025, 1:03 a.m.