gd-tools/README.md

202 lines
6.3 KiB
Markdown
Raw Permalink Normal View History

2024-02-04 18:24:04 +00:00
# GoldenDict tools
2024-02-04 18:11:05 +00:00
2024-02-04 18:24:04 +00:00
A set of helpful programs to enhance goldendict for immersion learning.
2024-02-06 22:49:52 +00:00
This is a fork from the original program made by tatsumoto
# Some significant features of this fork
- replace libfmt by a native function, making it 3x faster than the original version
- a sane build system using cmake
2024-02-07 15:23:29 +00:00
- system-agnostic, means it can even run on [windows](https://www.mediafire.com/file/h1v7owj7np9j7wg/gd-tools_windows.zip/file)
2024-02-06 22:49:52 +00:00
2024-02-04 18:24:04 +00:00
## Table of Contents
- [Installation](#installation)
- [gd-marisa](#gd-marisa)
- [gd-mecab](#gd-mecab)
- [gd-images](#gd-images)
- [gd-strokeorder](#gd-strokeorder)
- [gd-handwritten](#gd-handwritten)
- [gd-massif](#gd-massif)
- [gd-ankisearch](#gd-ankisearch)
## Installation
First, [install goldendict-ng](https://tatsumoto-ren.github.io/blog/setting-up-goldendict.html).
2024-02-06 22:49:52 +00:00
### Gnu Guix
2024-02-19 14:11:23 +00:00
gd-tools is available in our [channel](https://codeberg.org/hashirama/ajattix)
2024-02-04 18:24:04 +00:00
2024-02-20 23:10:53 +00:00
![gd-tools in guix](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/guix.png)
2024-02-14 13:10:03 +00:00
### Microsoft Windows
2024-06-08 03:45:44 +00:00
Download the latest ![installer](https://www.mediafire.com/file/h1v7owj7np9j7wg/gd-tools_windows.zip/file)
2024-02-14 13:10:03 +00:00
### Apple Mac
2024-02-14 13:13:42 +00:00
Refer to [Build on Mac](BUILDING.md) in Build Instructions
2024-02-14 13:10:03 +00:00
2024-02-06 22:49:52 +00:00
### Other Unix systems
2024-02-04 18:24:04 +00:00
2024-02-14 13:10:03 +00:00
[Build instructions](BUILDING.md)
2024-02-04 18:24:04 +00:00
## Setup
Open GoldenDict, press "Edit" > "Dictionaries" > "Programs" and add the installed executables.
Set type to `html`.
2024-02-07 17:36:37 +00:00
Command Line: `gd-tools <name of the program> --word %GDWORD% --sentence %GDSEARCH%`.
2024-02-07 17:34:02 +00:00
Optionally add arguments, such as: `gd-tools marisa --word %GDWORD% --sentence %GDSEARCH% `.
2024-02-04 18:24:04 +00:00
These programs are treated as dictionaries and you can add them under "Dictionaries" or "Groups".
## gd-marisa
This script outputs the sentence with clickable characters
and searches for the longest available dictionary entry
(from a predefined list) beginning at that character.
2024-03-17 00:02:57 +00:00
For deinflection it currently relies on [rdricpp](https://codeberg.org/hashirama/rdricpp).
2024-02-04 18:24:04 +00:00
It also provides links of available entries of smaller substrings.
2024-03-17 00:27:21 +00:00
![Alt](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/marisa.gif)
2024-02-04 18:24:04 +00:00
**Usage**
```
2024-02-07 17:32:04 +00:00
gd-tools marisa --word %GDWORD% --sentence %GDSEARCH%
2024-02-04 18:24:04 +00:00
```
The path to the `.dic` is an optional argument and defaults to `/usr/share/gd-tools/marisa_words.dic`
**Dependencies**
[marisa-trie](https://github.com/s-yata/marisa-trie).
The official Arch Linux package is called [marisa](https://archlinux.org/packages/community/x86_64/marisa/),
but it's already a dependency of goldendict.
**Building an own index from a set of words**
If you would like to make changes to found words,
you can also create an own index from a newline-separated list of words (here called `keyset.txt`):
```
marisa-build < keyset.txt > keyset.dic
```
More information at https://www.s-yata.jp/marisa-trie/docs/readme.en.html
2024-03-20 17:39:33 +00:00
## Creating Anime Cards with gd-tools & mpvacious
![showcase](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/screencast.gif)
> [full instruction here.](https://codeberg.org/hashirama/gd-tools/src/branch/main/docs/mpvacious.md)
2024-02-07 17:32:04 +00:00
## gd-ankisearch
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
This script searches Anki cards in your collection that contain %GDWORD%.
2024-02-04 18:24:04 +00:00
2024-03-17 00:27:21 +00:00
![screenshot](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/anki_search.png)
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
**Arguments:**
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
* `--field-name` `NAME` optional field to limit search to.
* `--deck-name` `NAME` optional deck to limit search to.
* `--show-fields` `VocabKanji,SentKanji` optional comma-separated list of fields to show.
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
**Example invocation:**
2024-02-04 18:24:04 +00:00
```
2024-02-07 17:32:04 +00:00
gd-tools ankisearch --field-name VocabKanji --show-fields VocabKanji,SentKanji,Image,SentAudio --word %GDWORD%
2024-02-04 18:24:04 +00:00
```
## gd-images
This script shows the top 5 pictures from Bing images for the given search string.
2024-03-17 00:27:21 +00:00
![image](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/gd-images.png)
2024-02-04 18:24:04 +00:00
## gd-strokeorder
This script shows the search string in the `KanjiStrokeOrders` font.
2024-03-17 00:27:21 +00:00
![screenshot](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/strokeorder.png)
2024-02-04 18:24:04 +00:00
Font source: https://www.nihilist.org.uk/
**Arguments**:
* `--max-len` `5` maximum size of the input string.
* `--font-size` `10rem` font size. It has to be large in order to see the stroke numbers.
**How to call**:
```
2024-02-07 17:32:04 +00:00
gd-tools strokeorder --word %GDWORD%
2024-02-04 18:24:04 +00:00
```
## gd-handwritten
This script displays the handwritten form of each character
2024-03-17 00:27:21 +00:00
![screenshot](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/handwritten.png)
2024-02-04 18:24:04 +00:00
Font source: [ArmedLemon](https://github.com/Ajatt-Tools/gd-tools/blob/main/res/ArmedLemon.ttf).
**How to call**:
```
2024-02-07 17:32:04 +00:00
gd-tools handwritten --word %GDWORD%
2024-02-04 18:24:04 +00:00
```
## gd-massif
This script shows example sentences from https://massif.la/
2024-03-17 00:27:21 +00:00
![image](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/massiff.png)
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
## gd-mandarin
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
This script passes a sentence through mecab in order to make every part of the sentence clickable.
It also automatically converts the sentence to traditional characters.
2024-02-04 18:24:04 +00:00
2024-03-17 00:27:21 +00:00
![image](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/mandarin.png)
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
To use `gd-mandarin`,
you need to install `gd-tools` by running `./quickinstall.sh --mandarin`.
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
## gd-mecab
2024-02-04 18:24:04 +00:00
This script passes a sentence through mecab in order to make every part of the sentence clickable.
![Alt](https://codeberg.org/hashirama/gd-tools/raw/branch/main/misc/mecab.gif)
2024-02-04 18:24:04 +00:00
2024-02-07 17:32:04 +00:00
**Dependencies**
This script requires [MeCab](https://taku910.github.io/mecab/) and the IPA dictionary to be installed.
If you are on an Arch Linux system you can simply install the AUR package `mecab-ipa` to obtain both.
**Command format**
Add this script to GoldenDict under "Dictionaries" > "Programs" (format HTML), like this:
```
gd-tools mecab --word %GDWORD% --sentence %GDSEARCH%
```
**Optional arguments**
* `--font-size SIZE` the font size to be used, e.g. `30px`.
* `--user-dict FILE` full path to the user_dic.dic file. This is done automatically if you install via make.
2024-02-07 21:57:28 +00:00
OBS: we stopped maintaining gd-mecab in favor of gd-marisa, which is a better replacement
2024-02-15 17:45:29 +00:00
### Contributors
2024-02-07 21:57:28 +00:00
2024-03-17 03:56:52 +00:00
<!-- contributors --><a href="https://codeberg.org/hashirama"><img src="https://codeberg.org/avatars/cc776cef25c95b3e4c031cd4459b06be7f099a518dc60f4168dec79041eb3f71?size=512" width="60px" alt="" /></a>
2024-02-15 17:45:29 +00:00
<a href="https://codeberg.org/xieamoe"><img src="https://codeberg.org/avatars/4cc3d9e9934291c6d21ffbfb433d9c95c87d27bf2aa1f79f2ec0291a10ab1778?size=512" width="60px" alt="" /></a><!-- contributors -->