add inflection for weedu

This commit is contained in:
lingdocs 2021-08-31 13:34:18 +04:00
parent 745a7333ba
commit ffcae9bdaa
3 changed files with 50 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "0.9.0", "version": "0.9.1",
"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

@ -164,6 +164,30 @@ const adjectives: Array<{
], ],
}, },
}, },
// adjective ending in u
{
in: {
ts: 1527812791,
p: "ویده",
f: "weedú",
g: "weedu",
e: "asleep",
c: "adj.",
i: 1,
},
out: {
masc: [
[{p: "ویده", f: "weedú"}],
[{p: "ویده", f: "weedú"}],
[{p: "ویدو", f: "weedó"}],
],
fem: [
[{p: "ویده", f: "weedá"}],
[{p: "ویدې", f: "weedé"}],
[{p: "ویدو", f: "weedó"}],
],
},
},
// adjective non-inflecting // adjective non-inflecting
{ {
in: { in: {

View File

@ -11,7 +11,11 @@ import {
concatInflections, concatInflections,
splitDoubleWord, splitDoubleWord,
ensureUnisexInflections, ensureUnisexInflections,
makePsString,
} from "./p-text-helpers"; } from "./p-text-helpers";
import {
removeAccents,
} from "./accent-helpers";
import * as T from "../types"; import * as T from "../types";
const endingInSingleARegex = /[^a]'??[aá]'??$/; const endingInSingleARegex = /[^a]'??[aá]'??$/;
@ -61,6 +65,9 @@ function handleUnisexWord(word: T.DictionaryEntry): T.Inflections | false {
if (pEnd === "ی" && f.slice(-2) === "ey") { if (pEnd === "ی" && f.slice(-2) === "ey") {
return inflectRegularYeyUnisex(word.p, f); return inflectRegularYeyUnisex(word.p, f);
} }
if (pEnd === "ه" && word.g.slice(-1) === "u") {
return inflectRegularShwaEndingUnisex(word.p, f);
}
if (pEnd === "ی" && f.slice(-2) === "éy") { if (pEnd === "ی" && f.slice(-2) === "éy") {
return inflectEmphasizedYeyUnisex(word.p, f); return inflectEmphasizedYeyUnisex(word.p, f);
} }
@ -166,6 +173,24 @@ export function inflectRegularYeyUnisex(p: string, f: string): T.UnisexInflectio
}; };
} }
export function inflectRegularShwaEndingUnisex(pr: string, fr: string): T.UnisexInflections {
const { p, f } = removeAccents(makePsString(pr, fr));
const baseP = p.slice(0, -1);
const baseF = f.slice(0, -1);
return {
masc: [
[{p: `${baseP}ه`, f: `${baseF}ú`}],
[{p: `${baseP}ه`, f: `${baseF}ú`}],
[{p: `${baseP}و`, f: `${baseF}ó`}],
],
fem: [
[{p: `${baseP}ه`, f: `${baseF}á`}],
[{p: `${baseP}ې`, f: `${baseF}é`}],
[{p: `${baseP}و`, f: `${baseF}ó`}],
],
};
}
function inflectEmphasizedYeyUnisex(p: string, f: string): T.UnisexInflections { function inflectEmphasizedYeyUnisex(p: string, f: string): T.UnisexInflections {
const baseP = p.slice(0, -1); const baseP = p.slice(0, -1);
const baseF = f.slice(0, -2); const baseF = f.slice(0, -2);