diff --git a/.github/workflows/check-inflections.yml b/.github/workflows/check-inflections.yml index 4246e77..6122c46 100644 --- a/.github/workflows/check-inflections.yml +++ b/.github/workflows/check-inflections.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - cache: "npm" + cache: "yarn" - name: run script run: | yarn install-r diff --git a/check-all-inflections.ts b/check-all-inflections.ts index 55aad43..2496cba 100644 --- a/check-all-inflections.ts +++ b/check-all-inflections.ts @@ -29,7 +29,7 @@ async function checkAll() { err: e.toString(), }); } - if (tp.isVerbEntry(entry)) { + if (tp.isVerbDictionaryEntry(entry)) { const complement = entry.l ? entries.find((e) => e.ts === entry.l) : undefined; @@ -41,6 +41,16 @@ async function checkAll() { err: "verb complement missing", }); } else { + try { + conjugateVerb(entry, complement); + } catch (e) { + errors.push({ + ts: entry.ts, + p: entry.p, + f: entry.f, + err: e, + }); + } } } }); diff --git a/package-lock.json b/package-lock.json index 0f5458b..1cfd8de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pashto-inflector", - "version": "7.4.0", + "version": "7.4.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pashto-inflector", - "version": "7.4.0", + "version": "7.4.1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 6fd4160..0c0b805 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pashto-inflector", - "version": "7.4.0", + "version": "7.4.1", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", @@ -79,4 +79,4 @@ ] }, "dependencies": {} -} \ No newline at end of file +} diff --git a/src/components/package-lock.json b/src/components/package-lock.json index 73fac23..08db85e 100644 --- a/src/components/package-lock.json +++ b/src/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lingdocs/ps-react", - "version": "7.4.0", + "version": "7.4.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@lingdocs/ps-react", - "version": "7.4.0", + "version": "7.4.1", "license": "MIT", "dependencies": { "@formkit/auto-animate": "^1.0.0-beta.3", diff --git a/src/components/package.json b/src/components/package.json index 5f83e53..b5b2344 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/ps-react", - "version": "7.4.0", + "version": "7.4.1", "description": "Pashto inflector library module with React components", "main": "dist/components/library.js", "module": "dist/components/library.js", diff --git a/src/lib/package.json b/src/lib/package.json index a2838b4..cc23ce5 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/inflect", - "version": "7.4.0", + "version": "7.4.1", "description": "Pashto inflector library", "main": "dist/index.js", "types": "dist/lib/library.d.ts", diff --git a/src/lib/src/dyn-comp-aux-verbs.ts b/src/lib/src/dyn-comp-aux-verbs.ts index ce5ba11..9e98945 100644 --- a/src/lib/src/dyn-comp-aux-verbs.ts +++ b/src/lib/src/dyn-comp-aux-verbs.ts @@ -576,4 +576,228 @@ export const dynamicAuxVerbs: Array<{ ec: "send,sends,sending,sent,sent", }, }, + { + entry: { + ts: 1577299232429, + i: 1770, + p: "بدلول", + f: "badlawúl", + g: "badlawul", + e: "to change, to adapt, exchange, replace", + r: 4, + c: "v. stat. comp. trans.", + l: 1577299160732, + ec: "change", + a: 1, + }, + complement: { + ts: 1577299160732, + i: 1761, + p: "بدل", + f: "badál", + g: "badal", + e: "changed, different, exchanged", + r: 4, + c: "adj.", + a: 1, + }, + }, + { + entry: { + ts: 1527812856, + i: 14629, + p: "لیکل", + f: "leekúl", + g: "leekul", + e: "to write, draw", + r: 3, + c: "v. trans./gramm. trans.", + ec: "write,writes,writing,wrote,written", + a: 1, + }, + }, + { + entry: { + ts: 1527812280, + i: 1425, + p: "اېښودل", + f: "exodúl", + g: "exodul", + e: "to put, put down, set in place, install, plant, plug in, invest, lay/build", + r: 4, + c: "v. trans.", + psp: "ږد", + psf: "Gd", + noOo: true, + a: 1, + }, + }, + { + entry: { + ts: 1527811395, + i: 6849, + p: "خپرول", + f: "khparawul", + g: "khparawul", + e: "to spread, disperse, open, unfold, publicize, distribute", + r: 3, + c: "v. stat. comp. trans.", + l: 1527816071, + ec: "spread,spreads,spreading,spread", + }, + complement: { + ts: 1527816071, + i: 6874, + p: "خپور", + f: "khpor", + g: "khpor", + e: "spread, dispersed, publicized, published", + r: 4, + c: "adj.", + infap: "خپاره", + infaf: "khpaaru", + infbp: "خپر", + infbf: "khpar", + }, + }, + { + entry: { + ts: 1527818218, + i: 18245, + p: "ویستل", + f: "weestul", + g: "weestul", + e: "to take out, throw out, drive out, discard, chuck, toss, extract", + r: 4, + c: "v. trans.", + psp: "باس", + psf: "báas", + ssp: "وباس", + ssf: "óobaas", + diacExcept: true, + a: 1, + }, + complement: { + ts: 1527818218, + i: 18245, + p: "ویستل", + f: "weestul", + g: "weestul", + e: "to take out, throw out, drive out, discard, chuck, toss, extract", + r: 4, + c: "v. trans.", + psp: "باس", + psf: "báas", + ssp: "وباس", + ssf: "óobaas", + diacExcept: true, + a: 1, + }, + }, + { + entry: { + ts: 1527811293, + i: 10992, + p: "ښودل", + f: "xodúl", + g: "xodul", + e: "to show; to teach; to suit, look good with (fig.), befit", + r: 4, + c: "v. trans.", + psp: "ښای", + psf: "xaay", + ec: "show,shows,showing,showed,shown", + a: 1, + }, + }, + { + entry: { + ts: 1527816012, + i: 14685, + p: "ماتول", + f: "maatawúl", + g: "maatawul", + e: "to break, split, defeat", + r: 4, + c: "v. stat. comp. trans.", + l: 1527816011, + ec: "break,breaks,breaking,broke,broken", + a: 1, + }, + complement: { + ts: 1527816011, + i: 14677, + p: "مات", + f: "maat", + g: "maat", + e: "broken, split, defeated", + r: 4, + c: "adj.", + a: 1, + }, + }, + { + entry: { + ts: 1527812222, + i: 6879, + p: "ختمول", + f: "khatumawúl", + g: "khatumawul", + e: "to finish, complete, end, use up, destroy, kill", + r: 4, + c: "v. stat. comp. trans.", + l: 1527812221, + ec: "finish", + a: 1, + }, + complement: { + ts: 1527812221, + i: 6878, + p: "ختم", + f: "khátum", + g: "khatum", + e: "finished, completed, ended, done", + r: 4, + c: "adj.", + a: 1, + }, + }, + { + entry: { + ts: 1527821309, + i: 2173, + p: "بندول", + f: "bandawúl", + g: "bandawul", + e: "to close, block, stop, barricade, cut off, restrain, hold back", + r: 3, + c: "v. stat. comp. trans.", + l: 1577301753727, + ec: "close", + a: 1, + }, + complement: { + ts: 1577301753727, + i: 2158, + p: "بند", + f: "band", + g: "band", + e: "closed, blocked, stopped", + c: "adj.", + a: 1, + }, + }, + { + entry: { + ts: 1527817750, + i: 9964, + p: "سکل", + f: "skul", + g: "skul", + e: "to drink", + r: 3, + c: "v. trans.", + ec: "drink,drinks,drinking,drank,drank", + }, + }, ]; diff --git a/src/lib/src/misc-helpers.ts b/src/lib/src/misc-helpers.ts index d48b1a6..00fa1ef 100644 --- a/src/lib/src/misc-helpers.ts +++ b/src/lib/src/misc-helpers.ts @@ -40,6 +40,10 @@ export function ensureNonComboVerbInfo(i: T.VerbInfo): T.NonComboVerbInfo { return "stative" in i ? i.stative : "transitive" in i ? i.transitive : i; } +export function ensureVerbConjugation(o: T.VerbOutput): T.VerbConjugation { + return "stative" in o ? o.stative : "transitive" in o ? o.transitive : o; +} + export function pickPersInf( s: T.OptionalPersonInflections, persInf: T.PersonInflectionsField diff --git a/src/lib/src/verb-conjugation.ts b/src/lib/src/verb-conjugation.ts index 3f28515..2e2697b 100644 --- a/src/lib/src/verb-conjugation.ts +++ b/src/lib/src/verb-conjugation.ts @@ -40,6 +40,8 @@ import { chooseParticipleInflection, spaceInForm, noPersInfs, + ensureNonComboVerbInfo, + ensureVerbConjugation, } from "./misc-helpers"; import * as T from "../../types"; @@ -74,16 +76,20 @@ export function conjugateVerb( if (info.type === "transitive or grammatically transitive simple") { return { info, - transitive: conjugateVerb( - { ...entry, c: entry.c ? entry.c.replace("/gramm. trans.", "") : "" }, - dummyEntry, - info.transitive - ) as T.VerbConjugation, - grammaticallyTransitive: conjugateVerb( - { ...entry, c: entry.c ? entry.c?.replace("trans./", "") : "" }, - dummyEntry, - info.grammaticallyTransitive - ) as T.VerbConjugation, + transitive: ensureVerbConjugation( + conjugateVerb( + { ...entry, c: entry.c ? entry.c.replace("/gramm. trans.", "") : "" }, + dummyEntry, + info.transitive + ) + ), + grammaticallyTransitive: ensureVerbConjugation( + conjugateVerb( + { ...entry, c: entry.c ? entry.c?.replace("trans./", "") : "" }, + dummyEntry, + info.grammaticallyTransitive + ) + ), }; } @@ -93,16 +99,20 @@ export function conjugateVerb( ) { return { info, - stative: conjugateVerb( - { ...entry, c: entry.c ? entry.c.replace("dyn./", "") : "" }, - dummyEntry, - info.stative - ) as T.VerbConjugation, - dynamic: conjugateVerb( - { ...entry, c: entry.c ? entry.c.replace("/stat.", "") : "" }, - dummyEntry, - info.dynamic - ) as T.VerbConjugation, + stative: ensureVerbConjugation( + conjugateVerb( + { ...entry, c: entry.c ? entry.c.replace("dyn./", "") : "" }, + dummyEntry, + info.stative + ) + ), + dynamic: ensureVerbConjugation( + conjugateVerb( + { ...entry, c: entry.c ? entry.c.replace("/stat.", "") : "" }, + dummyEntry, + info.dynamic + ) + ), }; } @@ -110,7 +120,7 @@ export function conjugateVerb( return conjugateDynamicCompound(info); } - const nonComboInfo = info as T.NonComboVerbInfo; + const nonComboInfo = ensureNonComboVerbInfo(info); const conjugation: T.VerbConjugation = { info: nonComboInfo, @@ -121,11 +131,9 @@ export function conjugateVerb( perfect: makePerfectContent(nonComboInfo), ...("singularForm" in info ? { - singularForm: conjugateVerb( - entry, - complement, - info.singularForm - ) as T.VerbConjugation, + singularForm: ensureVerbConjugation( + conjugateVerb(entry, complement, info.singularForm) + ), } : {}), // if transitive include passive voice @@ -153,7 +161,7 @@ function conjugateDynamicCompound( // && info.auxVerb.p === "کېدل" // ); const auxConj = enforceObject( - conjugateVerb(info.auxVerb, info.auxVerbComplement) as T.VerbConjugation, + ensureVerbConjugation(conjugateVerb(info.auxVerb, info.auxVerbComplement)), info.objComplement.person ); const complement = info.objComplement.plural diff --git a/src/lib/src/verb-info.ts b/src/lib/src/verb-info.ts index 6877d1b..27bd63a 100644 --- a/src/lib/src/verb-info.ts +++ b/src/lib/src/verb-info.ts @@ -45,6 +45,7 @@ import { getAuxTransitivity, chooseParticipleInflection, noPersInfs, + ensureNonComboVerbInfo, } from "./misc-helpers"; import * as T from "../../types"; import { isTlulVerb } from "./type-predicates"; @@ -283,10 +284,9 @@ function getDynamicCompoundInfo( const yulEnding = null; const objComplement = getObjComplementInfo(entry, comp, forceSingular); const auxVerb = getDynamicAuxVerb(entry); - const auxVerbInfo = getVerbInfo( - auxVerb.entry, - auxVerb.complement - ) as T.NonComboVerbInfo; + const auxVerbInfo = ensureNonComboVerbInfo( + getVerbInfo(auxVerb.entry, auxVerb.complement) + ); const compUsed = objComplement.plural ? objComplement.plural : objComplement.entry;