Compare commits

4 Commits

Author SHA1 Message Date
lingdong huang
d4924ce860 readme 2020-08-06 19:59:33 -04:00
lingdong huang
10d9d1b491 readme 2020-08-06 19:58:56 -04:00
lingdong huang
b9d641ac96 readme 2020-08-06 19:57:29 -04:00
lingdong huang
e104d0df1b readme 2020-08-06 14:06:55 -04:00

View File

@@ -1,7 +1,8 @@
# zdic-cli # zdic-cli
An alternative, offline, regex-supporting, command-line interface to [zdic (漢典)](https://zdic.net), featuring: An alternative, offline, regex-supporting, command-line interface to [zdic (漢典)](https://zdic.net), a comprehensive Chinese language dictionary, featuring:
- More than 460,000 entries
- No internet connection required - No internet connection required
- Full text search with regex: a command for finding characters/phrases in body text of definitions. - Full text search with regex: a command for finding characters/phrases in body text of definitions.
- Colorful text for highlighting entries - Colorful text for highlighting entries
@@ -47,13 +48,13 @@ sel n display entry at previously returned list index n
This repo does not contain the dictionary files themselves as they're too large. Instead, a shell script (`setup.sh`) is provided to automate the process: This repo does not contain the dictionary files themselves as they're too large. Instead, a shell script (`setup.sh`) is provided to automate the process:
- Automatically download the original Kindle dictionary format (.PRC) from the internet. The download link hardcoded in `setup.sh` might fail in the future, in which case a google search for `汉典.prc` should yield alternative resources. - Automatically download the original Kindle dictionary format (.PRC) from the internet. The download link hardcoded in `setup.sh` might fail in the future, in which case a google search for `汉典.prc` should yield alternative resources.
- Automatically download a python library (kroo/mobi-python) for parsing mobi files. A rather old library and have some oddities, a find-and-replace script will be automatically run to patch some glitches in the source code :P - Automatically download a python library ([kroo/mobi-python](https://github.com/kroo/mobi-python)) for parsing mobi files. A rather old library and have some oddities, so a find-and-replace script will be automatically run to patch some glitches in the source code :P
- `python/to_txt.py` is run to extract a raw `txt` file from the kindle format `prc`. - `python/to_txt.py` is run to extract a raw `txt` file from the kindle format `prc`.
- `phthon/to_json.py` is run to generate a directory of `json` files from the `txt` to make lookup and formatting more efficient. - `phthon/to_json.py` is run to generate a directory of `json` files from the `txt` to make lookup and formatting more efficient.
Run the shell script with: Run the shell script with:
``` ```bash
sh setup.sh sh setup.sh
``` ```
@@ -63,22 +64,22 @@ At this point you'll have `zdic.prc`, `zdic.txt` and directory `zdic_json/`. Onl
At this point you can also run the software by simply doing: At this point you can also run the software by simply doing:
``` ```bash
node index.js node index.js
``` ```
You can also package it into a binary using You can also package it into a binary using
``` ```bash
pkg . pkg .
``` ```
provided you have the node and pkg dependencies installed. provided you have the node and pkg dependencies installed.
Tip: to run the software by typing `zdic` anywhere, you can symlink it to `/user/bin`, e.g. Tip: to run the software by typing `zdic` anywhere, you can symlink it to `/usr/bin` or `/usr/local/bin`, e.g.
``` ```bash
ln -s /user/bin/zdic path/to/zdic-cli/zdic-cli ln -s path/to/zdic-cli/zdic-cli /usr/local/bin/zdic
``` ```
## Disclaimers ## Disclaimers