-3

I have a list of strings like below. I would like to see similarity between list1 and list2 using Doc2Vec.

list1 = [['i','love','machine','learning','its','awesome'],['i', 'love', 'coding', 'in', 'python'],['i', 'love', 'building', 'chatbots']]
list2 = ['i', 'love', 'chatbots']
Praveenkumar
  • 3
  • 1
  • 3

1 Answers1

0

If you're using the Doc2Vec implementation in the gensim library, there are intro notebooks that cover this. See for example the file doc2vec-lee.ipynb, which is inside the gensim docs/notebooks directory (where you can and sould run it locally), or viewable online at:

https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/doc2vec-lee.ipynb

Note that:

  • you'll need a model trained on far more data - ideally tens-of-thousands or more texts, each text being at least a sentence

  • if the two texts you want to compare were part of your training set, you can retrieve the learned doc-vectors from the model

  • if the two texts you want to compare are not part of the training set, you can infer doc-vectors for them, using the model, as is shown in that notebook

gojomo
  • 52,260
  • 14
  • 86
  • 115