eagleflo / jisho

Jisho is a CLI tool & Rust library that provides a Japanese-English dictionary.
GNU General Public License v3.0
13 stars 1 forks source link

Improve lookup heuristic #26

Closed eagleflo closed 1 year ago

eagleflo commented 1 year ago
~ % jisho ある限り
~ % jisho "all (there is)"
ある限り【あるかぎり】- all (there is), as long as there is

That's not ideal. The original very naïve piece of code just looked at the first character of the input when deciding which HashMap to look from. I rewrote it so that if there is any 漢字 in the query we look at keb rather than reb. Likewise reading lookups now require the whole input to be in 仮名; according to JMdict DTD reb is restricted to 仮名.

eagleflo commented 1 year ago

Fixed in 9c3fe27969e01178675332b1e2a9d7ec700c2df7.