R/numcomwords.R

Defines functions numcomwords

Documented in numcomwords

#' numcomwords
#'
#' number of common words between two strings
#' @param x data to recode from ASCII to latin
#' @param str1 string1
#' @param str2 string2
#' @export
numcomwords <- function(str1, str2) {
  mapply(function(x, y) length(intersect(x, y)),
         strsplit(str1, ' '), strsplit(str2, ' '))
}
nbarsch/tfwstring documentation built on May 4, 2023, 5:26 a.m.