jProgr / TokiPonaDictionary

A Toki Pona - English dictionary with search function
https://jprogr.github.io/TokiPonaDictionary/
Other
48 stars 11 forks source link

"ni" gives a confusing result (maybe) #9

Closed TheSeptembre closed 3 years ago

TheSeptembre commented 4 years ago

"ni" gives no result even if it is in the list

jProgr commented 4 years ago

I tried searching "ni" (without quotes) and got a couple of results; the "ni" definition was in the 11th place. I also tried searching "ni" (with quotes) and got no results; are you talking about this case? The dictionary does not use a fuzzy search algorithm, it uses a substring match. Also, it functions as reverse dictionary too, it looks at the meanings when searching, not only at the word keys. Do you think it should use another algorithm? Which results were you expecting?

TheSeptembre commented 4 years ago

I was initially confused that ni (without quote) did not bring the result at the top and thought it didn't work, whereas, as you make me notice now, it actually brings back results. However, it's maybe confusing since we have as first result:

akesi : n non-cute animal, reptile, amphibian, dinosaur, monster akesi definition appear since "animal" contains ni.

✳ What I suggest as a light workaround:

💢 Possible issues with this:

_ also, thank you in general for this project, which is very simple and useful for toki pona community. ♥

jProgr commented 4 years ago

I like those suggestions. I will try both and see which one makes more sense.

jProgr commented 4 years ago

Also check out @LongJohn-Silver suggestion:

I still think that the best solution would be to add to search entries for the two languages […] Maybe instead of two search boxes it could be something like this, with two buttons to select the language

https://github.com/jProgr/TokiPonaDictionary/issues/10#issuecomment-726249288

jProgr commented 4 years ago

After some deliberation, I will implement the following solution: The current results will still show in the same way but for every exact match (that is, every entry in the dictionary that has a string that is exactly as the query) there will a duplicate of such entry that will be shown before the current results and will be highlighted somehow.

The considered solutions were the ones present in this issue and #10. I thought about the advantages and problems of each one:

What do you think?

jProgr commented 4 years ago

These are the principles I follow when taking any decision about the tool:

Maybe I should add these to the code.

TheSeptembre commented 4 years ago

After some deliberation, I will implement the following solution: The current results will still show in the same way but for every exact match (that is, every entry in the dictionary that has a string that is exactly as the query) there will a duplicate of such entry that will be shown before the current results and will be highlighted somehow.

I like it a lot and find it very elegant. Seems lightweight and might not confuse users. 👏

jProgr commented 3 years ago

With the help of @mitaa the new search algorithm was implemented. While testing it out I noticed that a lot of the results between the exact matches and the partial ones were the same and the page usually ended up with the same word twice. And so I decided to remove the partial results and leave only the exact ones. The new release 210217 (currently live) has those changes.

Later I thought about showing the partial results if the exact results are empty, but I'm not sure.

Saevon commented 3 years ago

Removing partial matches has made finding some words harder to find though