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

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

View File

@ -10,422 +10,536 @@ import * as T from "../../types";
// TODO: Automatice syncing of aux verbs from dictionary // TODO: Automatice syncing of aux verbs from dictionary
export const dynamicAuxVerbs: Array< export const dynamicAuxVerbs: Array<{
{ entry: T.DictionaryEntry;
entry: T.DictionaryEntry, complement?: T.DictionaryEntry;
complement?: T.DictionaryEntry, }> = [
} {
> = [ entry: {
{ ts: 1527812752,
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"}, 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, entry: {
p:"ورکول", ts: 1527813914,
f:"wărkawul", p: "ورکول",
g: "", f: "wărkawul",
e:"to give (to him, her, them, others)", g: "",
c: "v. trans.", e: "to give (to him, her, them, others)",
i:12350, c: "v. trans.",
}, i: 12350,
}, },
{ },
entry: { {
ts: 1527812157, entry: {
p: "تېرول", ts: 1527812157,
f: "terawul", p: "تېرول",
g: "", f: "terawul",
e: "to pass (time), to take across, to pass, endure (difficulties)", g: "",
c: "v. stat. comp. trans.", e: "to pass (time), to take across, to pass, endure (difficulties)",
l: 1527813139, c: "v. stat. comp. trans.",
i: 3459, l: 1527813139,
}, i: 3459,
complement: {"i":3774,"ts":1527813139,g: "","p":"تېر","f":"ter","e":"last, past, previous, passed, gone over","c":"adj."},
}, },
{ complement: {
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"}, i: 3774,
ts: 1527813139,
g: "",
p: "تېر",
f: "ter",
e: "last, past, previous, passed, gone over",
c: "adj.",
}, },
{ },
entry: { {
ts: 1527817026, entry: {
p: "کښل", ts: 1527815399,
f: "kxul", i: 15049,
g: "", p: "وهل",
e: "to drag, pull, take out, draw, get", f: "wahul",
c: "v. trans.", g: "wahul",
i: 8862, e: "to hit",
}, r: 4,
c: "v. trans.",
tppp: "واهه",
tppf: "waahu",
ec: "hit,hits,hitting,hit,hit",
}, },
{ },
entry: { {
ts: 1527814084, entry: {
p: "لګول", ts: 1527817026,
f: "lagawul", p: "کښل",
g: "", f: "kxul",
e: "to touch, join, use, take, place", g: "",
c: "v. trans.", e: "to drag, pull, take out, draw, get",
i: 9794, c: "v. trans.",
}, i: 8862,
}, },
{ },
entry: { {
ts: 1527814084, entry: {
p: "لګول", ts: 1527814084,
f: "lagawul", p: "لګول",
g: "", f: "lagawul",
e: "to touch, join, use, take, place", g: "",
c: "v. trans.", e: "to touch, join, use, take, place",
i: 9794, c: "v. trans.",
} i: 9794,
}, },
{ },
entry: { {
ts: 1527817013, entry: {
p: "ویل", ts: 1527814084,
f: "wayul, wayl", p: "لګول",
g: "", f: "lagawul",
e: "to say, to tell", g: "",
c: "v. trans. indir.", e: "to touch, join, use, take, place",
i: 12229, c: "v. trans.",
}, i: 9794,
}, },
{ },
entry: { {
ts: 1527815396, entry: {
p: "وایل", ts: 1527817013,
f: "waayul", p: "ویل",
g: "", f: "wayul, wayl",
e: "to say, to tell", g: "",
c: "v. trans. indir.", e: "to say, to tell",
i: 11929, c: "v. trans. indir.",
}, i: 12229,
}, },
{ },
entry: { {
ts: 1527812447, entry: {
p: "اخستل", ts: 1527815396,
f: "akhustul", p: "وایل",
g: "", f: "waayul",
e: "to take, buy, purchase, receive; to shave, cut with scissors", g: "",
c: "v. trans.", e: "to say, to tell",
i: 251, c: "v. trans. indir.",
psp: "اخل", i: 11929,
psf: "akhl",
},
}, },
{ },
entry: { {
ts: 1527817298, entry: {
p: "اخیستل", ts: 1527812447,
f: "akheestul", p: "اخستل",
g: "", f: "akhustul",
e: "to take, buy, purchase, receive; to shave, cut with scissors", g: "",
c: "v. trans.", e: "to take, buy, purchase, receive; to shave, cut with scissors",
i: 266, c: "v. trans.",
}, i: 251,
psp: "اخل",
psf: "akhl",
}, },
{ },
entry: { {
ts: 1527814617, entry: {
p: "نیول", ts: 1527817298,
f: "neewul", p: "اخیستل",
g: "", f: "akheestul",
e: "to catch, grab, take, arrest; bear (fruit)", g: "",
c: "v. trans. irreg.", e: "to take, buy, purchase, receive; to shave, cut with scissors",
i: 11880, c: "v. trans.",
psp: "نیس", i: 266,
psf: "nees",
},
}, },
{ },
entry: { {
ts: 1527811872, entry: {
p: "اچول", ts: 1527814617,
f: "achawul", p: "نیول",
g: "", f: "neewul",
e: "to pour, drop, throw, put on", g: "",
c: "v. trans.", e: "to catch, grab, take, arrest; bear (fruit)",
i: 194, c: "v. trans. irreg.",
}, i: 11880,
psp: "نیس",
psf: "nees",
}, },
{ },
entry: { {
ts: 1527812790, entry: {
p: "خوړل", ts: 1527811872,
f: "khoRul", p: "اچول",
g: "", f: "achawul",
e: "to eat, to bite", g: "",
c: "v. trans.", e: "to pour, drop, throw, put on",
i: 4769, c: "v. trans.",
psp: "خور", i: 194,
psf: "khor",
tppp: "خوړ",
tppf: "khoR",
},
}, },
{ },
entry: { {
ts: 1527811868, entry: {
p: "غښتل", ts: 1527812790,
f: "ghuxtul", p: "خوړل",
g: "", f: "khoRul",
e: "to twist, curl, roll up, wrap up", g: "",
c: "v. trans.", e: "to eat, to bite",
i: 7958, c: "v. trans.",
}, i: 4769,
psp: "خور",
psf: "khor",
tppp: "خوړ",
tppf: "khoR",
}, },
{ },
entry: { {
ts: 1527816127, entry: {
p: "اړول", ts: 1527811868,
f: "aRawul", p: "غښتل",
g: "", f: "ghuxtul",
e: "to turn over, flip over; convert, change; to move over to, establish oneself in a new spot; divert, turn away, hijack; oblige, force", g: "",
c: "v. trans.", e: "to twist, curl, roll up, wrap up",
i: 389, c: "v. trans.",
}, i: 7958,
}, },
{ },
entry: { {
ts: 1527812868, entry: {
p: "لرل", ts: 1527816127,
f: "larul", p: "اړول",
g: "", f: "aRawul",
e: "to have, possess", g: "",
c: "v. trans.", e: "to turn over, flip over; convert, change; to move over to, establish oneself in a new spot; divert, turn away, hijack; oblige, force",
i: 9707, c: "v. trans.",
tppp: "لاره", i: 389,
tppf: "laaru",
},
}, },
{ },
entry: { {
ts: 1527813572, entry: {
p: "رسول", ts: 1527812868,
f: "rasawul", p: "لرل",
g: "", f: "larul",
e: "to deliver, to make arrive, provide, send, supply, bring to,", g: "",
c: "v. trans.", e: "to have, possess",
i: 5897, c: "v. trans.",
}, i: 9707,
tppp: "لاره",
tppf: "laaru",
}, },
{ },
entry: { {
ts: 1581619940636, entry: {
p: "باسل", ts: 1527813572,
f: "baasul", p: "رسول",
g: "", f: "rasawul",
e: "to take out, extract, pull out, tear out", g: "",
c: "v. trans.", e: "to deliver, to make arrive, provide, send, supply, bring to,",
i: 1115, c: "v. trans.",
}, i: 5897,
}, },
{ },
entry: { {
ts: 1527816146, entry: {
p: "ایستل", ts: 1581619940636,
f: "eestul", p: "باسل",
g: "", f: "baasul",
e: "to throw out, discard, chuck, toss; to extract, to take out", g: "",
c: "v. trans.", e: "to take out, extract, pull out, tear out",
i: 1025, c: "v. trans.",
psp: "باس", i: 1115,
psf: "baas",
},
}, },
{ },
entry: { {
ts: 1527818123, entry: {
p: "څنډل", ts: 1527816146,
f: "tsanDúl", p: "ایستل",
g: "", f: "eestul",
e: "to shake out, shake off, brush aside", g: "",
c: "v. trans.", e: "to throw out, discard, chuck, toss; to extract, to take out",
i: 4975, c: "v. trans.",
tppp: "څانډ", i: 1025,
tppf: "tsaanD", psp: "باس",
}, psf: "baas",
}, },
{ },
entry: { {
ts: 1527814862, entry: {
p: "وژل", ts: 1527818123,
f: "wajzul", p: "څنډل",
g: "", f: "tsanDúl",
e: "to kill, slaughter", g: "",
c: "v. trans. irreg.", e: "to shake out, shake off, brush aside",
i: 12071, c: "v. trans.",
psp: "وژن", i: 4975,
psf: "wajzn", tppp: "څانډ",
tppp: "واژه", tppf: "tsaanD",
tppf: "waajzu",
},
}, },
{ },
entry: { {
ts: 1527813019, entry: {
p: "ګرول", ts: 1527814862,
f: "grawul", p: "وژل",
g: "", f: "wajzul",
e: "to scratch, scrape", g: "",
c: "v. trans.", e: "to kill, slaughter",
i: 9370, c: "v. trans. irreg.",
}, i: 12071,
psp: "وژن",
psf: "wajzn",
tppp: "واژه",
tppf: "waajzu",
}, },
{ },
entry: { {
ts: 1527818260, entry: {
p: "بادول", ts: 1527813019,
f: "baadawúl", p: "ګرول",
g: "", f: "grawul",
e: "to winnow, toss, throw to the wind, squander", g: "",
c: "v. stat. comp. trans.", e: "to scratch, scrape",
l: 1527816345, c: "v. trans.",
i: 1088, i: 9370,
},
complement: {
ts: 1527816345,
p: "باد",
f: "baad",
g: "",
e: "wind, air; swelling, rheumitism",
c: "n. m.",
i: 1076,
},
}, },
{ },
entry: { {
ts: 1527815343, entry: {
p: "تېرېدل", ts: 1527818260,
f: "teredul", p: "بادول",
g: "", f: "baadawúl",
e: "to pass, go across, go by", g: "",
c: "v. stat. comp. intrans.", e: "to winnow, toss, throw to the wind, squander",
l: 1527813139, c: "v. stat. comp. trans.",
i: 3461, l: 1527816345,
}, i: 1088,
complement: {
ts: 1527813139,
p: "تېر",
f: "ter",
g: "",
e: "last, past, previous, passed, gone over",
c: "adj.",
i: 3449,
},
}, },
{ complement: {
entry: { ts: 1527816345,
ts: 1571859113828, p: "باد",
p: "پخول", f: "baad",
f: "pukhawul", g: "",
g: "", e: "wind, air; swelling, rheumitism",
e: "to cook, prepare, to cause to ripen", c: "n. m.",
c: "v. stat. comp. trans.", i: 1076,
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",
},
}, },
{ },
entry: { {
ts: 1527817706, entry: {
p: "ټکول", ts: 1527815343,
f: "Takawul", p: "تېرېدل",
g: "", f: "teredul",
e: "to knock, tap", g: "",
c: "v. trans.", e: "to pass, go across, go by",
i: 3568, c: "v. stat. comp. intrans.",
}, l: 1527813139,
i: 3461,
}, },
{ complement: {
entry: { ts: 1527813139,
ts: 1527812869, p: "تېر",
p: "لټول", f: "ter",
f: "luTawul", g: "",
g: "", e: "last, past, previous, passed, gone over",
e: "to search, seek", c: "adj.",
c: "v. trans.", i: 3449,
i: 9686,
},
}, },
{ },
entry: { {
ts: 1574784362578, entry: {
p: "ډنګول", ts: 1571859113828,
f: "Dangawul", p: "پخول",
g: "", f: "pukhawul",
e: "to make sound, to make ring out, to meat to make a sound (like a symbal, pan, etc.)", g: "",
c: "v. trans.", e: "to cook, prepare, to cause to ripen",
i: 5653, c: "v. stat. comp. trans.",
}, l: 1574867531681,
i: 2011,
}, },
{ complement: {
entry: { ts: 1574867531681,
ts: 1527811289, p: "پوخ",
p: "کېنول", f: "pokh",
f: "kenawul", g: "",
g: "", e: "mature, ripe, ready, cooked, able, skillful, experienced, tried, tested, true",
e: "to seat, to make or have someone sit down", c: "adj. irreg.",
c: "v. trans.", i: 2321,
i: 9240, infap: "پاخه",
noOo: true, infaf: "paakhu",
}, infbp: "پخ",
infbf: "pakh",
}, },
{ },
entry: { {
ts: 1527812873, entry: {
p: "لوستل", ts: 1527817706,
f: "lwustul", p: "ټکول",
g: "", f: "Takawul",
e: "to read, study", g: "",
c: "v. trans. irreg.", e: "to knock, tap",
i: 10163, c: "v. trans.",
psp: "لول", i: 3568,
psf: "lwul",
},
}, },
{ },
entry: { {
i:4362, entry: {
ts:1527814586, ts: 1527812869,
p:"چلول", p: "لټول",
f:"chalawul", f: "luTawul",
g: "", g: "",
e:"to drive, operate, handle, put forward, circulate", e: "to search, seek",
c:"v. trans.", 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 * as T from "../../types";
import { import {
isFemNounEntry, isFemNounEntry,
isNounEntry, isNounEntry,
isPattern1Entry, isPattern1Entry,
isPattern2Entry, isPattern2Entry,
isPattern3Entry, isPattern3Entry,
isPattern4Entry, isPattern4Entry,
isPattern5Entry, isPattern5Entry,
isPattern6FemEntry, isPattern6FemEntry,
} from "./type-predicates"; } from "./type-predicates";
export function getInflectionPattern(e: T.NounEntry | T.AdjectiveEntry): T.InflectionPattern { export function getInflectionPattern(
return isPattern1Entry(e) e: T.NounEntry | T.AdjectiveEntry
? T.InflectionPattern.Basic ): T.InflectionPattern {
: isPattern2Entry(e) return isPattern1Entry(e)
? T.InflectionPattern.UnstressedEy ? T.InflectionPattern.Basic
: isPattern3Entry(e) : isPattern2Entry(e)
? T.InflectionPattern.StressedEy ? T.InflectionPattern.UnstressedAy
: isPattern4Entry(e) : isPattern3Entry(e)
? T.InflectionPattern.Pashtun ? T.InflectionPattern.StressedAy
: isPattern5Entry(e) : isPattern4Entry(e)
? T.InflectionPattern.Squish ? T.InflectionPattern.Pashtun
: isNounEntry(e) && isFemNounEntry(e) && isPattern6FemEntry(e) : isPattern5Entry(e)
? T.InflectionPattern.FemInanEe ? T.InflectionPattern.Squish
: T.InflectionPattern.None; : 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 { makeVerbSelection } from "./make-verb-selection";
import { vEntry } from "./rs-helpers"; 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 wahul = vEntry({
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}); ts: 1527815399,
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"}); i: 15049,
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"}); p: "وهل",
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"}); f: "wahul",
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"}); g: "wahul",
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"}); 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( 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( 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( 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( 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( 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( 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: { const tests: {
verb: T.VerbEntry, verb: T.VerbEntry;
result: T.NewVerbSelection, result: T.NewVerbSelection;
}[] = [ }[] = [
{ {
verb: wahul, verb: wahul,
result: { result: {
type: "verb", type: "verb",
verb: wahul, verb: wahul,
voice: "active", voice: "active",
canChangeVoice: true, canChangeVoice: true,
transitivity: "transitive", transitivity: "transitive",
compound: false, compound: false,
canBeGenStat: false, canBeGenStat: false,
canChangeTransGenTrans: false, canChangeTransGenTrans: false,
variableRs: false, variableRs: false,
canChangeStatDyn: false, canChangeStatDyn: false,
negative: false, negative: false,
tense: "presentVerb", tense: "presentVerb",
},
}, },
{ },
verb: ghadzedul, {
result: { verb: ghadzedul,
type: "verb", result: {
verb: ghadzedul, type: "verb",
voice: "active", verb: ghadzedul,
canChangeVoice: false, voice: "active",
transitivity: "intransitive", canChangeVoice: false,
compound: false, transitivity: "intransitive",
canBeGenStat: false, compound: false,
canChangeTransGenTrans: false, canBeGenStat: false,
variableRs: false, canChangeTransGenTrans: false,
canChangeStatDyn: false, variableRs: false,
negative: false, canChangeStatDyn: false,
tense: "presentVerb", negative: false,
}, tense: "presentVerb",
}, },
{ },
verb: khandul, {
result: { verb: khandul,
type: "verb", result: {
verb: khandul, type: "verb",
voice: "active", verb: khandul,
canChangeVoice: false, voice: "active",
transitivity: "grammatically transitive", canChangeVoice: false,
compound: false, transitivity: "grammatically transitive",
canBeGenStat: false, compound: false,
canChangeTransGenTrans: false, canBeGenStat: false,
variableRs: false, canChangeTransGenTrans: false,
canChangeStatDyn: false, variableRs: false,
negative: false, canChangeStatDyn: false,
tense: "presentVerb", negative: false,
}, tense: "presentVerb",
}, },
{ },
verb: leedul, {
result: { verb: leedul,
type: "verb", result: {
verb: leedul, type: "verb",
voice: "active", verb: leedul,
canChangeVoice: true, voice: "active",
transitivity: "transitive", canChangeVoice: true,
compound: false, transitivity: "transitive",
canBeGenStat: false, compound: false,
canChangeTransGenTrans: true, canBeGenStat: false,
variableRs: false, canChangeTransGenTrans: true,
canChangeStatDyn: false, variableRs: false,
negative: false, canChangeStatDyn: false,
tense: "presentVerb", negative: false,
}, tense: "presentVerb",
}, },
{ },
verb: bandawul, {
result: { verb: bandawul,
type: "verb", result: {
verb: bandawul, type: "verb",
voice: "active", verb: bandawul,
canChangeVoice: true, voice: "active",
transitivity: "transitive", canChangeVoice: true,
compound: "stative", transitivity: "transitive",
canBeGenStat: false, compound: "stative",
canChangeTransGenTrans: false, canBeGenStat: false,
variableRs: false, canChangeTransGenTrans: false,
canChangeStatDyn: false, variableRs: false,
negative: false, canChangeStatDyn: false,
tense: "presentVerb", negative: false,
}, tense: "presentVerb",
}, },
{ },
verb: bandedul, {
result: { verb: bandedul,
type: "verb", result: {
verb: bandedul, type: "verb",
voice: "active", verb: bandedul,
canChangeVoice: false, voice: "active",
transitivity: "intransitive", canChangeVoice: false,
compound: "stative", transitivity: "intransitive",
canBeGenStat: false, compound: "stative",
canChangeTransGenTrans: false, canBeGenStat: false,
variableRs: false, canChangeTransGenTrans: false,
canChangeStatDyn: false, variableRs: false,
negative: false, canChangeStatDyn: false,
tense: "presentVerb", negative: false,
}, tense: "presentVerb",
}, },
{ },
verb: mundaWahul, {
result: { verb: mundaWahul,
type: "verb", result: {
verb: mundaWahul, type: "verb",
voice: "active", verb: mundaWahul,
canChangeVoice: true, voice: "active",
transitivity: "transitive", canChangeVoice: true,
compound: "dynamic", transitivity: "transitive",
canBeGenStat: false, compound: "dynamic",
canChangeTransGenTrans: false, canBeGenStat: false,
variableRs: false, canChangeTransGenTrans: false,
canChangeStatDyn: false, variableRs: false,
negative: false, canChangeStatDyn: false,
tense: "presentVerb", negative: false,
dynAuxVerb: wahul, tense: "presentVerb",
}, dynAuxVerb: wahul,
}, },
{ },
verb: istreeKawul, {
result: { verb: istreeKawul,
type: "verb", result: {
verb: istreeKawul, type: "verb",
voice: "active", verb: istreeKawul,
canChangeVoice: true, voice: "active",
transitivity: "transitive", canChangeVoice: true,
compound: "stative", transitivity: "transitive",
canBeGenStat: false, compound: "stative",
canChangeTransGenTrans: false, canBeGenStat: false,
variableRs: false, canChangeTransGenTrans: false,
canChangeStatDyn: true, variableRs: false,
negative: false, canChangeStatDyn: true,
tense: "presentVerb", negative: false,
dynAuxVerb: kawulDyn, tense: "presentVerb",
}, dynAuxVerb: kawulDyn,
}, },
{ },
verb: cheeghKawul, {
result: { verb: cheeghKawul,
type: "verb", result: {
verb: cheeghKawul, type: "verb",
voice: "active", verb: cheeghKawul,
canChangeVoice: false, voice: "active",
transitivity: "transitive", canChangeVoice: false,
compound: "dynamic", transitivity: "transitive",
canBeGenStat: true, compound: "dynamic",
canChangeTransGenTrans: false, canBeGenStat: true,
variableRs: false, canChangeTransGenTrans: false,
canChangeStatDyn: false, variableRs: false,
negative: false, canChangeStatDyn: false,
tense: "presentVerb", negative: false,
dynAuxVerb: kawulDyn, tense: "presentVerb",
}, dynAuxVerb: kawulDyn,
}, },
{ },
verb: kaarKawul, {
result: { verb: kaarKawul,
type: "verb", result: {
verb: kaarKawul, type: "verb",
voice: "active", verb: kaarKawul,
canChangeVoice: false, voice: "active",
transitivity: "transitive", canChangeVoice: false,
compound: "dynamic", transitivity: "transitive",
canBeGenStat: false, compound: "dynamic",
canChangeTransGenTrans: false, canBeGenStat: false,
variableRs: false, canChangeTransGenTrans: false,
canChangeStatDyn: false, variableRs: false,
negative: false, canChangeStatDyn: false,
tense: "presentVerb", negative: false,
dynAuxVerb: kawulDyn, tense: "presentVerb",
}, dynAuxVerb: kawulDyn,
}, },
},
]; ];
test("verb selection", () => { test("verb selection", () => {
tests.forEach(({ verb, result }) => { tests.forEach(({ verb, result }) => {
expect(makeVerbSelection(verb)) expect(makeVerbSelection(verb)).toEqual(result);
.toEqual(result); });
});
}); });
test("verb selection failures", () => { test("verb selection failures", () => {
expect(() => { expect(() => {
makeVerbSelection(wahulNoC); makeVerbSelection(wahulNoC);
}).toThrow(); }).toThrow();
expect(() => { expect(() => {
makeVerbSelection(wahulNoC2); makeVerbSelection(wahulNoC2);
}).toThrow(); }).toThrow();
}); });

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,18 @@
import * as T from "../../../types"; import * as T from "../../../types";
import { removeFVarients } from "../accent-and-ps-utils"; import { removeFVarients } from "../accent-and-ps-utils";
import { accentOnNFromEnd, accentPsSyllable, countSyllables, removeAccents, removeAccentsWLength } from "../accent-helpers"; import {
import { concatPsString, isUnisexSet, psStringFromEntry, trimOffPs } from "../p-text-helpers"; accentOnNFromEnd,
accentPsSyllable,
countSyllables,
removeAccents,
removeAccentsWLength,
} from "../accent-helpers";
import {
concatPsString,
isUnisexSet,
psStringFromEntry,
trimOffPs,
} from "../p-text-helpers";
import { inflectPattern1 } from "./new-inflectors"; import { inflectPattern1 } from "./new-inflectors";
import { getLength } from "../p-text-helpers"; import { getLength } from "../p-text-helpers";
import { equativeEndings } from "../grammar-units"; import { equativeEndings } from "../grammar-units";
@ -9,50 +20,54 @@ import { isAdjectiveEntry, isImperativeTense } from "../type-predicates";
import { inflectWord } from "../pashto-inflector"; import { inflectWord } from "../pashto-inflector";
export function isStatComp(v: T.VerbEntry): boolean { 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 { 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 { export function makeComplement(
if (isAdjectiveEntry(e)) { e: T.DictionaryEntryNoFVars,
const infs = inflectWord(e); { gender, number }: T.GenderNumber
const ps = infs && infs.inflections && isUnisexSet(infs.inflections) ): T.NComp {
? infs.inflections[gender][number === "singular" ? 0 : 1][0] if (isAdjectiveEntry(e)) {
: psStringFromEntry(e); const infs = inflectWord(e);
return { const ps =
type: "NComp", infs && infs.inflections && isUnisexSet(infs.inflections)
comp: { ? infs.inflections[gender][number === "singular" ? 0 : 1][0]
type: "AdjComp", : psStringFromEntry(e);
ps: lightEnforceCompAccent(ps),
gender,
number,
},
};
}
return { return {
type: "NComp", type: "NComp",
comp: { comp: {
type: "Comp", type: "AdjComp",
ps: lightEnforceCompAccent(psStringFromEntry(e)), ps: lightEnforceCompAccent(ps),
}, gender,
number,
},
}; };
function lightEnforceCompAccent(ps: T.PsString): T.PsString { }
return countSyllables(ps) === 1 return {
? accentPsSyllable(ps) type: "NComp",
: ps; 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 { export function vEntry(e: any, c?: any): T.VerbEntryNoFVars {
return { return {
entry: removeFVarients(e), entry: removeFVarients(e),
...c ? { ...(c
complement: c, ? {
} : {}, complement: c,
} as T.VerbEntryNoFVars; }
: {}),
} as T.VerbEntryNoFVars;
} }
// export function getAllRs(verb: T.VerbEntry): { // export function getAllRs(verb: T.VerbEntry): {
@ -85,81 +100,91 @@ export function vEntry(e: any, c?: any): T.VerbEntryNoFVars {
* @param end - the verb ending * @param end - the verb ending
* @returns * @returns
*/ */
export function verbEndingConcat(ps: T.PsString[], end: T.PsString[]): T.PsString[] { export function verbEndingConcat(
if (ps[0].f === "shw" && end[0].f === "oo") { ps: T.PsString[],
return [{ p: "شو", f: "shoo" }]; end: T.PsString[]
} ): T.PsString[] {
return ps.flatMap(v => ( if (ps[0].f === "shw" && end[0].f === "oo") {
end.map(e => { return [{ p: "شو", f: "shoo" }];
if (v.f.charAt(v.f.length-1) === "X") { }
// faster to do concatPsString(trimOffPs(v, 0, 1), accentSyllable(e)) return ps.flatMap((v) =>
// but this covers cases like adding the 3rd person no-ending to a string with the end.map((e) => {
// trailing accent marker and still getting the accent right if (v.f.charAt(v.f.length - 1) === "X") {
return accentOnNFromEnd(concatPsString(trimOffPs(v, 0, 1), e), 0); // 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
if (e.p === "ل" && ["ul", "úl"].includes(v.f.slice(-2))) { // trailing accent marker and still getting the accent right
return v; return accentOnNFromEnd(concatPsString(trimOffPs(v, 0, 1), e), 0);
} }
return concatPsString(v, e); 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 // 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(
export function weld(left: T.Welded["left"], right: T.VBBasic | T.NComp | T.Welded): T.Welded; left: T.Welded["left"],
export function weld(left: T.Welded["left"], right: T.VBBasic | T.VBGenNum | T.Welded | T.NComp | T.WeldedGN): T.Welded | T.WeldedGN { right: T.VBGenNum | T.WeldedGN
if (right.type === "welded") { ): T.WeldedGN;
return weld(weld(left, right.left), right.right); 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 (left.type === "NComp") {
if (right.type === "NComp") { return {
throw new Error("can't weld a complement on the right side"); ...left,
comp: {
...left.comp,
ps: removeAccents(left.comp.ps),
},
};
} }
return { return {
type: "welded", ...left,
left: removeAccentsFromLeft(left), right: {
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 { export function addTrailingAccent(ps: T.PsString): T.PsString {
return { return {
p: ps.p, p: ps.p,
f: ps.f + "X", f: ps.f + "X",
}; };
} }
// TODO: could do removeEndingL (slower but safer) // TODO: could do removeEndingL (slower but safer)
export function removeL(ps: T.PsString): T.PsString { 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 * returns a simple polar transitivity of the verb, only intransitive or transitive
@ -168,142 +193,164 @@ export function removeL(ps: T.PsString): T.PsString {
* @returns * @returns
*/ */
export function vTransitivity(v: T.VerbEntry): "intransitive" | "transitive" { 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]] { export function tlulPerfectiveStem(person: {
return [ gender: T.Gender;
[ number: T.NounNumber;
{ }): [[T.PH], [T.VB]] {
type: "PH", return [
ps: inflectPattern1({ p: "لاړ", f: "láaR" }, person).map(x => concatPsString(x, " "))[0], [
}, {
], type: "PH",
[ ps: inflectPattern1({ p: "لاړ", f: "láaR" }, person).map((x) =>
{ concatPsString(x, " ")
type: "VB", )[0],
ps: [{ p: "ش", f: "sh" }], },
}, ],
], [
]; {
type: "VB",
ps: [{ p: "ش", f: "sh" }],
},
],
];
} }
export function addAbilityEnding(vb: T.VBA): T.VBA { export function addAbilityEnding(vb: T.VBA): T.VBA {
const abilityEnding: T.PsString[] = [ const abilityEnding: T.PsString[] = [
{ p: "ی", f: "ey" }, { p: "ی", f: "ay" },
{ p: "ای", f: "aay" }, { p: "ای", f: "aay" },
]; ];
if (vb.type === "welded") { if (vb.type === "welded") {
return { return {
...vb, ...vb,
right: addToEnd(vb.right, abilityEnding), right: addToEnd(vb.right, abilityEnding),
}; };
} }
return addToEnd(vb, abilityEnding); return addToEnd(vb, abilityEnding);
function addToEnd(vb: T.VBBasic, end: T.PsString[]): T.VBBasic { function addToEnd(vb: T.VBBasic, end: T.PsString[]): T.VBBasic {
/* istanbul ignore next */ /* istanbul ignore next */
if (!("long" in vb.ps)) { if (!("long" in vb.ps)) {
throw new Error("should have long and short form for adding to ability ending"); 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),
},
};
} }
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.VBBasic>): T.VBBasic;
export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA; export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA;
export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA { export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA {
const shortenableEndings = ["ښتل", "ستل", "وتل"]; const shortenableEndings = ["ښتل", "ستل", "وتل"];
const wrul = ["وړل", "راوړل", "وروړل", "دروړل"]; const wrul = ["وړل", "راوړل", "وروړل", "دروړل"];
// can't find a case where this is used - type safety // can't find a case where this is used - type safety
/* istanbul ignore next */ /* istanbul ignore next */
if ("right" in vba) { if ("right" in vba) {
return { return {
...vba, ...vba,
right: possiblePPartLengths(vba.right), right: possiblePPartLengths(vba.right),
}; };
} }
const infinitive = vba.ps[0]; const infinitive = vba.ps[0];
if (infinitive.f === "tlúl") { if (infinitive.f === "tlúl") {
return { return {
type: "VB", type: "VB",
ps: { ps: {
long: [infinitive], long: [infinitive],
short: [{ p: "تل", f: "túl" }], short: [{ p: "تل", f: "túl" }],
}, },
}; };
} }
const [trimP, trimF] = (infinitive.p.slice(-4) === "ښودل" && infinitive.p.length > 4 && infinitive.p !== "کېښودل" && infinitive.p !== "کښېښودل") const [trimP, trimF] =
// special thing for اېښودل - پرېښودل infinitive.p.slice(-4) === "ښودل" &&
? [3, 4] infinitive.p.length > 4 &&
: (wrul.includes(infinitive.p) || (shortenableEndings.includes(infinitive.p.slice(-3)) && infinitive.p.slice(-4) !== "استل")) infinitive.p !== "کېښودل" &&
? [1, 2] infinitive.p !== "کښېښودل"
: [0, 0]; ? // special thing for اېښودل - پرېښودل
if (trimP) { [3, 4]
return { : wrul.includes(infinitive.p) ||
type: "VB", (shortenableEndings.includes(infinitive.p.slice(-3)) &&
ps: { infinitive.p.slice(-4) !== "استل")
long: [infinitive], ? [1, 2]
short: [accentOnNFromEnd(trimOffPs(infinitive, trimP, trimF), 0)], : [0, 0];
}, if (trimP) {
}; return {
} type: "VB",
return vba; 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.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>;
export function getLongVB(vb: T.VBA): T.VBNoLenghts<T.VBA> { export function getLongVB(vb: T.VBA): T.VBNoLenghts<T.VBA> {
if (vb.type === "welded") { if (vb.type === "welded") {
return {
...vb,
right: getLongVB(vb.right),
};
}
return { return {
...vb, ...vb,
ps: getLength(vb.ps, "long"), 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 { export function getAspect(
if (isImperativeTense(tense) && negative) { tense: T.VerbTense | T.AbilityTense | T.ImperativeTense,
return "imperfective"; negative: boolean
} ): T.Aspect {
const t = tense.replace("Modal", ""); if (isImperativeTense(tense) && negative) {
const imperfectives: Parameters<typeof getAspect>[0][] = ["presentVerb", "imperfectiveFuture", "imperfectivePast", "habitualImperfectivePast", "imperfectiveImperative"]; return "imperfective";
if (imperfectives.includes(t as Parameters<typeof getAspect>[0])) { }
return "imperfective"; const t = tense.replace("Modal", "");
} else { const imperfectives: Parameters<typeof getAspect>[0][] = [
return "perfective"; "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 { export function isKedul(v: T.VerbEntry): boolean {
return v.entry.p === "کېدل"; return v.entry.p === "کېدل";
} }
export function perfectTenseToEquative(t: T.PerfectTense): keyof typeof equativeEndings { export function perfectTenseToEquative(
return t === "presentPerfect" t: T.PerfectTense
? "present" ): keyof typeof equativeEndings {
: t === "futurePerfect" return t === "presentPerfect"
? "habitual" ? "present"
: t === "habitualPerfect" : t === "futurePerfect"
? "habitual" ? "habitual"
: t === "pastPerfect" : t === "habitualPerfect"
? "past" ? "habitual"
: t === "pastSubjunctivePerfect" : t === "pastPerfect"
? "pastSubjunctive" ? "past"
: t === "wouldBePerfect" : t === "pastSubjunctivePerfect"
? "past" ? "pastSubjunctive"
: t === "wouldHaveBeenPerfect" : t === "wouldBePerfect"
? "pastSubjunctive" ? "past"
: "subjunctive"; : 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 // TODO: See if there are animate feminine words ending in ي and test
import { import {
inflectRegularYeyUnisex, inflectRegularYayUnisex,
inflectWord, inflectWord,
} from "./pashto-inflector"; } from "./pashto-inflector";
import * as T from "../../types"; import * as T from "../../types";
@ -53,7 +53,7 @@ const adjectives: {
in: { in: {
ts: 1527815306, ts: 1527815306,
p: "ستړی", p: "ستړی",
f: "stúRey", f: "stúRay",
g: "", g: "",
e: "tired", e: "tired",
c: "adj.", c: "adj.",
@ -62,7 +62,7 @@ const adjectives: {
out: { out: {
inflections: { inflections: {
masc: [ masc: [
[{p: "ستړی", f: "stúRey"}], [{p: "ستړی", f: "stúRay"}],
[{p: "ستړي", f: "stúRee"}], [{p: "ستړي", f: "stúRee"}],
[{p: "ستړیو", f: "stúRiyo"}, {p: "ستړو", f: "stúRo"}], [{p: "ستړیو", f: "stúRiyo"}, {p: "ستړو", f: "stúRo"}],
], ],
@ -79,7 +79,7 @@ const adjectives: {
in: { in: {
ts: 1527813636, ts: 1527813636,
p: "وروستی", p: "وروستی",
f: "wroostéy", f: "wroostáy",
g: "", g: "",
e: "last, latest, recent", e: "last, latest, recent",
c: "adj.", c: "adj.",
@ -88,7 +88,7 @@ const adjectives: {
out: { out: {
inflections: { inflections: {
masc: [ masc: [
[{p: "وروستی", f: "wroostéy"}], [{p: "وروستی", f: "wroostáy"}],
[{p: "وروستي", f: "wroostée"}], [{p: "وروستي", f: "wroostée"}],
[{p: "وروستیو", f: "wroostiyo"}, {p: "وروستو", f: "wroostó"}], [{p: "وروستیو", f: "wroostiyo"}, {p: "وروستو", f: "wroostó"}],
], ],
@ -374,7 +374,7 @@ const nouns: {
in: { in: {
ts: 1527814159, ts: 1527814159,
p: "ملګری", p: "ملګری",
f: "malgúrey", f: "malgúray",
g: "", g: "",
e: "friend, companion", e: "friend, companion",
c: "n. m. unisex", c: "n. m. unisex",
@ -383,7 +383,7 @@ const nouns: {
out: { out: {
inflections: { inflections: {
masc: [ masc: [
[{p: "ملګری", f: "malgúrey"}], [{p: "ملګری", f: "malgúray"}],
[{p: "ملګري", f: "malgúree"}], [{p: "ملګري", f: "malgúree"}],
[{p: "ملګریو", f: "malgúriyo"}, {p: "ملګرو", f: "malgúro"}], [{p: "ملګریو", f: "malgúriyo"}, {p: "ملګرو", f: "malgúro"}],
], ],
@ -397,11 +397,11 @@ const nouns: {
}, },
// Unisex noun ending on ی with emphasis on the end // 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: { out: {
inflections: { inflections: {
masc: [ masc: [
[{p: "ترورزی", f: "trorzéy"}], [{p: "ترورزی", f: "trorzáy"}],
[{p: "ترورزي", f: "trorzée"}], [{p: "ترورزي", f: "trorzée"}],
[{p: "ترورزیو", f: "trorziyo"}, {p: "ترورزو", f: "trorzó"}], [{p: "ترورزیو", f: "trorziyo"}, {p: "ترورزو", f: "trorzó"}],
], ],
@ -463,11 +463,11 @@ const nouns: {
}, },
// with #3 pattern anim unisex // 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: { out: {
inflections: { inflections: {
masc: [ masc: [
[{ p: "پلوی", f: "palawéy" }], [{ p: "پلوی", f: "palawáy" }],
[{ p: "پلوي", f: "palawée" }], [{ p: "پلوي", f: "palawée" }],
[{ p: "پلویو", f: "palawiyo" }, { p: "پلوو", f: "palawó" }], [{ p: "پلویو", f: "palawiyo" }, { p: "پلوو", f: "palawó" }],
], ],
@ -495,7 +495,7 @@ const nouns: {
in: { in: {
ts: 1527815251, ts: 1527815251,
p: "سړی", p: "سړی",
f: "saRéy", f: "saRáy",
g: "", g: "",
e: "man", e: "man",
c: "n. m.", c: "n. m.",
@ -504,7 +504,7 @@ const nouns: {
out: { out: {
inflections: { inflections: {
masc: [ masc: [
[{p: "سړی", f: "saRéy"}], [{p: "سړی", f: "saRáy"}],
[{p: "سړي", f: "saRée"}], [{p: "سړي", f: "saRée"}],
[{p: "سړیو", f: "saRiyo"}, {p: "سړو", f: "saRo"}], [{p: "سړیو", f: "saRiyo"}, {p: "سړو", f: "saRo"}],
], ],
@ -514,19 +514,19 @@ const nouns: {
// Masculine #3 anim // Masculine #3 anim
// TODO: Also do Fem #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: { out: {
inflections: { inflections: {
masc: [ masc: [
[{ p: "سیلانی", f: "seylaanéy" }], [{ p: "سیلانی", f: "saylaanáy" }],
[{ p: "سیلاني", f: "seylaanée" }], [{ p: "سیلاني", f: "saylaanée" }],
[{ p: "سیلانیو", f: "seylaaniyo" }, { p: "سیلانو", f: "seylaano" }], [{ p: "سیلانیو", f: "saylaaniyo" }, { p: "سیلانو", f: "saylaano" }],
], ],
}, },
plural: { plural: {
masc: [ masc: [
[{ p: "سیلانیان", f: "seylaaniyáan" }], [{ p: "سیلانیان", f: "saylaaniyáan" }],
[{ p: "سیلانیانو", f: "seylaaniyáano" }], [{ p: "سیلانیانو", f: "saylaaniyáano" }],
], ],
}, },
}, },
@ -536,7 +536,7 @@ const nouns: {
in: { in: {
ts: 1527818511, ts: 1527818511,
p: "ترېلی", p: "ترېلی",
f: "treléy", f: "treláy",
g: "", g: "",
e: "pool, reservoir", e: "pool, reservoir",
c: "n. m.", c: "n. m.",
@ -545,7 +545,7 @@ const nouns: {
out: { out: {
inflections: { inflections: {
masc: [ masc: [
[{p: "ترېلی", f: "treléy"}], [{p: "ترېلی", f: "treláy"}],
[{p: "ترېلي", f: "trelée"}], [{p: "ترېلي", f: "trelée"}],
[{p: "ترېلیو", f: "treliyo"}, {p: "ترېلو", f: "trelo"}], [{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: { out: {
inflections: { inflections: {
// TODO: use smarter system using new isType5Entry predicates, to allow for not using the redundant one syllable accents with these // 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", e: "mother, mom",
c: "n. f. anim.", c: "n. f. anim.",
ppp: "میندې", ppp: "میندې",
ppf: "meynde", ppf: "maynde",
i: 11113, i: 11113,
}, },
out: { out: {
plural: { plural: {
fem: [ fem: [
[{ p: "میندې", f: "meynde" }], [{ p: "میندې", f: "maynde" }],
[{ p: "میندو", f: "meyndo" }], [{ p: "میندو", f: "mayndo" }],
], ],
}, },
}, },
@ -1218,19 +1218,19 @@ const nouns: {
}, },
// with variations on Pashto plural // 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: { out: {
inflections: { inflections: {
masc: [ masc: [
[{ p: "شی", f: "shey" }], [{ p: "شی", f: "shay" }],
[{ p: "شي", f: "shee" }], [{ p: "شي", f: "shee" }],
[{ p: "شیو", f: "shiyo" }, { p: "شو", f: "sho" }], [{ p: "شیو", f: "shiyo" }, { p: "شو", f: "sho" }],
], ],
}, },
plural: { plural: {
masc: [ masc: [
[{ p: "شیان", f: "sheyáan" }, { p: "شیونه", f: "sheyóona" }], [{ p: "شیان", f: "shayáan" }, { p: "شیونه", f: "shayóona" }],
[{ p: "شیانو", f: "sheyáano" }, { p: "شیونو", f: "sheyóono" }], [{ p: "شیانو", f: "shayáano" }, { p: "شیونو", f: "shayóono" }],
], ],
}, },
}, },
@ -1309,10 +1309,10 @@ others.forEach((word) => {
}); });
}); });
test(`inflectRegularYeyUnisex should work`, () => { test(`inflectRegularYayUnisex should work`, () => {
expect(inflectRegularYeyUnisex("لیدونکی", "leedóonkey")).toEqual({ expect(inflectRegularYayUnisex("لیدونکی", "leedóonkay")).toEqual({
masc: [ masc: [
[{p: "لیدونکی", f: "leedóonkey" }], [{p: "لیدونکی", f: "leedóonkay" }],
[{p: "لیدونکي", f: "leedóonkee" }], [{p: "لیدونکي", f: "leedóonkee" }],
[{p: "لیدونکیو", f: "leedóonkiyo" }, {p: "لیدونکو", f: "leedóonko"}], [{p: "لیدونکیو", f: "leedóonkiyo" }, {p: "لیدونکو", f: "leedóonko"}],
], ],

View File

@ -33,7 +33,7 @@ import * as T from "../../types";
import { fmapSingleOrLengthOpts } from "./fp-ps"; import { fmapSingleOrLengthOpts } from "./fp-ps";
const endingInSingleARegex = /[^a]'??[aá]'??$/; const endingInSingleARegex = /[^a]'??[aá]'??$/;
const endingInHeyOrAynRegex = /[^ا][هع]$/; const endingInHayOrAynRegex = /[^ا][هع]$/;
// const endingInAlefRegex = /اع?$/; // const endingInAlefRegex = /اع?$/;
export function inflectWord(word: T.DictionaryEntry): T.InflectorOutput { export function inflectWord(word: T.DictionaryEntry): T.InflectorOutput {
@ -89,8 +89,8 @@ function handleUnisexWord(word: T.DictionaryEntryNoFVars): T.InflectorOutput {
...plurals, ...plurals,
}; };
} }
if (pEnd === "ی" && word.f.slice(-2) === "ey") { if (pEnd === "ی" && word.f.slice(-2) === "ay") {
return { inflections: inflectRegularYeyUnisex(word.p, word.f), ...plurals }; return { inflections: inflectRegularYayUnisex(word.p, word.f), ...plurals };
} }
if (pEnd === "ه" && word.g.slice(-1) === "u") { if (pEnd === "ه" && word.g.slice(-1) === "u") {
return { return {
@ -98,9 +98,9 @@ function handleUnisexWord(word: T.DictionaryEntryNoFVars): T.InflectorOutput {
...plurals, ...plurals,
}; };
} }
if (pEnd === "ی" && word.f.slice(-2) === "éy") { if (pEnd === "ی" && word.f.slice(-2) === "áy") {
return { return {
inflections: inflectEmphasizedYeyUnisex(word.p, word.f), inflections: inflectEmphasizedYayUnisex(word.p, word.f),
...plurals, ...plurals,
}; };
} }
@ -155,12 +155,12 @@ function handleMascNoun(w: T.DictionaryEntryNoFVars): T.InflectorOutput {
if (isTobEnding) { if (isTobEnding) {
return { inflections: inflectTobMasc(w.p, w.f), ...plurals }; return { inflections: inflectTobMasc(w.p, w.f), ...plurals };
} }
if (pEnd === "ی" && fEnd === "ey") { if (pEnd === "ی" && fEnd === "ay") {
return { inflections: inflectRegularYeyMasc(w.p, w.f), ...plurals }; return { inflections: inflectRegularYayMasc(w.p, w.f), ...plurals };
} }
if (pEnd === "ی" && fEnd === "éy") { if (pEnd === "ی" && fEnd === "áy") {
return { return {
inflections: inflectRegularEmphasizedYeyMasc(w.p, w.f), inflections: inflectRegularEmphasizedYayMasc(w.p, w.f),
...plurals, ...plurals,
}; };
} }
@ -179,7 +179,7 @@ function handleFemNoun(word: T.DictionaryEntryNoFVars): T.InflectorOutput {
return !plurals ? false : { ...plurals }; 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 }; return { inflections: inflectRegularAFem(word.p, word.f), ...plurals };
} }
if (word.p.slice(-1) === "ح" && endingInSingleARegex.test(word.f)) { if (word.p.slice(-1) === "ح" && endingInSingleARegex.test(word.f)) {
@ -238,7 +238,7 @@ function inflectIrregularUnisex(
}; };
} }
export function inflectRegularYeyUnisex( export function inflectRegularYayUnisex(
p: string, p: string,
f: string f: string
): T.UnisexInflections { ): 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 baseP = p.slice(0, -1);
const baseF = f.slice(0, -2); const baseF = f.slice(0, -2);
return { 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 baseP = p.slice(0, -1);
const baseF = f.slice(0, -2); const baseF = f.slice(0, -2);
return { 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 baseP = p.slice(0, -1);
const baseF = f.slice(0, -2); const baseF = f.slice(0, -2);
return { return {
@ -677,7 +677,7 @@ function makePlural(
plural: { masc: addMascPluralSuffix(anim, shortSquish) }, 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() }; return { arabicPlural, plural: addAnimN3UnisexPluralSuffix() };
} }
// usually shortSquish nouns would never have arabicPlurals -- so we don't have to worry about catching // 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(); const { masc } = addAnimN3UnisexPluralSuffix();
return { return {
arabicPlural, arabicPlural,
@ -744,8 +744,8 @@ function makePlural(
return undefined; return undefined;
} }
export function inflectYey( export function inflectYay(
ps: T.SingleOrLengthOpts<T.PsString> ps: T.SingleOrLengthOpts<T.PsString>
): T.SingleOrLengthOpts<T.UnisexInflections> { ): 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,101 +4,134 @@ import { endsWith } from "./p-text-helpers";
import { countSyllables } from "./accent-helpers"; import { countSyllables } from "./accent-helpers";
export function isTlulVerb(e: T.VerbEntry | T.VerbDictionaryEntry): boolean { export function isTlulVerb(e: T.VerbEntry | T.VerbDictionaryEntry): boolean {
const entry = "entry" in e ? e.entry : e; const entry = "entry" in e ? e.entry : e;
return entry.f === "tlul" || entry.p === "راتلل" || entry.p === "درتلل" || entry.p === "ورتلل"; return (
entry.f === "tlul" ||
entry.p === "راتلل" ||
entry.p === "درتلل" ||
entry.p === "ورتلل"
);
} }
export function isKawulVerb(e: T.VerbEntry | T.VerbDictionaryEntry): boolean { export function isKawulVerb(e: T.VerbEntry | T.VerbDictionaryEntry): boolean {
const entry = "entry" in e ? e.entry : e; const entry = "entry" in e ? e.entry : e;
return ["کول", "راکول", "درکول", "ورکول"].includes(entry.p); return ["کول", "راکول", "درکول", "ورکول"].includes(entry.p);
} }
export function isNounEntry(e: T.Entry | T.DictionaryEntry): e is T.NounEntry { export function isNounEntry(e: T.Entry | T.DictionaryEntry): e is T.NounEntry {
if ("entry" in e) return false; if ("entry" in e) return false;
return !!(e.c && (e.c.includes("n. m.") || e.c.includes("n. f."))); 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 { export function isAdjectiveEntry(
if ("entry" in e) return false; e: T.Entry | T.DictionaryEntry
return !!e.c?.includes("adj."); ): 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 { export function isAdverbEntry(
if ("entry" in e) return false; e: T.Entry | T.DictionaryEntry
return !!e.c?.includes("adv."); ): 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 { export function isLocativeAdverbEntry(
if ("entry" in e) return false; e: T.Entry | T.DictionaryEntry
return !!e.c?.includes("loc. adv."); ): 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) { export function isNounOrAdjEntry(
return isNounEntry(e) || isAdjectiveEntry(e); 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 { export function isVerbDictionaryEntry(
return !!e.c?.startsWith("v."); e: T.DictionaryEntry | T.DictionaryEntryNoFVars
): e is T.VerbDictionaryEntry {
return !!e.c?.startsWith("v.");
} }
export function isVerbEntry( 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 { ): 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 { export function isMascNounEntry(
return !!e.c && e.c.includes("n. m."); 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 { export function isFemNounEntry(
return !!e.c && e.c.includes("n. f."); 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 { export function isUnisexNounEntry(
return isNounEntry(e) && e.c.includes("unisex"); 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 { export function isAnimNounEntry(
return e.c.includes("anim."); 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 { export function isUnisexAnimNounEntry(
return isUnisexNounEntry(e) && isAnimNounEntry(e); 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) { export function isAdjOrUnisexNounEntry(
return isAdjectiveEntry(e) || ( e: T.Entry
isNounEntry(e) && isUnisexNounEntry(e) ): 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 { export function isPattern(
if (p === 0) { p: T.InflectionPattern | "all"
return (e: T.NounEntry | T.AdjectiveEntry) => ( ): (entry: T.NounEntry | T.AdjectiveEntry) => boolean {
!isPattern1Entry(e) && !isPattern2Entry(e) && !isPattern3Entry(e) if (p === 0) {
&& !isPattern4Entry(e) && !isPattern5Entry(e) && !isPattern6FemEntry(e) return (e: T.NounEntry | T.AdjectiveEntry) =>
) !isPattern1Entry(e) &&
} !isPattern2Entry(e) &&
if (p === 1) { !isPattern3Entry(e) &&
return isPattern1Entry; !isPattern4Entry(e) &&
} !isPattern5Entry(e) &&
if (p === 2) { !isPattern6FemEntry(e);
return isPattern2Entry; }
} if (p === 1) {
if (p === 3) { return isPattern1Entry;
return isPattern3Entry; }
} if (p === 2) {
if (p === 4) { return isPattern2Entry;
return isPattern4Entry; }
} if (p === 3) {
if (p === 5) { return isPattern3Entry;
return isPattern5Entry; }
} if (p === 4) {
if (p === 6) { return isPattern4Entry;
return isPattern6FemEntry; }
} if (p === 5) {
return () => true; return isPattern5Entry;
}
if (p === 6) {
return isPattern6FemEntry;
}
return () => true;
} }
/** /**
@ -107,20 +140,40 @@ export function isPattern(p: T.InflectionPattern | "all"): (entry: T.NounEntry |
* @param e * @param e
* @returns * @returns
*/ */
export function isPattern1Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern1Entry<T> { export function isPattern1Entry<T extends T.NounEntry | T.AdjectiveEntry>(
if (e.noInf) return false; e: T
if (e.infap) return false; ): e is T.Pattern1Entry<T> {
if (isFemNounEntry(e)) { if (e.noInf) return false;
return ( if (e.infap) return false;
endsWith([{ p: "ه", f: "a" }, { p: "ح", f: "a" }], e) || if (isFemNounEntry(e)) {
(endsWith({ p: pashtoConsonants }, e) && !e.c.includes("anim."))
);
}
return ( return (
endsWith([{ p: pashtoConsonants }], e) || endsWith(
endsWith([{ p: "ه", f: "u" }, { p: "ه", f: "h" }], e) || [
endsWith([{ p: "ای", f: "aay" }, { p: "وی", f: "ooy" }], e) { 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
)
);
} }
/** /**
@ -129,14 +182,16 @@ export function isPattern1Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T
* @param e * @param e
* @returns T.T.T.T. * @returns T.T.T.T.
*/ */
export function isPattern2Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern2Entry<T> { export function isPattern2Entry<T extends T.NounEntry | T.AdjectiveEntry>(
if (e.noInf) return false; e: T
if (e.infap) return false; ): e is T.Pattern2Entry<T> {
if (isFemNounEntry(e)) { if (e.noInf) return false;
return !e.c.includes("pl.") && endsWith({ p: "ې", f: "e" }, e, true); if (e.infap) return false;
} if (isFemNounEntry(e)) {
// TODO: check if it's a single syllable word, in which case it would be pattern 1 return !e.c.includes("pl.") && endsWith({ p: "ې", f: "e" }, e, true);
return endsWith({ p: "ی", f: "ey" }, e, true) && (countSyllables(e.f) > 1); }
// 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;
} }
/** /**
@ -145,15 +200,17 @@ export function isPattern2Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T
* @param e * @param e
* @returns * @returns
*/ */
export function isPattern3Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern3Entry<T> { export function isPattern3Entry<T extends T.NounEntry | T.AdjectiveEntry>(
if (e.noInf) return false; e: T
if (e.infap) return false; ): e is T.Pattern3Entry<T> {
if (isFemNounEntry(e)) { if (e.noInf) return false;
return endsWith({ p: "ۍ" }, e); if (e.infap) return false;
} if (isFemNounEntry(e)) {
return (countSyllables(e.f) > 1) return endsWith({ p: "ۍ" }, e);
? endsWith({ p: "ی", f: "éy" }, e, true) }
: endsWith({ p: "ی", f: "ey" }, e) return countSyllables(e.f) > 1
? endsWith({ p: "ی", f: "áy" }, e, true)
: endsWith({ p: "ی", f: "ay" }, e);
} }
/** /**
@ -162,13 +219,15 @@ export function isPattern3Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T
* @param e * @param e
* @returns * @returns
*/ */
export function isPattern4Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern4Entry<T> { export function isPattern4Entry<T extends T.NounEntry | T.AdjectiveEntry>(
if (e.noInf) return false; e: T
return ( ): e is T.Pattern4Entry<T> {
!!(e.infap && e.infaf && e.infbp && e.infbf) if (e.noInf) return false;
&& return (
(e.infap.slice(1).includes("ا") && e.infap.slice(-1) === "ه") !!(e.infap && e.infaf && e.infbp && e.infbf) &&
); e.infap.slice(1).includes("ا") &&
e.infap.slice(-1) === "ه"
);
} }
/** /**
@ -177,59 +236,76 @@ export function isPattern4Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T
* @param e * @param e
* @returns * @returns
*/ */
export function isPattern5Entry<T extends (T.NounEntry | T.AdjectiveEntry)>(e: T): e is T.Pattern5Entry<T> { export function isPattern5Entry<T extends T.NounEntry | T.AdjectiveEntry>(
if (e.noInf) return false; e: T
return ( ): e is T.Pattern5Entry<T> {
!!(e.infap && e.infaf && e.infbp && e.infbf) if (e.noInf) return false;
&& return (
(!e.infap.slice(1).includes("ا") && e.infap.slice(-1) === "ه") !!(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> { export function isPattern6FemEntry(
if (!isFemNounEntry(e)) return false; e: T.NounEntry | T.AdjectiveEntry
if (e.c.includes("anim.")) return false; ): e is T.Pattern6FemEntry<T.FemNounEntry> {
return e.p.slice(-1) === "ي"; 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> { export function isPluralNounEntry<U extends T.NounEntry>(
return e.c.includes("pl."); 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> { export function isSingularEntry<U extends T.NounEntry>(
return !isPluralNounEntry(e); e: U
): e is T.SingularEntry<U> {
return !isPluralNounEntry(e);
} }
export function isArrayOneOrMore<U>(a: U[]): a is T.ArrayOneOrMore<U> { 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 { 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 { export function isVerbTense(tense: T.Tense): tense is T.VerbTense {
const verbTenses: T.VerbTense[] = [ const verbTenses: T.VerbTense[] = [
"presentVerb", "presentVerb",
"subjunctiveVerb", "subjunctiveVerb",
"perfectiveFuture", "perfectiveFuture",
"imperfectiveFuture", "imperfectiveFuture",
"perfectivePast", "perfectivePast",
"imperfectivePast", "imperfectivePast",
"habitualPerfectivePast", "habitualPerfectivePast",
"habitualImperfectivePast", "habitualImperfectivePast",
]; ];
return verbTenses.some(x => x === tense); return verbTenses.some((x) => x === tense);
} }
export function isAbilityTense(tense: T.Tense): tense is T.AbilityTense { 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 { 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 { 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, psStringEquals,
} from "./p-text-helpers"; } from "./p-text-helpers";
import { makePsString } from "./accent-and-ps-utils"; import { makePsString } from "./accent-and-ps-utils";
import { inflectYey } from "./pashto-inflector"; import { inflectYay } from "./pashto-inflector";
import { accentOnNFromEnd, removeAccents } from "./accent-helpers"; import { accentOnNFromEnd, removeAccents } from "./accent-helpers";
import { mapInflections } from "./fp-ps"; import { mapInflections } from "./fp-ps";
import { pashtoConsonants } from "./pashto-consonants"; import { pashtoConsonants } from "./pashto-consonants";
@ -55,7 +55,7 @@ const dummyEntry: T.DictionaryEntry = {
const aayTail = [ const aayTail = [
{ p: "ای", f: "aay" }, { p: "ای", f: "aay" },
{ p: "ی", f: "ey" }, { p: "ی", f: "ay" },
]; ];
export function conjugateVerb( export function conjugateVerb(
@ -508,14 +508,14 @@ function makeParticipleContent(info: T.NonComboVerbInfo): T.ParticipleContent {
: info.objComplement.entry, : info.objComplement.entry,
stativeAux[transitivity].participle.past as T.UnisexInflections stativeAux[transitivity].participle.past as T.UnisexInflections
) )
: inflectYey(noPersInfs(info.participle.past)); : inflectYay(noPersInfs(info.participle.past));
const present = const present =
"complement" in info && spaceInForm(info.root.imperfective) "complement" in info && spaceInForm(info.root.imperfective)
? concatInflections( ? concatInflections(
info.complement, info.complement,
stativeAux[transitivity].participle.present as T.UnisexInflections stativeAux[transitivity].participle.present as T.UnisexInflections
) )
: inflectYey(noPersInfs(info.participle.present)); : inflectYay(noPersInfs(info.participle.present));
return { return {
present, // PRESENT PARTICIPLE inflected present, // PRESENT PARTICIPLE inflected
past, // PAST PARTICIPLE inflected past, // PAST PARTICIPLE inflected
@ -537,7 +537,7 @@ function makePerfectContent(info: T.NonComboVerbInfo): T.PerfectContent {
stativeAux[transitivity].participle.past, stativeAux[transitivity].participle.past,
] ]
: // for regular compounds : // for regular compounds
[inflectYey(noPersInfs(info.participle.past))]; [inflectYay(noPersInfs(info.participle.past))];
const halfPerfect = addToForm([...pastPart], emptyVerbBlock); const halfPerfect = addToForm([...pastPart], emptyVerbBlock);
const past = addToForm([...pastPart, " "], equativeEndings.past.short); 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, getShort,
} from "./p-text-helpers"; } from "./p-text-helpers";
import { makePsString, removeFVarients } from "./accent-and-ps-utils"; import { makePsString, removeFVarients } from "./accent-and-ps-utils";
import { inflectYey } from "./pashto-inflector"; import { inflectYay } from "./pashto-inflector";
import { import {
accentOnFront, accentOnFront,
accentOnNFromEnd, accentOnNFromEnd,
@ -49,7 +49,7 @@ import {
import * as T from "../../types"; import * as T from "../../types";
import { isTlulVerb } from "./type-predicates"; 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 * Compiles the base information (roots, stems etc.) needed in order
@ -217,7 +217,7 @@ function getGenerativeStativeCompoundVerbInfo(
participle: { participle: {
present: auxVerb.info.participle.present, present: auxVerb.info.participle.present,
past: chooseParticipleInflection( past: chooseParticipleInflection(
inflectYey( inflectYay(
"mascSing" in auxVerb.info.participle.past "mascSing" in auxVerb.info.participle.past
? // purely for type saftey, will not have mascSing ? // purely for type saftey, will not have mascSing
// in a non stative compound verb // in a non stative compound verb
@ -315,7 +315,7 @@ function getDynamicCompoundInfo(
participle: { participle: {
present: auxVerbInfo.participle.present, present: auxVerbInfo.participle.present,
past: chooseParticipleInflection( past: chooseParticipleInflection(
inflectYey( inflectYay(
"mascSing" in auxVerbInfo.participle.past "mascSing" in auxVerbInfo.participle.past
? // purely for type saftey, will not have mascSing ? // purely for type saftey, will not have mascSing
// in a non stative compound verb // in a non stative compound verb
@ -944,7 +944,7 @@ function getParticiple(
removeAccentsFull(comp), removeAccentsFull(comp),
" ", " ",
compInflects compInflects
? unisexInfToObjectMatrix(inflectYey(aux) as T.UnisexInflections) ? unisexInfToObjectMatrix(inflectYay(aux) as T.UnisexInflections)
: aux : aux
); );
}; };
@ -962,12 +962,12 @@ function getParticiple(
short: accentPastPart( short: accentPastPart(
concatPsString( concatPsString(
ensureShortWurShwaShift(shortParticipleRoot), 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? // TODO: make this into a rule?
const shortImperfectiveRoot = 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( function getPassiveStem(
root: T.VerbRootSet, root: T.VerbRootSet,
@ -1444,8 +1444,8 @@ function getPassiveRootPerfectiveSplit(
}; };
} }
const abilityTail = { p: "ی", f: "ey" }; const abilityTail = { p: "ی", f: "ay" };
const abilityTailAccented = { p: "ی", f: "éy" }; const abilityTailAccented = { p: "ی", f: "áy" };
function getAbilityRoots( function getAbilityRoots(
root: T.VerbRootSet, root: T.VerbRootSet,

View File

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