Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds gd-mandarin #13

Merged
merged 12 commits into from
Aug 31, 2023
Merged

Adds gd-mandarin #13

merged 12 commits into from
Aug 31, 2023

Conversation

KonstantinDjairo
Copy link
Contributor

@KonstantinDjairo KonstantinDjairo commented Aug 11, 2023

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
Copy link
Member

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
Copy link
Contributor Author

KonstantinDjairo commented Aug 12, 2023

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

and also, the link words fine to me

@Bogozarnyj
Copy link

Bogozarnyj commented Aug 28, 2023

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
Copy link
Contributor Author

KonstantinDjairo commented Aug 29, 2023

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
Copy link
Member

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

@KonstantinDjairo KonstantinDjairo changed the title Adds gd-mandarim Adds gd-mandarin Aug 29, 2023
@tatsumoto-ren tatsumoto-ren merged commit f898593 into Ajatt-Tools:main Aug 31, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants