简体   繁体   中英

How to compute word similarity using TF-IDF or LSA with gensim?

I know that word2vec in gensim can compute similarity between words. But now I want to compute word similarity using TF-IDF or LSA with gensim . How to do it?

note: Computing document similarity using LSA with gensim is easy: http://radimrehurek.com/gensim/wiki.html

TF-IDF is a weighting scheme so it's not an alternative to LSA.

Imagine your problem as a matrix of "m" terms by "n" documents. Each entry Aij of your matrix represents the weight of term "i" in document "j". This is where you use TF-IDF. To know what to put in each cell of the matrix.

Then if it suits your application you can reduce the dimensions of the matrix using LSA.

I hope this clears a little the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM