This commit is contained in:
adueck 2023-04-14 21:46:02 -04:00
parent b59117ba2e
commit 9f08c4cc5b
5 changed files with 510 additions and 49 deletions

View File

@ -14,8 +14,6 @@ import {
import { entryFeeder } from "./entryFeeder";
import { renderVerb } from "../lib/src/new-verb-engine/render-verb";
import NPPronounPicker from "../components/src/np-picker/NPPronounPicker";
import { getAllRs } from "../lib/src/new-verb-engine/rs-helpers";
const transitivities: T.Transitivity[] = [
"transitive",
@ -252,12 +250,6 @@ function VPBuilderDemo({ opts }: {
role="subject"
opts={opts}
/>
{/* <details>
<summary>Roots and Stems</summary>
<pre>
{JSON.stringify(rs, null, " ")}
</pre>
</details> */}
<pre>
{JSON.stringify(rv, null, " ")}
</pre>

View File

@ -0,0 +1,172 @@
import { renderVerb } from "./render-verb";
import { vEntry } from "./rs-helpers";
import * as T from "../../../types";
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 achawul = vEntry({"ts":1527811872,"i":224,"p":"اچول","f":"achawul","g":"achawul","e":"to put, pour, drop, throw, put on","r":4,"c":"v. trans.","ec":"put,puts,putting,put,put"});
const ganul = vEntry({"ts":1527812000,"i":11398,"p":"ګڼل","f":"gaNul, guNul","g":"gaNul,guNul","e":"to count, consider, reckon, suppose, assume","r":4,"c":"v. trans.","tppp":"ګاڼه","tppf":"gaaNu","ec":"deem"});
const kawulStat = vEntry({"ts":1579015359582,"i":11030,"p":"کول","f":"kawul","g":"kawul","e":"to make ____ ____ (as in \"He's making me angry.\")","r":4,"c":"v. trans.","ssp":"کړ","ssf":"kR","prp":"کړل","prf":"kRul","pprtp":"کړی","pprtf":"kúRey","noOo":true,"ec":"make,makes,making,made,made"});
const kawulDyn = vEntry({"ts":1527812752,"i":11031,"p":"کول","f":"kawul","g":"kawul","e":"to do (an action or activity)","r":4,"c":"v. trans./gramm. trans.","ssp":"وکړ","ssf":"óokR","prp":"وکړل","prf":"óokRul","pprtp":"کړی","pprtf":"kúRey","diacExcept":true,"ec":"do,does,doing,did,done","separationAtP":1,"separationAtF":2});
const kedulStat = vEntry({"ts":1581086654898,"i":11100,"p":"کېدل","f":"kedul","g":"kedul","e":"to become _____","r":2,"c":"v. intrans.","ssp":"ش","ssf":"sh","prp":"شول","prf":"shwul","pprtp":"شوی","pprtf":"shúwey","noOo":true,"ec":"become"});
const kedulDyn = vEntry({"ts":1527812754,"i":11101,"p":"کېدل","f":"kedul","g":"kedul","e":"to happen, occur","r":2,"c":"v. intrans.","ssp":"وش","ssf":"óosh","prp":"وشول","prf":"óoshwul","pprtp":"شوی","pprtf":"shúwey","diacExcept":true,"ec":"happen","separationAtP":1,"separationAtF":2});
const raatlul = vEntry({"ts":1527815216,"i":6875,"p":"راتلل","f":"raatlúl","g":"raatlul","e":"to come","r":4,"c":"v. intrans.","psp":"راځ","psf":"raadz","ssp":"راش","ssf":"ráash","prp":"راغلل","prf":"ráaghlul","pprtp":"راغلی","pprtf":"raaghúley","tppp":"راغی","tppf":"ráaghey","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"come,comes,coming,came,come"});
const wartlul = vEntry({"ts":1585228579997,"i":14821,"p":"ورتلل","f":"wărtlul","g":"wartlul","e":"to come / go over to (third person or place)","r":4,"c":"v. intrans.","psp":"ورځ","psf":"wărdz","ssp":"ورش","ssf":"wársh","prp":"ورغلل","prf":"wárghlul","pprtp":"ورغلی","pprtf":"wărghúley","tppp":"ورغی","tppf":"wărghey","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"come,comes,coming,came,come"});
const osedul = vEntry({"ts":1527815139,"i":1127,"p":"اوسېدل","f":"osedul","g":"osedul","e":"to live, reside, stay, be","r":4,"c":"v. intrans.","shortIntrans":true,"diacExcept":true});
const tlul = vEntry({"ts":1527815348,"i":3791,"p":"تلل","f":"tlul","g":"tlul","e":"to go","r":4,"c":"v. intrans.","psp":"ځ","psf":"dz","ssp":"لاړ ش","ssf":"láaR sh","prp":"لاړ","prf":"láaR","ec":"go,goes,going,went,gone"});
const awuxtul = vEntry({"ts":1527814012,"i":1133,"p":"اوښتل","f":"awUxtul","g":"awUxtul","e":"to pass over, overturn, be flipped over, spill over, shift, change, diverge, pass, cross, abandon; to be sprained","r":4,"c":"v. intrans.","psp":"اوړ","psf":"awR","ec":"pass","ep":"over"});
const khorul = vEntry({"ts":1527812790,"i":6002,"p":"خوړل","f":"khoRul","g":"khoRul","e":"to eat, to bite","r":4,"c":"v. trans.","psp":"خور","psf":"khor","tppp":"خوړ","tppf":"khoR","ec":"eat,eats,eating,ate,eaten"});
const azmoyul = vEntry({"ts":1527811605,"i":468,"p":"ازمویل","f":"azmoyul","g":"azmoyul","e":"to attempt, try; to experiment, test","r":4,"c":"v. trans.","sepOo":true,"ec":"try"});
const khatul = vEntry({"ts":1527814025,"i":5677,"p":"ختل","f":"khatul","g":"khatul","e":"to climb, ascend, rise, go up; to fall out, to fall off, to leave/dissapear; to turn out to be ...; to give a sentence (in law)","r":3,"c":"v. intrans.","psp":"خېژ","psf":"khejz","tppp":"خوت","tppf":"khot","ec":"climb"});
const rasedul = vEntry({"ts":1527813573,"i":7057,"p":"رسېدل","f":"rasedul","g":"rasedul","e":"arrive, reach; (fig.) understand, attain to; mature, ripen","r":4,"c":"v. intrans.","shortIntrans":true,"ec":"arrive"});
const weshul = vEntry({"ts":1527811701,"i":15106,"p":"وېشل","f":"weshul","g":"weshul","e":"divide, distribute, share","r":4,"c":"v. trans.","ec":"divide"});
const watul = vEntry({"ts":1527823376,"i":14759,"p":"وتل","f":"watul","g":"watul","e":"to go out, exit, leave, emerge","r":4,"c":"v. intrans.","psp":"وځ","psf":"oodz","tppp":"واته","tppf":"waatu","ec":"go,goes,going,went,gone","ep":"out"});
const wurul = vEntry({"ts":1527816865,"i":14903,"p":"وړل","f":"wuRúl, oRúl, wRul","g":"wuRul,oRul,wRul","e":"to take, carry, bear, move (inanimate objects); to win, earn (subjunctive یوسي - yósee or ویسي - wéesee, simple past یو یې وړلو - yo ye wRulo)","r":3,"c":"v. trans.","ssp":"یوس","ssf":"yos","prp":"یوړل","prf":"yóRul","tppp":"یوړ","tppf":"yoR","noOo":true,"separationAtP":2,"separationAtF":2,"diacExcept":true,"ec":"take,takes,taking,took,taken"});
const kexodul = vEntry({"ts":1527812284,"i":11113,"p":"کېښودل","f":"kexodul","g":"kexodul","e":"to put, to put down, to set in place","r":4,"c":"v. trans.","psp":"ږد","psf":"Gd","ssp":"کېږد","ssf":"kéGd","noOo":true,"separationAtP":2,"separationAtF":2,"ec":"put,puts,putting,put,put"});
const kenaastul = vEntry({"ts":1527812759,"i":11124,"p":"کېناستل","f":"kenaastul","g":"kenaastul","e":"to sit down, to have a seat","r":4,"c":"v. intrans.","psp":"کېن","psf":"ken","noOo":true,"separationAtP":2,"separationAtF":2,"ec":"sit,sits,sitting,sat","ep":"down"});
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 prexodul = vEntry({"ts":1527815190,"i":2495,"p":"پرېښودل","f":"prexodúl","g":"prexodul","e":"to leave, abandon, forsake, let go, allow","r":4,"c":"v. trans.","psp":"پرېږد","psf":"preGd","noOo":true,"separationAtP":3,"separationAtF":3,"ec":"abandon"});
const raawustul = vEntry({"ts":1527819827,"i":6955,"p":"راوستل","f":"raawustúl","g":"raawustul","e":"to bring, deliver (animate objects), obtain, extract","r":3,"c":"v. trans.","psp":"راول","psf":"raawul","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"bring,brings,bringing,brought,brought"});
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."},
);
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."},
);
const stureyKawul = vEntry(
{"ts":1591033078746,"i":7877,"p":"ستړی کول","f":"stuRey kawul","g":"stuReykawul","e":"to make tired, wear out","r":4,"c":"v. stat. comp. trans.","l":1527815306,"ec":"make","ep":"tired"},
{"ts":1527815306,"i":7876,"p":"ستړی","f":"stúRey","g":"stuRey","e":"tired","r":4,"c":"adj. / adv."},
);
const stureyKedul = vEntry(
{"ts":1591033069786,"i":7878,"p":"ستړی کېدل","f":"stuRey kedul","g":"stuReykedul","e":"to get tired, fatigued","r":4,"c":"v. stat. comp. intrans.","l":1527815306,"ec":"get","ep":"tired"},
{"ts":1527815306,"i":7876,"p":"ستړی","f":"stúRey","g":"stuRey","e":"tired","r":4,"c":"adj. / adv."},
);
test("basic tenses", () => {
expect(renderVerb({
verb: wahul,
tense: "presentVerb",
person: T.Person.FirstSingMale,
voice: "active",
})).toEqual({
hasBa: false,
vbs: [
[],
[
{ type: "VB", ps: [{ p: "وهم", f: "wahum" }], person: T.Person.FirstSingMale },
],
],
});
expect(renderVerb({
verb: wahul,
tense: "subjunctiveVerb",
person: T.Person.SecondSingMale,
voice: "active",
})).toEqual({
hasBa: false,
vbs: [
[{ type: "PH", ps: { f: "óo", p: "و" }}],
[
{ type: "VB", ps: [{ p: "وهې", f: "wahe" }], person: T.Person.SecondSingMale },
],
],
});
expect(renderVerb({
verb: wahul,
tense: "habitualPerfectivePast",
person: T.Person.ThirdSingFemale,
voice: "active",
})).toEqual({
hasBa: true,
vbs: [
[{ type: "PH", ps: { f: "óo", p: "و" }}],
[
{
type: "VB",
ps: {
long: [{ p: "وهله", f: "wahula" }],
short: [{ p: "وهه", f: "waha" }],
},
person: T.Person.ThirdSingFemale
},
],
],
});
});
test("perfect tenses", () => {
expect(renderVerb({
verb: wahul,
tense: "presentPerfect",
person: T.Person.FirstSingMale,
voice: "active",
})).toEqual({
hasBa: false,
vbs: [
[],
[
{ type: "VB", ps: [{ p: "وهلی", f: "wahúley" }], gender: "masc", number: "singular" },
{ type: "VB", ps: [{ p: "یم", f: "yum" }], person: T.Person.FirstSingMale },
],
],
});
expect(renderVerb({
verb: wahul,
tense: "wouldBePerfect",
person: T.Person.SecondSingFemale,
voice: "active",
})).toEqual({
hasBa: true,
vbs: [
[],
[
{ type: "VB", ps: [{ p: "وهلې", f: "wahúle" }], gender: "fem", number: "singular" },
{
type: "VB",
ps: {
long: [{ p: "ولې", f: "wule" }],
short: [{ p: "وې", f: "we" }],
},
person: T.Person.SecondSingFemale,
},
],
],
});
});
test("ability tenses", () => {
expect(renderVerb({
verb: wahul,
tense: "presentVerbModal",
person: T.Person.FirstSingMale,
voice: "active",
})).toEqual({
hasBa: false,
vbs: [
[],
[
{
type: "VB",
ps: {
long: [
{ p: "وهلی", f: "wahúley" },
{ p: "وهلای", f: "wahúlaay" },
],
short: [
{ p: "وهی", f: "wahéy" },
{ p: "وهای", f: "waháay" },
],
},
},
{
type: "VB",
ps: [{ p: "شم", f: "shum" }],
person: T.Person.FirstSingMale,
},
],
],
});
});

View File

@ -21,21 +21,7 @@ import { pashtoConsonants } from "../pashto-consonants";
import { getPastParticiple, getRootStem } from "./roots-and-stems";
import { getAspect, isKedul, perfectTenseToEquative, verbEndingConcat } from "./rs-helpers";
// For the chart display of the results: base the length thing on the VBE at the end, if there are other
// length variations earlier in the blocks, flatten those into the variations
// TODO: Amazingly, the basic formula with the roots and stems from the basic verbs
// works perfectly with stative compounds as well!
// The only issue is that if we want to include more information (complement noun gender etc) in the blocks
// we need to redo the stem building to have those parts
// 2 options:
// 1. redo the root/stem builder to output primitive blocks
// 2. rebuild the roots/stems in the verb engine
// Will start with number 2 and then if I go back and rebuild the root/stem builder
// We can go back to using a very simple verb building formula
// TODO: problem with laaR - no perfective split
// TODO: are azmóyulum and wáayulo really not just azmoyúlum and waayúlo ?
// TODO: automatic 3rd person idiosyncronizing of raTul raaTu, shaRul, shaaRu, rasedul rased etc
// IMMEDIATE TODO: shwoo -> shoo

View File

@ -11,6 +11,7 @@ const kedulStat = vEntry({"ts":1581086654898,"i":11100,"p":"کېدل","f":"kedul
const kedulDyn = vEntry({"ts":1527812754,"i":11101,"p":"کېدل","f":"kedul","g":"kedul","e":"to happen, occur","r":2,"c":"v. intrans.","ssp":"وش","ssf":"óosh","prp":"وشول","prf":"óoshwul","pprtp":"شوی","pprtf":"shúwey","diacExcept":true,"ec":"happen","separationAtP":1,"separationAtF":2});
const raatlul = vEntry({"ts":1527815216,"i":6875,"p":"راتلل","f":"raatlúl","g":"raatlul","e":"to come","r":4,"c":"v. intrans.","psp":"راځ","psf":"raadz","ssp":"راش","ssf":"ráash","prp":"راغلل","prf":"ráaghlul","pprtp":"راغلی","pprtf":"raaghúley","tppp":"راغی","tppf":"ráaghey","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"come,comes,coming,came,come"});
const wartlul = vEntry({"ts":1585228579997,"i":14821,"p":"ورتلل","f":"wărtlul","g":"wartlul","e":"to come / go over to (third person or place)","r":4,"c":"v. intrans.","psp":"ورځ","psf":"wărdz","ssp":"ورش","ssf":"wársh","prp":"ورغلل","prf":"wárghlul","pprtp":"ورغلی","pprtf":"wărghúley","tppp":"ورغی","tppf":"wărghey","noOo":true,"separationAtP":2,"separationAtF":3,"ec":"come,comes,coming,came,come"});
const osedul = vEntry({"ts":1527815139,"i":1127,"p":"اوسېدل","f":"osedul","g":"osedul","e":"to live, reside, stay, be","r":4,"c":"v. intrans.","shortIntrans":true,"diacExcept":true});
const tlul = vEntry({"ts":1527815348,"i":3791,"p":"تلل","f":"tlul","g":"tlul","e":"to go","r":4,"c":"v. intrans.","psp":"ځ","psf":"dz","ssp":"لاړ ش","ssf":"láaR sh","prp":"لاړ","prf":"láaR","ec":"go,goes,going,went,gone"});
const awuxtul = vEntry({"ts":1527814012,"i":1133,"p":"اوښتل","f":"awUxtul","g":"awUxtul","e":"to pass over, overturn, be flipped over, spill over, shift, change, diverge, pass, cross, abandon; to be sprained","r":4,"c":"v. intrans.","psp":"اوړ","psf":"awR","ec":"pass","ep":"over"});
const khorul = vEntry({"ts":1527812790,"i":6002,"p":"خوړل","f":"khoRul","g":"khoRul","e":"to eat, to bite","r":4,"c":"v. trans.","psp":"خور","psf":"khor","tppp":"خوړ","tppf":"khoR","ec":"eat,eats,eating,ate,eaten"});
@ -66,6 +67,24 @@ describe("imperfective stems", () => {
},
],
},
{
title: "-awul verbs have a trailing accent",
tests: [
{
verb: achawul,
genderNumber: { gender: "masc", number: "singular" },
result: [
[],
[
{
type: "VB",
ps: [{ p: "اچو", f: "achawX" }],
},
],
],
},
],
},
{
title: "is the -eG for for regular intransitive verbs",
tests: [
@ -336,6 +355,30 @@ describe("perfective stems", () => {
},
],
},
{
title: "is the -eG for for regular intransitive verbs",
tests: [
{
verb: ghadzedul,
result: [[ooPH], [{ type: "VB", ps: [{ p: "غځېږ", f: "ghadzeG" }]}]],
},
{
verb: rasedul,
result: [
[ooPH],
[
{
type: "VB",
ps: {
long: [{ p: "رسېږ", f: "raseG" }],
short: [{ p: "رس", f: "ras" }],
},
},
],
],
},
],
},
{
title: "the imperfective stem the perfective stem is regularly built off could be irregular",
tests: [
@ -509,6 +552,71 @@ describe("perfective stems", () => {
},
],
},
{
title: "special/unusual heads for perfective split",
tests: [
{
verb: azmoyul,
genderNumber: { gender: "masc", number: "plural" },
result: [
[
{ type: "PH", ps: { p: "و ", f: "óo`" }},
],
[
{
type: "VB",
ps: [{ p: "ازموی", f: "azmoy" }],
},
],
],
},
{
verb: achawul,
genderNumber: { gender: "masc", number: "plural" },
result: [
[
{ type: "PH", ps: { p: "وا", f: "wáa" }},
],
[
{
type: "VB",
ps: [{ p: "چو", f: "chaw" }],
},
],
],
},
{
verb: watul,
genderNumber: { gender: "masc", number: "plural" },
result: [
[
{ type: "PH", ps: { p: "و", f: "wÚ" }},
],
[
{ type: "VB", ps: [{ p: "وځ", f: "oodz" }]},
],
],
},
{
verb: osedul,
genderNumber: { gender: "masc", number: "plural" },
result: [
[
{ type: "PH", ps: { p: "و", f: "óo`" }},
],
[
{
type: "VB",
ps: {
short: [{ p: "اوس", f: "os" }],
long: [{ p: "اوسېږ", f: "oseG" }],
},
},
],
],
},
],
},
];
tests.forEach(x => {
test(x.title, () => {
@ -1251,6 +1359,185 @@ describe("ability roots and stems", () => {
});
});
// describe("passive roots and stems", () => {
// test("");
// })
describe("passive roots and stems", () => {
test("root plus kedul", () => {
expect(getRootStem({
verb: wahul,
aspect: "imperfective",
type: "basic",
rs: "stem",
genderNumber: {
gender: "masc",
number: "singular",
},
voice: "passive",
})).toEqual([
[],
[
{
type: "welded",
left: {
type: "VB",
ps: [{ p: "وهل", f: "wahul" }],
},
right: {
type: "VB",
ps: [{ p: "کېږ", f: "kéG" }],
},
},
],
]);
expect(getRootStem({
verb: wahul,
aspect: "imperfective",
type: "basic",
rs: "root",
genderNumber: {
gender: "masc",
number: "singular",
},
voice: "passive",
})).toEqual([
[],
[
{
type: "welded",
left: {
type: "VB",
ps: [{ p: "وهل", f: "wahul" }],
},
right: {
type: "VB",
ps: {
short: [{ p: "کېد", f: "kedX" }],
long: [{ p: "کېدل", f: "kedúl" }],
},
},
},
],
]);
expect(getRootStem({
verb: wahul,
aspect: "perfective",
type: "basic",
rs: "stem",
genderNumber: {
gender: "masc",
number: "singular",
},
voice: "passive",
})).toEqual([
[ooPH],
[
{
type: "welded",
left: {
type: "VB",
ps: [{ p: "وهل", f: "wahul" }],
},
right: {
type: "VB",
ps: [{ p: "ش", f: "sh" }],
},
},
],
]);
expect(getRootStem({
verb: wahul,
aspect: "perfective",
type: "basic",
rs: "root",
genderNumber: {
gender: "masc",
number: "singular",
},
voice: "passive",
})).toEqual([
[ooPH],
[
{
type: "welded",
left: {
type: "VB",
ps: [{ p: "وهل", f: "wahul" }],
},
right: {
type: "VB",
ps: {
short: [{ p: "شو", f: "shw" }],
long: [{ p: "شول", f: "shwul" }],
},
},
},
],
]);
expect(getRootStem({
verb: bandawul,
aspect: "perfective",
type: "basic",
rs: "root",
genderNumber: {
gender: "fem",
number: "singular",
},
voice: "passive",
})).toEqual([
[
{
type: "NComp",
comp: {
type: "AdjComp",
ps: { p: "بنده", f: "bánda" },
gender: "fem",
number: "singular",
},
},
],
[
{
type: "welded",
left: {
type: "VB",
ps: [{ p: "کړل", f: "kRul" }],
},
right: {
type: "VB",
ps: {
short: [{ p: "شو", f: "shw" }],
long: [{ p: "شول", f: "shwul" }],
},
},
},
],
]);
expect(getRootStem({
verb: bandawul,
aspect: "imperfective",
type: "basic",
rs: "root",
genderNumber: {
gender: "fem",
number: "singular",
},
voice: "passive",
})).toEqual([
[],
[
{
type: "welded",
left: {
type: "VB",
ps: [{ p: "بندول", f: "bandawul" }],
},
right: {
type: "VB",
ps: {
short: [{ p: "کېد", f: "kedX" }],
long: [{ p: "کېدل", f: "kedúl" }],
},
},
},
],
]);
});
});

View File

@ -13,7 +13,7 @@ import * as T from "../../../types";
import { makePsString, removeFVarientsFromVerb } from "../accent-and-ps-utils";
import { accentOnNFromEnd, countSyllables, removeAccents } from "../accent-helpers";
import { isKawulVerb, isTlulVerb } from "../type-predicates";
import { vEntry, addAbilityEnding, weld, removeL, addTrailingAccent, tlulPerfectiveStem, getLongVB, possiblePPartLengths, isStatComp, statCompImperfectiveSpace, makeComplement, vTransitivity } from "./rs-helpers";
import { vEntry, addAbilityEnding, weld, removeL, addTrailingAccent, tlulPerfectiveStem, getLongVB, possiblePPartLengths, isStatComp, statCompImperfectiveSpace, makeComplement, vTransitivity, isKedul } from "./rs-helpers";
import { inflectPattern3 } from "./new-inflectors";
const statVerb = {
@ -212,10 +212,13 @@ function getStem(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber, aspect: T.
if (verb.entry.f === "tlul") {
return tlulPerfectiveStem(genderNum);
}
const base = (verb.entry.ssp && verb.entry.ssf)
// with irregular perfective stem
? makePsString(verb.entry.ssp, verb.entry.ssf)
: (verb.entry.psp && verb.entry.psf)
if (!isKedul(verb) && vTransitivity(verb) === "intransitive" && verb.entry.p.endsWith("ېدل")) {
return splitEdulIntans(edulIntransBase(verb))
}
const base: T.PsString = (verb.entry.ssp && verb.entry.ssf)
// with irregular perfective stem
? makePsString(verb.entry.ssp, verb.entry.ssf)
: (verb.entry.psp && verb.entry.psf)
// with perfective stem based on irregular perfective root
? makePsString(verb.entry.psp, verb.entry.psf)
// with regular infinitive based perfective stem
@ -248,46 +251,70 @@ function getStem(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber, aspect: T.
},
],
];
function splitEdulIntans(ps: T.SingleOrLengthOpts<T.PsString[]>): [[T.PH] | [], [T.VB]] {
const [ph, long] = ("long" in ps)
? getPerfectiveHead(ps.long[0], verb)
: getPerfectiveHead(ps[0], verb)
const short = ("long" in ps)
? getPerfectiveHead(ps.short[0], verb)
: undefined;
if (short) {
return [
ph ? [ph] : [],
[
{
type: "VB",
ps: {
long: [long],
short: [short[1]],
},
},
],
];
}
return [
ph ? [ph] : [],
[
{ type: "VB", ps: [long] },
],
];
}
}
function getPerfectiveHead(base: T.PsString, { entry }: T.VerbEntryNoFVars): [T.PH, T.PsString] | [undefined, T.PsString] {
// TODO: This is a nasty and messy way to do it with the length options included
function getPerfectiveHead(base: T.PsString, v: T.VerbEntryNoFVars): [T.PH, T.PsString] | [undefined, T.PsString] {
// if ((verb.entry.ssp && verb.entry.ssf) || verb.entry.separationAtP) {
// // handle split
// }
if (entry.separationAtP && entry.separationAtF) {
if (v.entry.separationAtP && v.entry.separationAtF) {
const ph: T.PH = {
type: "PH",
ps: accentOnNFromEnd({
p: base.p.slice(0, entry.separationAtP),
f: base.f.slice(0, entry.separationAtF),
p: base.p.slice(0, v.entry.separationAtP),
f: base.f.slice(0, v.entry.separationAtF),
}, 0),
};
const rest = {
p: base.p.slice(entry.separationAtP),
f: base.f.slice(entry.separationAtF),
p: base.p.slice(v.entry.separationAtP),
f: base.f.slice(v.entry.separationAtF),
};
return [ph, rest];
}
const [ph, rest]: [T.PH | undefined, T.PsString] = entry.noOo
const [ph, rest]: [T.PH | undefined, T.PsString] = v.entry.noOo
? [undefined, base]
: entry.sepOo
: v.entry.sepOo
? [
{ type: "PH", ps: { p: "و ", f: "óo`"}},
base,
]
: base.p.charAt(0) === "ا" && base.f.charAt(0) === "a"
? [
{ type: "PH", ps: { p: "وا", f: "wáa" }},
removeAStart(base),
]
: ["آ", "ا"].includes(base.p.charAt(0)) && base.f.slice(0, 2) === "aa"
: ["آ", "ا"].includes(base.p.charAt(0)) && base.f.charAt(0) === "a"
? [
{ type: "PH", ps: { p: "وا", f: "wáa" }},
removeAStart(base),
]
: ["óo", "oo"].includes(base.f.slice(0, 2))
? [
{ type: "PH", ps: { p: "wÚ", f: " }},
{ type: "PH", ps: { p: "و", f: "wÚ" }},
base,
]
: ["ée", "ee"].includes(base.f.slice(0, 2)) && base.p.slice(0, 2) === "ای"
@ -307,10 +334,7 @@ function getPerfectiveHead(base: T.PsString, { entry }: T.VerbEntryNoFVars): [T.
] : ["ó", "o"].includes(base.f[0]) && base.p.slice(0, 2) === "او"
? [
{ type: "PH", ps: { p: "و", f: "óo`"}},
{
p: base.p.slice(2),
f: base.f.slice(1),
},
base,
] : [
{ type: "PH", ps: { p: "و", f: "óo" }},
base,