machine-learning - 对相似的词组进行分类

标签 machine-learning statistics nlp cluster-analysis hierarchical-clustering

我有一组单词短语,我想按照下面的示例对它们进行分类。

示例:

adaptive and intelligent educational system
adaptive and intelligent tutoring system
adaptive educational system

对于人类来说,很容易理解上述三词短语应该属于一个类别。

有什么简单的方法吗?

目前,我正在使用亲和传播聚类算法,如下使用编辑距离。

words = np.asarray(words) #So that indexing with a list will work
lev_similarity = -1*np.array([[distance.levenshtein(w1,w2) for w1 in words] for w2 in words])

affprop = sklearn.cluster.AffinityPropagation(affinity="precomputed", damping=0.5)
affprop.fit(lev_similarity)
for cluster_id in np.unique(affprop.labels_):
    exemplar = words[affprop.cluster_centers_indices_[cluster_id]]
    cluster = np.unique(words[np.nonzero(affprop.labels_==cluster_id)])
    cluster_str = ", ".join(cluster)
    print(" - *%s:* %s" % (exemplar, cluster_str))

但是,我没有得到想要的输出。因此,请向我建议一种合适的方法来获得我想要的结果。

最佳答案

编辑距离适用于角色。

从这个角度来看,“教育”和“辅导”是尽可能不同的。

如果您想按语义相似度进行聚类,请不要使用字符级别相似度。

不幸的是,语义相似性很难。您将需要以某种方式使用庞大的知识库。例如,使用整个万维网来了解“辅导”和“教育”是相关的。或者你可以尝试例如WordNet 等

关于machine-learning - 对相似的词组进行分类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45542179/

相关文章:

perl - 如何在 Perl 中获取相关的 t 统计量和 p 值?

php - 词干提取避免将流行单词与不同含义进行匹配

python-3.x - 使用之前训练好的模型在catboost中进行进一步预测

machine-learning - tensorflow 初始阶段中预测标签图像无法加载计算图

hibernate - 是否有一个很好的 GUI 可用于显示 Hibernate 统计信息?

r - 在 Stan/Rstan 中实现指数一般线性模型

python - 判断一个句子是肯定的、中性的还是否定的?

nlp - 西类牙语单词网

machine-learning - 亲和性传播首选项初始化

php - 基于网络数据的大型机器学习