edict: fix PartsOfSpeech and Misc
This commit is contained in:
parent
c6c50ce5c5
commit
28bd180afa
19
edict.go
19
edict.go
@ -131,6 +131,7 @@ func jmdictExtractTerms(edictEntry jmdict.JmdictEntry, language string) []dbTerm
|
|||||||
}
|
}
|
||||||
|
|
||||||
var partsOfSpeech []string
|
var partsOfSpeech []string
|
||||||
|
var misc []string
|
||||||
for index, sense := range edictEntry.Sense {
|
for index, sense := range edictEntry.Sense {
|
||||||
if sense.RestrictedReadings != nil && !hasString(reading.Reading, sense.RestrictedReadings) {
|
if sense.RestrictedReadings != nil && !hasString(reading.Reading, sense.RestrictedReadings) {
|
||||||
continue
|
continue
|
||||||
@ -157,19 +158,21 @@ func jmdictExtractTerms(edictEntry jmdict.JmdictEntry, language string) []dbTerm
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(sense.PartsOfSpeech) != 0 {
|
||||||
|
partsOfSpeech = sense.PartsOfSpeech
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(sense.Misc) != 0 {
|
||||||
|
misc = sense.Misc
|
||||||
|
}
|
||||||
|
|
||||||
term.addTags(termBase.Tags...)
|
term.addTags(termBase.Tags...)
|
||||||
term.addTermTags(termBase.TermTags...)
|
term.addTermTags(termBase.TermTags...)
|
||||||
term.addTags(sense.PartsOfSpeech...)
|
term.addTags(partsOfSpeech...)
|
||||||
term.addTags(sense.Fields...)
|
term.addTags(sense.Fields...)
|
||||||
term.addTags(sense.Misc...)
|
term.addTags(misc...)
|
||||||
term.addTags(sense.Dialects...)
|
term.addTags(sense.Dialects...)
|
||||||
|
|
||||||
if index == 0 {
|
|
||||||
partsOfSpeech = sense.PartsOfSpeech
|
|
||||||
} else {
|
|
||||||
term.addTags(partsOfSpeech...)
|
|
||||||
}
|
|
||||||
|
|
||||||
jmdictBuildRules(&term)
|
jmdictBuildRules(&term)
|
||||||
jmdictBuildScore(&term)
|
jmdictBuildScore(&term)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user