Ajatt-Tools / gd-tools

🍣 A set of tools to enhance GoldenDict.
https://tatsumoto.neocities.org/blog/setting-up-goldendict#gd-tools
GNU General Public License v3.0
35 stars 6 forks source link

Adds gd-mandarin #13

Closed KonstantinDjairo closed 1 year ago

KonstantinDjairo commented 1 year ago

This PR adds a modified version of gd-mecab, in fact it also uses mecab. image

The data used to compile the dictionary was taken from that repository, and it's worthy noticing that this repository doesn't contain instructions on how to use it without needing to specify the directory everytime.

So basically what i did was compiling a "userdic" file, along with some other files, and with some trial and error i got it working. The folder that is mentioned inside the code will be available as a tarball, since i dont know what really is needed to accomplish what i did by accident.

https://easyupload.io/b9ihtw Also, notice that it doesn't generate clickable words, which is weird, since it's hipothetically the same code as gd-mecab

tatsumoto-ren commented 1 year ago

https://easyupload.io/b9ihtw

I can't download the file, but if its contents are identical to the linked github repo, it can be added as a submodule instead.

mandarim

probably should be mandarin

KonstantinDjairo commented 1 year ago

it's no identical, you would have to compile it from the repo

and also, the link words fine to me

Bogozarnyj commented 1 year ago

GD-MANDARIN

gd-mandarin is a program for GoldenDict that uses the CC-CEDICT-MeCab dictionary to analyze and segment sentences and make the words clickable, just like the gd-mecab for Japanese.

Screenshot_20230828_200600

Download link (ready files for Unix): FreeMdict Cloud Be sure you have mecab installed before installing gd-mandarin.

Script: https://pastebin.com/L9W5BDWN

Unpack the .zip file and move the folder "gd-mandarin" to ~/.local Move the script "gd-mandarin.sh" to ~/.local/bin and make it executable (on Ubuntu you can run "sudo chmod +x ~/.local/bin/gd-mandarin.sh")

The way it is, it automatically converts the sentence to Traditional Chinese. If you want it to convert to Simplified Chinese instead, open the dicrc file in ~/.local/gd-mandarin and replace \<a href="bword:%f[5]">%f[5]\</a> for \<a href="bword:%f[6]">%f[6]\</a>. It should look like this:

node-format-gdmandarin = %f[6] unk-format-gdmandarin = %f[6] bos-format-gdmandarin = eos-format-gdmandarin = \n

If you would like to disable the conversion feature, replace \<a href="bword:%f[5]">%f[5]\</a> for \<a href="bword:%m">%m\</a>. It should look like this:

node-format-gdmandarin = %m unk-format-gdmandarin = %m bos-format-gdmandarin = eos-format-gdmandarin = \n

On GoldenDict, go to "Edit", "Dictionaries", "Programs", click on "Add" and select "HTML" as type. In the "Name" field, write gd-mandarin or the name you would like to be displayed for the analyzer. In the "Command Line" field, write:

gd-mandarin.sh --word %GDWORD% --font-size 25px --sentence %GDSEARCH%

KonstantinDjairo commented 1 year ago

first of all, thanks for fixing my terrible code, appreciate your effort! i'll make some changes and merge it. notice that mecab-cache will conflict with the current japanese version of mecab, we have to change that variable

tatsumoto-ren commented 1 year ago

The gd-mandarin.zip file isn't used in the code. Did you forget to extract it?