fix sense tags for jmdict
This commit is contained in:
parent
5f8b673e99
commit
005e00ee7f
11
edict.go
11
edict.go
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user