From 4a6cb93a3dce18efd4fbb98a3a768f24ea91dec0 Mon Sep 17 00:00:00 2001 From: "D. Moonfire" Date: Sun, 8 Dec 2024 14:26:34 -0600 Subject: [PATCH] refactor: moving words into the right location --- convert | 73 ++++++++++++++++--- deno.lock | 2 +- package-lock.json | 37 +++++----- package.json | 2 +- src/dictionary/bo/{bozo.yaml => bojo.yaml} | 0 .../chi/{chisokoku.yaml => chisokuku.yaml} | 0 .../{cho/chobire.yaml => chyo/chyobire.yaml} | 0 .../{cho/chochi.yaml => chyo/chyochi.yaml} | 0 .../{cho/chon.yaml => chyo/chyon.yaml} | 0 .../{cho/chonesu.yaml => chyo/chyonesu.yaml} | 0 .../{cho/chota.yaml => chyo/chyota.yaml} | 0 .../chotafuchi.yaml => chyo/chyotafuchi.yaml} | 0 .../fa/{fapodi.yaml => fapode.yaml} | 0 .../ga/{gatiru.yaml => gachiru.yaml} | 0 .../ha/{hayoka.yaml => hagyoka.yaml} | 0 .../hi/{hiropadu.yaml => hiropado.yaml} | 0 .../hu/{hupodi.yaml => hupoji.yaml} | 0 .../hyu/{hyukadi.yaml => hyukada.yaml} | 0 .../jo/{jokotatsu.yaml => jokofatsu.yaml} | 0 src/dictionary/ka/{kadu.yaml => kado.yaml} | 0 .../ko/{kochozo.yaml => kochyojo.yaml} | 0 src/dictionary/ko/{kodi.yaml => kode.yaml} | 0 .../ko/{komiyaza.yaml => komishyaza.yaml} | 0 ...ashiokajudufa.yaml => mashiokazudofa.yaml} | 0 src/dictionary/{myo => myu}/myukira.yaml | 0 .../{n/netune.yaml => ne/netsune.yaml} | 0 src/dictionary/{n => no}/norikuchyofune.yaml | 0 src/dictionary/pa/{padu.yaml => pado.yaml} | 0 .../pi/{pimayazu.yaml => pimabyazu.yaml} | 0 src/dictionary/po/{pocho.yaml => pochyo.yaml} | 0 src/dictionary/po/{podi.yaml => poda.yaml} | 0 src/dictionary/ro/{rocho.yaml => rochyo.yaml} | 0 .../{ro/ryodifune.yaml => ryo/ryojifune.yaml} | 0 src/dictionary/u/{udimo.yaml => udemo.yaml} | 0 .../wu/{wuduna.yaml => wudona.yaml} | 0 src/grammar/syllables.md | 22 +++--- 36 files changed, 92 insertions(+), 44 deletions(-) rename src/dictionary/bo/{bozo.yaml => bojo.yaml} (100%) rename src/dictionary/chi/{chisokoku.yaml => chisokuku.yaml} (100%) rename src/dictionary/{cho/chobire.yaml => chyo/chyobire.yaml} (100%) rename src/dictionary/{cho/chochi.yaml => chyo/chyochi.yaml} (100%) rename src/dictionary/{cho/chon.yaml => chyo/chyon.yaml} (100%) rename src/dictionary/{cho/chonesu.yaml => chyo/chyonesu.yaml} (100%) rename src/dictionary/{cho/chota.yaml => chyo/chyota.yaml} (100%) rename src/dictionary/{cho/chotafuchi.yaml => chyo/chyotafuchi.yaml} (100%) rename src/dictionary/fa/{fapodi.yaml => fapode.yaml} (100%) rename src/dictionary/ga/{gatiru.yaml => gachiru.yaml} (100%) rename src/dictionary/ha/{hayoka.yaml => hagyoka.yaml} (100%) rename src/dictionary/hi/{hiropadu.yaml => hiropado.yaml} (100%) rename src/dictionary/hu/{hupodi.yaml => hupoji.yaml} (100%) rename src/dictionary/hyu/{hyukadi.yaml => hyukada.yaml} (100%) rename src/dictionary/jo/{jokotatsu.yaml => jokofatsu.yaml} (100%) rename src/dictionary/ka/{kadu.yaml => kado.yaml} (100%) rename src/dictionary/ko/{kochozo.yaml => kochyojo.yaml} (100%) rename src/dictionary/ko/{kodi.yaml => kode.yaml} (100%) rename src/dictionary/ko/{komiyaza.yaml => komishyaza.yaml} (100%) rename src/dictionary/ma/{mashiokajudufa.yaml => mashiokazudofa.yaml} (100%) rename src/dictionary/{myo => myu}/myukira.yaml (100%) rename src/dictionary/{n/netune.yaml => ne/netsune.yaml} (100%) rename src/dictionary/{n => no}/norikuchyofune.yaml (100%) rename src/dictionary/pa/{padu.yaml => pado.yaml} (100%) rename src/dictionary/pi/{pimayazu.yaml => pimabyazu.yaml} (100%) rename src/dictionary/po/{pocho.yaml => pochyo.yaml} (100%) rename src/dictionary/po/{podi.yaml => poda.yaml} (100%) rename src/dictionary/ro/{rocho.yaml => rochyo.yaml} (100%) rename src/dictionary/{ro/ryodifune.yaml => ryo/ryojifune.yaml} (100%) rename src/dictionary/u/{udimo.yaml => udemo.yaml} (100%) rename src/dictionary/wu/{wuduna.yaml => wudona.yaml} (100%) diff --git a/convert b/convert index 6244dba..95661f9 100755 --- a/convert +++ b/convert @@ -1,9 +1,7 @@ -#!/usr/bin/env -S deno --allow-read +#!/usr/bin/env -S deno --allow-read --allow-write import { parse, stringify } from "jsr:@std/yaml"; -import miwafu from "npm:fedran-miwafu@0.1.6"; - -console.log(miwafu); +import miwafu from "npm:@fedran/miwafu@0.2.1"; // Go through all the directories and parse each one. let done = false; @@ -52,6 +50,9 @@ for await (const rootEntry of Deno.readDir("src/dictionary")) { addGender(newLanguage, data.pos.verb, "verb", data.base); addList(newLanguage, data.pos.adv, "adv", data.base); addList(newLanguage, data.pos.adj, "adj", data.base); + addList(newLanguage, data.pos.num, "num", data.base); + addList(newLanguage, data.pos.pro, "pro", data.base); + addList(newLanguage, data.pos.part, "particle", data.base); // Write out the results. Deno.writeTextFile(filePath, stringify(newData)); @@ -73,6 +74,17 @@ function addGender( part: String, word: String, ) { + const m = miwafu.inflectMasculine(word); + + console.log( + "------", + word, + miwafu.splitSyllables(word), + m, + miwafu.inflectFeminine(word), + miwafu.inflectNeuter(word), + ); + if (gender) { addList(lang, gender.masculine, part, miwafu.inflectMasculine(word)); addList(lang, gender.feminine, part, miwafu.inflectFeminine(word)); @@ -87,10 +99,16 @@ function addPartList( word: String, ) { if (list) { + const p: NewPart = { + word, + definitions: [], + }; + lang.parts[part] ??= []; + lang.parts[part].push(p); for (const def of list) { - add(lang.parts[part], def, part, word); + add(p, def, part, word); } } } @@ -102,23 +120,48 @@ function addList( word: String, ) { if (list) { + let p: NewPart = { + word, + definitions: [], + }; + lang.parts[part] ??= []; + lang.parts[part].push(p); for (const def of list) { - add(lang.parts[part], def, part, word); + add(p, def, part, word); } } } -function add(dest: NewPart[], def: OldDefinition, part: String, word: String) { +function add(dest: NewPart, def: OldDefinition, part: String, word: String) { + // Create the top-level reference. console.log("**** def", part, word, def); - const newPart: NewPart = { - word: word, - definitions: [{ definition: def.def }], - }; + const newPart = { definition: def.def }; - dest.push(newPart); + dest.definitions.push(newPart); + + // Add in the various tags. + if (def.oow) { + newPart.tags ??= []; + newPart.tags.push("reality"); + } + + // See if we have references. + if (def.reference) { + newPart.references = def.reference + .map(o => { + const ref = o.url + ?.replace("https://fedran.com/", "") + ?.replace(/\/chapter-0*(\d+)\//, "/$1"); + + return { + ref, + excerpt: o.excerpt?.trimEnd(), + }; + }); + } } // Define the old data format. @@ -177,6 +220,12 @@ interface NewLanguage { interface NewPart { word: String; + definitions: NewDef[]; +} + +interface NewDef { + definition: String; + tags?: string[]; } /* diff --git a/deno.lock b/deno.lock index 5557117..b5060bf 100644 --- a/deno.lock +++ b/deno.lock @@ -13,9 +13,9 @@ "dependencies": [ "npm:@commitlint/cli@^7.2.1", "npm:@commitlint/config-conventional@^7.1.2", + "npm:@fedran/miwafu@~0.2.1", "npm:commitizen@^3.0.5", "npm:cz-conventional-changelog@^2.1.0", - "npm:fedran-miwafu@~0.1.6", "npm:fs-extra@^7.0.1", "npm:husky@^1.2.1", "npm:js-yaml@^3.13.1", diff --git a/package-lock.json b/package-lock.json index 9e4f731..6ab93c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "miwafu", "dependencies": { - "fedran-miwafu": "^0.1.6" + "@fedran/miwafu": "^0.2.1" }, "devDependencies": { "@commitlint/cli": "^7.2.1", @@ -325,6 +325,22 @@ "node": ">=4" } }, + "node_modules/@fedran/miwafu": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@fedran/miwafu/-/miwafu-0.2.1.tgz", + "integrity": "sha512-bj6KnNQKhOoRbewQXP25lT/cc/cFjSIsjbdiH51TvrFN41RTWGv+PHwRf0K68vURZys3Qgx82KBm59EmCueIdw==", + "license": "MIT", + "dependencies": { + "handlebars": "^4.0.11", + "handlebars-helpers": "^0.10.0", + "js-yaml": "^3.10.0", + "lodash": "^4.17.4", + "yargs": "^10.0.3" + }, + "bin": { + "fedran-miwafu": "lib/cli.js" + } + }, "node_modules/@marionebl/sander": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/@marionebl/sander/-/sander-0.6.1.tgz", @@ -2126,24 +2142,6 @@ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, - "node_modules/fedran-miwafu": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/fedran-miwafu/-/fedran-miwafu-0.1.6.tgz", - "integrity": "sha512-aY6cH6a2zYgQbjeX8RCl7WL9tQRvvxGIT3ZOi4bLBSuwHGOwyqM/+mxftzY1z17GIBIJb8FX3m59K+MS54Hzyw==", - "deprecated": "use @fedran/miwafu instead because groups are prettier", - "license": "MIT", - "dependencies": { - "handlebars": "^4.0.11", - "handlebars-helpers": "^0.10.0", - "js-yaml": "^3.10.0", - "lodash": "^4.17.4", - "typescript": "^2.6.2", - "yargs": "^10.0.3" - }, - "bin": { - "fedran-miwafu": "src/cli.js" - } - }, "node_modules/figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", @@ -6052,6 +6050,7 @@ "version": "2.9.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index da1ea62..3e7f533 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,6 @@ } }, "dependencies": { - "fedran-miwafu": "^0.1.6" + "@fedran/miwafu": "^0.2.1" } } diff --git a/src/dictionary/bo/bozo.yaml b/src/dictionary/bo/bojo.yaml similarity index 100% rename from src/dictionary/bo/bozo.yaml rename to src/dictionary/bo/bojo.yaml diff --git a/src/dictionary/chi/chisokoku.yaml b/src/dictionary/chi/chisokuku.yaml similarity index 100% rename from src/dictionary/chi/chisokoku.yaml rename to src/dictionary/chi/chisokuku.yaml diff --git a/src/dictionary/cho/chobire.yaml b/src/dictionary/chyo/chyobire.yaml similarity index 100% rename from src/dictionary/cho/chobire.yaml rename to src/dictionary/chyo/chyobire.yaml diff --git a/src/dictionary/cho/chochi.yaml b/src/dictionary/chyo/chyochi.yaml similarity index 100% rename from src/dictionary/cho/chochi.yaml rename to src/dictionary/chyo/chyochi.yaml diff --git a/src/dictionary/cho/chon.yaml b/src/dictionary/chyo/chyon.yaml similarity index 100% rename from src/dictionary/cho/chon.yaml rename to src/dictionary/chyo/chyon.yaml diff --git a/src/dictionary/cho/chonesu.yaml b/src/dictionary/chyo/chyonesu.yaml similarity index 100% rename from src/dictionary/cho/chonesu.yaml rename to src/dictionary/chyo/chyonesu.yaml diff --git a/src/dictionary/cho/chota.yaml b/src/dictionary/chyo/chyota.yaml similarity index 100% rename from src/dictionary/cho/chota.yaml rename to src/dictionary/chyo/chyota.yaml diff --git a/src/dictionary/cho/chotafuchi.yaml b/src/dictionary/chyo/chyotafuchi.yaml similarity index 100% rename from src/dictionary/cho/chotafuchi.yaml rename to src/dictionary/chyo/chyotafuchi.yaml diff --git a/src/dictionary/fa/fapodi.yaml b/src/dictionary/fa/fapode.yaml similarity index 100% rename from src/dictionary/fa/fapodi.yaml rename to src/dictionary/fa/fapode.yaml diff --git a/src/dictionary/ga/gatiru.yaml b/src/dictionary/ga/gachiru.yaml similarity index 100% rename from src/dictionary/ga/gatiru.yaml rename to src/dictionary/ga/gachiru.yaml diff --git a/src/dictionary/ha/hayoka.yaml b/src/dictionary/ha/hagyoka.yaml similarity index 100% rename from src/dictionary/ha/hayoka.yaml rename to src/dictionary/ha/hagyoka.yaml diff --git a/src/dictionary/hi/hiropadu.yaml b/src/dictionary/hi/hiropado.yaml similarity index 100% rename from src/dictionary/hi/hiropadu.yaml rename to src/dictionary/hi/hiropado.yaml diff --git a/src/dictionary/hu/hupodi.yaml b/src/dictionary/hu/hupoji.yaml similarity index 100% rename from src/dictionary/hu/hupodi.yaml rename to src/dictionary/hu/hupoji.yaml diff --git a/src/dictionary/hyu/hyukadi.yaml b/src/dictionary/hyu/hyukada.yaml similarity index 100% rename from src/dictionary/hyu/hyukadi.yaml rename to src/dictionary/hyu/hyukada.yaml diff --git a/src/dictionary/jo/jokotatsu.yaml b/src/dictionary/jo/jokofatsu.yaml similarity index 100% rename from src/dictionary/jo/jokotatsu.yaml rename to src/dictionary/jo/jokofatsu.yaml diff --git a/src/dictionary/ka/kadu.yaml b/src/dictionary/ka/kado.yaml similarity index 100% rename from src/dictionary/ka/kadu.yaml rename to src/dictionary/ka/kado.yaml diff --git a/src/dictionary/ko/kochozo.yaml b/src/dictionary/ko/kochyojo.yaml similarity index 100% rename from src/dictionary/ko/kochozo.yaml rename to src/dictionary/ko/kochyojo.yaml diff --git a/src/dictionary/ko/kodi.yaml b/src/dictionary/ko/kode.yaml similarity index 100% rename from src/dictionary/ko/kodi.yaml rename to src/dictionary/ko/kode.yaml diff --git a/src/dictionary/ko/komiyaza.yaml b/src/dictionary/ko/komishyaza.yaml similarity index 100% rename from src/dictionary/ko/komiyaza.yaml rename to src/dictionary/ko/komishyaza.yaml diff --git a/src/dictionary/ma/mashiokajudufa.yaml b/src/dictionary/ma/mashiokazudofa.yaml similarity index 100% rename from src/dictionary/ma/mashiokajudufa.yaml rename to src/dictionary/ma/mashiokazudofa.yaml diff --git a/src/dictionary/myo/myukira.yaml b/src/dictionary/myu/myukira.yaml similarity index 100% rename from src/dictionary/myo/myukira.yaml rename to src/dictionary/myu/myukira.yaml diff --git a/src/dictionary/n/netune.yaml b/src/dictionary/ne/netsune.yaml similarity index 100% rename from src/dictionary/n/netune.yaml rename to src/dictionary/ne/netsune.yaml diff --git a/src/dictionary/n/norikuchyofune.yaml b/src/dictionary/no/norikuchyofune.yaml similarity index 100% rename from src/dictionary/n/norikuchyofune.yaml rename to src/dictionary/no/norikuchyofune.yaml diff --git a/src/dictionary/pa/padu.yaml b/src/dictionary/pa/pado.yaml similarity index 100% rename from src/dictionary/pa/padu.yaml rename to src/dictionary/pa/pado.yaml diff --git a/src/dictionary/pi/pimayazu.yaml b/src/dictionary/pi/pimabyazu.yaml similarity index 100% rename from src/dictionary/pi/pimayazu.yaml rename to src/dictionary/pi/pimabyazu.yaml diff --git a/src/dictionary/po/pocho.yaml b/src/dictionary/po/pochyo.yaml similarity index 100% rename from src/dictionary/po/pocho.yaml rename to src/dictionary/po/pochyo.yaml diff --git a/src/dictionary/po/podi.yaml b/src/dictionary/po/poda.yaml similarity index 100% rename from src/dictionary/po/podi.yaml rename to src/dictionary/po/poda.yaml diff --git a/src/dictionary/ro/rocho.yaml b/src/dictionary/ro/rochyo.yaml similarity index 100% rename from src/dictionary/ro/rocho.yaml rename to src/dictionary/ro/rochyo.yaml diff --git a/src/dictionary/ro/ryodifune.yaml b/src/dictionary/ryo/ryojifune.yaml similarity index 100% rename from src/dictionary/ro/ryodifune.yaml rename to src/dictionary/ryo/ryojifune.yaml diff --git a/src/dictionary/u/udimo.yaml b/src/dictionary/u/udemo.yaml similarity index 100% rename from src/dictionary/u/udimo.yaml rename to src/dictionary/u/udemo.yaml diff --git a/src/dictionary/wu/wuduna.yaml b/src/dictionary/wu/wudona.yaml similarity index 100% rename from src/dictionary/wu/wuduna.yaml rename to src/dictionary/wu/wudona.yaml diff --git a/src/grammar/syllables.md b/src/grammar/syllables.md index 7448769..f0b6b3b 100644 --- a/src/grammar/syllables.md +++ b/src/grammar/syllables.md @@ -6,17 +6,17 @@ The basic units of Miwāfu are syllables. These are represented as a single glyp # Syllable Chart -- | w | r | m | p | b | h | n | d | t | z | s | g | k | f | - | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---- | --- | ---- | --- | --- | --- | - | a | wa | ra | ma | pa | ba | ha | na | da | ta | za | sa | ga | ka | fa | - | e | we | re | me | pe | be | he | ne | de | te | ze | se | ge | ke | fe | - | i | wi | ri | mi | pi | bi | hi | ni | | chi | ji | shi | gi | ki | fi | - | o | wo | ro | mo | po | bo | ho | no | do | to | jo | so | go | ko | fo | - | u | wu | ru | mu | pu | bu | hu | nu | | tsu | zu | su | gu | ku | fu | - | ya | | rya | mya | pya | bya | hya | nya | | chya | jya | shya | gya | kya | - | yo | | ryo | myo | pyo | byo | hyo | nyo | | chyo | jyo | shyo | gyo | kyo | - | yu | | ryu | myu | pyu | byu | hyu | nyu | | chyu | jyu | shyu | gyu | kyu | - | | | | | | | n | | | | | | | +| \* | w | r | m | p | b | h | n | d | t | z | s | g | k | f | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | ---- | --- | ---- | --- | --- | --- | +| a | wa | ra | ma | pa | ba | ha | na | da | ta | za | sa | ga | ka | fa | +| e | we | re | me | pe | be | he | ne | de | te | ze | se | ge | ke | fe | +| i | wi | ri | mi | pi | bi | hi | ni | | chi | ji | shi | gi | ki | fi | +| o | wo | ro | mo | po | bo | ho | no | do | to | jo | so | go | ko | fo | +| u | wu | ru | mu | pu | bu | hu | nu | | tsu | zu | su | gu | ku | fu | +| ya | | rya | mya | pya | bya | hya | nya | | chya | jya | shya | gya | kya | | +| yo | | ryo | myo | pyo | byo | hyo | nyo | | chyo | jyo | shyo | gyo | kyo | | +| yu | | ryu | myu | pyu | byu | hyu | nyu | | chyu | jyu | shyu | gyu | kyu | | +| | | | | | | | n | | | | | | | | # Penultimate Accents