我想在两列字符串之间应用余弦相似性,并获得它们在R中的计数

我想在两列字符串之间应用余弦相似性,并获得它们在R中的计数,r,R,我有两个数据帧a(数据文件)和b(参考),其中我需要比较答案列,应用余弦相似性,获得具有最佳匹配值及其余弦的数据帧。稍后,我需要计算a中存在的b的每个答案(基于余弦相似性后获得的最佳匹配值) 你的错误代码/不期望的结果在哪里?d.矩阵在此之后,如何获得a中存在的每个b答案的计数(基于余弦相似性后获得的最佳匹配值)。请使用尝试代码和任何支持性解释编辑你的帖子,而不是在评论中。这是表的工作吗?正如在As.data.frame(表(droplevels(matchwith)))中一样。出现错误/不希望

我有两个数据帧a(数据文件)和b(参考),其中我需要比较答案列,应用余弦相似性,获得具有最佳匹配值及其余弦的数据帧。稍后,我需要计算a中存在的b的每个答案(基于余弦相似性后获得的最佳匹配值)


你的错误代码/不期望的结果在哪里?d.矩阵在此之后,如何获得a中存在的每个b答案的计数(基于余弦相似性后获得的最佳匹配值)。请使用尝试代码和任何支持性解释编辑你的帖子,而不是在评论中。这是
的工作吗?正如在
As.data.frame(表(droplevels(matchwith)))
中一样。出现错误/不希望出现的结果的尝试代码在哪里?d.矩阵在此之后,如何获得a中存在的b的每个答案的计数(基于余弦相似性后获得的最佳匹配值)。请使用尝试的代码和任何支持性解释编辑您的文章,而不是在评论中。这是
的工作吗?如在
As.data.frame(表(droplevels(matchwith)))
中所示。
 a <- data.frame(Answer = c("Hey <firstname>, here are some topics I have been helping folks", 
                            "here are some topics I have been helping folks, have a nice day,<
                            "hello there, here are some topics I have been helping folks",
                             "Your final job decisions post the cycle will be available on this site",
                            "Compensation details will be sent on mail. Final job decisions post the cycle will be available on this link, have a great day"))

 b <- data.frame(Answer = c("here are some topics I have been helping folks,"Final Rewards decisions post the cycle will be available here","reward decisions post the cycle will be available on this link, have a great day"))
  Result = data.frame(Answer = c("here are some topics I have been helping folks,"Final Rewards decisions post the cycle will be available here"),count=c(3,2))