Python snippet to find similar word(s)
Apr 30, 2021
As part project I was building had this idea of rather than showing same static responses, to show similar word pool which is computed
After giving it a thought over coffee thought NLP should have an approach to achieve this — Yes, it has
We could find nearest/similar word of any given word in 3 lines of code by using of spaCy
Here goes the code ;)
Setup
python -m spacy download en_core_web_lgor python -m spacy download en_core_web_md
Note
- spacy.load()should have the same package been downloaded
- en_core_web_sm package do not include word vector