Settled on CUE

This commit is contained in:
Louis Burke 2025-02-03 20:48:19 -05:00
parent 7a14f48bd7
commit d77046d404
9 changed files with 459 additions and 1133 deletions

View file

@ -9,14 +9,17 @@ package shenikan
// Then search through model to find nearby vectors using model.most_similar.
// e.g. model.most_similar(model['aunt'] - model['woman'] + model['man'])
dictionary: {
_glyphs: {
// TODO: try generating a penta for each non-syntactic word in toki pona.
// TODO: make more AvB BvC AvBvC penta/icosa sets
_dictionary: {
glyphs: {
vowel: "i": ["outer"]
vowel: "e": ["outer", "slashed"]
vowel: "a": ["slashed"]
vowel: "o": ["inner", "slashed"]
vowel: "u": ["inner"]
vowel: "y": ["both"]
vowel: "y": ["inner", "outer"]
cluster: "θ": ["left", "top"]
cluster: "": ["left", "middle"]
@ -25,20 +28,20 @@ dictionary: {
cluster: "p": ["right", "top"]
cluster: "t": ["right", "middle"]
cluster: "k": ["right", "bottom"]
cluster: "θl": ["left", "top", "tall"]
cluster: "∫l": ["left", "middle", "tall"]
cluster: "xl": ["left", "bottom", "tall"]
cluster: "nl": ["center", "middle", "tall"]
cluster: "pl": ["right", "top", "tall"]
cluster: "tl": ["right", "middle", "tall"]
cluster: "kl": ["right", "bottom", "tall"]
cluster: "θr": ["left", "top", "wide"]
cluster: "∫r": ["left", "middle", "wide"]
cluster: "xr": ["left", "bottom", "wide"]
cluster: "nr": ["center", "middle", "wide"]
cluster: "pr": ["right", "top", "wide"]
cluster: "tr": ["right", "middle", "wide"]
cluster: "kr": ["right", "bottom", "wide"]
cluster: "θl": ["left", "top", "wide"]
cluster: "∫l": ["left", "middle", "wide"]
cluster: "xl": ["left", "bottom", "wide"]
cluster: "nl": ["center", "middle", "wide"] // use sparingly?
cluster: "l": ["right", "top", "wide"] // allophone of pl
cluster: "tl": ["right", "middle", "wide"]
cluster: "kl": ["right", "bottom", "wide"]
cluster: "θr": ["left", "top", "tall"]
cluster: "∫r": ["left", "middle", "tall"]
cluster: "xr": ["left", "bottom", "tall"]
cluster: "nr": ["center", "middle", "tall"] // use sparingly?
cluster: "r": ["right", "top", "tall"] // allophone of pr
cluster: "tr": ["right", "middle", "tall"]
cluster: "kr": ["right", "bottom", "tall"]
cluster: "": ["left", "top", "both"]
cluster: "s∫": ["left", "middle", "both"]
cluster: "sx": ["left", "bottom", "both"]
@ -50,9 +53,22 @@ dictionary: {
punctuation: "«": ["left"]
punctuation: ".": []
punctuation: "»": ["right"]
numeric: "0": ["circle"]
numeric: "1": ["dash"]
numeric: "2": ["vee"]
numeric: "3": ["hump"]
numeric: "4": ["dash", "hump"]
numeric: "5": ["vee", "hump"]
numeric: ",": ["dot"]
}
dialects: {
"shenkian": {
"l": "pl"
"r": "pr"
}
_dialects: {
"jukashenikan": {
"x": "ç"
"p": "j"
@ -67,27 +83,187 @@ dictionary: {
}
}
_words: {
dms: {
"-at": noun: "place of"
"plaxi-": noun: "study of"
}
words: {
"t": {
noun: "thing": "See t - dmPenta for better meaning."
verb: "be"
}
"tit": {
noun: "cool"
from: "t": via: "-t"
}
}
_pentas: {
pentas: {
"n x": {
// name: "Pronouns"
name: "Pronouns"
extremes: {i: "Fully proximal", u: "Fully distal"}
i: pronoun: "I/me"
o: {}
}
"p ls": {
name: "Coordinating Conjunctions"
extremes: {i: "Fully constrasting", u: "Fully non-contrasting"}
i: conjunction: "but/yet"
e: conjunction: "exclusive or"
a: conjunction: "or": "inclusive or"
o: conjunction: "implies": "logical implication (not p or q)"
u: conjunction: "and"
}
_icosas: {
"n t x": {
name: "Tests"
ii: noun: "foo"
"sp ns": {
name: "Group Clusivity"
extremes: {i: "Fully included", u: "Fully excluded"}
i: adposition: "among"
e: adposition: "with"
a: adposition: "throughout"
o: adposition: "without"
u: adposition: "out"
}
"r ks": {
name: "Process"
extremes: {i: "Beginning", u: "Ending"}
i: {verb: "start", noun: "start"}
e: {verb: "resume", noun: "resumption"}
a: {verb: "continue", noun: "continuation"}
o: {verb: "stop", noun: "stop"}
u: {verb: "finish", noun: "finish"}
}
"sp t": {
name: "Truth"
extremes: {i: "True", u: "False"}
i: {adjective: "true", noun: "truth"}
e: {adjective: "valid", noun: "validity"}
a: {
adjective: unknown: "Truth value unknown"
noun: unknown: "Unknown truth value"
}
o: {adjective: "invalid", noun: "invalidity"}
u: {adjective: "false", noun: "falsehood"}
}
"sp shs": {
name: "Biomes"
extremes: {i: "Wet Biomes", u: "Dry Biomes"}
i: noun: ["swamp", "wetlands"]
e: noun: "rainforest"
a: noun: "forest"
o: noun: "grassland"
u: noun: "desert"
}
"sth ps": {
name: "Generic Plants"
extremes: {i: "Trees", u: "Grasses"}
i: noun: "tree"
e: noun: "vine"
a: noun: "bush"
o: noun: "crop"
u: noun: "grass"
}
"k ks": {
name: "Queries"
extremes: {i: "Abstract", u: "Concrete"}
i: noun: "why"
e: noun: "how"
a: noun: "when"
o: noun: "where"
u: noun: ["what", "which", "who"]
}
}
icosas: {
"sth sp shs": {
name: "Plants"
extremes: {
ix: "Trees"
ux: "Grasses"
xi: "Wet"
xu: "Dry"
}
ix: "Trees"
ex: "Vines"
ax: "Bushes"
ox: "Crops"
ux: "Grasses"
xi: "Swamp Plants"
xe: "Rainforest Plants"
xa: "Forest Plants"
xo: "Grassland Plants"
xu: "Desert Plants"
ii: noun: "conifer tree"
ie: noun: "deciduous tree"
ia: noun: "temperate tree"
io: noun: "palm tree"
iu: noun: "desert tree": "Acacia for example"
ei: noun: "lily"
ee: noun: "vine"
ea: noun: "ivy"
eo: noun: "vine flower": "Rose for example"
eu: noun: "thornbush"
ai: noun: "seaweed"
ae: noun: "fern"
aa: noun: "bush"
ao: noun: "shrub"
au: noun: "cactus"
oi: noun: "fruit tree"
oe: noun: "berry bush"
oa: noun: "legume"
oo: noun: "cabbage": "Or similar grassland crop"
ou: noun: "grain"
ui: noun: "moss"
ue: noun: "flower": "Specifically ground or \"low\" flowers"
ua: noun: "grass"
uo: noun: "corn/maize"
uu: noun: "lichen"
}
"sth sp sshat": {
name: "Biomes"
}
}
dmPentas: {
"t -": {
name: "Articles"
extremes: {i: "Specific", u: "General"}
i: syntax: "proper noun indicator"
e: syntax: "the"
a: syntax: "a"
o: syntax: ["any", "some"]
u: syntax: "all"
}
"k -": {
name: "Listing Prefixes"
extremes: {i: "Additive", u: "Reductive"}
i: syntax: "or": "Inclusive or"
e: syntax: "or": "Exclusive or"
a: syntax: "and"
o: syntax: "xnor": "Exclusive nor"
u: syntax: "nor": "Neither nor"
}
}
}

View file

@ -1,249 +0,0 @@
// vim: fdm=marker fmr={,} fileencoding=utf8
glyphs { // in font encoding and alphabetical order
// bare vowels
(vowel)glyph "i" dashed="outer"
(vowel)glyph "e" dashed="outer" slashed=true
(vowel)glyph "a" slashed=true
(vowel)glyph "o" dashed="inner" slashed=true
(vowel)glyph "u" dashed="inner"
(vowel)glyph "y" dashed="both"
// consonant clusters (note: both core can be written with a dot in most cases)
(cluster)glyph "θ" side="left" height="top"
(cluster)glyph "∫" side="left" height="middle"
(cluster)glyph "x" side="left" height="bottom"
(cluster)glyph "n" side="center" height="middle"
(cluster)glyph "p" side="right" height="top"
(cluster)glyph "t" side="right" height="middle"
(cluster)glyph "k" side="right" height="bottom"
(cluster)glyph "θl" side="left" height="top" core="tall"
(cluster)glyph "∫l" side="left" height="middle" core="tall"
(cluster)glyph "xl" side="left" height="bottom" core="tall"
(cluster)glyph "nl" side="center" height="middle" core="tall"
(cluster)glyph "pl" side="right" height="top" core="tall"
(cluster)glyph "tl" side="right" height="middle" core="tall"
(cluster)glyph "kl" side="right" height="bottom" core="tall"
(cluster)glyph "θr" side="left" height="top" core="wide"
(cluster)glyph "∫r" side="left" height="middle" core="wide"
(cluster)glyph "xr" side="left" height="bottom" core="wide"
(cluster)glyph "nr" side="center" height="middle" core="wide"
(cluster)glyph "pr" side="right" height="top" core="wide"
(cluster)glyph "tr" side="right" height="middle" core="wide"
(cluster)glyph "kr" side="right" height="bottom" core="wide"
(cluster)glyph "sθ" side="left" height="top" core="both"
(cluster)glyph "s∫" side="left" height="middle" core="both"
(cluster)glyph "sx" side="left" height="bottom" core="both"
(cluster)glyph "sn" side="center" height="middle" core="both"
(cluster)glyph "sp" side="right" height="top" core="both"
(cluster)glyph "st" side="right" height="middle" core="both"
(cluster)glyph "sk" side="right" height="bottom" core="both"
// syllables (generated with vim macros [main=@s]: j=«`cYpdWdi"k^Wp^ci(syllable??a0j^dWkJj^`cjmc» q=«Y27pk28@j`c{jjmc» s=«?vowels n0jV}kyp{{jjmc6@q») }}
(syllable)glyph "θi" dashed="outer" side="left" height="top"
(syllable)glyph "∫i" dashed="outer" side="left" height="middle"
(syllable)glyph "xi" dashed="outer" side="left" height="bottom"
(syllable)glyph "ni" dashed="outer" side="center" height="middle"
(syllable)glyph "pi" dashed="outer" side="right" height="top"
(syllable)glyph "ti" dashed="outer" side="right" height="middle"
(syllable)glyph "ki" dashed="outer" side="right" height="bottom"
(syllable)glyph "θli" dashed="outer" side="left" height="top" core="tall"
(syllable)glyph "∫li" dashed="outer" side="left" height="middle" core="tall"
(syllable)glyph "xli" dashed="outer" side="left" height="bottom" core="tall"
(syllable)glyph "nli" dashed="outer" side="center" height="middle" core="tall"
(syllable)glyph "pli" dashed="outer" side="right" height="top" core="tall"
(syllable)glyph "tli" dashed="outer" side="right" height="middle" core="tall"
(syllable)glyph "kli" dashed="outer" side="right" height="bottom" core="tall"
(syllable)glyph "θri" dashed="outer" side="left" height="top" core="wide"
(syllable)glyph "∫ri" dashed="outer" side="left" height="middle" core="wide"
(syllable)glyph "xri" dashed="outer" side="left" height="bottom" core="wide"
(syllable)glyph "nri" dashed="outer" side="center" height="middle" core="wide"
(syllable)glyph "pri" dashed="outer" side="right" height="top" core="wide"
(syllable)glyph "tri" dashed="outer" side="right" height="middle" core="wide"
(syllable)glyph "kri" dashed="outer" side="right" height="bottom" core="wide"
(syllable)glyph "sθi" dashed="outer" side="left" height="top" core="both"
(syllable)glyph "s∫i" dashed="outer" side="left" height="middle" core="both"
(syllable)glyph "sxi" dashed="outer" side="left" height="bottom" core="both"
(syllable)glyph "sni" dashed="outer" side="center" height="middle" core="both"
(syllable)glyph "spi" dashed="outer" side="right" height="top" core="both"
(syllable)glyph "sti" dashed="outer" side="right" height="middle" core="both"
(syllable)glyph "ski" dashed="outer" side="right" height="bottom" core="both"
(syllable)glyph "θe" dashed="outer" slashed=true side="left" height="top"
(syllable)glyph "∫e" dashed="outer" slashed=true side="left" height="middle"
(syllable)glyph "xe" dashed="outer" slashed=true side="left" height="bottom"
(syllable)glyph "ne" dashed="outer" slashed=true side="center" height="middle"
(syllable)glyph "pe" dashed="outer" slashed=true side="right" height="top"
(syllable)glyph "te" dashed="outer" slashed=true side="right" height="middle"
(syllable)glyph "ke" dashed="outer" slashed=true side="right" height="bottom"
(syllable)glyph "θle" dashed="outer" slashed=true side="left" height="top" core="tall"
(syllable)glyph "∫le" dashed="outer" slashed=true side="left" height="middle" core="tall"
(syllable)glyph "xle" dashed="outer" slashed=true side="left" height="bottom" core="tall"
(syllable)glyph "nle" dashed="outer" slashed=true side="center" height="middle" core="tall"
(syllable)glyph "ple" dashed="outer" slashed=true side="right" height="top" core="tall"
(syllable)glyph "tle" dashed="outer" slashed=true side="right" height="middle" core="tall"
(syllable)glyph "kle" dashed="outer" slashed=true side="right" height="bottom" core="tall"
(syllable)glyph "θre" dashed="outer" slashed=true side="left" height="top" core="wide"
(syllable)glyph "∫re" dashed="outer" slashed=true side="left" height="middle" core="wide"
(syllable)glyph "xre" dashed="outer" slashed=true side="left" height="bottom" core="wide"
(syllable)glyph "nre" dashed="outer" slashed=true side="center" height="middle" core="wide"
(syllable)glyph "pre" dashed="outer" slashed=true side="right" height="top" core="wide"
(syllable)glyph "tre" dashed="outer" slashed=true side="right" height="middle" core="wide"
(syllable)glyph "kre" dashed="outer" slashed=true side="right" height="bottom" core="wide"
(syllable)glyph "sθe" dashed="outer" slashed=true side="left" height="top" core="both"
(syllable)glyph "s∫e" dashed="outer" slashed=true side="left" height="middle" core="both"
(syllable)glyph "sxe" dashed="outer" slashed=true side="left" height="bottom" core="both"
(syllable)glyph "sne" dashed="outer" slashed=true side="center" height="middle" core="both"
(syllable)glyph "spe" dashed="outer" slashed=true side="right" height="top" core="both"
(syllable)glyph "ste" dashed="outer" slashed=true side="right" height="middle" core="both"
(syllable)glyph "ske" dashed="outer" slashed=true side="right" height="bottom" core="both"
(syllable)glyph "θa" slashed=true side="left" height="top"
(syllable)glyph "∫a" slashed=true side="left" height="middle"
(syllable)glyph "xa" slashed=true side="left" height="bottom"
(syllable)glyph "na" slashed=true side="center" height="middle"
(syllable)glyph "pa" slashed=true side="right" height="top"
(syllable)glyph "ta" slashed=true side="right" height="middle"
(syllable)glyph "ka" slashed=true side="right" height="bottom"
(syllable)glyph "θla" slashed=true side="left" height="top" core="tall"
(syllable)glyph "∫la" slashed=true side="left" height="middle" core="tall"
(syllable)glyph "xla" slashed=true side="left" height="bottom" core="tall"
(syllable)glyph "nla" slashed=true side="center" height="middle" core="tall"
(syllable)glyph "pla" slashed=true side="right" height="top" core="tall"
(syllable)glyph "tla" slashed=true side="right" height="middle" core="tall"
(syllable)glyph "kla" slashed=true side="right" height="bottom" core="tall"
(syllable)glyph "θra" slashed=true side="left" height="top" core="wide"
(syllable)glyph "∫ra" slashed=true side="left" height="middle" core="wide"
(syllable)glyph "xra" slashed=true side="left" height="bottom" core="wide"
(syllable)glyph "nra" slashed=true side="center" height="middle" core="wide"
(syllable)glyph "pra" slashed=true side="right" height="top" core="wide"
(syllable)glyph "tra" slashed=true side="right" height="middle" core="wide"
(syllable)glyph "kra" slashed=true side="right" height="bottom" core="wide"
(syllable)glyph "sθa" slashed=true side="left" height="top" core="both"
(syllable)glyph "s∫a" slashed=true side="left" height="middle" core="both"
(syllable)glyph "sxa" slashed=true side="left" height="bottom" core="both"
(syllable)glyph "sna" slashed=true side="center" height="middle" core="both"
(syllable)glyph "spa" slashed=true side="right" height="top" core="both"
(syllable)glyph "sta" slashed=true side="right" height="middle" core="both"
(syllable)glyph "ska" slashed=true side="right" height="bottom" core="both"
(syllable)glyph "θo" dashed="inner" slashed=true side="left" height="top"
(syllable)glyph "∫o" dashed="inner" slashed=true side="left" height="middle"
(syllable)glyph "xo" dashed="inner" slashed=true side="left" height="bottom"
(syllable)glyph "no" dashed="inner" slashed=true side="center" height="middle"
(syllable)glyph "po" dashed="inner" slashed=true side="right" height="top"
(syllable)glyph "to" dashed="inner" slashed=true side="right" height="middle"
(syllable)glyph "ko" dashed="inner" slashed=true side="right" height="bottom"
(syllable)glyph "θlo" dashed="inner" slashed=true side="left" height="top" core="tall"
(syllable)glyph "∫lo" dashed="inner" slashed=true side="left" height="middle" core="tall"
(syllable)glyph "xlo" dashed="inner" slashed=true side="left" height="bottom" core="tall"
(syllable)glyph "nlo" dashed="inner" slashed=true side="center" height="middle" core="tall"
(syllable)glyph "plo" dashed="inner" slashed=true side="right" height="top" core="tall"
(syllable)glyph "tlo" dashed="inner" slashed=true side="right" height="middle" core="tall"
(syllable)glyph "klo" dashed="inner" slashed=true side="right" height="bottom" core="tall"
(syllable)glyph "θro" dashed="inner" slashed=true side="left" height="top" core="wide"
(syllable)glyph "∫ro" dashed="inner" slashed=true side="left" height="middle" core="wide"
(syllable)glyph "xro" dashed="inner" slashed=true side="left" height="bottom" core="wide"
(syllable)glyph "nro" dashed="inner" slashed=true side="center" height="middle" core="wide"
(syllable)glyph "pro" dashed="inner" slashed=true side="right" height="top" core="wide"
(syllable)glyph "tro" dashed="inner" slashed=true side="right" height="middle" core="wide"
(syllable)glyph "kro" dashed="inner" slashed=true side="right" height="bottom" core="wide"
(syllable)glyph "sθo" dashed="inner" slashed=true side="left" height="top" core="both"
(syllable)glyph "s∫o" dashed="inner" slashed=true side="left" height="middle" core="both"
(syllable)glyph "sxo" dashed="inner" slashed=true side="left" height="bottom" core="both"
(syllable)glyph "sno" dashed="inner" slashed=true side="center" height="middle" core="both"
(syllable)glyph "spo" dashed="inner" slashed=true side="right" height="top" core="both"
(syllable)glyph "sto" dashed="inner" slashed=true side="right" height="middle" core="both"
(syllable)glyph "sko" dashed="inner" slashed=true side="right" height="bottom" core="both"
(syllable)glyph "θu" dashed="inner" side="left" height="top"
(syllable)glyph "∫u" dashed="inner" side="left" height="middle"
(syllable)glyph "xu" dashed="inner" side="left" height="bottom"
(syllable)glyph "nu" dashed="inner" side="center" height="middle"
(syllable)glyph "pu" dashed="inner" side="right" height="top"
(syllable)glyph "tu" dashed="inner" side="right" height="middle"
(syllable)glyph "ku" dashed="inner" side="right" height="bottom"
(syllable)glyph "θlu" dashed="inner" side="left" height="top" core="tall"
(syllable)glyph "∫lu" dashed="inner" side="left" height="middle" core="tall"
(syllable)glyph "xlu" dashed="inner" side="left" height="bottom" core="tall"
(syllable)glyph "nlu" dashed="inner" side="center" height="middle" core="tall"
(syllable)glyph "plu" dashed="inner" side="right" height="top" core="tall"
(syllable)glyph "tlu" dashed="inner" side="right" height="middle" core="tall"
(syllable)glyph "klu" dashed="inner" side="right" height="bottom" core="tall"
(syllable)glyph "θru" dashed="inner" side="left" height="top" core="wide"
(syllable)glyph "∫ru" dashed="inner" side="left" height="middle" core="wide"
(syllable)glyph "xru" dashed="inner" side="left" height="bottom" core="wide"
(syllable)glyph "nru" dashed="inner" side="center" height="middle" core="wide"
(syllable)glyph "pru" dashed="inner" side="right" height="top" core="wide"
(syllable)glyph "tru" dashed="inner" side="right" height="middle" core="wide"
(syllable)glyph "kru" dashed="inner" side="right" height="bottom" core="wide"
(syllable)glyph "sθu" dashed="inner" side="left" height="top" core="both"
(syllable)glyph "s∫u" dashed="inner" side="left" height="middle" core="both"
(syllable)glyph "sxu" dashed="inner" side="left" height="bottom" core="both"
(syllable)glyph "snu" dashed="inner" side="center" height="middle" core="both"
(syllable)glyph "spu" dashed="inner" side="right" height="top" core="both"
(syllable)glyph "stu" dashed="inner" side="right" height="middle" core="both"
(syllable)glyph "sku" dashed="inner" side="right" height="bottom" core="both"
(syllable)glyph "θy" dashed="both" side="left" height="top"
(syllable)glyph "∫y" dashed="both" side="left" height="middle"
(syllable)glyph "xy" dashed="both" side="left" height="bottom"
(syllable)glyph "ny" dashed="both" side="center" height="middle"
(syllable)glyph "py" dashed="both" side="right" height="top"
(syllable)glyph "ty" dashed="both" side="right" height="middle"
(syllable)glyph "ky" dashed="both" side="right" height="bottom"
(syllable)glyph "θly" dashed="both" side="left" height="top" core="tall"
(syllable)glyph "∫ly" dashed="both" side="left" height="middle" core="tall"
(syllable)glyph "xly" dashed="both" side="left" height="bottom" core="tall"
(syllable)glyph "nly" dashed="both" side="center" height="middle" core="tall"
(syllable)glyph "ply" dashed="both" side="right" height="top" core="tall"
(syllable)glyph "tly" dashed="both" side="right" height="middle" core="tall"
(syllable)glyph "kly" dashed="both" side="right" height="bottom" core="tall"
(syllable)glyph "θry" dashed="both" side="left" height="top" core="wide"
(syllable)glyph "∫ry" dashed="both" side="left" height="middle" core="wide"
(syllable)glyph "xry" dashed="both" side="left" height="bottom" core="wide"
(syllable)glyph "nry" dashed="both" side="center" height="middle" core="wide"
(syllable)glyph "pry" dashed="both" side="right" height="top" core="wide"
(syllable)glyph "try" dashed="both" side="right" height="middle" core="wide"
(syllable)glyph "kry" dashed="both" side="right" height="bottom" core="wide"
(syllable)glyph "sθy" dashed="both" side="left" height="top" core="both"
(syllable)glyph "s∫y" dashed="both" side="left" height="middle" core="both"
(syllable)glyph "sxy" dashed="both" side="left" height="bottom" core="both"
(syllable)glyph "sny" dashed="both" side="center" height="middle" core="both"
(syllable)glyph "spy" dashed="both" side="right" height="top" core="both"
(syllable)glyph "sty" dashed="both" side="right" height="middle" core="both"
(syllable)glyph "sky" dashed="both" side="right" height="bottom" core="both"
// punctuation
(punctuation)glyph "«" dir="left"
(punctuation)glyph "."
(punctuation)glyph "»" dir="right"
// mathematics
(math)glyph "0" shape="circle"
(math)glyph "1" shape="dash"
(math)glyph "2" shape="vee"
(math)glyph "3" shape="hump"
(math)glyph "4" shape="dash-hump"
(math)glyph "5" shape="dash-hump-dash"
(math)glyph "." shape="dot"
}
dialect "jukashenikan" {
replace "x" with="ç"
replace "p" with="j"
// ...
}
dialect "gazhenigan" {
replace "k" with="g"
replace "∫" with="ʒ"
replace "s" with="z"
replace "θ" with="ð"
replace "t" with="d"
// ...
}
romanization {
// TODO
}
dictionary {
}

View file

@ -1,80 +0,0 @@
#!/usr/bin/kscript
@file:Import("dsl.kt")
glyphs { // in font encoding and alphabetical order
// bare vowels
glyph(vowel, "i", outer)
glyph(vowel, "e", outer, slashed)
glyph(vowel, "a", slashed)
glyph(vowel, "o", `inner`, slashed)
glyph(vowel, "u", `inner`)
glyph(vowel, "y", both)
// consonant clusters (note: both core can be written with a dot in most cases)
glyph(cluster, "θ", left, top)
glyph(cluster, "∫", left, middle)
glyph(cluster, "x", left, bottom)
glyph(cluster, "n", center, middle)
glyph(cluster, "p", right, top)
glyph(cluster, "t", right, middle)
glyph(cluster, "k", right, bottom)
glyph(cluster, "θl", left, top, tall)
glyph(cluster, "∫l", left, middle, tall)
glyph(cluster, "xl", left, bottom, tall)
glyph(cluster, "nl", center, middle, tall)
glyph(cluster, "pl", right, top, tall)
glyph(cluster, "tl", right, middle, tall)
glyph(cluster, "kl", right, bottom, tall)
glyph(cluster, "θr", left, top, wide)
glyph(cluster, "∫r", left, middle, wide)
glyph(cluster, "xr", left, bottom, wide)
glyph(cluster, "nr", center, middle, wide)
glyph(cluster, "pr", right, top, wide)
glyph(cluster, "tr", right, middle, wide)
glyph(cluster, "kr", right, bottom, wide)
glyph(cluster, "sθ", left, top, both)
glyph(cluster, "s∫", left, middle, both)
glyph(cluster, "sx", left, bottom, both)
glyph(cluster, "sn", center, middle, both)
glyph(cluster, "sp", right, top, both)
glyph(cluster, "st", right, middle, both)
glyph(cluster, "sk", right, bottom, both)
syllables()
glyph(punctuation, "«", left)
glyph(punctuation, ".")
glyph(punctuation, "»", right)
glyph(numeric, "0", circle)
glyph(numeric, "1", dash)
glyph(numeric, "2", vee)
glyph(numeric, "3", hump)
glyph(numeric, "4", dash, hump)
glyph(numeric, "5", vee, hump)
glyph(numeric, ".", dump)
}
dialect("jukashenikan") {
replace("x", "ç")
replace("p", "j")
// ...
}
dialect("gazhenigan") {
replace("k", "g")
replace("∫", "ʒ")
replace("s", "z")
replace("θ", "ð")
replace("t", "d")
// ...
}
romanization {
// TODO
}
dictionary {
// TODO
}

View file

@ -1,98 +0,0 @@
import dsl
import std/tables
# Tips: in python run
#
# import gensim.downloader
# model = gensim.downloader.load("glove-wiki-gigaword-50") # or other models @https://github.com/piskvorky/gensim-data
#
# Then find words related to what you want in model[] and do math on them.
# Then search through model to find nearby vectors using model.most_similar.
# e.g. model.most_similar(model['aunt'] - model['woman'] + model['man'])
dictionary:
glyphs:
vowel "i", outer
vowel "e", outer, slashed
vowel "a", slashed
vowel "o", inner, slashed
vowel "u", inner
vowel "y", both
cluster "θ", left, top
cluster "", left, middle
cluster "x", left, bottom
cluster "n", center, middle
cluster "p", right, top
cluster "t", right, middle
cluster "k", right, bottom
cluster "θl", left, top, tall
cluster "∫l", left, middle, tall
cluster "xl", left, bottom, tall
cluster "nl", center, middle, tall
cluster "pl", right, top, tall
cluster "tl", right, middle, tall
cluster "kl", right, bottom, tall
cluster "θr", left, top, wide
cluster "∫r", left, middle, wide
cluster "xr", left, bottom, wide
cluster "nr", center, middle, wide
cluster "pr", right, top, wide
cluster "tr", right, middle, wide
cluster "kr", right, bottom, wide
cluster "", left, top, both
cluster "s∫", left, middle, both
cluster "sx", left, bottom, both
cluster "sn", center, middle, both
cluster "sp", right, top, both
cluster "st", right, middle, both
cluster "sk", right, bottom, both
syllables()
punctuation "«", left
punctuation "."
punctuation "»", right
numeric "0", circle
numeric "1", dash
numeric "2", vee
numeric "3", hump
numeric "4", dash, hump
numeric "5", vee, hump
numeric ".", dot
dialect "jukashenikan":
replace "x", "ç"
replace "p", "j"
# ...
dialect "gazhenigan":
replace "k", "g"
replace "", "ʒ"
replace "s", "z"
replace "θ", "ð"
replace "t", "d"
# ...
words:
word "t":
noun "thing", "See t - dmPenta for better meaning."
# verb "be"
penta "n x", "Pronouns":
extremes(i="Fully proximal", u="Fully distal")
i: pronoun "I/me"
e: pronoun "this"
a: pronoun "you"
o: pronoun "it"
u: pronoun "that"
icosapenta "n t x", "Tests":
ii: noun "foo"
# TODO: Consider hepta scales as well? how?
when isMainModule:
echo dict.jsonify

229
dsl.cue
View file

@ -1,149 +1,120 @@
// CUE code for defining the DSL
package shenikan
import ( "strings"
// Generate json output via `cue export -p shenikan`
// Generate json output via `cue export -p shenikan`
)
import "strings"
dictionary: {
_glyphs: vowel: [Orthography=_]: [...#VowelAttribute] | *null
_glyphs: cluster: [Orthography=_]: [...#ClusterAttribute] | *null
_glyphs: punctuation: [Orthography=_]: [...#PunctuationAttribute] | *null
_glyphs: numeric: [Orthography=_]: [...#NumericAttribute] | *null
_#ShortDefinition: string
_#LongDefinition: {[string]: string}
_#AnyDefinition: _#ShortDefinition | _#LongDefinition
_#RawDefinition: _#AnyDefinition | [..._#AnyDefinition] | *""
glyphs: [
for k, datum in _glyphs
for o, glyph in datum {
kind: k
ortho: o
attrs: glyph
},
_dictionary: {
glyphs: vowel: [Orthography=_]: [...#VowelAttribute] | *null
glyphs: cluster: [Orthography=_]: [...#ClusterAttribute] | *null
glyphs: punctuation: [Orthography=_]: [...#PunctuationAttribute] | *null
glyphs: numeric: [Orthography=_]: [...#NumericAttribute] | *null
for v, vglyph in _glyphs.vowel
for c, cglyph in _glyphs.cluster {
kind: "syllable"
ortho: c + v
attrs: vglyph + cglyph
},
]
dialects: [Name=_]: [Old=_]: string
_dialects: [Name=_]: [Old=_]: string
dialects: [
for d, dialect in _dialects {
name: d
replacements: [
for o, n in dialect {
old: o
new: n
},
]
},
]
#RawDefinition: string | {[string]: string} | *""
_words: [Orthography=_]: {
[#PartOfSpeech]: #RawDefinition
_#DMDSL: {[#PartOfSpeech]: _#RawDefinition}
dms: [Orthography=_]: _#DMDSL
dmPentas: [Orthography=_]: {
name?: string
extremes: {i?: string, u?: string}
for v in _vowels {"\(v)": _#DMDSL | *null}
}
// 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
}
}
words: [
for o, word in _words {
spelling: o
definitions: [
for p, defn in word {
_defn: defn
pos: p
{_#Definition}
},
]
},
for o, penta in _pentas
dms: {
for o, dmPenta in dmPentas {
for v in _vowels
let ortho = strings.Replace(o, " ", v, 1)
if dmPenta["\(v)"] != null {
(ortho): dmPenta["\(v)"]
}
}
}
#Derivable: from?: [string]: via: string | [...string]
_#WordDSL: {[#PartOfSpeech]: _#RawDefinition, #Derivable}
words: [Orthography=_]: _#WordDSL
_#PentaDSL: {
name?: string
extremes: {i?: string, u?: string}
for v in _vowels {"\(v)": _#WordDSL | *null}
#Derivable
}
pentas: [Orthography=_]: _#PentaDSL
words: {
for o, penta in pentas {
for v in _vowels
let ortho = strings.Replace(o, " ", v, 1)
if penta["\(v)"] != null {
spelling: strings.Replace(o, " ", v, 1)
definitions: [
for p, defn in penta["\(v)"] {
_defn: defn
pos: p
{_#Definition}
},
]
},
(ortho): penta["\(v)"] & {
if penta.from != _|_ {
from: {
for r, v in penta.from {
(ortho): v
}
}
}
}
}
}
}
for o, icosa in _icosas
for v1 in _vowels
for v2 in _vowels
if icosa["\(v1)\(v2)"] != null {
spelling: strings.Replace(strings.Replace(o, " ", v1, 1), " ", v2, 1)
definitions: [
for p, defn in icosa["\(v1)\(v2)"] {
_defn: defn
pos: p
{_#Definition}
},
]
},
]
_pentas: [Orthography=_]: {
icosas: [Orthography=_]: {
name?: string
extremes: {
i?: string
u?: string
}
for v in _vowels {
"\(v)": {[#PartOfSpeech]: #RawDefinition} | *null
}
}
pentas: [
for o, penta in _pentas {
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: [Orthography=_]: {
name?: string
extremes: {
ix?: string
ux?: string
xi?: string
xu?: string
}
extremes: {ix?: string, ux?: string, xi?: string, xu?: string}
for v1 in _vowels
for v2 in _vowels {
"\(v1)\(v2)": {[#PartOfSpeech]: #RawDefinition} | *null
"\(v1)\(v2)": _#WordDSL
}
for v in _vowels {
"\(v)x": string
"x\(v)": string
}
icosas: [
for o, icosa in _icosas {
if icosa.name != _|_ {name: icosa.name}
if icosa.extremes != _|_ {
#Derivable
}
pentas: {
for o, icosa in icosas {
for v in _vowels {
(strings.Replace(o, " ", v, 1)): {
if icosa["\(v)x"] != _|_ {name: icosa["\(v)x"]}
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}
if icosa.extremes.xi != _|_ {i: icosa.extremes.xi}
if icosa.extremes.xu != _|_ {u: icosa.extremes.xu}
}
}
let o1 = strings.Replace(o, " ", "~", 1)
let o2 = strings.Replace(o1, " ", v, 1)
(strings.Replace(o2, "~", " ", 1)): {
if icosa["x\(v)"] != _|_ {name: icosa["x\(v)"]}
extremes: {
if icosa.extremes.ix != _|_ {i: icosa.extremes.ix}
if icosa.extremes.ux != _|_ {u: icosa.extremes.ux}
}
}
}
}
}
words: {
for o, icosa in icosas {
for v1 in _vowels
for v2 in _vowels
let ortho = strings.Replace(strings.Replace(o, " ", v1, 1), " ", v2, 1)
if icosa["\(v1)\(v2)"] != null {
(ortho): icosa["\(v1)\(v2)"] & {
if icosa.from != _|_ {
from: {
for r, v in icosa.from {
(ortho): v
}
}
}
}
}
}
}
},
]
}

20
dsl.kt
View file

@ -1,20 +0,0 @@
class Database {
}
enum class GlyphType(val repr: String) {
Vowel("vowel"),
Cluster("cluster"),
Syllable("syllable"),
Punctuation("punctuation"),
Numeric("numeric"),
}
open class Feature
data class Glyph(
val type: GlyphType,
val unicode: String,
val features: Array<Feature>,
) {
constructor(t: GlyphType, u: String, vararg f: Feature) : this(t, u, f) {}
}

529
dsl.nim
View file

@ -1,529 +0,0 @@
import std/macros
import std/tables
import std/options
import std/strutils
import std/[json, jsonutils]
import std/sequtils
type
GlyphAttribute* = enum
# Vowel Attributes
outer, slashed, inner,
# Cluster/Punctuation Attributes
left, center, right,
top, middle, bottom,
tall, wide, both,
# Numeric Attributes
circle, dash, vee, hump, dot,
GlyphKind* = enum Vowel, Cluster, Punctuation, Syllable, Numeric
Glyph* = object
spelling*: string
kind*: GlyphKind
attrs*: set[GlyphAttribute]
Replacement* = object
original*: string
replaced*: string
PartOfSpeech* = enum Noun, Pronoun, Verb, Adjective, Adverb, Syntactic
V* = enum
V_I, V_E, V_A, V_O, V_U
Definition* = object
brief*: string
long*: Option[string]
Word* = ref object
spelling*: string
definitions*: Table[PartOfSpeech, Definition]
derivations*: seq[Derivation]
Extremes* = object
i*: Option[string]
u*: Option[string]
Penta* = ref object
spelling*: string
name*: string
exts*: Extremes
elems*: array[V, Word]
BiExtremes* = object
first*: Extremes
second*: Extremes
Icosapenta* = ref object
spelling*: string
name*: string
exts*: BiExtremes
first*: array[V, Penta]
second*: array[V, Penta]
DerivationalMorphology* = ref object
spelling*: string
definitions*: Table[PartOfSpeech, Definition]
Derivation* = ref object
root*: Word
dm*: DerivationalMorphology
Dictionary* = object
glyphs*: seq[Glyph]
dialects*: Table[string, seq[Replacement]]
words*: Table[string, Word]
pentas*: Table[string, Penta]
icosapentas*: Table[string, Icosapenta]
dms*: Table[string, DerivationalMorphology]
const
Vowel2Char*: array[V, char] = [
V_I: 'i',
V_E: 'e',
V_A: 'a',
V_O: 'o',
V_U: 'u'
]
proc replaceFirst(haystack: string, needle: char, content: char): string =
let idx = haystack.find(needle)
result = haystack
result[idx] = content
proc replaceLast(haystack: string, needle: char, content: char): string =
let idx = haystack.rfind(needle)
result = haystack
result[idx] = content
macro makeposprocs(): untyped =
result = nnkStmtList.newNimNode
for pos in PartOfSpeech:
let w = ident("w")
let name = ident(($pos).toLowerAscii)
let vpos = pos.newLit
result.add quote do:
proc `name`(short: string) {.used.} =
`w`.definitions[`vpos`] = Definition(brief: short, long: string.none)
proc `name`(short: string, long: string) {.used.} =
`w`.definitions[`vpos`] = Definition(brief: short, long: long.some)
macro makepentaprocs(): untyped =
result = nnkStmtList.newNimNode
for v in V:
let p = ident("p")
let name = ident("" & ($v).toLowerAscii[^1])
let val = v.newLit
result.add quote do:
template `name`(defns2: untyped) {.used.} =
edit_word `p`.elems[`val`]: defns2
macro make_icosaprocs(): untyped =
result = nnkStmtList.newNimNode
let ip = ident("ip")
# -x and x- templates
for v in V:
let namex = ident(($v).toLowerAscii[^1] & "x")
let xname = ident("x" & ($v).toLowerAscii[^1])
let val = v.newLit
result.add quote do:
template `namex`(defns2: untyped) {.used.} =
edit_penta `ip`.first[`val`]: defns2
template `xname`(defns2: untyped) {.used.} =
edit_penta `ip`.second[`val`]: defns2
# -- templates
for v1 in V:
for v2 in V:
let name = ident(($v1).toLowerAscii[^1] & ($v2).toLowerAscii[^1])
let val1 = v1.newLit
let name2 = ident("" & ($v2).toLowerAscii[^1])
result.add quote do:
template `name`(defns2: untyped) {.used.} =
edit_penta(`ip`.first[`val1`]):
`name2`: defns2
template glyph_dsl(dict: var Dictionary, gbody: untyped) =
block:
proc vowel(spelling: string, attrs: varargs[GlyphAttribute]) =
var v: Glyph = Glyph(spelling: spelling, kind: Vowel)
for attr in attrs:
v.attrs.incl attr
dict.glyphs.add v
proc cluster(spelling: string, attrs: varargs[GlyphAttribute]) =
var c: Glyph = Glyph(spelling: spelling, kind: Cluster)
for attr in attrs:
c.attrs.incl attr
dict.glyphs.add c
proc punctuation(spelling: string, attrs: varargs[GlyphAttribute]) =
var p: Glyph = Glyph(spelling: spelling, kind: Punctuation)
for attr in attrs:
p.attrs.incl attr
dict.glyphs.add p
proc numeric(spelling: string, attrs: varargs[GlyphAttribute]) =
var n: Glyph = Glyph(spelling: spelling, kind: Numeric)
for attr in attrs:
n.attrs.incl attr
dict.glyphs.add n
proc syllables() =
var newglyphs: seq[Glyph]
for v in dict.glyphs:
if v.kind != Vowel:
continue
for c in dict.glyphs:
if c.kind != Cluster:
continue
newglyphs.add Glyph(
spelling: c.spelling & v.spelling,
kind: Syllable,
attrs: v.attrs + c.attrs
)
dict.glyphs.add newglyphs
gbody
template dialect_dsl(dict: var Dictionary, name: string, dbody: untyped) =
block:
var dial: seq[Replacement]
proc replace(orig: string, by: string) =
dial.add Replacement(original: orig, replaced: by)
dbody
dict.dialects[name] = dial
template edit_word_dsl(theword: Word, defns: untyped) =
block:
var w {.inject.}: Word = theword
makeposprocs()
defns
template edit_dm_dsl(thedm: DerivationalMorphology, defns: untyped) =
block:
var w {.inject.}: DerivationalMorphology = thedm
makeposprocs()
defns
template words_dsl(dict: var Dictionary, wbody: untyped) =
block:
template edit_word(theword: Word, defns: untyped) =
edit_word_dsl(theword):
defns
template word(ortho: string, defns: untyped) =
block:
var w {.inject.} = Word(spelling: ortho)
proc via(root: string, dm: string) {.inject, used.} =
w.derivations.add Derivation(root: dict.words[root], dm: dict.dms[dm])
edit_word(w): defns
dict.words[w.spelling] = w
template edit_penta(thepenta: Penta, defns: untyped) =
block:
var p {.inject.}: Penta = thepenta
proc extremes(i {.inject.}: string, u {.inject.}: string) {.used.} =
p.exts.i = some(i)
p.exts.u = some(u)
makepentaprocs()
defns
template penta(ortho: string, pname: string, defns: untyped) =
block:
var p {.inject.}: Penta = Penta(
spelling: ortho,
name: pname,
exts: Extremes(i: string.none, u: string.none)
)
for v in V:
let spelling = ortho.replaceFirst(' ', Vowel2Char[v])
if spelling in dict.words:
p.elems[v] = dict.words[spelling]
else:
word ortho.replaceFirst(' ', Vowel2Char[v]):
p.elems[v] = w
edit_penta(p): defns
dict.pentas[ortho] = p
template edit_icosapenta(theicosa: Icosapenta, idefns: untyped) =
block:
var ip {.inject.}: Icosapenta = theicosa
proc firsts(i {.inject.}: string, u {.inject.}: string) {.used.} =
ip.exts.first.i = some(i)
ip.exts.first.u = some(u)
proc seconds(i {.inject.}: string, u {.inject.}: string) {.used.} =
ip.exts.second.i = some(i)
ip.exts.second.u = some(u)
template ix(defns2: untyped) {.used.} =
edit_penta ip.first[V_I]: defns2
template ex(defns2: untyped) {.used.} =
edit_penta ip.first[V_E]: defns2
template ax(defns2: untyped) {.used.} =
edit_penta ip.first[V_A]: defns2
template ox(defns2: untyped) {.used.} =
edit_penta ip.first[V_O]: defns2
template ux(defns2: untyped) {.used.} =
edit_penta ip.first[V_U]: defns2
template xi(defns2: untyped) {.used.} =
edit_penta ip.second[V_I]: defns2
template xe(defns2: untyped) {.used.} =
edit_penta ip.second[V_E]: defns2
template xa(defns2: untyped) {.used.} =
edit_penta ip.second[V_A]: defns2
template xo(defns2: untyped) {.used.} =
edit_penta ip.second[V_O]: defns2
template xu(defns2: untyped) {.used.} =
edit_penta ip.second[V_U]: defns2
make_icosaprocs()
# NOTE: first extremes is exts, second extremes is elems[*].exts
idefns
template icosapenta(iortho: string, iname: string, idefns: untyped) =
block:
var ip {.inject.}: Icosapenta = Icosapenta(
spelling: iortho,
name: iname,
exts: BiExtremes(
first: Extremes(i: string.none, u: string.none),
second: Extremes(i: string.none, u: string.none)
)
)
for v in V:
penta iortho.replaceFirst(' ', Vowel2Char[v]), Vowel2Char[v] & "x " & iname:
ip.first[v] = p
penta iortho.replaceLast(' ', Vowel2Char[v]), "x" & Vowel2Char[v] & " " & iname:
ip.second[v] = p
edit_icosapenta(ip): idefns
dict.icosapentas[iortho] = ip
template edit_dm(thedm: DerivationalMorphology, dmbody: untyped) =
edit_dm_dsl(thedm):
dmbody
template dm(ortho: string, defns: untyped) =
block:
var w {.inject.} = DerivationalMorphology(spelling: ortho)
edit_dm(w): defns
dict.dms[ortho] = w
wbody
template dictionary*(body: untyped) =
var dict {.inject.}: Dictionary
dict.glyphs = @[]
template glyphs(gbody: untyped) =
glyph_dsl(dict):
gbody
template dialect(name: string, dbody: untyped) =
dialect_dsl(dict, name):
dbody
# TODO: add a words: proc to create and return a dm, so that within words
# you can use it
# e.g.
#
# words:
# let foo = dm "example-":
# noun "does something to nouns"
#
# word "example1":
# noun "does something once to nouns"
# by "1" via foo
# # or maybe?
# foo["1"]
template words(wbody: untyped) =
words_dsl(dict):
wbody
body
proc toJsonHook(attrs: set[GlyphAttribute]): JsonNode =
newJString(attrs.toSeq.join("-"))
proc toJsonHook(glyphs: seq[Glyph]): JsonNode =
result = newJObject()
for glyph in glyphs:
let kindname = ($glyph.kind).toLowerAscii
if kindname notin result:
result[kindname] = newJObject()
result[kindname][glyph.spelling] = glyph.attrs.toJson
proc toJsonHook(defns: Table[PartOfSpeech, Definition]): JsonNode =
result = newJObject()
for pos, defn in defns:
result[($pos).toLowerAscii] = defn.toJson
proc toJsonHook(words: seq[Word]): JsonNode =
result = newJObject()
for word in words:
result[word.spelling] = word.definitions.toJson
proc toJsonHook(exts: Extremes): JsonNode =
result = newJObject()
if exts.i.isSome:
result["i"] = newJString(exts.i.get)
if exts.u.isSome:
result["u"] = newJString(exts.u.get)
proc toJson(penta: Penta): JsonNode =
result = newJObject()
result["extremes"] = penta.exts.toJson
result["name"] = newJString(penta.name)
proc toJson(pentas: seq[Penta]): JsonNode =
result = newJObject()
for penta in pentas:
result[penta.spelling] = penta.toJson
proc toJson(exts: BiExtremes): JsonNode =
result = newJObject()
if exts.first.i.isSome:
result["ix"] = newJString(exts.first.i.get)
if exts.first.u.isSome:
result["ux"] = newJString(exts.first.u.get)
if exts.second.i.isSome:
result["xi"] = newJString(exts.second.i.get)
if exts.second.u.isSome:
result["xu"] = newJString(exts.second.u.get)
proc toJson(icosa: Icosapenta): JsonNode =
result = newJObject()
result["extremes"] = icosa.exts.toJson
result["name"] = newJString(icosa.name)
proc toJson(icosas: seq[Icosapenta]): JsonNode =
result = newJObject()
for icosa in icosas:
result[icosa.spelling] = icosa.toJson
proc toJsonHook(dict: Dictionary): JsonNode =
result = newJObject()
result["glyphs"] = dict.glyphs.toJson
result["dialects"] = dict.dialects.toJson
result["words"] = dict.words.values.toSeq.toJson
result["pentas"] = dict.pentas.toJson
result["icosas"] = dict.icosapentas.toJson
proc jsonify*(dict: Dictionary): string =
return $(dict.toJson)
proc `$`*(word: Word): string =
if word.definitions.len > 0:
return word.spelling & "(" & word.definitions.pairs.toSeq.map(proc(p: (PartOfSpeech, Definition)): string = $p[0] & ":" & p[1].brief).join(",") & ")"
return word.spelling
when isMainModule:
dictionary:
glyphs:
vowel "i", outer
vowel "y", both
cluster "θ", left, top
cluster "", left, middle
syllables()
punctuation "«", left
numeric "0", circle
dialect "jukashenikan":
replace "x", "ç"
dialect "gazhenigan":
replace "k", "g"
words:
dm "foo-":
noun "fooish"
word "t":
noun "thing", "See t - dmPenta for better meaning."
# verb "be"
penta "n x", "Pronouns":
extremes(i="Fully proximal", u="Fully distal")
i: pronoun "I/me"
icosapenta "n t t", "Tests":
ii: verb "foo"
word "foot":
noun "fooish thing"
via("t", "foo-")
# "t".via "foo-"
echo dict.jsonify

133
generation.cue Normal file
View file

@ -0,0 +1,133 @@
// 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}
}
}
},
]
}

View file

@ -1,3 +1,4 @@
// CUE definitions for the eventual output dictionary
package shenikan
_vowels: ["i", "e", "a", "o", "u"]
@ -26,18 +27,36 @@ _vowels: ["i", "e", "a", "o", "u"]
replacements: [...#Replacement]
}
#PartOfSpeech: "noun" | "pronoun" | "verb" | "adjective" | "adverb" | "syntax"
#PartOfSpeech: "noun" | "pronoun" | "verb" | "adjective" | "adverb" | "adposition" | "conjunction" | "syntax"
#Definition: {
pos: #PartOfSpeech
short: string
long?: string
}
#Word: {
#DerivationalMorphology: {
spelling: string
definitions: [...#Definition]
}
#DMPenta: {
spelling: string
name?: string
extremes?: {
i?: string
u?: string
}
}
#Derivation: {
root: string
via: [...string]
}
#Word: {
spelling: string
definitions: [...#Definition]
derivations: [...#Derivation]
}
#Penta: {
spelling: string
name?: string
extremes?: {
i?: string
@ -46,6 +65,7 @@ _vowels: ["i", "e", "a", "o", "u"]
}
#Icosa: {
spelling: string
name?: string
extremes?: {
ix?: string
@ -58,6 +78,8 @@ _vowels: ["i", "e", "a", "o", "u"]
dictionary: {
glyphs: [...#Glyph]
dialects: [...#Dialect]
dms: [...#DerivationalMorphology]
dmPentas: [...#DMPenta]
words: [...#Word]
pentas: [...#Penta]
icosas: [...#Icosa]