From 0bb86509345cc6999bfe00490693322d8b755a25 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Fri, 4 Nov 2016 09:10:45 -0700 Subject: [PATCH] WIP --- termmeta.go | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/termmeta.go b/termmeta.go index 51eba18..8107c4a 100644 --- a/termmeta.go +++ b/termmeta.go @@ -189,22 +189,16 @@ func extractEdictTermMeta(edictEntry jmdict.JmdictEntry) []termMetaEntry { } func outputTermMetaJson(dir string, reader io.Reader, flags int) error { - // dict, entities, err := jmdict.LoadJmdictNoTransform(reader) - // if err != nil { - // return err - // } + dict, entities, err := jmdict.LoadJmdictNoTransform(reader) + if err != nil { + return err + } - // meta := make(map[string][]string) - // for _, entry := range dict.Entries { - // } + var entries []termMetaEntry + for _, jmdictEntry := range dict.Entries { + entries = append(entries, extractEdictTermMeta(jmdictEntry)...) + } - // var entries []termMetaEntry - // for _, entry := range dict.Entries { - // // defs = append(defs, convertEdictEntry(e)...) - // } - - // index := newTermMetaIndex(entries, entities) - // return index.output(dir, flags&flagPrettyJson == flagPrettyJson) - - return nil + index := newTermMetaIndex(entries, entities) + return index.output(dir, flags&flagPrettyJson == flagPrettyJson) }