calc_sim_seq {conversim} | R Documentation |
This function calculates a sequence of similarities between consecutive windows in a conversation.
calc_sim_seq(conversation, window_size, similarity_func)
conversation |
A dataframe containing the conversation, with a column named 'processed_text'. |
window_size |
An integer specifying the size of each window. |
similarity_func |
A function that calculates similarity between two text strings. |
A list containing two elements:
sequence |
A numeric vector of similarity scores between consecutive windows |
average |
The mean of the similarity scores |
conversation <- data.frame(processed_text = c("hello", "world", "how", "are", "you"))
result <- calc_sim_seq(conversation, 2, function(x, y) sum(x == y) / max(length(x), length(y)))