gd-tools/README.md
2024-03-17 00:21:40 +00:00

6.1 KiB

GoldenDict tools

A set of helpful programs to enhance goldendict for immersion learning.

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
  • system-agnostic, means it can even run on windows

Table of Contents

Installation

First, install goldendict-ng.

Gnu Guix

gd-tools is available in our channel

gd-tools in guix

Microsoft Windows

Refer to Build on MinGW in Build Instructions

Apple Mac

Refer to Build on Mac in Build Instructions

Other Unix systems

Build instructions

Setup

Open GoldenDict, press "Edit" > "Dictionaries" > "Programs" and add the installed executables. Set type to html. Command Line: gd-tools <name of the program> --word %GDWORD% --sentence %GDSEARCH%. Optionally add arguments, such as: gd-tools marisa --word %GDWORD% --sentence %GDSEARCH% . 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. For deinflection it currently relies on rdricpp. It also provides links of available entries of smaller substrings.

Alt

Usage

gd-tools marisa --word %GDWORD% --sentence %GDSEARCH% 

The path to the .dic is an optional argument and defaults to /usr/share/gd-tools/marisa_words.dic

Dependencies

marisa-trie. The official Arch Linux package is called 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

gd-ankisearch

This script searches Anki cards in your collection that contain %GDWORD%.

screenshot

Arguments:

  • --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.

Example invocation:

gd-tools ankisearch --field-name VocabKanji --show-fields VocabKanji,SentKanji,Image,SentAudio --word %GDWORD%

gd-images

This script shows the top 5 pictures from Bing images for the given search string.

image

gd-strokeorder

This script shows the search string in the KanjiStrokeOrders font.

screenshot

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:

gd-tools strokeorder --word %GDWORD%

gd-handwritten

This script displays the handwritten form of each character

screenshot

Font source: ArmedLemon.

How to call:

gd-tools handwritten --word %GDWORD%

gd-massif

This script shows example sentences from https://massif.la/

image

gd-mandarin

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.

image

To use gd-mandarin, you need to install gd-tools by running ./quickinstall.sh --mandarin.

gd-mecab

This script passes a sentence through mecab in order to make every part of the sentence clickable.

https://user-images.githubusercontent.com/50422430/226139459-0c8bcf0e-e68f-491e-8171-bae3f50a7ae1.mp4

Dependencies

This script requires 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.

Contributors