Learn R Programming

NaileR (version 1.2.2)

sim_llm: LLM text similarity

Description

Compute a similarity score, on a scale ranging from 0 (totally different) to 100 (the exact same), between two character strings.

Usage

sim_llm(textA, textB)

Value

An integer between 0 and 100.

Arguments

textA, textB

two character strings.

Details

The similarity score is generated by an LLM. Therefore, the result might vary if the function is run several times.

Examples

Run this code
if (FALSE) {
# Processing time is often longer than ten seconds
# because the function uses a large language model.

textA <- "Participant A was described as a nice, outgoing man, with a friendly attitude."
textB <- "Participant A was an extroverted and caring individual."

sim_llm(textA, textB)
}

Run the code above in your browser using DataLab