x <- data.frame(doc_id = c(1, 2),
text = c("This is some text", "Another set of texts."),
stringsAsFactors = FALSE)
y <- data.frame(doc_id = c(1, 2, 3),
text = c("were as some thing", "else, another set", NA_character_),
stringsAsFactors = FALSE)
alignments <- smith_waterman_pairwise(x, y)
alignments
alignments <- smith_waterman_pairwise(x, y, FUN = as.data.frame)
do.call(rbind, alignments)
alignments <- smith_waterman_pairwise(x, y,
FUN = function(x) list(sim = x$similarity))
do.call(rbind, alignments)
x <- c("1" = "This is some text", "2" = "Another set of texts.")
y <- c("1" = "were as some thing", "2" = "else, another set", "3" = NA_character_)
alignments <- smith_waterman_pairwise(x, y)
Run the code above in your browser using DataLab