1
This commit is contained in:
Alex Yatskov 2017-09-10 13:37:40 -07:00
parent 532838764b
commit 2017635e01
4 changed files with 15 additions and 16 deletions

2
gui.go
View File

@ -136,7 +136,7 @@ func gui() error {
}
})
success = exportDb(inputPath, outputPath, format, language, title, DEFAULT_STRIDE, false) == nil
success = exportDb(inputPath, outputPath, format, language, title, defaultStride, false) == nil
}()
})

View File

@ -116,6 +116,10 @@ func kanjidicExportDb(inputPath, outputPath, language, title string, stride int,
}
}
if title == "" {
title = "KANJIDIC2"
}
tags := dbTagList{
dbTag{Name: "jouyou", Notes: "included in list of regular-use characters", Category: "frequent", Order: -5},
dbTag{Name: "jinmeiyou", Notes: "included in list of characters for use in personal names", Category: "frequent", Order: -5},
@ -125,10 +129,6 @@ func kanjidicExportDb(inputPath, outputPath, language, title string, stride int,
dbTag{Name: "heisig", Notes: "frame number in Remembering the Kanji"},
}
if title == "" {
title = "KANJIDIC2"
}
recordData := map[string]dbRecordList{
"kanji": kanji.crush(),
"tags": tags.crush(),

15
main.go
View File

@ -34,9 +34,8 @@ import (
)
const (
DEFAULT_STRIDE = 10000
DEFAULT_PORT = 9876
DEFAULT_LANGUAGE = "english"
defaultStride = 10000
defaultLanguage = "english"
)
func usage() {
@ -77,9 +76,9 @@ func makeTmpDir() (string, error) {
func main() {
var (
format = flag.String("format", "", "dictionary format [edict|enamdict|epwing|kanjidic|rikai]")
language = flag.String("language", DEFAULT_LANGUAGE, "dictionary language (if supported)")
language = flag.String("language", defaultLanguage, "dictionary language (if supported)")
title = flag.String("title", "", "dictionary title")
stride = flag.Int("stride", DEFAULT_STRIDE, "dictionary bank stride")
stride = flag.Int("stride", defaultStride, "dictionary bank stride")
pretty = flag.Bool("pretty", false, "output prettified dictionary JSON")
)
@ -89,10 +88,10 @@ func main() {
if flag.NArg() != 2 {
if err := gui(); err == nil {
return
} else {
usage()
os.Exit(2)
}
usage()
os.Exit(2)
}
var (

View File

@ -57,11 +57,11 @@ func rikaiBuildScore(term *dbTerm) {
for _, tag := range term.Tags {
switch tag {
case "news", "ichi", "spec", "gai":
term.Score += 1
term.Score++
case "arch", "iK":
term.Score--
case "P":
term.Score += 5
case "arch", "iK":
term.Score -= 1
}
}
}