Use empty interface type for dictionary glossaries
Necesssary for structured content support
This commit is contained in:
parent
9222417bfd
commit
853d0b33dc
@ -21,7 +21,7 @@ const (
|
|||||||
|
|
||||||
const databaseFormat = 3
|
const databaseFormat = 3
|
||||||
|
|
||||||
type dbRecord []interface{}
|
type dbRecord []any
|
||||||
type dbRecordList []dbRecord
|
type dbRecordList []dbRecord
|
||||||
|
|
||||||
type dbTag struct {
|
type dbTag struct {
|
||||||
@ -46,7 +46,7 @@ func (meta dbTagList) crush() dbRecordList {
|
|||||||
type dbMeta struct {
|
type dbMeta struct {
|
||||||
Expression string
|
Expression string
|
||||||
Mode string
|
Mode string
|
||||||
Data interface{}
|
Data any
|
||||||
}
|
}
|
||||||
|
|
||||||
type dbMetaList []dbMeta
|
type dbMetaList []dbMeta
|
||||||
@ -66,7 +66,7 @@ type dbTerm struct {
|
|||||||
DefinitionTags []string
|
DefinitionTags []string
|
||||||
Rules []string
|
Rules []string
|
||||||
Score int
|
Score int
|
||||||
Glossary []string
|
Glossary []any
|
||||||
Sequence int
|
Sequence int
|
||||||
TermTags []string
|
TermTags []string
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ func (e *daijirinExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
|
|||||||
for _, reading := range readings {
|
for _, reading := range readings {
|
||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: reading,
|
Expression: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ func (e *daijirinExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
|
|||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: expression,
|
Expression: expression,
|
||||||
Reading: reading,
|
Reading: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ func (e *daijisenExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
|
|||||||
if len(expressions) == 0 {
|
if len(expressions) == 0 {
|
||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: reading,
|
Expression: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ func (e *daijisenExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
|
|||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: expression,
|
Expression: expression,
|
||||||
Reading: reading,
|
Reading: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,9 @@ func jmnedictExtractTerms(enamdictEntry jmdict.JmnedictEntry) []dbTerm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, trans := range enamdictEntry.Translations {
|
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...)
|
term.addDefinitionTags(trans.NameTypes...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ func (e *gakkenExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbTe
|
|||||||
for _, reading := range readings {
|
for _, reading := range readings {
|
||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: reading,
|
Expression: reading,
|
||||||
Glossary: []string{entryText},
|
Glossary: []any{entryText},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ func (e *gakkenExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbTe
|
|||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: expression,
|
Expression: expression,
|
||||||
Reading: reading,
|
Reading: reading,
|
||||||
Glossary: []string{entryText},
|
Glossary: []any{entryText},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ func (e *kotowazaExtractor) extractTerms(entry zig.BookEntry, sequence int) []db
|
|||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: expression,
|
Expression: expression,
|
||||||
Reading: reading,
|
Reading: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func (e *koujienExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbT
|
|||||||
for _, reading := range readings {
|
for _, reading := range readings {
|
||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: reading,
|
Expression: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ func (e *koujienExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbT
|
|||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: expression,
|
Expression: expression,
|
||||||
Reading: reading,
|
Reading: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ func (e *meikyouExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbT
|
|||||||
for _, reading := range readings {
|
for _, reading := range readings {
|
||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: reading,
|
Expression: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ func (e *meikyouExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbT
|
|||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: expression,
|
Expression: expression,
|
||||||
Reading: reading,
|
Reading: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ func (e *shougakukan2Extractor) extractTerms(entry zig.BookEntry, sequence int)
|
|||||||
terms = append(terms, dbTerm{
|
terms = append(terms, dbTerm{
|
||||||
Expression: expression,
|
Expression: expression,
|
||||||
Reading: reading,
|
Reading: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
2
wadai.go
2
wadai.go
@ -74,7 +74,7 @@ func (e *wadaiExtractor) extractTerms(entry zig.BookEntry, sequence int) []dbTer
|
|||||||
term := dbTerm{
|
term := dbTerm{
|
||||||
Expression: expression,
|
Expression: expression,
|
||||||
Reading: reading,
|
Reading: reading,
|
||||||
Glossary: []string{entry.Text},
|
Glossary: []any{entry.Text},
|
||||||
Sequence: sequence,
|
Sequence: sequence,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user