1

Group by sense

This commit is contained in:
Alex Yatskov 2016-09-18 11:36:54 -07:00
parent 1253ab2912
commit e171e81f27

View File

@ -36,20 +36,19 @@ func convertEdictEntry(edictEntry jmdict.JmdictEntry) []termSource {
return
}
var entry termSource
var entryBase termSource
entryBase.addTags(reading.Information...)
entryBase.addTagsPri(reading.Priorities...)
if kanji == nil {
entry.Expression = reading.Reading
entryBase.Expression = reading.Reading
} else {
entry.Expression = kanji.Expression
entry.Reading = reading.Reading
entry.addTags(kanji.Information...)
entry.addTagsPri(kanji.Priorities...)
entryBase.Expression = kanji.Expression
entryBase.Reading = reading.Reading
entryBase.addTags(kanji.Information...)
entryBase.addTagsPri(kanji.Priorities...)
}
entry.addTags(reading.Information...)
entry.addTagsPri(reading.Priorities...)
for _, sense := range edictEntry.Sense {
if hasString(reading.Reading, sense.RestrictedReadings) {
continue
@ -59,6 +58,9 @@ func convertEdictEntry(edictEntry jmdict.JmdictEntry) []termSource {
continue
}
entry := entryBase
entry.Tags = append(entry.Tags, entryBase.Tags...)
for _, glossary := range sense.Glossary {
entry.Glossary = append(entry.Glossary, glossary.Content)
}
@ -67,10 +69,10 @@ func convertEdictEntry(edictEntry jmdict.JmdictEntry) []termSource {
entry.addTags(sense.Fields...)
entry.addTags(sense.Misc...)
entry.addTags(sense.Dialects...)
}
entries = append(entries, entry)
}
}
if len(edictEntry.Kanji) > 0 {
for _, kanji := range edictEntry.Kanji {