R将预定义主题与文本匹配

时间:2017-12-19 08:09:00

标签: r cluster-computing text-classification topic-modeling

我有一些主题和很多文字。我需要将主题与文本相匹配。所以我问R中是否有包可以这样做。这是一些示例数据:

texts = c("I like my pet. It is a dog which has brown hair. He likes to play with other dogs.", "There are many colours like blue, red, yellow, orange or purple. My dog is brown.", "School was very boring today. My teacher also fell asleep.")
topics = c("pets", "school", "colour")

所需的输出应该是这样的:

result = data.frame(texts, c("pets", "colour", "school"))

我找到了一些选项来聚类文本,例如K均值。但后来我会得到代表集群的数字。 是否可以将文本与那些预定义的主题相匹配?

0 个答案:

没有答案