1

Include term tags and scores in standalone forms dictionary

This commit is contained in:
stephenmk 2023-01-23 23:52:42 -06:00
parent d606f729cf
commit ef1e74447d
No known key found for this signature in database
GPG Key ID: B6DA730DB06235F1

View File

@ -81,7 +81,7 @@ func (h *headword) KanjiForm() string {
}
}
func jmdNeedsFormTable(headwords []headword) bool {
func needsFormTable(headwords []headword) bool {
// Does the entry contain more than 1 distinct reading?
// E.g. バカがい and ばかがい are not distinct.
uniqueReading := ""
@ -186,7 +186,7 @@ func formsGlossary(headwords []headword) []any {
func baseFormsTerm(entry jmdict.JmdictEntry) dbTerm {
term := dbTerm{Sequence: entry.Sequence}
headwords := extractHeadwords(entry)
if jmdNeedsFormTable(headwords) {
if needsFormTable(headwords) {
term.Glossary = formsTableGlossary(headwords)
} else {
term.Glossary = formsGlossary(headwords)
@ -224,6 +224,8 @@ func formsExportDb(inputPath, outputPath, languageName, title string, stride int
term = baseTerm
term.Expression = h.Expression
term.Reading = h.Reading
term.addTermTags(h.TermTags...)
term.Score = calculateTermScore(0, h)
}
terms = append(terms, term)
}