clustering list of words in python

后端 未结 3 1637
無奈伤痛
無奈伤痛 2021-01-03 11:37

I am a newbie in text mining, here is my situation. Suppose i have a list of words [\'car\', \'dog\', \'puppy\', \'vehicle\'], i would like to cluster words into k groups, I

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-03 12:22

    Following up the answer by Brian O'Donnell, once you've computed the semantic similarity with word2vec (or FastText or GLoVE, ...), you can then cluster the matrix using sklearn.clustering. I've found that for small matrices, spectral clustering gives the best results.

    It's worth keeping in mind that the word vectors are often embedded on a high-dimensional sphere. K-means with a Euclidean distance matrix fails to capture this, and may lead to poor results for the similarity of words that aren't immediate neighbors.

提交回复
热议问题