1

fix sense tags for jmdict

This commit is contained in:
Alex Yatskov 2017-02-19 14:38:10 -08:00
parent 5f8b673e99
commit 005e00ee7f

View File

@ -29,7 +29,7 @@ import (
"github.com/FooSoft/jmdict"
)
const JMDICT_REVISION = "jmdict1"
const JMDICT_REVISION = "jmdict2"
func jmdictBuildRules(term *dbTerm) {
for _, tag := range term.Tags {
@ -123,7 +123,8 @@ func jmdictExtractTerms(edictEntry jmdict.JmdictEntry) []dbTerm {
}
}
for _, sense := range edictEntry.Sense {
var partsOfSpeech []string
for index, sense := range edictEntry.Sense {
if sense.RestrictedReadings != nil && !hasString(reading.Reading, sense.RestrictedReadings) {
continue
}
@ -139,6 +140,12 @@ func jmdictExtractTerms(edictEntry jmdict.JmdictEntry) []dbTerm {
term.addTags(sense.Misc...)
term.addTags(sense.Dialects...)
if index == 0 {
partsOfSpeech = sense.PartsOfSpeech
} else {
term.addTags(partsOfSpeech...)
}
for _, glossary := range sense.Glossary {
term.Glossary = append(term.Glossary, glossary.Content)
}