From ef1e74447d51854826ee81be7d5a28783f16dff2 Mon Sep 17 00:00:00 2001 From: stephenmk Date: Mon, 23 Jan 2023 23:52:42 -0600 Subject: [PATCH] Include term tags and scores in standalone forms dictionary --- jmdictForms.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jmdictForms.go b/jmdictForms.go index 15b894d..def7f7a 100644 --- a/jmdictForms.go +++ b/jmdictForms.go @@ -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) }