Fuzzy search

I currently use dictcc offline with an alias like this (fzy is an fzf alternative, another fuzzy finder):

cat /home/janek/.local/share/dictcc/dict.txt | sed '/#/d;/&/d;/^$/d' | fzy

This very easily accomplishes an interactive full-text search which I find to be very handy.

The following package allows fuzzy finding, but only offline: https://github.com/martenlienen/dictcc.el/issues/19

Could this be implemented here using the full offline file, just like in the Terminal?

Assigned to
5 months ago
4 months ago
No labels applied.

~tsdh 5 months ago

There's a flag -r which interprets the query string as a regular expression. Of course, that's not fuzzy search and it's also quite slow.

You could also do something like rdictcc.rb -c -r . | my-collapse.sh | fzy. That invocation will simply spit out all words with their translation in the format - word: translation1, translation2,... which, however, can be multi-line so that the my-collapse.sh would need to collapse multi-line entries to one long line before feeding it to fzy.

Of course, that would have the downside that inside fzy, the fuzzy search would be performed on both languages, not only the source one...

I could implement a new flag --dump-words or something which would just print all translatable words so you could do rdictcc.rb --dump-words | fzy | rdictcc.rb. Would that work?

~xeras 5 months ago

Woops, I expressed myself wrongly. The alias is fine for terminal use, no need for extra work on your side there. I was referring to the emacs integration which could use ivy.

Performing the fuzzy search in both languages is actually intentional, and I just updated my alias to make that even more convenient: https://git.jfischer.org/xeruf/dotfiles/src/branch/main/.config/shell/functions#L311

~xeras 4 months ago

On that same vein: Calling "rdictcc-translate-word" with an empty string creates an unusable buffer, so this should definitely be interactive.

Register here or Log in to comment, or comment via email.