Sigmund Reed
Sigmund Reed

Reputation: 77

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.

Upvotes: 2

Views: 6350

Answers (2)

aerin
aerin

Reputation: 22634

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

Upvotes: 2

jgorostegui
jgorostegui

Reputation: 1310

You are going to need to add the next imports to your code:

from scipy import spatial
from gensim import models
import numpy as np

If you are using Anaconda Distribution you can install gensim with:

conda install -c anaconda gensim=0.13.3

Remember that you're going to need some model in order to make a runnable code.

Upvotes: 0

Related Questions