In this project, we will use the gensim library to demonstrate the use of word2vec.
The program learns the text corpus and finds the top 5 most probable related words to the words we input to the algorithm. This is the underlying algorithm for text prediction.
The word2vec algorithm uses a neural network model to learn word associations from a large corpus of text. Once trained, such a model can detect words with highest cosine similarity from the text.
Python 3.x
- Clone the Repo
- Run the commands as below:
When running for the first time use the following command to to install gensim:
$ pip install -U gensim
Command to run the consumer python program:
$ python test.py fake_or_real_news.csv mymodel query_words.txt
NOTE: For changing words in query_words.txt, be careful to enter words exactly in the format below:
word1
word2
word3
wordn
Build a flask app implementation of autocomplete