From a26f850c2372718d2b69d6b258d686c68ddba5ff Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sat, 20 Apr 2024 21:07:51 +0200 Subject: ref: Better doc and makefile It adds README explaining how to compile and install. Makefile allows to install dict system wide. --- README.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 README.md (limited to 'README.md') diff --git a/README.md b/README.md new file mode 100644 index 0000000..f5faf7d --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# Iterative dictionary + +The goal is to provide a frictionless dictionary searching experience: you type +and the words show up on your prompt. Not need to wait a http request to go +through. + +As of right now, dict just provides a thin layer on top of sqlite's fts5[^1] +virtual table with support of spellfix[^2] for word suggestion. + +The whole database is loaded in memory for faster search and import process, +which means that this application will consume substantial amounts of memory. +On DE-EN dictionary, for example, it uses ~300MB, more then dict.cc tab on +firefox (but less the most electron application out there) + +# Compiling + +You will need go, gcc and sqlite-dev, then you can just run + +```sh +make +``` + +For development you can run: + +```sh +make run # run the ui with default values +make import # run the importer with default values +make version # run the version command +``` + +# Installing + +To install locally you may run: + +```sh +PREFIX=$(HOME)/.local make install +``` + +Or for a system wide istall: + +```sh +sudo make install +``` + +# Usage + +To run the importer you will need to download dict.cc dictionary. +First go to its request page[^3] and select your dictionary of choice. +Once you download and unzip run the following command: + +```sh +dict import --input dict.txt --output main.dict +``` + +Once the import process is complete[4] you can run the ui. + +```sh +dict ui --database main.dict +``` + +# TODO + +- On disk operation: to reduce memory footprint we can read from the disk. We + would need to remove the instance response, since that is not possible + reading from the disk. +- Better coloring on the list. +- Better default path for sqlite database making use of XDG variables. +- [optional] Multi dictionary support. Support more than one dict at once. +- Async response. Even though in memory is fast enough most often it can have + some hiccups with 2 letter queries. +- Finish server +- Alpine package + + +[^1]: https://sqlite.org/fts5.html +[^2]: https://www.sqlite.org/spellfix1.html +[^3]: https://www1.dict.cc/translation_file_request.php +[4]: It may take some time depending the size of the dictionary you selected -- cgit v1.2.3