Skip to contents

This function calculates semantic similarity over a sequence of conversation exchanges within a single dyad.

Usage

sem_sim_seq(conversation, method = "tfidf", window_size = 3, ...)

Arguments

conversation

A data frame representing the conversation

method

A character string specifying the method to use: "tfidf", "word2vec", or "glove"

window_size

An integer specifying the size of the sliding window

...

Additional arguments passed to semantic_similarity

Value

A list containing the sequence of similarities and the average similarity

Examples

conversation <- data.frame(
  processed_text = c("The weather is nice", "It's a beautiful day",
                     "The sun is shining", "Perfect day for a picnic")
)
result <- sem_sim_seq(conversation, 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.
print(result)
#> $sequence
#> [1] 0.5 0.5
#> 
#> $average
#> [1] 0.5
#>