3
$\begingroup$

Hello I am building a python program for text spinning. I have read about GloVe, word2vec, doc2vec or text2vec. I understand that what they do is to represent each word as a semantic vector.

So I guess that if I train a GloVe I could use it just for finding synonyms, or something more?

EDIT: I have come up with one strategy:

  1. First I train a doc2vec model. The goal would be to build semantic vectors of phrases
  2. Then I use my original paragraph input. Word by word I change it randomly with a synonym (provided by nltk or other synonym db). Before finally spinning one word I compute the doc2vec for the changed paragraph and compute the distance with the original paragraph vectorized. I only change the synonym if the distance is small.

How does that sound to you?

$\endgroup$

1 Answer 1

2
$\begingroup$

So I guess that if I train a GloVe I could use it just for finding synonyms, or something more?

GloVe (vectors) are not the perfect word representations if you were to find synonyms. Since GloVe vectors are generated on the basis of the contexts in which they appear (context implies words before and after the word in study within a sentence), you may find antonyms will also have similar GloVe vectors since they too will appear in the same context. For eg.

Consider the two words "good" and "bad" used in the following sentences:

John was a good boy who was injured in the war. John was a bad boy who was injured in the war.

Here, both the words "good" and "bad" appear in the same context. The context before is "John was a" and the context after is " who was injured in the war."

Hence, their GloVe vectors won't have much of a distinction and you might change the meaning of your sentence completely when spinning for a new word.

To address the above, a very good alternative to GloVe vectors is "retro-fit vectors". Here is the link of the original article. and here is the GitHub link of the actual vectors. since they are learned for semantic similarity. I suggest using these retro-fit vectors since you seem to be interested in lexical substitution of synonyms.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.