A simple tool to calculate the similarity between two words or phrases.
- Install the required dependencies by running:
npm install
- Use the
text-sim.js
script to compare two words or phrases:
./text-sim.js "word1" "word2"
Replace "word1"
and "word2"
with the desired words or phrases. If the words contain spaces, enclose them in quotes.
Compare the similarity between "coffee" and "cafe":
./text-sim.js coffee cafe
This will output a similarity score between 0 and 1, where:
- 1 indicates a perfect match (the words are identical or very closely related)
- 0 indicates no relation at all (the words are completely unrelated)