package dict
// Form is one written form of a word: a kanji spelling or a kana reading.
type Form struct {
Text string
Common bool
Tags []string // JMdict tags such as "ik", "rK", "sK" (search-only)
}
type Sense struct {
POS []string // JMdict part-of-speech codes: "v1", "n", "adj-i", ...
Misc []string // "uk", "col", "hon", ...
Field []string
Dialect []string
Info []string
Gloss []string // English glosses
// When non-empty, the sense applies only to these forms ("*" means all).
AppliesToKanji []string
AppliesToKana []string
}
// Pitch is a Tokyo pitch accent pattern for one reading, as downstep mora
// positions: 0 is heiban, 1 atamadaka, n means the pitch falls after mora n.
type Pitch struct {
Reading string
Downsteps []int
}
type Entry struct {
ID uint32 // JMdict ent_seq; 0 for entries that did not come from JMdict
Kanji []Form
Kana []Form
Senses []Sense
Pitch []Pitch
JLPT string // "N5".."N1" when known (jisho results), else ""
}
func (e *Entry) Common() bool {
for _, f := range e.Kanji {
if f.Common {
return true
}
}
for _, f := range e.Kana {
if f.Common {
return true
}
}
return false
}
// Kanji is one KANJIDIC2 character.
type Kanji struct {
Literal string
Meanings []string // English
On []string // katakana
Kun []string // hiragana, okurigana after a "." as in KANJIDIC ("た.べる")
Nanori []string
Strokes int
Grade int // 0 when ungraded
JLPT int // old 4-level JLPT from KANJIDIC2, 0 when absent
Freq int // newspaper frequency rank, 0 when absent
}