Calculate semantic similarity for multiple dyads
Source:R/conversation_multidyads.R
semantic_sim_dyads.Rd
This function calculates semantic similarity over a sequence of conversation exchanges for multiple dyads.
Value
A list containing the sequence of similarities for each dyad and the overall average similarity
Examples
library(lme4)
convs <- data.frame(
dyad_id = c(1, 1, 1, 1, 2, 2, 2, 2),
speaker = c("A", "B", "A", "B", "C", "D", "C", "D"),
processed_text = c("i love pizza", "me too favorite food",
"whats your favorite topping", "enjoy pepperoni mushrooms",
"i prefer pasta", "pasta delicious like spaghetti carbonara",
"ever tried making home", "yes quite easy make")
)
semantic_sim_dyads(convs, method = "tfidf", window_size = 2)
#> Warning: The 'tfidf' method may not provide highly meaningful results for short conversations or those with little vocabulary overlap. Consider using 'word2vec' or 'glove' methods for more robust results.
#> Warning: The 'tfidf' method may not provide highly meaningful results for short conversations or those with little vocabulary overlap. Consider using 'word2vec' or 'glove' methods for more robust results.
#> Warning: The 'tfidf' method may not provide highly meaningful results for short conversations or those with little vocabulary overlap. Consider using 'word2vec' or 'glove' methods for more robust results.
#> Warning: The 'tfidf' method may not provide highly meaningful results for short conversations or those with little vocabulary overlap. Consider using 'word2vec' or 'glove' methods for more robust results.
#> Warning: The 'tfidf' method may not provide highly meaningful results for short conversations or those with little vocabulary overlap. Consider using 'word2vec' or 'glove' methods for more robust results.
#> Warning: The 'tfidf' method may not provide highly meaningful results for short conversations or those with little vocabulary overlap. Consider using 'word2vec' or 'glove' methods for more robust results.
#> Warning: Problem with Hessian check (infinite or missing values?)
#> $similarities_by_dyad
#> $similarities_by_dyad$`1`
#> [1] 0.5 0.5 0.5
#>
#> $similarities_by_dyad$`2`
#> [1] 0.5 0.5 0.5
#>
#>
#> $overall_average
#> (Intercept)
#> 0.5
#>