This commit is contained in:
adueck 2023-09-01 12:47:15 +04:00
parent a9c21d520a
commit 28f79729a4
8 changed files with 70 additions and 7 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "pashto-inflector", "name": "pashto-inflector",
"version": "6.0.7", "version": "6.0.8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pashto-inflector", "name": "pashto-inflector",
"version": "6.0.7", "version": "6.0.8",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "pashto-inflector", "name": "pashto-inflector",
"version": "6.0.7", "version": "6.0.8",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -1,12 +1,12 @@
{ {
"name": "@lingdocs/ps-react", "name": "@lingdocs/ps-react",
"version": "6.0.7", "version": "6.0.8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lingdocs/ps-react", "name": "@lingdocs/ps-react",
"version": "6.0.7", "version": "6.0.8",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@formkit/auto-animate": "^1.0.0-beta.3", "@formkit/auto-animate": "^1.0.0-beta.3",

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/ps-react", "name": "@lingdocs/ps-react",
"version": "6.0.7", "version": "6.0.8",
"description": "Pashto inflector library module with React components", "description": "Pashto inflector library module with React components",
"main": "dist/components/library.js", "main": "dist/components/library.js",
"module": "dist/components/library.js", "module": "dist/components/library.js",

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/inflect", "name": "@lingdocs/inflect",
"version": "6.0.7", "version": "6.0.8",
"description": "Pashto inflector library", "description": "Pashto inflector library",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/lib/library.d.ts", "types": "dist/lib/library.d.ts",

View File

@ -80,6 +80,7 @@ const kedulDyn = vEntry({
separationAtP: 1, separationAtP: 1,
separationAtF: 2, separationAtF: 2,
}); });
const ahkeestul = wordQuery("اخیستل", "verb");
const wahul = wordQuery("وهل", "verb"); const wahul = wordQuery("وهل", "verb");
const achawul = wordQuery("اچول", "verb"); const achawul = wordQuery("اچول", "verb");
const ganul = wordQuery("ګڼل", "verb"); const ganul = wordQuery("ګڼل", "verb");
@ -290,6 +291,44 @@ const tests: {
], ],
}, },
}, },
{
input: {
verb: ahkeestul,
tense: "perfectivePast",
subject: T.Person.FirstSingMale,
object: T.Person.ThirdSingMale,
voice: "active",
negative: false,
},
output: {
hasBa: false,
vbs: [
[{ type: "PH", ps: { p: "وا", f: "wáa" } }],
[
{
type: "VB",
ps: {
long: [{ p: "خیستلو", f: "kheestulo" }],
short: [
{ p: "خیست", f: "kheest" },
{
p: "خیسته",
f: "kheestu",
},
],
},
person: T.Person.ThirdSingMale,
info: {
type: "verb",
aspect: "perfective",
base: "root",
verb: ahkeestul,
},
},
],
],
},
},
], ],
}, },
{ {

View File

@ -377,6 +377,8 @@ function ensure3rdPast(
if (verb.entry.tppp && verb.entry.tppf) { if (verb.entry.tppp && verb.entry.tppf) {
const tpps = splitPsByVarients( const tpps = splitPsByVarients(
makePsString(verb.entry.tppp, verb.entry.tppf) makePsString(verb.entry.tppp, verb.entry.tppf)
).map((ps) =>
!verb.entry.sepOo && aspect === "perfective" ? takeOffAaStart(ps) : ps
); );
if (verb.entry.p === "وړل" && aspect === "perfective") { if (verb.entry.p === "وړل" && aspect === "perfective") {
return [ return [
@ -445,3 +447,23 @@ function removeAbility(
): T.VerbTense | T.ImperativeTense { ): T.VerbTense | T.ImperativeTense {
return tense.replace("Modal", "") as T.VerbTense | T.ImperativeTense; return tense.replace("Modal", "") as T.VerbTense | T.ImperativeTense;
} }
function takeOffAaStart(ps: T.PsString): T.PsString {
if (!["ا", "آ"].includes(ps.p[0])) {
return ps;
}
// TODO handle more than just the starting aa
if (["aa", "áa"].includes(ps.f.slice(0, 2))) {
return {
p: ps.p.slice(1),
f: ps.f.slice(2),
};
}
if (["a", "á"].includes(ps.f[0])) {
return {
p: ps.p.slice(1),
f: ps.f.slice(1),
};
}
return ps;
}

View File

@ -30,6 +30,8 @@ import { LookupFunction } from "./lookup";
// learn to use jq to edit selected json in vim ?? COOOL // learn to use jq to edit selected json in vim ?? COOOL
// TODO: test grammatically transitive stuff // TODO: test grammatically transitive stuff
// test bo ba ye dzee
// test raaba ye wree
export function parseVP( export function parseVP(
tokens: Readonly<T.Token[]>, tokens: Readonly<T.Token[]>,