Search code examples
pythonvectorword2veccosine-similaritysentence

Using word2vec to calculate sentence similarity


On a previous post I found some code that described a method for calculating the semantic similarity between 2 sentences.

My question is what libraries, modules, etc. (ex. from NAME import NAME) do I need in order to run this code on my computer. Link to code

I was thinking maybe word2vec, numpy, scikit learn but I'm not sure.


Solution

  • Basically what you need is:

    pretrained word vector
    gensim
    numpy
    scipy 
    

    For the semantic, you need word vector so that you can calculate the similarities between your sentences.

    Here is a step by step tutorial: How to calculate phrase similarity between phrases