get_levenshtein_d {chatRater} | R Documentation |
Get Levenshtein Distance (D)
Description
Uses an LLM to compute the Levenshtein distance (D) between two linguistic stimuli.
Usage
get_levenshtein_d(
stimulus1,
stimulus2,
model = "gpt-3.5-turbo",
api_key = "",
top_p = 1,
temp = 0
)
Arguments
stimulus1 |
A character string representing the first text. |
stimulus2 |
A character string representing the second text. |
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: "Levenshtein distance is defined as the minimum number of single-character edits (insertions, deletions, or substitutions) required to transform one string into another."
Value
A numeric value representing the Levenshtein distance.
Examples
## Not run:
lev_dist <- get_levenshtein_d("kitten", "sitting",
model = "gpt-3.5-turbo",
api_key = "your_api_key")
cat("Levenshtein Distance:", lev_dist, "\n")
## End(Not run)
[Package chatRater version 1.1.0 Index]