54 lines
2.3 KiB
Go
54 lines
2.3 KiB
Go
// Package seed is the SCHEMA of a book's glossary seed file — the YAML artifact that
|
|
// carries curated terms into the memory bank.
|
|
//
|
|
// It is deliberately a schema and nothing else: no loading policy, no validation, no
|
|
// store types. Two subsystems meet on this file and must not depend on each other —
|
|
// the miner WRITES it (the mined delta is emitted as a seed the operator reviews) and
|
|
// the memory bank READS it (loadGlossarySeed validates and materializes store rows).
|
|
// Sharing the struct is the mechanism that keeps the emitted delta loadable by the very
|
|
// loader `translate` runs: a field added on one side cannot silently drift from the
|
|
// other, and SeedLint dry-runs the real loader over an emitted delta.
|
|
//
|
|
// The yaml tags ARE the file format (operator-authored seeds live in the book's data
|
|
// directory, outside git); renaming a Go field is safe, changing a tag is a data-format
|
|
// break.
|
|
package seed
|
|
|
|
// File is a whole seed YAML document.
|
|
type File struct {
|
|
Terms []Term `yaml:"terms"`
|
|
}
|
|
|
|
// Term is one seeded term: the source surface, its rendering and the metadata the bank
|
|
// needs to inject it (gender/speech/declension, spoiler window, trust status, aliases).
|
|
type Term struct {
|
|
Src string `yaml:"src"`
|
|
Dst string `yaml:"dst"`
|
|
Type string `yaml:"type"`
|
|
Sense string `yaml:"sense"`
|
|
Gender string `yaml:"gender"`
|
|
Speech string `yaml:"speech"`
|
|
Decl *Decl `yaml:"decl"`
|
|
TranslitPolicy string `yaml:"translit_policy"`
|
|
FirstPerson string `yaml:"first_person"`
|
|
NicknameTranslation string `yaml:"nickname_translation"`
|
|
SinceCh int `yaml:"since_ch"`
|
|
UntilCh int `yaml:"until_ch"`
|
|
Status string `yaml:"status"`
|
|
AllowShort bool `yaml:"allow_short"`
|
|
Note string `yaml:"note"`
|
|
Aliases []Alias `yaml:"aliases"`
|
|
}
|
|
|
|
// Decl carries the target-side declension forms used by the post-check (an invariant
|
|
// term has none by design).
|
|
type Decl struct {
|
|
Invariant bool `yaml:"invariant"`
|
|
Forms []string `yaml:"forms"`
|
|
}
|
|
|
|
// Alias is an additional source surface that fires for the same term.
|
|
type Alias struct {
|
|
Alias string `yaml:"alias"`
|
|
Type string `yaml:"type"`
|
|
}
|