Cleanup
This commit is contained in:
parent
b40f4a757f
commit
7177da9e1e
13
jmdict.go
13
jmdict.go
@ -301,16 +301,16 @@ func outputCharacterDictJson(writer io.Writer, characters []characterDictSource,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func convertKanjidicCharacter(kanjidicCharacter jmdict.KanjidicCharacter) characterDictSource {
|
func convertKanjidicCharacter(kanjidicCharacter jmdict.KanjidicCharacter) characterDictSource {
|
||||||
var character characterDictSource
|
character := characterDictSource{Character: kanjidicCharacter.Literal}
|
||||||
|
|
||||||
character.Character = kanjidicCharacter.Literal
|
if kanjidicCharacter.ReadingMeaning != nil {
|
||||||
for _, m := range kanjidicCharacter.ReadingMeaning.ReadingMeaning.Meanings {
|
for _, m := range kanjidicCharacter.ReadingMeaning.Meanings {
|
||||||
if m.Language == "en" || m.Language == "" {
|
if m.Language == "en" || m.Language == "" {
|
||||||
character.Meanings = append(character.Meanings, m.Meaning)
|
character.Meanings = append(character.Meanings, m.Meaning)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, r := range kanjidicCharacter.ReadingMeaning.ReadingMeaning.Readings {
|
for _, r := range kanjidicCharacter.ReadingMeaning.Readings {
|
||||||
switch r.Type {
|
switch r.Type {
|
||||||
case "ja_on":
|
case "ja_on":
|
||||||
character.Onyomi = append(character.Onyomi, r.Value)
|
character.Onyomi = append(character.Onyomi, r.Value)
|
||||||
@ -320,18 +320,19 @@ func convertKanjidicCharacter(kanjidicCharacter jmdict.KanjidicCharacter) charac
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return character
|
return character
|
||||||
}
|
}
|
||||||
|
|
||||||
func processKanjidic(writer io.Writer, reader io.Reader, flags int) error {
|
func processKanjidic(writer io.Writer, reader io.Reader, flags int) error {
|
||||||
kanjidicCharacters, err := jmdict.LoadKanjidic(reader)
|
kanjidic, err := jmdict.LoadKanjidic(reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var characters []characterDictSource
|
var characters []characterDictSource
|
||||||
for _, kanjidicCharacter := range kanjidicCharacters {
|
for _, kanjidicCharacter := range kanjidic.Characters {
|
||||||
characters = append(characters, convertKanjidicCharacter(kanjidicCharacter))
|
characters = append(characters, convertKanjidicCharacter(kanjidicCharacter))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user