1
This commit is contained in:
Alex Yatskov 2016-08-10 23:17:53 -07:00
parent e84763a8a6
commit 98615708ca
4 changed files with 8 additions and 8 deletions

View File

@ -87,7 +87,7 @@ func convertEdictEntry(edictEntry jmdict.JmdictEntry) []vocabSource {
return entries return entries
} }
func processEdict(writer io.Writer, reader io.Reader, flags int) error { func outputEdictJson(writer io.Writer, reader io.Reader, flags int) error {
dict, entities, err := jmdict.LoadJmdictNoTransform(reader) dict, entities, err := jmdict.LoadJmdictNoTransform(reader)
if err != nil { if err != nil {
return err return err

View File

@ -73,7 +73,7 @@ func convertJmnedictEntry(enamdictEntry jmdict.JmnedictEntry) []vocabSource {
return entries return entries
} }
func processJmnedict(writer io.Writer, reader io.Reader, flags int) error { func outputJmnedictJson(writer io.Writer, reader io.Reader, flags int) error {
dict, entities, err := jmdict.LoadJmnedictNoTransform(reader) dict, entities, err := jmdict.LoadJmnedictNoTransform(reader)
if err != nil { if err != nil {
return err return err

View File

@ -139,7 +139,7 @@ func convertKanjidicCharacter(kanjidicCharacter jmdict.KanjidicCharacter) kanjiS
return character return character
} }
func processKanjidic(writer io.Writer, reader io.Reader, flags int) error { func outputKanjidicJson(writer io.Writer, reader io.Reader, flags int) error {
dict, err := jmdict.LoadKanjidic(reader) dict, err := jmdict.LoadKanjidic(reader)
if err != nil { if err != nil {
return err return err

10
main.go
View File

@ -42,11 +42,11 @@ func usage() {
flag.PrintDefaults() flag.PrintDefaults()
} }
func process(fileFormat, inputFile, outputFile string, flags int) error { func outputJson(fileFormat, inputFile, outputFile string, flags int) error {
handlers := map[string]func(io.Writer, io.Reader, int) error{ handlers := map[string]func(io.Writer, io.Reader, int) error{
"edict": processEdict, "edict": outputEdictJson,
"enamdict": processJmnedict, "enamdict": outputJmnedictJson,
"kanjidic": processKanjidic, "kanjidic": outputKanjidicJson,
} }
handler, ok := handlers[fileFormat] handler, ok := handlers[fileFormat]
@ -79,7 +79,7 @@ func main() {
} }
if flag.NArg() == 3 { if flag.NArg() == 3 {
if err := process(flag.Arg(0), flag.Arg(1), flag.Arg(2), flags); err != nil { if err := outputJson(flag.Arg(0), flag.Arg(1), flag.Arg(2), flags); err != nil {
log.Fatal(err) log.Fatal(err)
} }
} else { } else {