1

Use empty interface type for dictionary glossaries

Necesssary for structured content support
This commit is contained in:
stephenmk 2023-01-22 14:14:33 -06:00
parent 9222417bfd
commit 853d0b33dc
No known key found for this signature in database
GPG Key ID: B6DA730DB06235F1
10 changed files with 19 additions and 17 deletions

View File

@ -21,7 +21,7 @@ const (
const databaseFormat = 3
type dbRecord []interface{}
type dbRecord []any
type dbRecordList []dbRecord
type dbTag struct {
@ -46,7 +46,7 @@ func (meta dbTagList) crush() dbRecordList {
type dbMeta struct {
Expression string
Mode string
Data interface{}
Data any
}
type dbMetaList []dbMeta
@ -66,7 +66,7 @@ type dbTerm struct {
DefinitionTags []string
Rules []string
Score int
Glossary []string
Glossary []any
Sequence int
TermTags []string
}

View File

@ -65,7 +65,7 @@ func (e *daijirinExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
for _, reading := range readings {
term := dbTerm{
Expression: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}
@ -79,7 +79,7 @@ func (e *daijirinExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
term := dbTerm{
Expression: expression,
Reading: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}

View File

@ -70,7 +70,7 @@ func (e *daijisenExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
if len(expressions) == 0 {
term := dbTerm{
Expression: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}
@ -82,7 +82,7 @@ func (e *daijisenExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
term := dbTerm{
Expression: expression,
Reading: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}

View File

@ -53,7 +53,9 @@ func jmnedictExtractTerms(enamdictEntry jmdict.JmnedictEntry) []dbTerm {
}
for _, trans := range enamdictEntry.Translations {
term.Glossary = append(term.Glossary, trans.Translations...)
for _, translation := range trans.Translations {
term.Glossary = append(term.Glossary, translation)
}
term.addDefinitionTags(trans.NameTypes...)
}

View File

@ -90,7 +90,7 @@ func (e *gakkenExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbTe
for _, reading := range readings {
term := dbTerm{
Expression: reading,
Glossary: []string{entryText},
Glossary: []any{entryText},
Sequence: sequence,
}
@ -107,7 +107,7 @@ func (e *gakkenExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbTe
term := dbTerm{
Expression: expression,
Reading: reading,
Glossary: []string{entryText},
Glossary: []any{entryText},
Sequence: sequence,
}

View File

@ -72,7 +72,7 @@ func (e *kotowazaExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
term := dbTerm{
Expression: expression,
Reading: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}

View File

@ -75,7 +75,7 @@ func (e *koujienExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbT
for _, reading := range readings {
term := dbTerm{
Expression: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}
@ -89,7 +89,7 @@ func (e *koujienExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbT
term := dbTerm{
Expression: expression,
Reading: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}

View File

@ -106,7 +106,7 @@ func (e *meikyouExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbT
for _, reading := range readings {
term := dbTerm{
Expression: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}
@ -120,7 +120,7 @@ func (e *meikyouExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbT
term := dbTerm{
Expression: expression,
Reading: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}

View File

@ -93,7 +93,7 @@ func (e *shougakukan2Extractor) extractTerms(entry zig.BookEntry, sequence int)
terms = append(terms, dbTerm{
Expression: expression,
Reading: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
})
}

View File

@ -74,7 +74,7 @@ func (e *wadaiExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbTer
term := dbTerm{
Expression: expression,
Reading: reading,
Glossary: []string{entry.Text},
Glossary: []any{entry.Text},
Sequence: sequence,
}