I have this task for research purposes and searched a while for a framework or a paper which already took care of this problem.

Unfortunately I don't find anything which helps me with my problem.

I have a sentence like

if the age of the applicant is **higher** than 18, then ...

and a list of words like

higher, bigger, greater, wider ...

which are all a

Now I want to find find out, which of the given words approximately fits the best at the predefined position in the sentence.

The best fitting word in this example would be 'greater', but for example 'higher' would be also fine. In my specific case, I want to show an error message if someone would write 'wider', because this doesn't make sense in this semantic context.

I hope that I explained my problem good enough.

  • $\begingroup$ I think it would be helpful to answer your question if you could define "best fit" a bit more. $\endgroup$
    – oW_
    Commented Mar 26, 2019 at 15:22

1 Answer 1


There are two options :

  1. CBOW . Modify Word2Vec CBOW code to save the whole trained model (current implementations only persist embedding layer)

CBOW Model: This method takes the context of each word as the input and tries to predict the word corresponding to the context.

Intro : https://towardsdatascience.com/introduction-to-word-embedding-and-word2vec-652d0c2060fa Example : https://www.tensorflow.org/tutorials/representation/word2vec

  1. Train an LSTM / GRU to predict next word (given previous N words)

Karpathy's article is probably the best introduction to text generation with RNN (this works at character level, you will have to modify it to work at word level [Word-Vector level])


Example :


  • $\begingroup$ Thank you for your fast answer, I will have a look at both! $\endgroup$ Commented Mar 27, 2019 at 7:29

Your Answer

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

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