I have a text file that contains the content of a web page that I have extracted using BeautifulSoup. I need to find N similar words from the text file based on a given word. The process is as follows:
- The website from which text was extracted: https://en.wikipedia.org/wiki/Football
- The extracted text is saved to a text file.
- The User inputs a word, ex: "goal" and I have to display the top N most similar words from the text file.
I have only worked in Computer Vision and completely new to NLP. I'm currently stuck in step 3. I have tried Spacy and Gensim, but my approach is not at all efficient. I currently do this:
for word in ['goal', 'soccer']:
# 1. compute similarity using spacy for each word in the text file with the given word.
# 2. sort them based on the scores and choose the top N-words.
Is there any other approach or a simple solution to solve this problem? Any help is appreciated. Thanks!