if (FALSE) {
# Processing time is often longer than ten seconds
# because the function uses a large language model.
library(NaileR)
data(rorschach)
### Example 1: perception of the inkblots for one panel ###
intro_rorschach <- "For this study,
we asked 20 people to briefly describe
the 10 inkblots of the Rorschach test."
intro_rorschach <- gsub('\n', ' ', intro_rorschach) |>
stringr::str_squish()
request_rorschach <- "Based on the comments of the 20 people,
please give me a description of each inkblot
in terms of how it was perceived. Tell me if it was
a rather positive or negative perception."
request_rorschach <- gsub('\n', ' ', request_rorschach) |>
stringr::str_squish()
rorschach_A <- droplevels(rorschach[rorschach$Panel=="A",])
res_nail_textual_rorschach <- nail_textual(rorschach_A, num.var = 2,
num.text = 5,
introduction = intro_rorschach,
request = request_rorschach,
model = 'llama3',
isolate.groups = FALSE,
generate = FALSE)
cat(res_nail_textual_rorschach$prompt)
ppt <- gsub("## Group", "## Inkblot", res_nail_textual_rorschach$prompt)
cat(ppt)
res_inkblot <- ollamar::generate(model = 'llama3', prompt = ppt,
output = "df")
cat(res_inkblot$response)
}
Run the code above in your browser using DataLab