Group by sense
This commit is contained in:
parent
1253ab2912
commit
e171e81f27
24
edict.go
24
edict.go
@ -36,20 +36,19 @@ func convertEdictEntry(edictEntry jmdict.JmdictEntry) []termSource {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var entry termSource
|
var entryBase termSource
|
||||||
|
entryBase.addTags(reading.Information...)
|
||||||
|
entryBase.addTagsPri(reading.Priorities...)
|
||||||
|
|
||||||
if kanji == nil {
|
if kanji == nil {
|
||||||
entry.Expression = reading.Reading
|
entryBase.Expression = reading.Reading
|
||||||
} else {
|
} else {
|
||||||
entry.Expression = kanji.Expression
|
entryBase.Expression = kanji.Expression
|
||||||
entry.Reading = reading.Reading
|
entryBase.Reading = reading.Reading
|
||||||
|
entryBase.addTags(kanji.Information...)
|
||||||
entry.addTags(kanji.Information...)
|
entryBase.addTagsPri(kanji.Priorities...)
|
||||||
entry.addTagsPri(kanji.Priorities...)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.addTags(reading.Information...)
|
|
||||||
entry.addTagsPri(reading.Priorities...)
|
|
||||||
|
|
||||||
for _, sense := range edictEntry.Sense {
|
for _, sense := range edictEntry.Sense {
|
||||||
if hasString(reading.Reading, sense.RestrictedReadings) {
|
if hasString(reading.Reading, sense.RestrictedReadings) {
|
||||||
continue
|
continue
|
||||||
@ -59,6 +58,9 @@ func convertEdictEntry(edictEntry jmdict.JmdictEntry) []termSource {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entry := entryBase
|
||||||
|
entry.Tags = append(entry.Tags, entryBase.Tags...)
|
||||||
|
|
||||||
for _, glossary := range sense.Glossary {
|
for _, glossary := range sense.Glossary {
|
||||||
entry.Glossary = append(entry.Glossary, glossary.Content)
|
entry.Glossary = append(entry.Glossary, glossary.Content)
|
||||||
}
|
}
|
||||||
@ -67,10 +69,10 @@ func convertEdictEntry(edictEntry jmdict.JmdictEntry) []termSource {
|
|||||||
entry.addTags(sense.Fields...)
|
entry.addTags(sense.Fields...)
|
||||||
entry.addTags(sense.Misc...)
|
entry.addTags(sense.Misc...)
|
||||||
entry.addTags(sense.Dialects...)
|
entry.addTags(sense.Dialects...)
|
||||||
}
|
|
||||||
|
|
||||||
entries = append(entries, entry)
|
entries = append(entries, entry)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(edictEntry.Kanji) > 0 {
|
if len(edictEntry.Kanji) > 0 {
|
||||||
for _, kanji := range edictEntry.Kanji {
|
for _, kanji := range edictEntry.Kanji {
|
||||||
|
Loading…
Reference in New Issue
Block a user