partway into phonetics conversion

This commit is contained in:
adueck 2023-07-26 18:48:18 +04:00
parent 0846fee749
commit fc97db0dd3
21 changed files with 27578 additions and 13078 deletions

View File

@ -7,93 +7,101 @@
*/
import { makePsString } from "./accent-and-ps-utils";
import {
accentOnFront,
accentPastParticiple,
accentFSylsOnNFromEnd,
accentOnNFromEnd,
splitUpSyllables,
hasAccents,
countSyllables,
import {
accentOnFront,
accentPastParticiple,
accentFSylsOnNFromEnd,
accentOnNFromEnd,
splitUpSyllables,
hasAccents,
countSyllables,
} from "./accent-helpers";
const toAccentFront = [
{
input: makePsString("پرېښودل", "prexodúl"),
output: makePsString("پرېښودل", "préxodul"),
{
input: makePsString("پرېښودل", "prexodúl"),
output: makePsString("پرېښودل", "préxodul"),
},
{
input: {
long: makePsString("وګرځېد", "oogurdzed"),
short: makePsString("وګرځ", "oogurdz"),
},
{
input: {
long: makePsString("وګرځېد", "oogurdzed"),
short: makePsString("وګرځ", "oogurdz"),
},
output: {
long: makePsString("وګرځېد", "óogurdzed"),
short: makePsString("وګرځ", "óogurdz"),
},
output: {
long: makePsString("وګرځېد", "óogurdzed"),
short: makePsString("وګرځ", "óogurdz"),
},
},
];
test(`accentOnFront should work`, () => {
toAccentFront.forEach((item) => {
expect(accentOnFront(item.input)).toEqual(item.output);
});
toAccentFront.forEach((item) => {
expect(accentOnFront(item.input)).toEqual(item.output);
});
});
const toAccentPastParticiple = [
{
input: makePsString("پرېښی", "prexey"),
output: makePsString("پرېښی", "préxey"),
},
{
input: makePsString("ازمویلی", "azmoyuley"),
output: makePsString("ازمویلی", "azmóyuley"),
},
{
input: makePsString("پرېښی", "prexay"),
output: makePsString("پرېښی", "préxay"),
},
{
input: makePsString("ازمویلی", "azmoyulay"),
output: makePsString("ازمویلی", "azmóyulay"),
},
];
test(`accentPastParticiple should work`, () => {
toAccentPastParticiple.forEach((item) => {
expect(accentPastParticiple(item.input)).toEqual(item.output);
});
toAccentPastParticiple.forEach((item) => {
expect(accentPastParticiple(item.input)).toEqual(item.output);
});
});
test(`splitUpSyllables should work`, () => {
expect(splitUpSyllables("akheestul")).toEqual(["akh", "eest", "ul"]);
expect(splitUpSyllables("akheestul")).toEqual(["akh", "eest", "ul"]);
});
test("countSyllables", () => {
expect(countSyllables("saRéy")).toEqual(2);
expect(countSyllables("saRey")).toEqual(2);
expect(countSyllables("zRú")).toEqual(1);
expect(countSyllables("zRu")).toEqual(1);
expect(countSyllables("zRU")).toEqual(1);
expect(countSyllables("tbtkz")).toEqual(0);
expect(countSyllables({ p: "اونۍ", f: "onúy, ownúy" })).toEqual(2);
expect(countSyllables("saRáy")).toEqual(2);
expect(countSyllables("saRay")).toEqual(2);
expect(countSyllables("zRú")).toEqual(1);
expect(countSyllables("zRu")).toEqual(1);
expect(countSyllables("zRU")).toEqual(1);
expect(countSyllables("tbtkz")).toEqual(0);
expect(countSyllables({ p: "اونۍ", f: "onúy, ownúy" })).toEqual(2);
});
test(`accentOnFSylsOnNFromEnd should work`, () => {
expect(accentFSylsOnNFromEnd(["pu", "xtaa", "nu"], 0)).toBe("puxtaanú");
expect(accentFSylsOnNFromEnd(["leed", "ul", "ey"], 1)).toBe("leedúley");
expect(accentFSylsOnNFromEnd(["pu", "xtaa", "nu"], 0)).toBe("puxtaanú");
expect(accentFSylsOnNFromEnd(["leed", "ul", "ay"], 1)).toBe("leedúlay");
});
test(`accentOnNFromEnd should work`, () => {
expect(accentOnNFromEnd({ p: "پښتانه", f: "puxtaanu" }, 0)).toEqual({
p: "پښتانه",
f: "puxtaanú",
});
expect(accentOnNFromEnd({ p: "لیدلی", f: "leedúley" }, 1)).toEqual({
p: "لیدلی",
f: "leedúley",
});
expect(accentOnNFromEnd({ p: "پښتانه", f: "puxtaanu" }, 0)).toEqual({
p: "پښتانه",
f: "puxtaanú",
});
expect(accentOnNFromEnd({ p: "لیدلی", f: "leedúlay" }, 1)).toEqual({
p: "لیدلی",
f: "leedúlay",
});
});
test(`has accents should work`, () => {
const accents = ["koRanúy", "wutáaq", "gÚta", "taté", "bít", "sóra", "kúcha"];
const noAccents = ["koRanuy", "wutaaq", "gUta", "tate", "bit", "sora", "kucha"];
accents.forEach((x) => {
expect(hasAccents(x)).toBe(true);
});
noAccents.forEach((x) => {
expect(hasAccents(x)).toBe(false);
});
})
const accents = ["koRanúy", "wutáaq", "gÚta", "taté", "bít", "sóra", "kúcha"];
const noAccents = [
"koRanuy",
"wutaaq",
"gUta",
"tate",
"bit",
"sora",
"kucha",
];
accents.forEach((x) => {
expect(hasAccents(x)).toBe(true);
});
noAccents.forEach((x) => {
expect(hasAccents(x)).toBe(false);
});
});

View File

@ -38,12 +38,12 @@ export function accentOnFront(
}
/**
* Ensures an accent on a past participle ie. leedúley, préxey, azmóyuley
* Ensures an accent on a past participle ie. leedúlay, préxay, azmóyulay
*
* @param s - the Pashto string (with Pashto and Phonetics) to ensure the accent on
*/
export function accentPastParticiple(s: T.PsString): T.PsString {
// check for accent placing in words like wáayuley and azmóyuley
// check for accent placing in words like wáayulay and azmóyulay
const accentFallsOnThirdLast = (syls: string[]) => {
if (syls.length < 3) return false;
const secondLast = syls[syls.length - 2];
@ -64,7 +64,7 @@ export function accentPastParticiple(s: T.PsString): T.PsString {
export function splitUpSyllables(f: string): string[] {
return (
f.match(
/ |([^a|á|e|é|i|í|o|ó|u|ú| ]*(aa|áa|a|á|ey|éy|ee|ée|e|é|oo|óo|o|ó|i|í|u|ú)[^a|á|e|é|i|í|o|ó|u|ú| ]*)/gi
/ |([^a|á|e|é|i|í|o|ó|u|ú| ]*(aa|áa|a|á|ay|áy|ee|ée|e|é|oo|óo|o|ó|i|í|u|ú)[^a|á|e|é|i|í|o|ó|u|ú| ]*)/gi
) || ([] as string[])
);
}

View File

@ -10,422 +10,536 @@ import * as T from "../../types";
// TODO: Automatice syncing of aux verbs from dictionary
export const dynamicAuxVerbs: Array<
{
entry: T.DictionaryEntry,
complement?: T.DictionaryEntry,
}
> = [
{
entry: {"ts":1527812752,"i":11033,"p":"کول","f":"kawul","g":"kawul","e":"to do (an action or activity)","r":4,"c":"v. trans./gramm. trans.","ssp":"وکړ","ssf":"óokR","prp":"وکړل","prf":"óokRul","pprtp":"کړی","pprtf":"kúRey","separationAtP":1,"separationAtF":2,"diacExcept":true,"ec":"do,does,doing,did,done"},
export const dynamicAuxVerbs: Array<{
entry: T.DictionaryEntry;
complement?: T.DictionaryEntry;
}> = [
{
entry: {
ts: 1527812752,
i: 11033,
p: "کول",
f: "kawul",
g: "kawul",
e: "to do (an action or activity)",
r: 4,
c: "v. trans./gramm. trans.",
ssp: "وکړ",
ssf: "óokR",
prp: "وکړل",
prf: "óokRul",
pprtp: "کړی",
pprtf: "kúRay",
separationAtP: 1,
separationAtF: 2,
diacExcept: true,
ec: "do,does,doing,did,done",
},
{
entry: {"i":10122,"ts":1527812754,g: "","p":"کېدل","f":"kedul","e":"to happen, occur","c":"v. intrans. irreg. aux. dyn.","ssp":"وش","ssf":"óosh","prp":"وشول","prf":"óoshwul","pprtp":"شوی","pprtf":"shúwey","diacExcept":true},
},
{
entry: {
i: 10122,
ts: 1527812754,
g: "",
p: "کېدل",
f: "kedul",
e: "to happen, occur",
c: "v. intrans. irreg. aux. dyn.",
ssp: "وش",
ssf: "óosh",
prp: "وشول",
prf: "óoshwul",
pprtp: "شوی",
pprtf: "shúway",
diacExcept: true,
},
{
entry: {
ts:1527813914,
p:"ورکول",
f:"wărkawul",
g: "",
e:"to give (to him, her, them, others)",
c: "v. trans.",
i:12350,
},
},
{
entry: {
ts: 1527813914,
p: "ورکول",
f: "wărkawul",
g: "",
e: "to give (to him, her, them, others)",
c: "v. trans.",
i: 12350,
},
{
entry: {
ts: 1527812157,
p: "تېرول",
f: "terawul",
g: "",
e: "to pass (time), to take across, to pass, endure (difficulties)",
c: "v. stat. comp. trans.",
l: 1527813139,
i: 3459,
},
complement: {"i":3774,"ts":1527813139,g: "","p":"تېر","f":"ter","e":"last, past, previous, passed, gone over","c":"adj."},
},
{
entry: {
ts: 1527812157,
p: "تېرول",
f: "terawul",
g: "",
e: "to pass (time), to take across, to pass, endure (difficulties)",
c: "v. stat. comp. trans.",
l: 1527813139,
i: 3459,
},
{
entry: {"ts":1527815399,"i":15049,"p":"وهل","f":"wahul","g":"wahul","e":"to hit","r":4,"c":"v. trans.","tppp":"واهه","tppf":"waahu","ec":"hit,hits,hitting,hit,hit"},
complement: {
i: 3774,
ts: 1527813139,
g: "",
p: "تېر",
f: "ter",
e: "last, past, previous, passed, gone over",
c: "adj.",
},
{
entry: {
ts: 1527817026,
p: "کښل",
f: "kxul",
g: "",
e: "to drag, pull, take out, draw, get",
c: "v. trans.",
i: 8862,
},
},
{
entry: {
ts: 1527815399,
i: 15049,
p: "وهل",
f: "wahul",
g: "wahul",
e: "to hit",
r: 4,
c: "v. trans.",
tppp: "واهه",
tppf: "waahu",
ec: "hit,hits,hitting,hit,hit",
},
{
entry: {
ts: 1527814084,
p: "لګول",
f: "lagawul",
g: "",
e: "to touch, join, use, take, place",
c: "v. trans.",
i: 9794,
},
},
{
entry: {
ts: 1527817026,
p: "کښل",
f: "kxul",
g: "",
e: "to drag, pull, take out, draw, get",
c: "v. trans.",
i: 8862,
},
{
entry: {
ts: 1527814084,
p: "لګول",
f: "lagawul",
g: "",
e: "to touch, join, use, take, place",
c: "v. trans.",
i: 9794,
}
},
{
entry: {
ts: 1527814084,
p: "لګول",
f: "lagawul",
g: "",
e: "to touch, join, use, take, place",
c: "v. trans.",
i: 9794,
},
{
entry: {
ts: 1527817013,
p: "ویل",
f: "wayul, wayl",
g: "",
e: "to say, to tell",
c: "v. trans. indir.",
i: 12229,
},
},
{
entry: {
ts: 1527814084,
p: "لګول",
f: "lagawul",
g: "",
e: "to touch, join, use, take, place",
c: "v. trans.",
i: 9794,
},
{
entry: {
ts: 1527815396,
p: "وایل",
f: "waayul",
g: "",
e: "to say, to tell",
c: "v. trans. indir.",
i: 11929,
},
},
{
entry: {
ts: 1527817013,
p: "ویل",
f: "wayul, wayl",
g: "",
e: "to say, to tell",
c: "v. trans. indir.",
i: 12229,
},
{
entry: {
ts: 1527812447,
p: "اخستل",
f: "akhustul",
g: "",
e: "to take, buy, purchase, receive; to shave, cut with scissors",
c: "v. trans.",
i: 251,
psp: "اخل",
psf: "akhl",
},
},
{
entry: {
ts: 1527815396,
p: "وایل",
f: "waayul",
g: "",
e: "to say, to tell",
c: "v. trans. indir.",
i: 11929,
},
{
entry: {
ts: 1527817298,
p: "اخیستل",
f: "akheestul",
g: "",
e: "to take, buy, purchase, receive; to shave, cut with scissors",
c: "v. trans.",
i: 266,
},
},
{
entry: {
ts: 1527812447,
p: "اخستل",
f: "akhustul",
g: "",
e: "to take, buy, purchase, receive; to shave, cut with scissors",
c: "v. trans.",
i: 251,
psp: "اخل",
psf: "akhl",
},
{
entry: {
ts: 1527814617,
p: "نیول",
f: "neewul",
g: "",
e: "to catch, grab, take, arrest; bear (fruit)",
c: "v. trans. irreg.",
i: 11880,
psp: "نیس",
psf: "nees",
},
},
{
entry: {
ts: 1527817298,
p: "اخیستل",
f: "akheestul",
g: "",
e: "to take, buy, purchase, receive; to shave, cut with scissors",
c: "v. trans.",
i: 266,
},
{
entry: {
ts: 1527811872,
p: "اچول",
f: "achawul",
g: "",
e: "to pour, drop, throw, put on",
c: "v. trans.",
i: 194,
},
},
{
entry: {
ts: 1527814617,
p: "نیول",
f: "neewul",
g: "",
e: "to catch, grab, take, arrest; bear (fruit)",
c: "v. trans. irreg.",
i: 11880,
psp: "نیس",
psf: "nees",
},
{
entry: {
ts: 1527812790,
p: "خوړل",
f: "khoRul",
g: "",
e: "to eat, to bite",
c: "v. trans.",
i: 4769,
psp: "خور",
psf: "khor",
tppp: "خوړ",
tppf: "khoR",
},
},
{
entry: {
ts: 1527811872,
p: "اچول",
f: "achawul",
g: "",
e: "to pour, drop, throw, put on",
c: "v. trans.",
i: 194,
},
{
entry: {
ts: 1527811868,
p: "غښتل",
f: "ghuxtul",
g: "",
e: "to twist, curl, roll up, wrap up",
c: "v. trans.",
i: 7958,
},
},
{
entry: {
ts: 1527812790,
p: "خوړل",
f: "khoRul",
g: "",
e: "to eat, to bite",
c: "v. trans.",
i: 4769,
psp: "خور",
psf: "khor",
tppp: "خوړ",
tppf: "khoR",
},
{
entry: {
ts: 1527816127,
p: "اړول",
f: "aRawul",
g: "",
e: "to turn over, flip over; convert, change; to move over to, establish oneself in a new spot; divert, turn away, hijack; oblige, force",
c: "v. trans.",
i: 389,
},
},
{
entry: {
ts: 1527811868,
p: "غښتل",
f: "ghuxtul",
g: "",
e: "to twist, curl, roll up, wrap up",
c: "v. trans.",
i: 7958,
},
{
entry: {
ts: 1527812868,
p: "لرل",
f: "larul",
g: "",
e: "to have, possess",
c: "v. trans.",
i: 9707,
tppp: "لاره",
tppf: "laaru",
},
},
{
entry: {
ts: 1527816127,
p: "اړول",
f: "aRawul",
g: "",
e: "to turn over, flip over; convert, change; to move over to, establish oneself in a new spot; divert, turn away, hijack; oblige, force",
c: "v. trans.",
i: 389,
},
{
entry: {
ts: 1527813572,
p: "رسول",
f: "rasawul",
g: "",
e: "to deliver, to make arrive, provide, send, supply, bring to,",
c: "v. trans.",
i: 5897,
},
},
{
entry: {
ts: 1527812868,
p: "لرل",
f: "larul",
g: "",
e: "to have, possess",
c: "v. trans.",
i: 9707,
tppp: "لاره",
tppf: "laaru",
},
{
entry: {
ts: 1581619940636,
p: "باسل",
f: "baasul",
g: "",
e: "to take out, extract, pull out, tear out",
c: "v. trans.",
i: 1115,
},
},
{
entry: {
ts: 1527813572,
p: "رسول",
f: "rasawul",
g: "",
e: "to deliver, to make arrive, provide, send, supply, bring to,",
c: "v. trans.",
i: 5897,
},
{
entry: {
ts: 1527816146,
p: "ایستل",
f: "eestul",
g: "",
e: "to throw out, discard, chuck, toss; to extract, to take out",
c: "v. trans.",
i: 1025,
psp: "باس",
psf: "baas",
},
},
{
entry: {
ts: 1581619940636,
p: "باسل",
f: "baasul",
g: "",
e: "to take out, extract, pull out, tear out",
c: "v. trans.",
i: 1115,
},
{
entry: {
ts: 1527818123,
p: "څنډل",
f: "tsanDúl",
g: "",
e: "to shake out, shake off, brush aside",
c: "v. trans.",
i: 4975,
tppp: "څانډ",
tppf: "tsaanD",
},
},
{
entry: {
ts: 1527816146,
p: "ایستل",
f: "eestul",
g: "",
e: "to throw out, discard, chuck, toss; to extract, to take out",
c: "v. trans.",
i: 1025,
psp: "باس",
psf: "baas",
},
{
entry: {
ts: 1527814862,
p: "وژل",
f: "wajzul",
g: "",
e: "to kill, slaughter",
c: "v. trans. irreg.",
i: 12071,
psp: "وژن",
psf: "wajzn",
tppp: "واژه",
tppf: "waajzu",
},
},
{
entry: {
ts: 1527818123,
p: "څنډل",
f: "tsanDúl",
g: "",
e: "to shake out, shake off, brush aside",
c: "v. trans.",
i: 4975,
tppp: "څانډ",
tppf: "tsaanD",
},
{
entry: {
ts: 1527813019,
p: "ګرول",
f: "grawul",
g: "",
e: "to scratch, scrape",
c: "v. trans.",
i: 9370,
},
},
{
entry: {
ts: 1527814862,
p: "وژل",
f: "wajzul",
g: "",
e: "to kill, slaughter",
c: "v. trans. irreg.",
i: 12071,
psp: "وژن",
psf: "wajzn",
tppp: "واژه",
tppf: "waajzu",
},
{
entry: {
ts: 1527818260,
p: "بادول",
f: "baadawúl",
g: "",
e: "to winnow, toss, throw to the wind, squander",
c: "v. stat. comp. trans.",
l: 1527816345,
i: 1088,
},
complement: {
ts: 1527816345,
p: "باد",
f: "baad",
g: "",
e: "wind, air; swelling, rheumitism",
c: "n. m.",
i: 1076,
},
},
{
entry: {
ts: 1527813019,
p: "ګرول",
f: "grawul",
g: "",
e: "to scratch, scrape",
c: "v. trans.",
i: 9370,
},
{
entry: {
ts: 1527815343,
p: "تېرېدل",
f: "teredul",
g: "",
e: "to pass, go across, go by",
c: "v. stat. comp. intrans.",
l: 1527813139,
i: 3461,
},
complement: {
ts: 1527813139,
p: "تېر",
f: "ter",
g: "",
e: "last, past, previous, passed, gone over",
c: "adj.",
i: 3449,
},
},
{
entry: {
ts: 1527818260,
p: "بادول",
f: "baadawúl",
g: "",
e: "to winnow, toss, throw to the wind, squander",
c: "v. stat. comp. trans.",
l: 1527816345,
i: 1088,
},
{
entry: {
ts: 1571859113828,
p: "پخول",
f: "pukhawul",
g: "",
e: "to cook, prepare, to cause to ripen",
c: "v. stat. comp. trans.",
l: 1574867531681,
i: 2011,
},
complement: {
ts: 1574867531681,
p: "پوخ",
f: "pokh",
g: "",
e: "mature, ripe, ready, cooked, able, skillful, experienced, tried, tested, true",
c: "adj. irreg.",
i: 2321,
infap: "پاخه",
infaf: "paakhu",
infbp: "پخ",
infbf: "pakh",
},
complement: {
ts: 1527816345,
p: "باد",
f: "baad",
g: "",
e: "wind, air; swelling, rheumitism",
c: "n. m.",
i: 1076,
},
{
entry: {
ts: 1527817706,
p: "ټکول",
f: "Takawul",
g: "",
e: "to knock, tap",
c: "v. trans.",
i: 3568,
},
},
{
entry: {
ts: 1527815343,
p: "تېرېدل",
f: "teredul",
g: "",
e: "to pass, go across, go by",
c: "v. stat. comp. intrans.",
l: 1527813139,
i: 3461,
},
{
entry: {
ts: 1527812869,
p: "لټول",
f: "luTawul",
g: "",
e: "to search, seek",
c: "v. trans.",
i: 9686,
},
complement: {
ts: 1527813139,
p: "تېر",
f: "ter",
g: "",
e: "last, past, previous, passed, gone over",
c: "adj.",
i: 3449,
},
{
entry: {
ts: 1574784362578,
p: "ډنګول",
f: "Dangawul",
g: "",
e: "to make sound, to make ring out, to meat to make a sound (like a symbal, pan, etc.)",
c: "v. trans.",
i: 5653,
},
},
{
entry: {
ts: 1571859113828,
p: "پخول",
f: "pukhawul",
g: "",
e: "to cook, prepare, to cause to ripen",
c: "v. stat. comp. trans.",
l: 1574867531681,
i: 2011,
},
{
entry: {
ts: 1527811289,
p: "کېنول",
f: "kenawul",
g: "",
e: "to seat, to make or have someone sit down",
c: "v. trans.",
i: 9240,
noOo: true,
},
complement: {
ts: 1574867531681,
p: "پوخ",
f: "pokh",
g: "",
e: "mature, ripe, ready, cooked, able, skillful, experienced, tried, tested, true",
c: "adj. irreg.",
i: 2321,
infap: "پاخه",
infaf: "paakhu",
infbp: "پخ",
infbf: "pakh",
},
{
entry: {
ts: 1527812873,
p: "لوستل",
f: "lwustul",
g: "",
e: "to read, study",
c: "v. trans. irreg.",
i: 10163,
psp: "لول",
psf: "lwul",
},
},
{
entry: {
ts: 1527817706,
p: "ټکول",
f: "Takawul",
g: "",
e: "to knock, tap",
c: "v. trans.",
i: 3568,
},
{
entry: {
i:4362,
ts:1527814586,
p:"چلول",
f:"chalawul",
g: "",
e:"to drive, operate, handle, put forward, circulate",
c:"v. trans.",
},
},
{
entry: {
ts: 1527812869,
p: "لټول",
f: "luTawul",
g: "",
e: "to search, seek",
c: "v. trans.",
i: 9686,
},
{
entry: {"i":6731,"ts":1527815240,"p":"ساتل","f":"saatul",g: "","e":"to keep, protect, watch over; to hold","c":"v. trans."},
},
{
entry: {
ts: 1574784362578,
p: "ډنګول",
f: "Dangawul",
g: "",
e: "to make sound, to make ring out, to meat to make a sound (like a symbal, pan, etc.)",
c: "v. trans.",
i: 5653,
},
{
entry: {"i":11782,"ts":1527814053,"p":"موندل","f":"moondúl",g: "","e":"to find, acquire, discover, get","c":"v. trans. irreg.","psp":"موم","psf":"moom"},
},
{
entry: {
ts: 1527811289,
p: "کېنول",
f: "kenawul",
g: "",
e: "to seat, to make or have someone sit down",
c: "v. trans.",
i: 9240,
noOo: true,
},
{
entry: {"i":4212,"ts":1527812712,"p":"جوړول",g: "","f":"joRawul","e":"to make, form, build, mend","l":1527812711,"c":"v. stat. comp. trans."},
complement: {"i":4206,"ts":1527812711,g: "","p":"جوړ","f":"joR","e":"well, healthy, whole, made","c":"adj."},
},
{
entry: {
ts: 1527812873,
p: "لوستل",
f: "lwustul",
g: "",
e: "to read, study",
c: "v. trans. irreg.",
i: 10163,
psp: "لول",
psf: "lwul",
},
{
entry: {"i":13869,"ts":1527816865,g: "","p":"وړل","f":"wuRúl, oRúl, wRul","e":"to take, carry, bear, move (inanimate objects); to win, earn (subjunctive یوسي - yósee or ویسي - wéesee, simple past یو یې وړلو - yo ye wRulo)","separationAtP":2,"separationAtF":2,"c":"v. trans. irreg.","ssp":"یوس","ssf":"yos","prp":"یوړل","prf":"yóRul","noOo":true,"diacExcept":true},
},
{
entry: {
i: 4362,
ts: 1527814586,
p: "چلول",
f: "chalawul",
g: "",
e: "to drive, operate, handle, put forward, circulate",
c: "v. trans.",
},
{
entry: {"i":6503,"ts":1527815214,g: "","p":"راوړل","f":"raawRúl","e":"to bring, deliver (inanimate objects)","separationAtP":2,"separationAtF":3,"c":"v. trans. irreg.","noOo":true},
},
{
entry: {
i: 6731,
ts: 1527815240,
p: "ساتل",
f: "saatul",
g: "",
e: "to keep, protect, watch over; to hold",
c: "v. trans.",
},
},
{
entry: {
i: 11782,
ts: 1527814053,
p: "موندل",
f: "moondúl",
g: "",
e: "to find, acquire, discover, get",
c: "v. trans. irreg.",
psp: "موم",
psf: "moom",
},
},
{
entry: {
i: 4212,
ts: 1527812712,
p: "جوړول",
g: "",
f: "joRawul",
e: "to make, form, build, mend",
l: 1527812711,
c: "v. stat. comp. trans.",
},
complement: {
i: 4206,
ts: 1527812711,
g: "",
p: "جوړ",
f: "joR",
e: "well, healthy, whole, made",
c: "adj.",
},
},
{
entry: {
i: 13869,
ts: 1527816865,
g: "",
p: "وړل",
f: "wuRúl, oRúl, wRul",
e: "to take, carry, bear, move (inanimate objects); to win, earn (subjunctive یوسي - yósee or ویسي - wéesee, simple past یو یې وړلو - yo ye wRulo)",
separationAtP: 2,
separationAtF: 2,
c: "v. trans. irreg.",
ssp: "یوس",
ssf: "yos",
prp: "یوړل",
prf: "yóRul",
noOo: true,
diacExcept: true,
},
},
{
entry: {
i: 6503,
ts: 1527815214,
g: "",
p: "راوړل",
f: "raawRúl",
e: "to bring, deliver (inanimate objects)",
separationAtP: 2,
separationAtF: 3,
c: "v. trans. irreg.",
noOo: true,
},
},
];

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +1,29 @@
import * as T from "../../types";
import {
isFemNounEntry,
isNounEntry,
isPattern1Entry,
isPattern2Entry,
isPattern3Entry,
isPattern4Entry,
isPattern5Entry,
isPattern6FemEntry,
isFemNounEntry,
isNounEntry,
isPattern1Entry,
isPattern2Entry,
isPattern3Entry,
isPattern4Entry,
isPattern5Entry,
isPattern6FemEntry,
} from "./type-predicates";
export function getInflectionPattern(e: T.NounEntry | T.AdjectiveEntry): T.InflectionPattern {
return isPattern1Entry(e)
? T.InflectionPattern.Basic
: isPattern2Entry(e)
? T.InflectionPattern.UnstressedEy
: isPattern3Entry(e)
? T.InflectionPattern.StressedEy
: isPattern4Entry(e)
? T.InflectionPattern.Pashtun
: isPattern5Entry(e)
? T.InflectionPattern.Squish
: isNounEntry(e) && isFemNounEntry(e) && isPattern6FemEntry(e)
? T.InflectionPattern.FemInanEe
: T.InflectionPattern.None;
}
export function getInflectionPattern(
e: T.NounEntry | T.AdjectiveEntry
): T.InflectionPattern {
return isPattern1Entry(e)
? T.InflectionPattern.Basic
: isPattern2Entry(e)
? T.InflectionPattern.UnstressedAy
: isPattern3Entry(e)
? T.InflectionPattern.StressedAy
: isPattern4Entry(e)
? T.InflectionPattern.Pashtun
: isPattern5Entry(e)
? T.InflectionPattern.Squish
: isNounEntry(e) && isFemNounEntry(e) && isPattern6FemEntry(e)
? T.InflectionPattern.FemInanEe
: T.InflectionPattern.None;
}

File diff suppressed because it is too large Load Diff

View File

@ -2,232 +2,438 @@ import * as T from "../../../types";
import { makeVerbSelection } from "./make-verb-selection";
import { vEntry } from "./rs-helpers";
const wahul = vEntry({"ts":1527815399,"i":15049,"p":"وهل","f":"wahul","g":"wahul","e":"to hit","r":4,"c":"v. trans.","tppp":"واهه","tppf":"waahu","ec":"hit,hits,hitting,hit,hit"});
const kawulDyn = vEntry({"ts":1527812752,"i":11033,"p":"کول","f":"kawul","g":"kawul","e":"to do (an action or activity)","r":4,"c":"v. trans./gramm. trans.","ssp":"وکړ","ssf":"óokR","prp":"وکړل","prf":"óokRul","pprtp":"کړی","pprtf":"kúRey","diacExcept":true,"ec":"do,does,doing,did,done","separationAtP":1,"separationAtF":2});
const wahulNoC = vEntry({"ts":1527815399,"i":15049,"p":"وهل","f":"wahul","g":"wahul","e":"to hit","r":4,"tppp":"واهه","tppf":"waahu","ec":"hit,hits,hitting,hit,hit"});
const wahulNoC2 = vEntry({"ts":1527815399,"i":15049,"p":"وهل","f":"wahul","g":"wahul",c:"v","e":"to hit","r":4,"tppp":"واهه","tppf":"waahu","ec":"hit,hits,hitting,hit,hit"});
const khandul = vEntry({"ts":1527812767,"i":5896,"p":"خندل","f":"khandul","g":"khandul","e":"to laugh","r":4,"c":"v. gramm. trans.","psp":"خاند","psf":"khaand","ec":"laugh"});
const leedul = vEntry({"ts":1527812275,"i":12053,"p":"لیدل","f":"leedul","g":"leedul","e":"to see","r":4,"c":"v. trans./gramm. trans.","psp":"وین","psf":"ween","tppp":"لید","tppf":"leed","ec":"see,sees,seeing,saw,seen"});
const ghadzedul = vEntry({"ts":1527812615,"i":9500,"p":"غځېدل","f":"ghadzedul","g":"ghadzedul","e":"stretch out, lie, be extended, expand","r":3,"c":"v. intrans.","ec":"stretch","ep":"out"});
const wahul = vEntry({
ts: 1527815399,
i: 15049,
p: "وهل",
f: "wahul",
g: "wahul",
e: "to hit",
r: 4,
c: "v. trans.",
tppp: "واهه",
tppf: "waahu",
ec: "hit,hits,hitting,hit,hit",
});
const kawulDyn = vEntry({
ts: 1527812752,
i: 11033,
p: "کول",
f: "kawul",
g: "kawul",
e: "to do (an action or activity)",
r: 4,
c: "v. trans./gramm. trans.",
ssp: "وکړ",
ssf: "óokR",
prp: "وکړل",
prf: "óokRul",
pprtp: "کړی",
pprtf: "kúRay",
diacExcept: true,
ec: "do,does,doing,did,done",
separationAtP: 1,
separationAtF: 2,
});
const wahulNoC = vEntry({
ts: 1527815399,
i: 15049,
p: "وهل",
f: "wahul",
g: "wahul",
e: "to hit",
r: 4,
tppp: "واهه",
tppf: "waahu",
ec: "hit,hits,hitting,hit,hit",
});
const wahulNoC2 = vEntry({
ts: 1527815399,
i: 15049,
p: "وهل",
f: "wahul",
g: "wahul",
c: "v",
e: "to hit",
r: 4,
tppp: "واهه",
tppf: "waahu",
ec: "hit,hits,hitting,hit,hit",
});
const khandul = vEntry({
ts: 1527812767,
i: 5896,
p: "خندل",
f: "khandul",
g: "khandul",
e: "to laugh",
r: 4,
c: "v. gramm. trans.",
psp: "خاند",
psf: "khaand",
ec: "laugh",
});
const leedul = vEntry({
ts: 1527812275,
i: 12053,
p: "لیدل",
f: "leedul",
g: "leedul",
e: "to see",
r: 4,
c: "v. trans./gramm. trans.",
psp: "وین",
psf: "ween",
tppp: "لید",
tppf: "leed",
ec: "see,sees,seeing,saw,seen",
});
const ghadzedul = vEntry({
ts: 1527812615,
i: 9500,
p: "غځېدل",
f: "ghadzedul",
g: "ghadzedul",
e: "stretch out, lie, be extended, expand",
r: 3,
c: "v. intrans.",
ec: "stretch",
ep: "out",
});
const bandawul = vEntry(
{"ts":1527821309,"i":1792,"p":"بندول","f":"bandawul","g":"bandawul","e":"to close, block, stop, barricade, cut off, restrain, hold back","r":3,"c":"v. stat. comp. trans.","l":1577301753727,"ec":"close"},
{"ts":1577301753727,"i":1780,"p":"بند","f":"band","g":"band","e":"closed, blocked, stopped","c":"adj."},
{
ts: 1527821309,
i: 1792,
p: "بندول",
f: "bandawul",
g: "bandawul",
e: "to close, block, stop, barricade, cut off, restrain, hold back",
r: 3,
c: "v. stat. comp. trans.",
l: 1577301753727,
ec: "close",
},
{
ts: 1577301753727,
i: 1780,
p: "بند",
f: "band",
g: "band",
e: "closed, blocked, stopped",
c: "adj.",
}
);
const bandedul = vEntry(
{"ts":1588781671306,"i":1796,"p":"بندېدل","f":"bandedúl","g":"bandedul","e":"to be closed, blocked, stopped","r":4,"c":"v. stat. comp. intrans.","l":1577301753727,"ec":"be","ep":"closed"},
{"ts":1577301753727,"i":1780,"p":"بند","f":"band","g":"band","e":"closed, blocked, stopped","c":"adj."},
{
ts: 1588781671306,
i: 1796,
p: "بندېدل",
f: "bandedúl",
g: "bandedul",
e: "to be closed, blocked, stopped",
r: 4,
c: "v. stat. comp. intrans.",
l: 1577301753727,
ec: "be",
ep: "closed",
},
{
ts: 1577301753727,
i: 1780,
p: "بند",
f: "band",
g: "band",
e: "closed, blocked, stopped",
c: "adj.",
}
);
const mundaWahul = vEntry(
{"ts":1527812939,"i":13322,"p":"منډه وهل","f":"munDa wahul","g":"munDawahul","e":"to run","r":4,"c":"v. dyn. comp. trans.","l":1527815805,"ec":"run,runs,running,ran,run"},
{"ts":1527815805,"i":13321,"p":"منډه","f":"múnDa","g":"munDa","e":"run, running","r":4,"c":"n. f."},
{
ts: 1527812939,
i: 13322,
p: "منډه وهل",
f: "munDa wahul",
g: "munDawahul",
e: "to run",
r: 4,
c: "v. dyn. comp. trans.",
l: 1527815805,
ec: "run,runs,running,ran,run",
},
{
ts: 1527815805,
i: 13321,
p: "منډه",
f: "múnDa",
g: "munDa",
e: "run, running",
r: 4,
c: "n. f.",
}
);
const istreeKawul = vEntry(
{"ts":1658796089458,"i":519,"p":"استري کول","f":"istree kawul","g":"istreekawul","e":"to iron (clothes etc.)","r":4,"c":"v. dyn./stat. comp. trans.","l":1658795458148,"ec":"iron"},
{"ts":1658795458148,"i":518,"p":"استري","f":"istree","g":"istree","e":"iron (for ironing clothes)","r":4,"c":"n. f."},
{
ts: 1658796089458,
i: 519,
p: "استري کول",
f: "istree kawul",
g: "istreekawul",
e: "to iron (clothes etc.)",
r: 4,
c: "v. dyn./stat. comp. trans.",
l: 1658795458148,
ec: "iron",
},
{
ts: 1658795458148,
i: 518,
p: "استري",
f: "istree",
g: "istree",
e: "iron (for ironing clothes)",
r: 4,
c: "n. f.",
}
);
const cheeghKawul = vEntry(
{"ts":1608137130992,"i":5190,"p":"چیغه کول","f":"chéegha kawul","g":"cheeghakawul","e":"to yell, scream, cry out","r":3,"c":"v. gen. stat./dyn. comp. trans.","l":1527813972},
{"ts":1527813972,"i":5189,"p":"چیغه","f":"chéegha","g":"cheegha","e":"yell, scream, cry","r":3,"c":"n. f."},
{
ts: 1608137130992,
i: 5190,
p: "چیغه کول",
f: "chéegha kawul",
g: "cheeghakawul",
e: "to yell, scream, cry out",
r: 3,
c: "v. gen. stat./dyn. comp. trans.",
l: 1527813972,
},
{
ts: 1527813972,
i: 5189,
p: "چیغه",
f: "chéegha",
g: "cheegha",
e: "yell, scream, cry",
r: 3,
c: "n. f.",
}
);
const kaarKawul = vEntry(
{"ts":1527812732,"i":10270,"p":"کار کول","f":"kaar kawul","g":"kaarkawul","e":"to work","r":4,"c":"v. dyn. comp. trans.","l":1527822084,"ec":"work"},
{"ts":1527822084,"i":10268,"p":"کار","f":"kaar","g":"kaar","e":"work, job, business, stuff to do","r":4,"c":"n. m."},
{
ts: 1527812732,
i: 10270,
p: "کار کول",
f: "kaar kawul",
g: "kaarkawul",
e: "to work",
r: 4,
c: "v. dyn. comp. trans.",
l: 1527822084,
ec: "work",
},
{
ts: 1527822084,
i: 10268,
p: "کار",
f: "kaar",
g: "kaar",
e: "work, job, business, stuff to do",
r: 4,
c: "n. m.",
}
);
const tests: {
verb: T.VerbEntry,
result: T.NewVerbSelection,
verb: T.VerbEntry;
result: T.NewVerbSelection;
}[] = [
{
verb: wahul,
result: {
type: "verb",
verb: wahul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: false,
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
{
verb: wahul,
result: {
type: "verb",
verb: wahul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: false,
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
{
verb: ghadzedul,
result: {
type: "verb",
verb: ghadzedul,
voice: "active",
canChangeVoice: false,
transitivity: "intransitive",
compound: false,
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
},
{
verb: ghadzedul,
result: {
type: "verb",
verb: ghadzedul,
voice: "active",
canChangeVoice: false,
transitivity: "intransitive",
compound: false,
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
{
verb: khandul,
result: {
type: "verb",
verb: khandul,
voice: "active",
canChangeVoice: false,
transitivity: "grammatically transitive",
compound: false,
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
},
{
verb: khandul,
result: {
type: "verb",
verb: khandul,
voice: "active",
canChangeVoice: false,
transitivity: "grammatically transitive",
compound: false,
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
{
verb: leedul,
result: {
type: "verb",
verb: leedul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: false,
canBeGenStat: false,
canChangeTransGenTrans: true,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
},
{
verb: leedul,
result: {
type: "verb",
verb: leedul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: false,
canBeGenStat: false,
canChangeTransGenTrans: true,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
{
verb: bandawul,
result: {
type: "verb",
verb: bandawul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: "stative",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
},
{
verb: bandawul,
result: {
type: "verb",
verb: bandawul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: "stative",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
{
verb: bandedul,
result: {
type: "verb",
verb: bandedul,
voice: "active",
canChangeVoice: false,
transitivity: "intransitive",
compound: "stative",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
},
{
verb: bandedul,
result: {
type: "verb",
verb: bandedul,
voice: "active",
canChangeVoice: false,
transitivity: "intransitive",
compound: "stative",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
},
{
verb: mundaWahul,
result: {
type: "verb",
verb: mundaWahul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: "dynamic",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
dynAuxVerb: wahul,
},
},
{
verb: mundaWahul,
result: {
type: "verb",
verb: mundaWahul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: "dynamic",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
dynAuxVerb: wahul,
},
{
verb: istreeKawul,
result: {
type: "verb",
verb: istreeKawul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: "stative",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: true,
negative: false,
tense: "presentVerb",
dynAuxVerb: kawulDyn,
},
},
{
verb: istreeKawul,
result: {
type: "verb",
verb: istreeKawul,
voice: "active",
canChangeVoice: true,
transitivity: "transitive",
compound: "stative",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: true,
negative: false,
tense: "presentVerb",
dynAuxVerb: kawulDyn,
},
{
verb: cheeghKawul,
result: {
type: "verb",
verb: cheeghKawul,
voice: "active",
canChangeVoice: false,
transitivity: "transitive",
compound: "dynamic",
canBeGenStat: true,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
dynAuxVerb: kawulDyn,
},
},
{
verb: cheeghKawul,
result: {
type: "verb",
verb: cheeghKawul,
voice: "active",
canChangeVoice: false,
transitivity: "transitive",
compound: "dynamic",
canBeGenStat: true,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
dynAuxVerb: kawulDyn,
},
{
verb: kaarKawul,
result: {
type: "verb",
verb: kaarKawul,
voice: "active",
canChangeVoice: false,
transitivity: "transitive",
compound: "dynamic",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
dynAuxVerb: kawulDyn,
},
},
{
verb: kaarKawul,
result: {
type: "verb",
verb: kaarKawul,
voice: "active",
canChangeVoice: false,
transitivity: "transitive",
compound: "dynamic",
canBeGenStat: false,
canChangeTransGenTrans: false,
variableRs: false,
canChangeStatDyn: false,
negative: false,
tense: "presentVerb",
dynAuxVerb: kawulDyn,
},
},
];
test("verb selection", () => {
tests.forEach(({ verb, result }) => {
expect(makeVerbSelection(verb))
.toEqual(result);
});
tests.forEach(({ verb, result }) => {
expect(makeVerbSelection(verb)).toEqual(result);
});
});
test("verb selection failures", () => {
expect(() => {
makeVerbSelection(wahulNoC);
}).toThrow();
expect(() => {
makeVerbSelection(wahulNoC2);
}).toThrow();
expect(() => {
makeVerbSelection(wahulNoC);
}).toThrow();
expect(() => {
makeVerbSelection(wahulNoC2);
}).toThrow();
});

View File

@ -1,9 +1,6 @@
import { renderVerb } from "./render-verb";
import { vEntry } from "./rs-helpers";
import * as T from "../../../types";
import { negate } from "rambda";
import { personToGenNum } from "../misc-helpers";
import { getTransitivity } from "../verb-info";
const wahul = vEntry({
ts: 1527815399,
@ -72,7 +69,7 @@ const kawulStat = vEntry({
prp: "کړل",
prf: "kRul",
pprtp: "کړی",
pprtf: "kúRey",
pprtf: "kúRay",
noOo: true,
ec: "make,makes,making,made,made",
});
@ -90,7 +87,7 @@ const kawulDyn = vEntry({
prp: "وکړل",
prf: "óokRul",
pprtp: "کړی",
pprtf: "kúRey",
pprtf: "kúRay",
diacExcept: true,
ec: "do,does,doing,did,done",
separationAtP: 1,
@ -110,7 +107,7 @@ const kedulStat = vEntry({
prp: "شول",
prf: "shwul",
pprtp: "شوی",
pprtf: "shúwey",
pprtf: "shúway",
noOo: true,
ec: "become",
});
@ -128,7 +125,7 @@ const kedulDyn = vEntry({
prp: "وشول",
prf: "óoshwul",
pprtp: "شوی",
pprtf: "shúwey",
pprtf: "shúway",
diacExcept: true,
ec: "happen",
separationAtP: 1,
@ -150,9 +147,9 @@ const raatlul = vEntry({
prp: "راغلل",
prf: "ráaghlul",
pprtp: "راغلی",
pprtf: "raaghúley",
pprtf: "raaghúlay",
tppp: "راغی",
tppf: "ráaghey",
tppf: "ráaghay",
noOo: true,
separationAtP: 2,
separationAtF: 3,
@ -174,9 +171,9 @@ const wartlul = vEntry({
prp: "ورغلل",
prf: "wárghlul",
pprtp: "ورغلی",
pprtf: "wărghúley",
pprtf: "wărghúlay",
tppp: "ورغی",
tppf: "wărghey",
tppf: "wărghay",
noOo: true,
separationAtP: 2,
separationAtF: 3,
@ -468,13 +465,13 @@ const bandedul = vEntry(
c: "adj.",
}
);
const stureyKawul = vEntry(
const sturayKawul = vEntry(
{
ts: 1591033078746,
i: 7877,
p: "ستړی کول",
f: "stuRey kawul",
g: "stuReykawul",
f: "stuRay kawul",
g: "stuRaykawul",
e: "to make tired, wear out",
r: 4,
c: "v. stat. comp. trans.",
@ -486,20 +483,20 @@ const stureyKawul = vEntry(
ts: 1527815306,
i: 7876,
p: "ستړی",
f: "stúRey",
g: "stuRey",
f: "stúRay",
g: "stuRay",
e: "tired",
r: 4,
c: "adj. / adv.",
}
);
const stureyKedul = vEntry(
const sturayKedul = vEntry(
{
ts: 1591033069786,
i: 7878,
p: "ستړی کېدل",
f: "stuRey kedul",
g: "stuReykedul",
f: "stuRay kedul",
g: "stuRaykedul",
e: "to get tired, fatigued",
r: 4,
c: "v. stat. comp. intrans.",
@ -511,8 +508,8 @@ const stureyKedul = vEntry(
ts: 1527815306,
i: 7876,
p: "ستړی",
f: "stúRey",
g: "stuRey",
f: "stúRay",
g: "stuRay",
e: "tired",
r: 4,
c: "adj. / adv.",
@ -1055,7 +1052,7 @@ test("special endings", () => {
[
{
type: "VB",
ps: [{ p: "غی", f: "ghey" }],
ps: [{ p: "غی", f: "ghay" }],
person: T.Person.ThirdSingMale,
},
],
@ -1069,7 +1066,7 @@ test("special endings", () => {
[
{
type: "VB",
ps: [{ p: "غی", f: "ghey" }],
ps: [{ p: "غی", f: "ghay" }],
person: T.Person.ThirdSingMale,
},
],
@ -1259,7 +1256,7 @@ test("imperative tenses", () => {
})
).toEqual({
hasBa: false,
vbs: [[], [{ type: "VB", ps: [{ p: "وهئ", f: "wahéyy" }], person: 8 }]],
vbs: [[], [{ type: "VB", ps: [{ p: "وهئ", f: "wahéy" }], person: 8 }]],
});
expect(
renderVerb({
@ -1272,7 +1269,7 @@ test("imperative tenses", () => {
})
).toEqual({
hasBa: false,
vbs: [[ooPh], [{ type: "VB", ps: [{ p: "وهئ", f: "waheyy" }], person: 9 }]],
vbs: [[ooPh], [{ type: "VB", ps: [{ p: "وهئ", f: "wahey" }], person: 9 }]],
});
});
@ -1295,11 +1292,11 @@ test("ability tenses", () => {
type: "VB",
ps: {
long: [
{ p: "وهلی", f: "wahúley" },
{ p: "وهلی", f: "wahúlay" },
{ p: "وهلای", f: "wahúlaay" },
],
short: [
{ p: "وهی", f: "wahéy" },
{ p: "وهی", f: "waháy" },
{ p: "وهای", f: "waháay" },
],
},
@ -1331,7 +1328,7 @@ test("perfect tenses", () => {
[
{
type: "VB",
ps: [{ p: "وهلی", f: "wahúley" }],
ps: [{ p: "وهلی", f: "wahúlay" }],
gender: "masc",
number: "singular",
},
@ -1359,7 +1356,7 @@ test("perfect tenses", () => {
[
{
type: "VB",
ps: [{ p: "وهلی", f: "wahúley" }],
ps: [{ p: "وهلی", f: "wahúlay" }],
gender: "masc",
number: "singular",
},
@ -1387,7 +1384,7 @@ test("perfect tenses", () => {
[
{
type: "VB",
ps: [{ p: "وهلی", f: "wahúley" }],
ps: [{ p: "وهلی", f: "wahúlay" }],
gender: "masc",
number: "singular",
},
@ -1443,7 +1440,7 @@ test("perfect tenses", () => {
[
{
type: "VB",
ps: [{ p: "وهلی", f: "wahúley" }],
ps: [{ p: "وهلی", f: "wahúlay" }],
gender: "masc",
number: "singular",
},
@ -1541,7 +1538,7 @@ test("perfect tenses", () => {
type: "VB",
ps: [
{ p: "وای", f: "waay" },
{ p: "وی", f: "wey" },
{ p: "وی", f: "way" },
],
person: T.Person.SecondSingFemale,
},
@ -1572,7 +1569,7 @@ test("perfect tenses", () => {
type: "VB",
ps: [
{ p: "وای", f: "waay" },
{ p: "وی", f: "wey" },
{ p: "وی", f: "way" },
],
person: T.Person.SecondSingFemale,
},
@ -1584,7 +1581,7 @@ test("perfect tenses", () => {
test("ending on complex verbs", () => {
expect(
renderVerb({
verb: stureyKawul,
verb: sturayKawul,
tense: "presentVerbModal",
subject: T.Person.SecondSingMale,
object: T.Person.ThirdSingFemale,
@ -1611,11 +1608,11 @@ test("ending on complex verbs", () => {
type: "VB",
ps: {
long: [
{ p: "کولی", f: "kawúley" },
{ p: "کولی", f: "kawúlay" },
{ p: "کولای", f: "kawúlaay" },
],
short: [
{ p: "کوی", f: "kawéy" },
{ p: "کوی", f: "kawáy" },
{ p: "کوای", f: "kawáay" },
],
},
@ -1631,7 +1628,7 @@ test("ending on complex verbs", () => {
});
expect(
renderVerb({
verb: stureyKawul,
verb: sturayKawul,
tense: "presentVerb",
subject: T.Person.SecondSingMale,
voice: "active",

View File

@ -230,7 +230,7 @@ function addEnding({
if (vb.ps.short[0].f === "ghl" && pastThird && basicForm) {
return {
...vb,
ps: [{ p: "غی", f: "ghey" }],
ps: [{ p: "غی", f: "ghay" }],
};
}
const endLong = getLength(end, "long");

View File

@ -53,7 +53,7 @@ const kawulStat = vEntry({
prp: "کړل",
prf: "kRul",
pprtp: "کړی",
pprtf: "kúRey",
pprtf: "kúRay",
noOo: true,
ec: "make,makes,making,made,made",
});
@ -71,7 +71,7 @@ const kawulDyn = vEntry({
prp: "وکړل",
prf: "óokRul",
pprtp: "کړی",
pprtf: "kúRey",
pprtf: "kúRay",
diacExcept: true,
ec: "do,does,doing,did,done",
separationAtP: 1,
@ -91,7 +91,7 @@ const kedulStat = vEntry({
prp: "شول",
prf: "shwul",
pprtp: "شوی",
pprtf: "shúwey",
pprtf: "shúway",
noOo: true,
ec: "become",
});
@ -109,7 +109,7 @@ const kedulDyn = vEntry({
prp: "وشول",
prf: "óoshwul",
pprtp: "شوی",
pprtf: "shúwey",
pprtf: "shúway",
diacExcept: true,
ec: "happen",
separationAtP: 1,
@ -131,9 +131,9 @@ const raatlul = vEntry({
prp: "راغلل",
prf: "ráaghlul",
pprtp: "راغلی",
pprtf: "raaghúley",
pprtf: "raaghúlay",
tppp: "راغی",
tppf: "ráaghey",
tppf: "ráaghay",
noOo: true,
separationAtP: 2,
separationAtF: 3,
@ -155,9 +155,9 @@ const wartlul = vEntry({
prp: "ورغلل",
prf: "wárghlul",
pprtp: "ورغلی",
pprtf: "wărghúley",
pprtf: "wărghúlay",
tppp: "ورغی",
tppf: "wărghey",
tppf: "wărghay",
noOo: true,
separationAtP: 2,
separationAtF: 3,
@ -434,13 +434,13 @@ const bandedul = vEntry(
c: "adj.",
}
);
const stureyKawul = vEntry(
const sturayKawul = vEntry(
{
ts: 1591033078746,
i: 7877,
p: "ستړی کول",
f: "stuRey kawul",
g: "stuReykawul",
f: "stuRay kawul",
g: "stuRaykawul",
e: "to make tired, wear out",
r: 4,
c: "v. stat. comp. trans.",
@ -452,20 +452,20 @@ const stureyKawul = vEntry(
ts: 1527815306,
i: 7876,
p: "ستړی",
f: "stúRey",
g: "stuRey",
f: "stúRay",
g: "stuRay",
e: "tired",
r: 4,
c: "adj. / adv.",
}
);
const stureyKedul = vEntry(
const sturayKedul = vEntry(
{
ts: 1591033069786,
i: 7878,
p: "ستړی کېدل",
f: "stuRey kedul",
g: "stuReykedul",
f: "stuRay kedul",
g: "stuRaykedul",
e: "to get tired, fatigued",
r: 4,
c: "v. stat. comp. intrans.",
@ -477,8 +477,8 @@ const stureyKedul = vEntry(
ts: 1527815306,
i: 7876,
p: "ستړی",
f: "stúRey",
g: "stuRey",
f: "stúRay",
g: "stuRay",
e: "tired",
r: 4,
c: "adj. / adv.",
@ -544,7 +544,7 @@ const warkawul = vEntry({
r: 4,
c: "v. trans.",
pprtp: "ورکړی",
pprtf: "wărkúRey",
pprtf: "wărkúRay",
ec: "give,gives,giving,gave,given",
});
const raakawul = vEntry({
@ -557,7 +557,7 @@ const raakawul = vEntry({
r: 4,
c: "v. trans.",
pprtp: "راکړی",
pprtf: "raakúRey",
pprtf: "raakúRay",
ec: "give,gives,giving,gave,given",
});
const darkawul = vEntry({
@ -569,7 +569,7 @@ const darkawul = vEntry({
e: "to give (to second person - you, you pl.)",
r: 4,
pprtp: "درکړی",
pprtf: "dărkúRey",
pprtf: "dărkúRay",
ec: "give,gives,giving,gave,given",
});
@ -677,7 +677,7 @@ describe("imperfective stems", () => {
"is welded together with the complement on seperated stative compounds",
tests: [
{
verb: stureyKawul,
verb: sturayKawul,
genderNumber: { gender: "fem", number: "singular" },
result: [
[],
@ -702,7 +702,7 @@ describe("imperfective stems", () => {
],
},
{
verb: stureyKedul,
verb: sturayKedul,
genderNumber: { gender: "fem", number: "singular" },
result: [
[],
@ -837,7 +837,7 @@ describe("imperfective roots", () => {
"is welded together with the complement on seperated stative compounds",
tests: [
{
verb: stureyKawul,
verb: sturayKawul,
genderNumber: { gender: "fem", number: "singular" },
result: [
[],
@ -865,7 +865,7 @@ describe("imperfective roots", () => {
],
},
{
verb: stureyKedul,
verb: sturayKedul,
genderNumber: { gender: "fem", number: "singular" },
result: [
[],
@ -1176,7 +1176,7 @@ describe("perfective stems", () => {
],
},
{
verb: stureyKedul,
verb: sturayKedul,
genderNumber: { gender: "masc", number: "plural" },
result: [
[
@ -1580,7 +1580,7 @@ describe("perfective roots", () => {
],
},
{
verb: stureyKedul,
verb: sturayKedul,
genderNumber: { gender: "masc", number: "plural" },
result: [
[
@ -1630,7 +1630,7 @@ describe("perfective roots", () => {
});
describe("past participles", () => {
test("for most verbs are just the imperfective root (imperative) plus ی - ey", () => {
test("for most verbs are just the imperfective root (imperative) plus ی - ay", () => {
expect(
getPastParticiple(rasedul, "active", {
gender: "masc",
@ -1638,7 +1638,7 @@ describe("past participles", () => {
})
).toEqual({
type: "VB",
ps: [{ p: "رسېدلی", f: "rasedúley" }],
ps: [{ p: "رسېدلی", f: "rasedúlay" }],
gender: "masc",
number: "singular",
});
@ -1739,7 +1739,7 @@ describe("past participles", () => {
})
).toEqual({
type: "VB",
ps: [{ p: "کړی", f: "kúRey" }],
ps: [{ p: "کړی", f: "kúRay" }],
gender: "masc",
number: "singular",
});
@ -1836,7 +1836,7 @@ describe("past participles", () => {
},
});
});
test("special passive forms for kawul verbs - kRul perfective root + shúwey", () => {
test("special passive forms for kawul verbs - kRul perfective root + shúway", () => {
expect(
getPastParticiple(kawulStat, "passive", {
gender: "masc",
@ -1850,7 +1850,7 @@ describe("past participles", () => {
},
right: {
type: "VB",
ps: [{ p: "شوی", f: "shúwey" }],
ps: [{ p: "شوی", f: "shúway" }],
gender: "masc",
number: "singular",
},
@ -1868,7 +1868,7 @@ describe("past participles", () => {
},
right: {
type: "VB",
ps: [{ p: "شوی", f: "shúwey" }],
ps: [{ p: "شوی", f: "shúway" }],
gender: "masc",
number: "singular",
},
@ -1934,11 +1934,11 @@ describe("ability roots and stems", () => {
type: "VB",
ps: {
long: [
{ p: "ختلی", f: "khatúley" },
{ p: "ختلی", f: "khatúlay" },
{ p: "ختلای", f: "khatúlaay" },
],
short: [
{ p: "ختی", f: "khatéy" },
{ p: "ختی", f: "khatáy" },
{ p: "ختای", f: "khatáay" },
],
},
@ -1962,11 +1962,11 @@ describe("ability roots and stems", () => {
type: "VB",
ps: {
long: [
{ p: "ختلی", f: "khatuley" },
{ p: "ختلی", f: "khatulay" },
{ p: "ختلای", f: "khatulaay" },
],
short: [
{ p: "ختی", f: "khatey" },
{ p: "ختی", f: "khatay" },
{ p: "ختای", f: "khataay" },
],
},
@ -1990,11 +1990,11 @@ describe("ability roots and stems", () => {
type: "VB",
ps: {
long: [
{ p: "ختلی", f: "khatúley" },
{ p: "ختلی", f: "khatúlay" },
{ p: "ختلای", f: "khatúlaay" },
],
short: [
{ p: "ختی", f: "khatéy" },
{ p: "ختی", f: "khatáy" },
{ p: "ختای", f: "khatáay" },
],
},
@ -2021,11 +2021,11 @@ describe("ability roots and stems", () => {
type: "VB",
ps: {
long: [
{ p: "ختلی", f: "khatuley" },
{ p: "ختلی", f: "khatulay" },
{ p: "ختلای", f: "khatulaay" },
],
short: [
{ p: "ختی", f: "khatey" },
{ p: "ختی", f: "khatay" },
{ p: "ختای", f: "khataay" },
],
},
@ -2057,11 +2057,11 @@ describe("ability roots and stems", () => {
type: "VB",
ps: {
long: [
{ p: "راتللی", f: "raatlúley" },
{ p: "راتللی", f: "raatlúlay" },
{ p: "راتللای", f: "raatlúlaay" },
],
short: [
{ p: "راتلی", f: "raatléy" },
{ p: "راتلی", f: "raatláy" },
{ p: "راتلای", f: "raatláay" },
],
},
@ -2085,11 +2085,11 @@ describe("ability roots and stems", () => {
type: "VB",
ps: {
long: [
{ p: "راتللی", f: "raatlúley" },
{ p: "راتللی", f: "raatlúlay" },
{ p: "راتللای", f: "raatlúlaay" },
],
short: [
{ p: "راتلی", f: "raatléy" },
{ p: "راتلی", f: "raatláy" },
{ p: "راتلای", f: "raatláay" },
],
},
@ -2118,11 +2118,11 @@ describe("ability roots and stems", () => {
type: "VB",
ps: {
long: [
{ p: "بندېدلی", f: "bandedúley" },
{ p: "بندېدلی", f: "bandedúlay" },
{ p: "بندېدلای", f: "bandedúlaay" },
],
short: [
{ p: "بندېدی", f: "bandedéy" },
{ p: "بندېدی", f: "bandedáy" },
{ p: "بندېدای", f: "bandedáay" },
],
},
@ -2158,11 +2158,11 @@ describe("ability roots and stems", () => {
type: "VB",
ps: {
long: [
{ p: "کېدلی", f: "kedúley" },
{ p: "کېدلی", f: "kedúlay" },
{ p: "کېدلای", f: "kedúlaay" },
],
short: [
{ p: "کېدی", f: "kedéy" },
{ p: "کېدی", f: "kedáy" },
{ p: "کېدای", f: "kedáay" },
],
},
@ -2393,7 +2393,7 @@ describe("passive roots and stems", () => {
]);
expect(
getRootStem({
verb: stureyKawul,
verb: sturayKawul,
aspect: "imperfective",
type: "basic",
voice: "passive",
@ -2416,7 +2416,7 @@ describe("passive roots and stems", () => {
type: "AdjComp",
ps: {
p: "ستړی",
f: "stuRey",
f: "stuRay",
},
gender: "masc",
number: "singular",

View File

@ -50,7 +50,7 @@ export const statVerb = {
prp: "شول",
prf: "shwul",
pprtp: "شوی",
pprtf: "shúwey",
pprtf: "shúway",
noOo: true,
ec: "become",
}),
@ -68,7 +68,7 @@ export const statVerb = {
prp: "کړل",
prf: "kRul",
pprtp: "کړی",
pprtf: "kúRey",
pprtf: "kúRay",
noOo: true,
ec: "make,makes,making,made,made",
}),
@ -183,7 +183,7 @@ export function getPastParticiple(
ps: T.SingleOrLengthOpts<T.PsString[]>
): T.SingleOrLengthOpts<T.PsString[]> {
return fmapSingleOrLengthOpts((x) => {
const withTail = concatPsString(x[0], { p: "ی", f: "ey" });
const withTail = concatPsString(x[0], { p: "ی", f: "ay" });
return inflectPattern3(withTail, { gender, number });
}, ps);
}

View File

@ -1,7 +1,18 @@
import * as T from "../../../types";
import { removeFVarients } from "../accent-and-ps-utils";
import { accentOnNFromEnd, accentPsSyllable, countSyllables, removeAccents, removeAccentsWLength } from "../accent-helpers";
import { concatPsString, isUnisexSet, psStringFromEntry, trimOffPs } from "../p-text-helpers";
import {
accentOnNFromEnd,
accentPsSyllable,
countSyllables,
removeAccents,
removeAccentsWLength,
} from "../accent-helpers";
import {
concatPsString,
isUnisexSet,
psStringFromEntry,
trimOffPs,
} from "../p-text-helpers";
import { inflectPattern1 } from "./new-inflectors";
import { getLength } from "../p-text-helpers";
import { equativeEndings } from "../grammar-units";
@ -9,50 +20,54 @@ import { isAdjectiveEntry, isImperativeTense } from "../type-predicates";
import { inflectWord } from "../pashto-inflector";
export function isStatComp(v: T.VerbEntry): boolean {
return !!v.entry.c?.includes("stat. comp.") && !!v.complement;
return !!v.entry.c?.includes("stat. comp.") && !!v.complement;
}
export function statCompImperfectiveSpace(v: T.VerbEntryNoFVars): boolean {
return v.entry.p.startsWith(`${v.complement?.p} `);
return v.entry.p.startsWith(`${v.complement?.p} `);
}
export function makeComplement(e: T.DictionaryEntryNoFVars, { gender, number }: T.GenderNumber): T.NComp {
if (isAdjectiveEntry(e)) {
const infs = inflectWord(e);
const ps = infs && infs.inflections && isUnisexSet(infs.inflections)
? infs.inflections[gender][number === "singular" ? 0 : 1][0]
: psStringFromEntry(e);
return {
type: "NComp",
comp: {
type: "AdjComp",
ps: lightEnforceCompAccent(ps),
gender,
number,
},
};
}
export function makeComplement(
e: T.DictionaryEntryNoFVars,
{ gender, number }: T.GenderNumber
): T.NComp {
if (isAdjectiveEntry(e)) {
const infs = inflectWord(e);
const ps =
infs && infs.inflections && isUnisexSet(infs.inflections)
? infs.inflections[gender][number === "singular" ? 0 : 1][0]
: psStringFromEntry(e);
return {
type: "NComp",
comp: {
type: "Comp",
ps: lightEnforceCompAccent(psStringFromEntry(e)),
},
type: "NComp",
comp: {
type: "AdjComp",
ps: lightEnforceCompAccent(ps),
gender,
number,
},
};
function lightEnforceCompAccent(ps: T.PsString): T.PsString {
return countSyllables(ps) === 1
? accentPsSyllable(ps)
: ps;
}
}
return {
type: "NComp",
comp: {
type: "Comp",
ps: lightEnforceCompAccent(psStringFromEntry(e)),
},
};
function lightEnforceCompAccent(ps: T.PsString): T.PsString {
return countSyllables(ps) === 1 ? accentPsSyllable(ps) : ps;
}
}
export function vEntry(e: any, c?: any): T.VerbEntryNoFVars {
return {
entry: removeFVarients(e),
...c ? {
complement: c,
} : {},
} as T.VerbEntryNoFVars;
return {
entry: removeFVarients(e),
...(c
? {
complement: c,
}
: {}),
} as T.VerbEntryNoFVars;
}
// export function getAllRs(verb: T.VerbEntry): {
@ -64,7 +79,7 @@ export function vEntry(e: any, c?: any): T.VerbEntryNoFVars {
// perfective: T.RootsStemsOutput,
// imperfective: T.RootsStemsOutput,
// },
// } {
// } {
// return {
// stem: {
// perfective: getRootStem({ verb, type: "basic", voice: "active", rs: "stem", aspect: "perfective", genderNumber: { gender: "masc", number: "singular" } }),
@ -80,230 +95,262 @@ export function vEntry(e: any, c?: any): T.VerbEntryNoFVars {
/**
* adds a verb ending, creating all the variations with a set of root psStrings
* it is aware of the trailing accent marker X and also avoids adding the double ل ending 3rd pers masc plur
*
*
* @param ps - a verb root/stem
* @param end - the verb ending
* @returns
* @returns
*/
export function verbEndingConcat(ps: T.PsString[], end: T.PsString[]): T.PsString[] {
if (ps[0].f === "shw" && end[0].f === "oo") {
return [{ p: "شو", f: "shoo" }];
}
return ps.flatMap(v => (
end.map(e => {
if (v.f.charAt(v.f.length-1) === "X") {
// faster to do concatPsString(trimOffPs(v, 0, 1), accentSyllable(e))
// but this covers cases like adding the 3rd person no-ending to a string with the
// trailing accent marker and still getting the accent right
return accentOnNFromEnd(concatPsString(trimOffPs(v, 0, 1), e), 0);
}
if (e.p === "ل" && ["ul", "úl"].includes(v.f.slice(-2))) {
return v;
}
return concatPsString(v, e);
})
));
export function verbEndingConcat(
ps: T.PsString[],
end: T.PsString[]
): T.PsString[] {
if (ps[0].f === "shw" && end[0].f === "oo") {
return [{ p: "شو", f: "shoo" }];
}
return ps.flatMap((v) =>
end.map((e) => {
if (v.f.charAt(v.f.length - 1) === "X") {
// faster to do concatPsString(trimOffPs(v, 0, 1), accentSyllable(e))
// but this covers cases like adding the 3rd person no-ending to a string with the
// trailing accent marker and still getting the accent right
return accentOnNFromEnd(concatPsString(trimOffPs(v, 0, 1), e), 0);
}
if (e.p === "ل" && ["ul", "úl"].includes(v.f.slice(-2))) {
return v;
}
return concatPsString(v, e);
})
);
}
// TODO: THIS IS UGGGGLY NEED TO THINK THROUGH THE TYPING ON THE WELDING
export function weld(left: T.Welded["left"], right: T.VBGenNum | T.WeldedGN): T.WeldedGN;
export function weld(left: T.Welded["left"], right: T.VBBasic | T.NComp | T.Welded): T.Welded;
export function weld(left: T.Welded["left"], right: T.VBBasic | T.VBGenNum | T.Welded | T.NComp | T.WeldedGN): T.Welded | T.WeldedGN {
if (right.type === "welded") {
return weld(weld(left, right.left), right.right);
export function weld(
left: T.Welded["left"],
right: T.VBGenNum | T.WeldedGN
): T.WeldedGN;
export function weld(
left: T.Welded["left"],
right: T.VBBasic | T.NComp | T.Welded
): T.Welded;
export function weld(
left: T.Welded["left"],
right: T.VBBasic | T.VBGenNum | T.Welded | T.NComp | T.WeldedGN
): T.Welded | T.WeldedGN {
if (right.type === "welded") {
return weld(weld(left, right.left), right.right);
}
/* istanbul ignore next */
if (right.type === "NComp") {
throw new Error("can't weld a complement on the right side");
}
return {
type: "welded",
left: removeAccentsFromLeft(left),
right,
};
function removeAccentsFromLeft(left: T.Welded["left"]): T.Welded["left"] {
if (left.type === "VB") {
return {
...left,
ps: removeAccentsWLength(left.ps),
};
}
/* istanbul ignore next */
if (right.type === "NComp") {
throw new Error("can't weld a complement on the right side");
if (left.type === "NComp") {
return {
...left,
comp: {
...left.comp,
ps: removeAccents(left.comp.ps),
},
};
}
return {
type: "welded",
left: removeAccentsFromLeft(left),
right,
...left,
right: {
...left.right,
ps: removeAccentsWLength(left.right.ps),
},
};
function removeAccentsFromLeft(left: T.Welded["left"]): T.Welded["left"] {
if (left.type === "VB") {
return {
...left,
ps: removeAccentsWLength(left.ps),
}
}
if (left.type === "NComp") {
return {
...left,
comp: {
...left.comp,
ps: removeAccents(left.comp.ps),
},
};
}
return {
...left,
right: {
...left.right,
ps: removeAccentsWLength(left.right.ps),
},
};
}
}
}
export function addTrailingAccent(ps: T.PsString): T.PsString {
return {
p: ps.p,
f: ps.f + "X",
};
return {
p: ps.p,
f: ps.f + "X",
};
}
// TODO: could do removeEndingL (slower but safer)
export function removeL(ps: T.PsString): T.PsString {
return trimOffPs(ps, 1, 2);
return trimOffPs(ps, 1, 2);
}
/**
* returns a simple polar transitivity of the verb, only intransitive or transitive
*
* @param v
* @returns
*
* @param v
* @returns
*/
export function vTransitivity(v: T.VerbEntry): "intransitive" | "transitive" {
return v.entry.c?.includes("intrans.") ? "intransitive" : "transitive";
return v.entry.c?.includes("intrans.") ? "intransitive" : "transitive";
}
export function tlulPerfectiveStem(person: { gender: T.Gender, number: T.NounNumber }): [[T.PH], [T.VB]] {
return [
[
{
type: "PH",
ps: inflectPattern1({ p: "لاړ", f: "láaR" }, person).map(x => concatPsString(x, " "))[0],
},
],
[
{
type: "VB",
ps: [{ p: "ش", f: "sh" }],
},
],
];
export function tlulPerfectiveStem(person: {
gender: T.Gender;
number: T.NounNumber;
}): [[T.PH], [T.VB]] {
return [
[
{
type: "PH",
ps: inflectPattern1({ p: "لاړ", f: "láaR" }, person).map((x) =>
concatPsString(x, " ")
)[0],
},
],
[
{
type: "VB",
ps: [{ p: "ش", f: "sh" }],
},
],
];
}
export function addAbilityEnding(vb: T.VBA): T.VBA {
const abilityEnding: T.PsString[] = [
{ p: "ی", f: "ey" },
{ p: "ای", f: "aay" },
];
if (vb.type === "welded") {
return {
...vb,
right: addToEnd(vb.right, abilityEnding),
};
}
return addToEnd(vb, abilityEnding);
function addToEnd(vb: T.VBBasic, end: T.PsString[]): T.VBBasic {
/* istanbul ignore next */
if (!("long" in vb.ps)) {
throw new Error("should have long and short form for adding to ability ending");
}
return {
...vb,
ps: {
long: verbEndingConcat(vb.ps.long, end),
short: verbEndingConcat(vb.ps.short, end),
},
};
const abilityEnding: T.PsString[] = [
{ p: "ی", f: "ay" },
{ p: "ای", f: "aay" },
];
if (vb.type === "welded") {
return {
...vb,
right: addToEnd(vb.right, abilityEnding),
};
}
return addToEnd(vb, abilityEnding);
function addToEnd(vb: T.VBBasic, end: T.PsString[]): T.VBBasic {
/* istanbul ignore next */
if (!("long" in vb.ps)) {
throw new Error(
"should have long and short form for adding to ability ending"
);
}
return {
...vb,
ps: {
long: verbEndingConcat(vb.ps.long, end),
short: verbEndingConcat(vb.ps.short, end),
},
};
}
}
export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBBasic>): T.VBBasic;
export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA;
export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA {
const shortenableEndings = ["ښتل", "ستل", "وتل"];
const wrul = ["وړل", "راوړل", "وروړل", "دروړل"];
// can't find a case where this is used - type safety
/* istanbul ignore next */
if ("right" in vba) {
return {
...vba,
right: possiblePPartLengths(vba.right),
};
}
const infinitive = vba.ps[0];
if (infinitive.f === "tlúl") {
return {
type: "VB",
ps: {
long: [infinitive],
short: [{ p: "تل", f: "túl" }],
},
};
}
const [trimP, trimF] = (infinitive.p.slice(-4) === "ښودل" && infinitive.p.length > 4 && infinitive.p !== "کېښودل" && infinitive.p !== "کښېښودل")
// special thing for اېښودل - پرېښودل
? [3, 4]
: (wrul.includes(infinitive.p) || (shortenableEndings.includes(infinitive.p.slice(-3)) && infinitive.p.slice(-4) !== "استل"))
? [1, 2]
: [0, 0];
if (trimP) {
return {
type: "VB",
ps: {
long: [infinitive],
short: [accentOnNFromEnd(trimOffPs(infinitive, trimP, trimF), 0)],
},
};
}
return vba;
const shortenableEndings = ["ښتل", "ستل", "وتل"];
const wrul = ["وړل", "راوړل", "وروړل", "دروړل"];
// can't find a case where this is used - type safety
/* istanbul ignore next */
if ("right" in vba) {
return {
...vba,
right: possiblePPartLengths(vba.right),
};
}
const infinitive = vba.ps[0];
if (infinitive.f === "tlúl") {
return {
type: "VB",
ps: {
long: [infinitive],
short: [{ p: "تل", f: "túl" }],
},
};
}
const [trimP, trimF] =
infinitive.p.slice(-4) === "ښودل" &&
infinitive.p.length > 4 &&
infinitive.p !== "کېښودل" &&
infinitive.p !== "کښېښودل"
? // special thing for اېښودل - پرېښودل
[3, 4]
: wrul.includes(infinitive.p) ||
(shortenableEndings.includes(infinitive.p.slice(-3)) &&
infinitive.p.slice(-4) !== "استل")
? [1, 2]
: [0, 0];
if (trimP) {
return {
type: "VB",
ps: {
long: [infinitive],
short: [accentOnNFromEnd(trimOffPs(infinitive, trimP, trimF), 0)],
},
};
}
return vba;
}
export function getLongVB(vb: T.VBBasic): T.VBNoLenghts<T.VBBasic>;
export function getLongVB(vb: T.VBA): T.VBNoLenghts<T.VBA>;
export function getLongVB(vb: T.VBA): T.VBNoLenghts<T.VBA> {
if (vb.type === "welded") {
return {
...vb,
right: getLongVB(vb.right),
};
}
if (vb.type === "welded") {
return {
...vb,
ps: getLength(vb.ps, "long"),
...vb,
right: getLongVB(vb.right),
};
}
return {
...vb,
ps: getLength(vb.ps, "long"),
};
}
export function getAspect(tense: T.VerbTense | T.AbilityTense | T.ImperativeTense, negative: boolean): T.Aspect {
if (isImperativeTense(tense) && negative) {
return "imperfective";
}
const t = tense.replace("Modal", "");
const imperfectives: Parameters<typeof getAspect>[0][] = ["presentVerb", "imperfectiveFuture", "imperfectivePast", "habitualImperfectivePast", "imperfectiveImperative"];
if (imperfectives.includes(t as Parameters<typeof getAspect>[0])) {
return "imperfective";
} else {
return "perfective";
}
export function getAspect(
tense: T.VerbTense | T.AbilityTense | T.ImperativeTense,
negative: boolean
): T.Aspect {
if (isImperativeTense(tense) && negative) {
return "imperfective";
}
const t = tense.replace("Modal", "");
const imperfectives: Parameters<typeof getAspect>[0][] = [
"presentVerb",
"imperfectiveFuture",
"imperfectivePast",
"habitualImperfectivePast",
"imperfectiveImperative",
];
if (imperfectives.includes(t as Parameters<typeof getAspect>[0])) {
return "imperfective";
} else {
return "perfective";
}
}
export function isKedul(v: T.VerbEntry): boolean {
return v.entry.p === "کېدل";
return v.entry.p === "کېدل";
}
export function perfectTenseToEquative(t: T.PerfectTense): keyof typeof equativeEndings {
return t === "presentPerfect"
? "present"
: t === "futurePerfect"
? "habitual"
: t === "habitualPerfect"
? "habitual"
: t === "pastPerfect"
? "past"
: t === "pastSubjunctivePerfect"
? "pastSubjunctive"
: t === "wouldBePerfect"
? "past"
: t === "wouldHaveBeenPerfect"
? "pastSubjunctive"
: "subjunctive";
}
export function perfectTenseToEquative(
t: T.PerfectTense
): keyof typeof equativeEndings {
return t === "presentPerfect"
? "present"
: t === "futurePerfect"
? "habitual"
: t === "habitualPerfect"
? "habitual"
: t === "pastPerfect"
? "past"
: t === "pastSubjunctivePerfect"
? "pastSubjunctive"
: t === "wouldBePerfect"
? "past"
: t === "wouldHaveBeenPerfect"
? "pastSubjunctive"
: "subjunctive";
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
// TODO: See if there are animate feminine words ending in ي and test
import {
inflectRegularYeyUnisex,
inflectRegularYayUnisex,
inflectWord,
} from "./pashto-inflector";
import * as T from "../../types";
@ -53,7 +53,7 @@ const adjectives: {
in: {
ts: 1527815306,
p: "ستړی",
f: "stúRey",
f: "stúRay",
g: "",
e: "tired",
c: "adj.",
@ -62,7 +62,7 @@ const adjectives: {
out: {
inflections: {
masc: [
[{p: "ستړی", f: "stúRey"}],
[{p: "ستړی", f: "stúRay"}],
[{p: "ستړي", f: "stúRee"}],
[{p: "ستړیو", f: "stúRiyo"}, {p: "ستړو", f: "stúRo"}],
],
@ -79,7 +79,7 @@ const adjectives: {
in: {
ts: 1527813636,
p: "وروستی",
f: "wroostéy",
f: "wroostáy",
g: "",
e: "last, latest, recent",
c: "adj.",
@ -88,7 +88,7 @@ const adjectives: {
out: {
inflections: {
masc: [
[{p: "وروستی", f: "wroostéy"}],
[{p: "وروستی", f: "wroostáy"}],
[{p: "وروستي", f: "wroostée"}],
[{p: "وروستیو", f: "wroostiyo"}, {p: "وروستو", f: "wroostó"}],
],
@ -374,7 +374,7 @@ const nouns: {
in: {
ts: 1527814159,
p: "ملګری",
f: "malgúrey",
f: "malgúray",
g: "",
e: "friend, companion",
c: "n. m. unisex",
@ -383,7 +383,7 @@ const nouns: {
out: {
inflections: {
masc: [
[{p: "ملګری", f: "malgúrey"}],
[{p: "ملګری", f: "malgúray"}],
[{p: "ملګري", f: "malgúree"}],
[{p: "ملګریو", f: "malgúriyo"}, {p: "ملګرو", f: "malgúro"}],
],
@ -397,11 +397,11 @@ const nouns: {
},
// Unisex noun ending on ی with emphasis on the end
{
in: {"i":3319,"ts":1527816431,"p":"ترورزی","f":"trorzéy","g":"trorzey","e":"cousin (of paternal aunt)","c":"n. m. unisex","ppp":"ترورزامن","ppf":"trorzaamun"},
in: {"i":3319,"ts":1527816431,"p":"ترورزی","f":"trorzáy","g":"trorzay","e":"cousin (of paternal aunt)","c":"n. m. unisex","ppp":"ترورزامن","ppf":"trorzaamun"},
out: {
inflections: {
masc: [
[{p: "ترورزی", f: "trorzéy"}],
[{p: "ترورزی", f: "trorzáy"}],
[{p: "ترورزي", f: "trorzée"}],
[{p: "ترورزیو", f: "trorziyo"}, {p: "ترورزو", f: "trorzó"}],
],
@ -463,11 +463,11 @@ const nouns: {
},
// with #3 pattern anim unisex
{
in: {"ts":1527820130,"i":2561,"p":"پلوی","f":"palawéy","g":"palawey","e":"adherent, supporter; the outside or further ox in a team of oxes grinding or threshing","c":"n. m. anim. unisex"},
in: {"ts":1527820130,"i":2561,"p":"پلوی","f":"palawáy","g":"palaway","e":"adherent, supporter; the outside or further ox in a team of oxes grinding or threshing","c":"n. m. anim. unisex"},
out: {
inflections: {
masc: [
[{ p: "پلوی", f: "palawéy" }],
[{ p: "پلوی", f: "palawáy" }],
[{ p: "پلوي", f: "palawée" }],
[{ p: "پلویو", f: "palawiyo" }, { p: "پلوو", f: "palawó" }],
],
@ -495,7 +495,7 @@ const nouns: {
in: {
ts: 1527815251,
p: "سړی",
f: "saRéy",
f: "saRáy",
g: "",
e: "man",
c: "n. m.",
@ -504,7 +504,7 @@ const nouns: {
out: {
inflections: {
masc: [
[{p: "سړی", f: "saRéy"}],
[{p: "سړی", f: "saRáy"}],
[{p: "سړي", f: "saRée"}],
[{p: "سړیو", f: "saRiyo"}, {p: "سړو", f: "saRo"}],
],
@ -514,19 +514,19 @@ const nouns: {
// Masculine #3 anim
// TODO: Also do Fem #3 anim!
{
in: {"ts":1527819801,"i":8082,"p":"سیلانی","f":"seylaanéy","g":"seylaaney","e":"tourist, sightseer, visitor","c":"n. m. anim."},
in: {"ts":1527819801,"i":8082,"p":"سیلانی","f":"saylaanáy","g":"saylaanay","e":"tourist, sightseer, visitor","c":"n. m. anim."},
out: {
inflections: {
masc: [
[{ p: "سیلانی", f: "seylaanéy" }],
[{ p: "سیلاني", f: "seylaanée" }],
[{ p: "سیلانیو", f: "seylaaniyo" }, { p: "سیلانو", f: "seylaano" }],
[{ p: "سیلانی", f: "saylaanáy" }],
[{ p: "سیلاني", f: "saylaanée" }],
[{ p: "سیلانیو", f: "saylaaniyo" }, { p: "سیلانو", f: "saylaano" }],
],
},
plural: {
masc: [
[{ p: "سیلانیان", f: "seylaaniyáan" }],
[{ p: "سیلانیانو", f: "seylaaniyáano" }],
[{ p: "سیلانیان", f: "saylaaniyáan" }],
[{ p: "سیلانیانو", f: "saylaaniyáano" }],
],
},
},
@ -536,7 +536,7 @@ const nouns: {
in: {
ts: 1527818511,
p: "ترېلی",
f: "treléy",
f: "treláy",
g: "",
e: "pool, reservoir",
c: "n. m.",
@ -545,7 +545,7 @@ const nouns: {
out: {
inflections: {
masc: [
[{p: "ترېلی", f: "treléy"}],
[{p: "ترېلی", f: "treláy"}],
[{p: "ترېلي", f: "trelée"}],
[{p: "ترېلیو", f: "treliyo"}, {p: "ترېلو", f: "trelo"}],
],
@ -617,9 +617,9 @@ const nouns: {
}
},
},
// should NOT do the oona plural with the squish nouns, when they're animate
// should NOT do the oona plural with the squish nouns, when thay're animate
{
in: {"i":5465,"ts":1527812802,"p":"خر","f":"khur","g":"khur","e":"donkey","c":"n. m. anim. unisex irreg.","infap":"خره","infaf":"khru","infbp":"خر","infbf":"khr"},
in: {"i":5465,"ts":1527812802,"p":"خر","f":"khur","g":"khur","e":"donkay","c":"n. m. anim. unisex irreg.","infap":"خره","infaf":"khru","infbp":"خر","infbf":"khr"},
out: {
inflections: {
// TODO: use smarter system using new isType5Entry predicates, to allow for not using the redundant one syllable accents with these
@ -1104,14 +1104,14 @@ const nouns: {
e: "mother, mom",
c: "n. f. anim.",
ppp: "میندې",
ppf: "meynde",
ppf: "maynde",
i: 11113,
},
out: {
plural: {
fem: [
[{ p: "میندې", f: "meynde" }],
[{ p: "میندو", f: "meyndo" }],
[{ p: "میندې", f: "maynde" }],
[{ p: "میندو", f: "mayndo" }],
],
},
},
@ -1218,19 +1218,19 @@ const nouns: {
},
// with variations on Pashto plural
{
in: {"ts":1527815268,"i":8475,"p":"شی","f":"shey","g":"shey","ppp":"شیان، شیونه", "ppf": "sheyáan, sheyóona","e":"thing","c":"n. m."},
in: {"ts":1527815268,"i":8475,"p":"شی","f":"shay","g":"shay","ppp":"شیان، شیونه", "ppf": "shayáan, shayóona","e":"thing","c":"n. m."},
out: {
inflections: {
masc: [
[{ p: "شی", f: "shey" }],
[{ p: "شی", f: "shay" }],
[{ p: "شي", f: "shee" }],
[{ p: "شیو", f: "shiyo" }, { p: "شو", f: "sho" }],
],
},
plural: {
masc: [
[{ p: "شیان", f: "sheyáan" }, { p: "شیونه", f: "sheyóona" }],
[{ p: "شیانو", f: "sheyáano" }, { p: "شیونو", f: "sheyóono" }],
[{ p: "شیان", f: "shayáan" }, { p: "شیونه", f: "shayóona" }],
[{ p: "شیانو", f: "shayáano" }, { p: "شیونو", f: "shayóono" }],
],
},
},
@ -1309,10 +1309,10 @@ others.forEach((word) => {
});
});
test(`inflectRegularYeyUnisex should work`, () => {
expect(inflectRegularYeyUnisex("لیدونکی", "leedóonkey")).toEqual({
test(`inflectRegularYayUnisex should work`, () => {
expect(inflectRegularYayUnisex("لیدونکی", "leedóonkay")).toEqual({
masc: [
[{p: "لیدونکی", f: "leedóonkey" }],
[{p: "لیدونکی", f: "leedóonkay" }],
[{p: "لیدونکي", f: "leedóonkee" }],
[{p: "لیدونکیو", f: "leedóonkiyo" }, {p: "لیدونکو", f: "leedóonko"}],
],

View File

@ -33,7 +33,7 @@ import * as T from "../../types";
import { fmapSingleOrLengthOpts } from "./fp-ps";
const endingInSingleARegex = /[^a]'??[aá]'??$/;
const endingInHeyOrAynRegex = /[^ا][هع]$/;
const endingInHayOrAynRegex = /[^ا][هع]$/;
// const endingInAlefRegex = /اع?$/;
export function inflectWord(word: T.DictionaryEntry): T.InflectorOutput {
@ -89,8 +89,8 @@ function handleUnisexWord(word: T.DictionaryEntryNoFVars): T.InflectorOutput {
...plurals,
};
}
if (pEnd === "ی" && word.f.slice(-2) === "ey") {
return { inflections: inflectRegularYeyUnisex(word.p, word.f), ...plurals };
if (pEnd === "ی" && word.f.slice(-2) === "ay") {
return { inflections: inflectRegularYayUnisex(word.p, word.f), ...plurals };
}
if (pEnd === "ه" && word.g.slice(-1) === "u") {
return {
@ -98,9 +98,9 @@ function handleUnisexWord(word: T.DictionaryEntryNoFVars): T.InflectorOutput {
...plurals,
};
}
if (pEnd === "ی" && word.f.slice(-2) === "éy") {
if (pEnd === "ی" && word.f.slice(-2) === "áy") {
return {
inflections: inflectEmphasizedYeyUnisex(word.p, word.f),
inflections: inflectEmphasizedYayUnisex(word.p, word.f),
...plurals,
};
}
@ -155,12 +155,12 @@ function handleMascNoun(w: T.DictionaryEntryNoFVars): T.InflectorOutput {
if (isTobEnding) {
return { inflections: inflectTobMasc(w.p, w.f), ...plurals };
}
if (pEnd === "ی" && fEnd === "ey") {
return { inflections: inflectRegularYeyMasc(w.p, w.f), ...plurals };
if (pEnd === "ی" && fEnd === "ay") {
return { inflections: inflectRegularYayMasc(w.p, w.f), ...plurals };
}
if (pEnd === "ی" && fEnd === "éy") {
if (pEnd === "ی" && fEnd === "áy") {
return {
inflections: inflectRegularEmphasizedYeyMasc(w.p, w.f),
inflections: inflectRegularEmphasizedYayMasc(w.p, w.f),
...plurals,
};
}
@ -179,7 +179,7 @@ function handleFemNoun(word: T.DictionaryEntryNoFVars): T.InflectorOutput {
return !plurals ? false : { ...plurals };
}
if (endingInHeyOrAynRegex.test(word.p) && endingInSingleARegex.test(word.f)) {
if (endingInHayOrAynRegex.test(word.p) && endingInSingleARegex.test(word.f)) {
return { inflections: inflectRegularAFem(word.p, word.f), ...plurals };
}
if (word.p.slice(-1) === "ح" && endingInSingleARegex.test(word.f)) {
@ -238,7 +238,7 @@ function inflectIrregularUnisex(
};
}
export function inflectRegularYeyUnisex(
export function inflectRegularYayUnisex(
p: string,
f: string
): T.UnisexInflections {
@ -283,7 +283,7 @@ export function inflectRegularShwaEndingUnisex(
};
}
function inflectEmphasizedYeyUnisex(p: string, f: string): T.UnisexInflections {
function inflectEmphasizedYayUnisex(p: string, f: string): T.UnisexInflections {
const baseP = p.slice(0, -1);
const baseF = f.slice(0, -2);
return {
@ -325,7 +325,7 @@ function inflectConsonantEndingUnisex(
};
}
function inflectRegularYeyMasc(p: string, f: string): T.Inflections {
function inflectRegularYayMasc(p: string, f: string): T.Inflections {
const baseP = p.slice(0, -1);
const baseF = f.slice(0, -2);
return {
@ -352,7 +352,7 @@ function inflectTobMasc(p: string, f: string): T.Inflections {
};
}
function inflectRegularEmphasizedYeyMasc(p: string, f: string): T.Inflections {
function inflectRegularEmphasizedYayMasc(p: string, f: string): T.Inflections {
const baseP = p.slice(0, -1);
const baseF = f.slice(0, -2);
return {
@ -677,7 +677,7 @@ function makePlural(
plural: { masc: addMascPluralSuffix(anim, shortSquish) },
};
}
if (endsWith([{ p: "ی", f: "éy" }, { p: "ي" }], w, true)) {
if (endsWith([{ p: "ی", f: "áy" }, { p: "ي" }], w, true)) {
return { arabicPlural, plural: addAnimN3UnisexPluralSuffix() };
}
// usually shortSquish nouns would never have arabicPlurals -- so we don't have to worry about catching
@ -696,7 +696,7 @@ function makePlural(
},
};
}
if (type === "masc noun" && endsWith({ p: "ی", f: "éy" }, w, true) && anim) {
if (type === "masc noun" && endsWith({ p: "ی", f: "áy" }, w, true) && anim) {
const { masc } = addAnimN3UnisexPluralSuffix();
return {
arabicPlural,
@ -744,8 +744,8 @@ function makePlural(
return undefined;
}
export function inflectYey(
export function inflectYay(
ps: T.SingleOrLengthOpts<T.PsString>
): T.SingleOrLengthOpts<T.UnisexInflections> {
return fmapSingleOrLengthOpts((x) => inflectRegularYeyUnisex(x.p, x.f), ps);
return fmapSingleOrLengthOpts((x) => inflectRegularYayUnisex(x.p, x.f), ps);
}

View File

@ -4,232 +4,308 @@ import { endsWith } from "./p-text-helpers";
import { countSyllables } from "./accent-helpers";
export function isTlulVerb(e: T.VerbEntry | T.VerbDictionaryEntry): boolean {
const entry = "entry" in e ? e.entry : e;
return entry.f === "tlul" || entry.p === "راتلل" || entry.p === "درتلل" || entry.p === "ورتلل";
const entry = "entry" in e ? e.entry : e;
return (
entry.f === "tlul" ||
entry.p === "راتلل" ||
entry.p === "درتلل" ||
entry.p === "ورتلل"
);
}
export function isKawulVerb(e: T.VerbEntry | T.VerbDictionaryEntry): boolean {
const entry = "entry" in e ? e.entry : e;
return ["کول", "راکول", "درکول", "ورکول"].includes(entry.p);
const entry = "entry" in e ? e.entry : e;
return ["کول", "راکول", "درکول", "ورکول"].includes(entry.p);
}
export function isNounEntry(e: T.Entry | T.DictionaryEntry): e is T.NounEntry {
if ("entry" in e) return false;
return !!(e.c && (e.c.includes("n. m.") || e.c.includes("n. f.")));
if ("entry" in e) return false;
return !!(e.c && (e.c.includes("n. m.") || e.c.includes("n. f.")));
}
export function isAdjectiveEntry(e: T.Entry | T.DictionaryEntry): e is T.AdjectiveEntry {
if ("entry" in e) return false;
return !!e.c?.includes("adj.");
export function isAdjectiveEntry(
e: T.Entry | T.DictionaryEntry
): e is T.AdjectiveEntry {
if ("entry" in e) return false;
return !!e.c?.includes("adj.");
}
export function isAdverbEntry(e: T.Entry | T.DictionaryEntry): e is T.AdverbEntry {
if ("entry" in e) return false;
return !!e.c?.includes("adv.");
export function isAdverbEntry(
e: T.Entry | T.DictionaryEntry
): e is T.AdverbEntry {
if ("entry" in e) return false;
return !!e.c?.includes("adv.");
}
export function isLocativeAdverbEntry(e: T.Entry | T.DictionaryEntry): e is T.LocativeAdverbEntry {
if ("entry" in e) return false;
return !!e.c?.includes("loc. adv.");
export function isLocativeAdverbEntry(
e: T.Entry | T.DictionaryEntry
): e is T.LocativeAdverbEntry {
if ("entry" in e) return false;
return !!e.c?.includes("loc. adv.");
}
export function isNounOrAdjEntry(e: T.Entry | T.DictionaryEntry): e is (T.NounEntry | T.AdjectiveEntry) {
return isNounEntry(e) || isAdjectiveEntry(e);
export function isNounOrAdjEntry(
e: T.Entry | T.DictionaryEntry
): e is T.NounEntry | T.AdjectiveEntry {
return isNounEntry(e) || isAdjectiveEntry(e);
}
export function isVerbDictionaryEntry(e: T.DictionaryEntry | T.DictionaryEntryNoFVars): e is T.VerbDictionaryEntry {
return !!e.c?.startsWith("v.");
export function isVerbDictionaryEntry(
e: T.DictionaryEntry | T.DictionaryEntryNoFVars
): e is T.VerbDictionaryEntry {
return !!e.c?.startsWith("v.");
}
export function isVerbEntry(
e: T.Entry | T.DictionaryEntry | { entry: T.DictionaryEntry, comp?: T.DictionaryEntry }
e:
| T.Entry
| T.DictionaryEntry
| { entry: T.DictionaryEntry; comp?: T.DictionaryEntry }
): e is T.VerbEntry {
return "entry" in e && isVerbDictionaryEntry(e.entry);
return "entry" in e && isVerbDictionaryEntry(e.entry);
}
export function isMascNounEntry(e: T.NounEntry | T.AdjectiveEntry): e is T.MascNounEntry {
return !!e.c && e.c.includes("n. m.");
export function isMascNounEntry(
e: T.NounEntry | T.AdjectiveEntry
): e is T.MascNounEntry {
return !!e.c && e.c.includes("n. m.");
}
export function isFemNounEntry(e: T.NounEntry | T.AdjectiveEntry): e is T.FemNounEntry {
return !!e.c && e.c.includes("n. f.");
export function isFemNounEntry(
e: T.NounEntry | T.AdjectiveEntry
): e is T.FemNounEntry {
return !!e.c && e.c.includes("n. f.");
}
export function isUnisexNounEntry(e: T.NounEntry | T.AdjectiveEntry): e is T.UnisexNounEntry {
return isNounEntry(e) && e.c.includes("unisex");
export function isUnisexNounEntry(
e: T.NounEntry | T.AdjectiveEntry
): e is T.UnisexNounEntry {
return isNounEntry(e) && e.c.includes("unisex");
}
export function isAnimNounEntry(e: T.NounEntry | T.AdverbEntry): e is T.AnimNounEntry {
return e.c.includes("anim.");
export function isAnimNounEntry(
e: T.NounEntry | T.AdverbEntry
): e is T.AnimNounEntry {
return e.c.includes("anim.");
}
export function isUnisexAnimNounEntry(e: T.NounEntry | T.AdjectiveEntry): e is T.UnisexAnimNounEntry {
return isUnisexNounEntry(e) && isAnimNounEntry(e);
export function isUnisexAnimNounEntry(
e: T.NounEntry | T.AdjectiveEntry
): e is T.UnisexAnimNounEntry {
return isUnisexNounEntry(e) && isAnimNounEntry(e);
}
export function isAdjOrUnisexNounEntry(e: T.Entry): e is (T.AdjectiveEntry | T.UnisexNounEntry) {
return isAdjectiveEntry(e) || (
isNounEntry(e) && isUnisexNounEntry(e)
);
export function isAdjOrUnisexNounEntry(
e: T.Entry
): e is T.AdjectiveEntry | T.UnisexNounEntry {
return isAdjectiveEntry(e) || (isNounEntry(e) && isUnisexNounEntry(e));
}
export function isPattern(p: T.InflectionPattern | "all"): (entry: T.NounEntry | T.AdjectiveEntry) => boolean {
if (p === 0) {
return (e: T.NounEntry | T.AdjectiveEntry) => (
!isPattern1Entry(e) && !isPattern2Entry(e) && !isPattern3Entry(e)
&& !isPattern4Entry(e) && !isPattern5Entry(e) && !isPattern6FemEntry(e)
)
}
if (p === 1) {
return isPattern1Entry;
}
if (p === 2) {
return isPattern2Entry;
}
if (p === 3) {
return isPattern3Entry;
}
if (p === 4) {
return isPattern4Entry;
}
if (p === 5) {
return isPattern5Entry;
}
if (p === 6) {
return isPattern6FemEntry;
}
return () => true;
export function isPattern(
p: T.InflectionPattern | "all"
): (entry: T.NounEntry | T.AdjectiveEntry) => boolean {
if (p === 0) {
return (e: T.NounEntry | T.AdjectiveEntry) =>
!isPattern1Entry(e) &&
!isPattern2Entry(e) &&
!isPattern3Entry(e) &&
!isPattern4Entry(e) &&
!isPattern5Entry(e) &&
!isPattern6FemEntry(e);
}
if (p === 1) {
return isPattern1Entry;
}
if (p === 2) {
return isPattern2Entry;
}
if (p === 3) {
return isPattern3Entry;
}
if (p === 4) {
return isPattern4Entry;
}
if (p === 5) {
return isPattern5Entry;
}
if (p === 6) {
return isPattern6FemEntry;
}
return () => true;
}
/**
* shows if a noun/adjective has the basic (consonant / ه) inflection pattern
*
* @param e
* @returns
*
* @param e
* @returns
*/
export function isPattern1Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern1Entry<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNounEntry(e)) {
return (
endsWith([{ p: "ه", f: "a" }, { p: "ح", f: "a" }], e) ||
(endsWith({ p: pashtoConsonants }, e) && !e.c.includes("anim."))
);
}
export function isPattern1Entry<T extends T.NounEntry | T.AdjectiveEntry>(
e: T
): e is T.Pattern1Entry<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNounEntry(e)) {
return (
endsWith([{ p: pashtoConsonants }], e) ||
endsWith([{ p: "ه", f: "u" }, { p: "ه", f: "h" }], e) ||
endsWith([{ p: "ای", f: "aay" }, { p: "وی", f: "ooy" }], e)
endsWith(
[
{ p: "ه", f: "a" },
{ p: "ح", f: "a" },
],
e
) ||
(endsWith({ p: pashtoConsonants }, e) && !e.c.includes("anim."))
);
}
return (
endsWith([{ p: pashtoConsonants }], e) ||
endsWith(
[
{ p: "ه", f: "u" },
{ p: "ه", f: "h" },
],
e
) ||
endsWith(
[
{ p: "ای", f: "aay" },
{ p: "وی", f: "ooy" },
],
e
)
);
}
/**
* shows if a noun/adjective has the unstressed ی inflection pattern
*
* @param e
*
* @param e
* @returns T.T.T.T.
*/
export function isPattern2Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern2Entry<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNounEntry(e)) {
return !e.c.includes("pl.") && endsWith({ p: "ې", f: "e" }, e, true);
}
// TODO: check if it's a single syllable word, in which case it would be pattern 1
return endsWith({ p: "ی", f: "ey" }, e, true) && (countSyllables(e.f) > 1);
export function isPattern2Entry<T extends T.NounEntry | T.AdjectiveEntry>(
e: T
): e is T.Pattern2Entry<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNounEntry(e)) {
return !e.c.includes("pl.") && endsWith({ p: "ې", f: "e" }, e, true);
}
// TODO: check if it's a single syllable word, in which case it would be pattern 1
return endsWith({ p: "ی", f: "ay" }, e, true) && countSyllables(e.f) > 1;
}
/**
* shows if a noun/adjective has the stressed ی inflection pattern
*
* @param e
* @returns
*
* @param e
* @returns
*/
export function isPattern3Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern3Entry<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNounEntry(e)) {
return endsWith({ p: "ۍ" }, e);
}
return (countSyllables(e.f) > 1)
? endsWith({ p: "ی", f: "éy" }, e, true)
: endsWith({ p: "ی", f: "ey" }, e)
export function isPattern3Entry<T extends T.NounEntry | T.AdjectiveEntry>(
e: T
): e is T.Pattern3Entry<T> {
if (e.noInf) return false;
if (e.infap) return false;
if (isFemNounEntry(e)) {
return endsWith({ p: "ۍ" }, e);
}
return countSyllables(e.f) > 1
? endsWith({ p: "ی", f: "áy" }, e, true)
: endsWith({ p: "ی", f: "ay" }, e);
}
/**
* shows if a noun/adjective has the "Pashtoon" inflection pattern
*
* @param e
* @returns
*
* @param e
* @returns
*/
export function isPattern4Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern4Entry<T> {
if (e.noInf) return false;
return (
!!(e.infap && e.infaf && e.infbp && e.infbf)
&&
(e.infap.slice(1).includes("ا") && e.infap.slice(-1) === "ه")
);
export function isPattern4Entry<T extends T.NounEntry | T.AdjectiveEntry>(
e: T
): e is T.Pattern4Entry<T> {
if (e.noInf) return false;
return (
!!(e.infap && e.infaf && e.infbp && e.infbf) &&
e.infap.slice(1).includes("ا") &&
e.infap.slice(-1) === "ه"
);
}
/**
* shows if a noun/adjective has the shorter squish inflection pattern
*
* @param e
* @returns
*
* @param e
* @returns
*/
export function isPattern5Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern5Entry<T> {
if (e.noInf) return false;
return (
!!(e.infap && e.infaf && e.infbp && e.infbf)
&&
(!e.infap.slice(1).includes("ا") && e.infap.slice(-1) === "ه")
);
export function isPattern5Entry<T extends T.NounEntry | T.AdjectiveEntry>(
e: T
): e is T.Pattern5Entry<T> {
if (e.noInf) return false;
return (
!!(e.infap && e.infaf && e.infbp && e.infbf) &&
!e.infap.slice(1).includes("ا") &&
e.infap.slice(-1) === "ه"
);
}
export function isPattern6FemEntry(e: T.NounEntry | T.AdjectiveEntry): e is T.Pattern6FemEntry<T.FemNounEntry> {
if (!isFemNounEntry(e)) return false;
if (e.c.includes("anim.")) return false;
return e.p.slice(-1) === "ي";
export function isPattern6FemEntry(
e: T.NounEntry | T.AdjectiveEntry
): e is T.Pattern6FemEntry<T.FemNounEntry> {
if (!isFemNounEntry(e)) return false;
if (e.c.includes("anim.")) return false;
return e.p.slice(-1) === "ي";
}
export function isPluralNounEntry<U extends T.NounEntry>(e: U): e is T.PluralNounEntry<U> {
return e.c.includes("pl.");
export function isPluralNounEntry<U extends T.NounEntry>(
e: U
): e is T.PluralNounEntry<U> {
return e.c.includes("pl.");
}
export function isSingularEntry<U extends T.NounEntry>(e: U): e is T.SingularEntry<U> {
return !isPluralNounEntry(e);
export function isSingularEntry<U extends T.NounEntry>(
e: U
): e is T.SingularEntry<U> {
return !isPluralNounEntry(e);
}
export function isArrayOneOrMore<U>(a: U[]): a is T.ArrayOneOrMore<U> {
return a.length > 0;
return a.length > 0;
}
export function isPerfectTense(tense: T.Tense): tense is T.PerfectTense {
return tense.endsWith("Perfect");
return tense.endsWith("Perfect");
}
export function isVerbTense(tense: T.Tense): tense is T.VerbTense {
const verbTenses: T.VerbTense[] = [
"presentVerb",
"subjunctiveVerb",
"perfectiveFuture",
"imperfectiveFuture",
"perfectivePast",
"imperfectivePast",
"habitualPerfectivePast",
"habitualImperfectivePast",
];
return verbTenses.some(x => x === tense);
const verbTenses: T.VerbTense[] = [
"presentVerb",
"subjunctiveVerb",
"perfectiveFuture",
"imperfectiveFuture",
"perfectivePast",
"imperfectivePast",
"habitualPerfectivePast",
"habitualImperfectivePast",
];
return verbTenses.some((x) => x === tense);
}
export function isAbilityTense(tense: T.Tense): tense is T.AbilityTense {
return tense.endsWith("Modal");
return tense.endsWith("Modal");
}
export function isEquativeTense(t: T.Tense): t is T.EquativeTense {
return (t === "present" || t === "future" || t === "habitual" || t === "past" || t === "wouldBe" || t === "subjunctive" || t === "pastSubjunctive" || t === "wouldHaveBeen");
return (
t === "present" ||
t === "future" ||
t === "habitual" ||
t === "past" ||
t === "wouldBe" ||
t === "subjunctive" ||
t === "pastSubjunctive" ||
t === "wouldHaveBeen"
);
}
export function isImperativeTense(tense: T.Tense): tense is T.ImperativeTense {
return tense === "imperfectiveImperative" || tense === "perfectiveImperative";
return tense === "imperfectiveImperative" || tense === "perfectiveImperative";
}

View File

@ -28,7 +28,7 @@ import {
psStringEquals,
} from "./p-text-helpers";
import { makePsString } from "./accent-and-ps-utils";
import { inflectYey } from "./pashto-inflector";
import { inflectYay } from "./pashto-inflector";
import { accentOnNFromEnd, removeAccents } from "./accent-helpers";
import { mapInflections } from "./fp-ps";
import { pashtoConsonants } from "./pashto-consonants";
@ -55,7 +55,7 @@ const dummyEntry: T.DictionaryEntry = {
const aayTail = [
{ p: "ای", f: "aay" },
{ p: "ی", f: "ey" },
{ p: "ی", f: "ay" },
];
export function conjugateVerb(
@ -508,14 +508,14 @@ function makeParticipleContent(info: T.NonComboVerbInfo): T.ParticipleContent {
: info.objComplement.entry,
stativeAux[transitivity].participle.past as T.UnisexInflections
)
: inflectYey(noPersInfs(info.participle.past));
: inflectYay(noPersInfs(info.participle.past));
const present =
"complement" in info && spaceInForm(info.root.imperfective)
? concatInflections(
info.complement,
stativeAux[transitivity].participle.present as T.UnisexInflections
)
: inflectYey(noPersInfs(info.participle.present));
: inflectYay(noPersInfs(info.participle.present));
return {
present, // PRESENT PARTICIPLE inflected
past, // PAST PARTICIPLE inflected
@ -537,7 +537,7 @@ function makePerfectContent(info: T.NonComboVerbInfo): T.PerfectContent {
stativeAux[transitivity].participle.past,
]
: // for regular compounds
[inflectYey(noPersInfs(info.participle.past))];
[inflectYay(noPersInfs(info.participle.past))];
const halfPerfect = addToForm([...pastPart], emptyVerbBlock);
const past = addToForm([...pastPart, " "], equativeEndings.past.short);

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ import {
getShort,
} from "./p-text-helpers";
import { makePsString, removeFVarients } from "./accent-and-ps-utils";
import { inflectYey } from "./pashto-inflector";
import { inflectYay } from "./pashto-inflector";
import {
accentOnFront,
accentOnNFromEnd,
@ -49,7 +49,7 @@ import {
import * as T from "../../types";
import { isTlulVerb } from "./type-predicates";
const eyEndingUnaccented: T.PsString = { p: "ی", f: "ey" };
const ayEndingUnaccented: T.PsString = { p: "ی", f: "ay" };
/**
* Compiles the base information (roots, stems etc.) needed in order
@ -217,7 +217,7 @@ function getGenerativeStativeCompoundVerbInfo(
participle: {
present: auxVerb.info.participle.present,
past: chooseParticipleInflection(
inflectYey(
inflectYay(
"mascSing" in auxVerb.info.participle.past
? // purely for type saftey, will not have mascSing
// in a non stative compound verb
@ -315,7 +315,7 @@ function getDynamicCompoundInfo(
participle: {
present: auxVerbInfo.participle.present,
past: chooseParticipleInflection(
inflectYey(
inflectYay(
"mascSing" in auxVerbInfo.participle.past
? // purely for type saftey, will not have mascSing
// in a non stative compound verb
@ -944,7 +944,7 @@ function getParticiple(
removeAccentsFull(comp),
" ",
compInflects
? unisexInfToObjectMatrix(inflectYey(aux) as T.UnisexInflections)
? unisexInfToObjectMatrix(inflectYay(aux) as T.UnisexInflections)
: aux
);
};
@ -962,12 +962,12 @@ function getParticiple(
short: accentPastPart(
concatPsString(
ensureShortWurShwaShift(shortParticipleRoot),
eyEndingUnaccented
ayEndingUnaccented
)
),
long: accentPastPart(concatPsString(infinitive, eyEndingUnaccented)),
long: accentPastPart(concatPsString(infinitive, ayEndingUnaccented)),
}
: accentPastPart(concatPsString(infinitive, eyEndingUnaccented));
: accentPastPart(concatPsString(infinitive, ayEndingUnaccented));
// TODO: make this into a rule?
const shortImperfectiveRoot =
@ -1334,7 +1334,7 @@ export function getPassiveRootsAndStems(
};
}
const passiveRootTail: T.PsString = { p: "ی", f: "ey" };
const passiveRootTail: T.PsString = { p: "ی", f: "ay" };
function getPassiveStem(
root: T.VerbRootSet,
@ -1444,8 +1444,8 @@ function getPassiveRootPerfectiveSplit(
};
}
const abilityTail = { p: "ی", f: "ey" };
const abilityTailAccented = { p: "ی", f: "éy" };
const abilityTail = { p: "ی", f: "ay" };
const abilityTailAccented = { p: "ی", f: "áy" };
function getAbilityRoots(
root: T.VerbRootSet,

View File

@ -659,8 +659,8 @@ export type FullEntry = VerbEntry | DictionaryEntry;
export enum InflectionPattern {
None = 0,
Basic = 1,
UnstressedEy = 2,
StressedEy = 3,
UnstressedAy = 2,
StressedAy = 3,
Pashtun = 4,
Squish = 5,
FemInanEe = 6,