Может быть, что-то вроде этого
all_words <- stringr::str_extract_all(text, "\\w+")
I <- expand.grid(seq_along(text), seq_along(text))
L <- map2(I$Var1, I$Var2, ~paste(intersect(all_words[[.x]], all_words[[.y]]), collapse="|"))
mat <- matrix(L, nrow=5)
diag(mat) <- NA
mat
# [,1] [,2] [,3] [,4] [,5]
# [1,] NA "black" "black" "is|black" "black"
# [2,] "black" NA "I|love|black" "black" "black"
# [3,] "black" "I|love|black" NA "black" "black"
# [4,] "is|black" "black" "black" NA "black"
# [5,] "black" "black" "black" "black" NA
Для подсчета общих слов выполните
L <- map2(I$Var1, I$Var2, ~length(intersect(all_words[[.x]], all_words[[.y]])))
mat <- matrix(L, nrow=5)
diag(mat) <- NA
mat
# [,1] [,2] [,3] [,4] [,5]
# [1,] NA 1 1 2 1
# [2,] 1 NA 3 1 1
# [3,] 1 3 NA 1 1
# [4,] 2 1 1 NA 1
# [5,] 1 1 1 1 NA