134 lines
2.6 KiB
CUE
134 lines
2.6 KiB
CUE
// CUE code for actually generating the output dictionary
|
|
package shenikan
|
|
|
|
// create { _defn: ..., { _#Definition } } to populate a proper definition
|
|
_#Definition: {
|
|
_defn: string | {[string]: string}
|
|
short: _defn & string | [for brief, long in _defn {brief}][0]
|
|
_long: *([for brief, long in _defn {long}][0]) | null
|
|
if _long != null {long: _long}
|
|
}
|
|
|
|
dictionary: {
|
|
glyphs: [
|
|
for k, datum in _dictionary.glyphs
|
|
for o, glyph in datum {
|
|
kind: k
|
|
ortho: o
|
|
attrs: glyph
|
|
},
|
|
|
|
for v, vglyph in _dictionary.glyphs.vowel
|
|
for c, cglyph in _dictionary.glyphs.cluster {
|
|
kind: "syllable"
|
|
ortho: c + v
|
|
attrs: vglyph + cglyph
|
|
},
|
|
]
|
|
|
|
dialects: [
|
|
for d, dialect in _dictionary.dialects {
|
|
name: d
|
|
replacements: [
|
|
for o, n in dialect {
|
|
old: o
|
|
new: n
|
|
},
|
|
]
|
|
},
|
|
]
|
|
|
|
dms: [
|
|
for o, dm in _dictionary.dms {
|
|
spelling: o
|
|
definitions: [
|
|
for p, defn in dm
|
|
if (defn & _#AnyDefinition) != _|_ {
|
|
_defn: defn
|
|
pos: p
|
|
{_#Definition}
|
|
},
|
|
for p, defns in dm
|
|
if (defns & [..._#AnyDefinition]) != _|_
|
|
for def in defns {
|
|
_defn: def
|
|
pos: p
|
|
{_#Definition}
|
|
},
|
|
]
|
|
},
|
|
]
|
|
|
|
dmPentas: [
|
|
for o, dmPenta in _dictionary.dmPentas {
|
|
spelling: o
|
|
if dmPenta.name != _|_ {name: dmPenta.name}
|
|
if dmPenta.extremes != _|_ {
|
|
extremes: {
|
|
if dmPenta.extremes.i != _|_ {i: dmPenta.extremes.i}
|
|
if dmPenta.extremes.u != _|_ {u: dmPenta.extremes.u}
|
|
}
|
|
}
|
|
},
|
|
]
|
|
|
|
words: [
|
|
for o, word in _dictionary.words {
|
|
spelling: o
|
|
definitions: [
|
|
for p, defn in word
|
|
if (defn & _#AnyDefinition) != _|_
|
|
if p != "from" {
|
|
_defn: defn
|
|
pos: p
|
|
{_#Definition}
|
|
},
|
|
for p, defns in word
|
|
if p != "from"
|
|
if (defns & [..._#AnyDefinition]) != _|_
|
|
for def in defns {
|
|
_defn: def
|
|
pos: p
|
|
{_#Definition}
|
|
},
|
|
]
|
|
if word.from != _|_ {
|
|
derivations: [
|
|
for r, v in word.from {
|
|
root: r
|
|
via: [v.via & string] | v.via
|
|
},
|
|
]
|
|
}
|
|
},
|
|
]
|
|
|
|
pentas: [
|
|
for o, penta in _dictionary.pentas {
|
|
spelling: o
|
|
if penta.name != _|_ {name: penta.name}
|
|
if penta.extremes != _|_ {
|
|
extremes: {
|
|
if penta.extremes.i != _|_ {i: penta.extremes.i}
|
|
if penta.extremes.u != _|_ {u: penta.extremes.u}
|
|
}
|
|
}
|
|
},
|
|
]
|
|
|
|
icosas: [
|
|
for o, icosa in _dictionary.icosas {
|
|
spelling: o
|
|
if icosa.name != _|_ {name: icosa.name}
|
|
if icosa.extremes != _|_ {
|
|
extremes: {
|
|
if icosa.extremes.ix != _|_ {ix: icosa.extremes.ix}
|
|
if icosa.extremes.ux != _|_ {ux: icosa.extremes.ux}
|
|
if icosa.extremes.xi != _|_ {xi: icosa.extremes.xi}
|
|
if icosa.extremes.xu != _|_ {xu: icosa.extremes.xu}
|
|
}
|
|
}
|
|
},
|
|
]
|
|
}
|