You are browsing as a guest. Sign up (or log in) to start making projects!

2h 3m 31s logged

Compare the words! +

I have reworked how words are compared!
before, if I tried to compare “different” and “diferent”
the code would see

| d | i | f | f | e | r | e | n | t |
| d | i | f | e | r | e | n | t |
| ^ | ^ | ^ |X |X | X | X | X | X |

For a total of 33% accuracy (very wrong)!
Now, the new code only compares the difference in letters, without caring about where each letter is placed!
The code now sees:

| d | i | f  | r | e | n | t |  <- all letters used
| 1 | 1 | 2  | 1 | 2 | 1 | 1 |  <- count for "different"
| 1 | 1 | 1  | 1 | 2 | 1 | 1 |   <- count for "diferent"

then calculates the accuracy per letter:

| d | i | f  | r | e | n | t |
| 1 | 1 | .5  | 1 | 1 | 1 | 1 |

witch gives an average (aka accuracy) of 0.928(93%)! This is far better than before!
This can give some results that you wouldn’t think like how the code sees “rustq” as most similar to “quarts” (as seen in the image below).
You can see the function code here.
Now, I’m thinking of getting word definitions for the top i most similar words.
Can’t wait for next time, bye!

0
5

Comments 0

No comments yet. Be the first!