1

Add script to build dictionaries

This commit is contained in:
Alex Yatskov 2021-01-01 17:18:22 -08:00
parent 16d75c71e2
commit 1172bc8b84
3 changed files with 42 additions and 1 deletions

3
scripts/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.gz
src
dst

38
scripts/build_dicts.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
go get github.com/FooSoft/yomichan-import/yomichan
mkdir -p src
mkdir -p dst
if [ ! -f src/JMdict ]; then
wget http://ftp.monash.edu/pub/nihongo/JMdict.gz
gunzip -c JMdict.gz > src/JMdict
fi
yomichan -language="dutch" -title="JMdict (Dutch)" src/JMdict dst/jmdict_dutch.zip
yomichan -language="english" -title="JMdict (English)" src/JMdict dst/jmdict_english.zip
yomichan -language="french" -title="JMdict (French)" src/JMdict dst/jmdict_french.zip
yomichan -language="german" -title="JMdict (German)" src/JMdict dst/jmdict_german.zip
yomichan -language="hungarian" -title="JMdict (Hungarian)" src/JMdict dst/jmdict_hungarian.zip
yomichan -language="russian" -title="JMdict (Russian)" src/JMdict dst/jmdict_russian.zip
yomichan -language="slovenian" -title="JMdict (Slovenian)" src/JMdict dst/jmdict_slovenian.zip
yomichan -language="spanish" -title="JMdict (Spanish)" src/JMdict dst/jmdict_spanish.zip
yomichan -language="swedish" -title="JMdict (Swedish)" src/JMdict dst/jmdict_swedish.zip
if [ ! -f src/JMnedict.xml ]; then
wget http://ftp.monash.edu/pub/nihongo/JMnedict.xml.gz
gunzip -c JMnedict.xml.gz > src/JMnedict.xml
fi
yomichan src/JMnedict.xml dst/jmnedict.zip
if [ ! -f src/kanjidic2.xml ]; then
wget http://www.edrdg.org/kanjidic/kanjidic2.xml.gz
gunzip -c kanjidic2.xml.gz > src/kanjidic2.xml
fi
yomichan -language="english" -title="KANJIDIC (English)" src/kanjidic2.xml dst/kanjidic_english.zip
yomichan -language="french" -title="KANJIDIC (French)" src/kanjidic2.xml dst/kanjidic_french.zip
yomichan -language="portuguese" -title="KANJIDIC (Portuguese)" src/kanjidic2.xml dst/kanjidic_portuguese.zip
yomichan -language="spanish" -title="KANJIDIC (Spanish)" src/kanjidic2.xml dst/kanjidic_spanish.zip

View File

@ -133,7 +133,7 @@ func main() {
if err == nil {
ui.MsgBox(window, "Success", "Conversion process complete!")
} else {
ui.MsgBox(window, "Error", fmt.Sprintf("Conversion process failed:\n%e", err))
ui.MsgBox(window, "Error", fmt.Sprintf("Conversion process failed: %s", err.Error()))
}
})
}()