more work and tests
This commit is contained in:
parent
092c64f967
commit
bbeb219b01
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"PS Sententce": {
|
||||||
|
"prefix": "pssentence",
|
||||||
|
"body": [
|
||||||
|
"{",
|
||||||
|
"\tp: \"$1\",",
|
||||||
|
"\tf: \"$2\",",
|
||||||
|
"\te: \"$3\",",
|
||||||
|
"}"
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"PS String": {
|
||||||
|
"prefix": "psstring",
|
||||||
|
"body": "{ p: \"$1\", f: \"$2\" }",
|
||||||
|
},
|
||||||
|
"InlinePs": {
|
||||||
|
"prefix": "inlineps",
|
||||||
|
"body": "<InlinePs opts={opts} ps={{ p: \"$1\", f: \"$2\", e: \"$3\" }} />",
|
||||||
|
},
|
||||||
|
"EditableVPEx": {
|
||||||
|
"prefix": "editablevpex",
|
||||||
|
"body": [
|
||||||
|
"<EditableVPEx opts={opts}>{",
|
||||||
|
"\t$1",
|
||||||
|
"}</EditableVPEx>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"EditableEPEx": {
|
||||||
|
"prefix": "editableepex",
|
||||||
|
"body": [
|
||||||
|
"<EditableEPEx opts={opts} hideOmitSubject>{",
|
||||||
|
"\t$1",
|
||||||
|
"}</EditableEPEx>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Examples": {
|
||||||
|
"prefix": "examples",
|
||||||
|
"body": [
|
||||||
|
"<Examples opts={opts}>{[",
|
||||||
|
"\t{",
|
||||||
|
"\t\tp: \"$1\",",
|
||||||
|
"\t\tf: \"$2\",",
|
||||||
|
"\t\te: \"$3\",",
|
||||||
|
"\t},",
|
||||||
|
"]}</Examples>",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"Link": {
|
||||||
|
"prefix": "link",
|
||||||
|
"body": "<Link to=\"$1\">$2</Link>",
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,7 +27,7 @@ export function accentOnFront(s: T.SingleOrLengthOpts<T.PsString>): T.SingleOrLe
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...s,
|
...s,
|
||||||
f: accentSyllable(removeAccents(s.f)),
|
f: accentLetter(removeAccents(s.f)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ export function accentFSylsOnNFromEnd(syls: string[] | string, n: number): strin
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
...syls.slice(0, syls.length-(n+1)), // before accent
|
...syls.slice(0, syls.length-(n+1)), // before accent
|
||||||
accentSyllable(syls[syls.length-(n+1)]), // syllable to be accented
|
accentLetter(syls[syls.length-(n+1)]), // syllable to be accented
|
||||||
...(n !== 0) ? syls.slice(syls.length-n) : [], // after syllable to be accented
|
...(n !== 0) ? syls.slice(syls.length-n) : [], // after syllable to be accented
|
||||||
].join("");
|
].join("");
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ const accentReplacer = [
|
||||||
{ vowel: "U", accented: "Ú" },
|
{ vowel: "U", accented: "Ú" },
|
||||||
];
|
];
|
||||||
|
|
||||||
export function accentSyllable(s: string): string {
|
export function accentLetter(s: string): string {
|
||||||
return s.replace(/a|e|i|o|u|U/, (match) => {
|
return s.replace(/a|e|i|o|u|U/, (match) => {
|
||||||
const r = accentReplacer.find((x) => x.vowel === match);
|
const r = accentReplacer.find((x) => x.vowel === match);
|
||||||
/* istanbul ignore next */
|
/* istanbul ignore next */
|
||||||
|
@ -115,7 +115,7 @@ export function accentSyllable(s: string): string {
|
||||||
export function accentPsSyllable(ps: T.PsString): T.PsString {
|
export function accentPsSyllable(ps: T.PsString): T.PsString {
|
||||||
return {
|
return {
|
||||||
p: ps.p,
|
p: ps.p,
|
||||||
f: accentSyllable(ps.f),
|
f: accentLetter(ps.f),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import * as T from "../../../types";
|
import * as T from "../../../types";
|
||||||
import { getPastParticiple } from "./roots-and-stems";
|
import { getPastParticiple, getRootStem } from "./roots-and-stems";
|
||||||
import { vEntry } from "./rs-helpers";
|
import { vEntry } from "./rs-helpers";
|
||||||
import { getAllRs } 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({"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 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"});
|
||||||
|
@ -26,6 +25,719 @@ const kenaastul = vEntry({"ts":1527812759,"i":11124,"p":"کېناستل","f":"ke
|
||||||
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 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 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 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."},
|
||||||
|
);
|
||||||
|
|
||||||
|
const ooPH: T.PH= { type: "PH", ps: { p: "و", f: "óo" }};
|
||||||
|
|
||||||
|
describe("imperfective stems", () => {
|
||||||
|
const tests: {
|
||||||
|
title: string,
|
||||||
|
tests: {
|
||||||
|
verb: T.VerbEntry,
|
||||||
|
genderNumber?: T.GenderNumber,
|
||||||
|
result: T.RootsStemsOutput,
|
||||||
|
}[],
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
title: "is the shortened infinitive for regular verbs",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: ganul,
|
||||||
|
result: [[], [{ type: "VB", ps: [{ p: "ګڼ", f: "gaN" }]}]],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: wahul,
|
||||||
|
result: [[], [{ type: "VB", ps: [{ p: "وه", f: "wah" }]}]],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "is the -eG for for regular intransitive verbs",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: ghadzedul,
|
||||||
|
result: [[], [{ type: "VB", ps: [{ p: "غځېږ", f: "ghadzéG" }]}]],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: rasedul,
|
||||||
|
result: [[], [{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "رسېږ", f: "raséG" }],
|
||||||
|
short: [{ p: "رس", f: "ras" }],
|
||||||
|
},
|
||||||
|
}]],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "is the special imperfective stem for irregular verbs with a special imperfective stem",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: khorul,
|
||||||
|
result: [[], [{ type: "VB", ps: [{ p: "خور", f: "khor" }]}]],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: kexodul,
|
||||||
|
result: [[], [{ type: "VB", ps: [{ p: "ږد", f: "Gd" }] }]],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "is the fused word for stative compounds that swallow the k",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: bandawul,
|
||||||
|
genderNumber: { gender: "masc", number: "singular" },
|
||||||
|
result: [[], [{ type: "VB", ps: [{ p: "بندو", f: "bandawX" }]}]],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: bandedul,
|
||||||
|
genderNumber: { gender: "masc", number: "singular" },
|
||||||
|
result: [[], [{ type: "VB", ps: [{ p: "بندېږ", f: "bandéG" }]}]],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "is welded together with the complement on seperated stative compounds",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: stureyKawul,
|
||||||
|
genderNumber: { gender: "fem", number: "singular" },
|
||||||
|
result: [[], [{
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "ستړې", f: "stuRe" },
|
||||||
|
number: "singular",
|
||||||
|
gender: "fem",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "کو", f: "kawX" }],
|
||||||
|
},
|
||||||
|
}]],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: stureyKedul,
|
||||||
|
genderNumber: { gender: "fem", number: "singular" },
|
||||||
|
result: [[], [{
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "ستړې", f: "stuRe" },
|
||||||
|
number: "singular",
|
||||||
|
gender: "fem",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "کېږ", f: "kéG" }],
|
||||||
|
},
|
||||||
|
}]],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
tests.forEach(x => {
|
||||||
|
test(x.title, () => {
|
||||||
|
x.tests.forEach(y => {
|
||||||
|
expect(getRootStem({
|
||||||
|
verb: y.verb,
|
||||||
|
aspect: "imperfective",
|
||||||
|
type: "basic",
|
||||||
|
rs: "stem",
|
||||||
|
voice: "active",
|
||||||
|
genderNumber: y.genderNumber || {
|
||||||
|
gender: "masc",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
})).toEqual(y.result);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("imperfective roots", () => {
|
||||||
|
const tests: {
|
||||||
|
title: string,
|
||||||
|
tests: {
|
||||||
|
verb: T.VerbEntry,
|
||||||
|
genderNumber?: T.GenderNumber,
|
||||||
|
result: T.RootsStemsOutput,
|
||||||
|
}[],
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
title: "is the infinitive with and without ل for regular verbs, with a trailing accent on the short form",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: wahul,
|
||||||
|
result: [[], [{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "وهل", f: "wahúl" }],
|
||||||
|
short: [{ p: "وه", f: "wahX" }],
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "is the fused word for stative compounds that swallow the k",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: bandawul,
|
||||||
|
genderNumber: { gender: "masc", number: "singular" },
|
||||||
|
result: [
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "بندول", f: "bandawúl" }],
|
||||||
|
short: [{ p: "بندو", f: "bandawX" }],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: bandedul,
|
||||||
|
genderNumber: { gender: "masc", number: "singular" },
|
||||||
|
result: [
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "بندېدل", f: "bandedúl" }],
|
||||||
|
short: [{ p: "بندېد", f: "bandedX" }]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "is welded together with the complement on seperated stative compounds",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: stureyKawul,
|
||||||
|
genderNumber: { gender: "fem", number: "singular" },
|
||||||
|
result: [[], [{
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "ستړې", f: "stuRe" },
|
||||||
|
number: "singular",
|
||||||
|
gender: "fem",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "کول", f: "kawúl" }],
|
||||||
|
short: [{ p: "کو", f: "kawX" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}]],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: stureyKedul,
|
||||||
|
genderNumber: { gender: "fem", number: "singular" },
|
||||||
|
result: [[], [{
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "ستړې", f: "stuRe" },
|
||||||
|
number: "singular",
|
||||||
|
gender: "fem",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "کېدل", f: "kedúl" }],
|
||||||
|
short: [{ p: "کېد", f: "kedX" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}]],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
tests.forEach(x => {
|
||||||
|
test(x.title, () => {
|
||||||
|
x.tests.forEach(y => {
|
||||||
|
expect(getRootStem({
|
||||||
|
verb: y.verb,
|
||||||
|
aspect: "imperfective",
|
||||||
|
type: "basic",
|
||||||
|
rs: "root",
|
||||||
|
voice: "active",
|
||||||
|
genderNumber: y.genderNumber || {
|
||||||
|
gender: "masc",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
})).toEqual(y.result);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("perfective stems", () => {
|
||||||
|
const tests: {
|
||||||
|
title: string,
|
||||||
|
tests: {
|
||||||
|
verb: T.VerbEntry,
|
||||||
|
genderNumber?: T.GenderNumber,
|
||||||
|
result: T.RootsStemsOutput,
|
||||||
|
}[],
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
title: "is the imprefective stem with an oo- prefix for regular verbs",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: ganul,
|
||||||
|
result: [
|
||||||
|
[ooPH],
|
||||||
|
[{ type: "VB", ps: [{ p: "ګڼ", f: "gaN" }]}],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: wahul,
|
||||||
|
result: [[ooPH], [{ type: "VB", ps: [{ p: "وه", f: "wah" }]}]],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "the imperfective stem the perfective stem is regularly built off could be irregular",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: khorul,
|
||||||
|
result: [[ooPH], [{ type: "VB", ps: [{ p: "خور", f: "khor" }]}]],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "is the irregular perfective stem if the entry has a ssp/ssf",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: wurul,
|
||||||
|
result: [
|
||||||
|
[{ type: "PH", ps: { p: "یو", f: "yó" }}],
|
||||||
|
[{ type: "VB", ps: [{ p: "س", f: "s" }]}],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "includes extra irregular short roots for kawul verbs",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: kawulDyn,
|
||||||
|
result: [
|
||||||
|
[ooPH],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "کړ", f: "kR" }],
|
||||||
|
short: [{ p: "ک", f: "k" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "doesn't have a perfective head for kawul stative",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: kawulStat,
|
||||||
|
result: [
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "کړ", f: "kR" }],
|
||||||
|
short: [{ p: "ک", f: "k" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "irregular, inflecting stem for tlul",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: tlul,
|
||||||
|
genderNumber: { gender: "fem", number: "singular" },
|
||||||
|
result: [
|
||||||
|
[{ type: "PH", ps: { p: "لاړه ", f: "láaRa " }}],
|
||||||
|
[
|
||||||
|
{ type: "VB", ps: [{ p: "ش", f: "sh" }]},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: tlul,
|
||||||
|
genderNumber: { gender: "fem", number: "plural" },
|
||||||
|
result: [
|
||||||
|
[{ type: "PH", ps: { p: "لاړې ", f: "láaRe " }}],
|
||||||
|
[
|
||||||
|
{ type: "VB", ps: [{ p: "ش", f: "sh" }]},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: tlul,
|
||||||
|
genderNumber: { gender: "masc", number: "plural" },
|
||||||
|
result: [
|
||||||
|
[{ type: "PH", ps: { p: "لاړ ", f: "láaR " }}],
|
||||||
|
[
|
||||||
|
{ type: "VB", ps: [{ p: "ش", f: "sh" }]},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "broken apart with complement seperately in the perfective",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: bandawul,
|
||||||
|
genderNumber: { gender: "masc", number: "singular" },
|
||||||
|
result: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "بند", f: "bánd" },
|
||||||
|
gender: "masc",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "کړ", f: "kR" }],
|
||||||
|
short: [{ p: "ک", f: "k" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: bandedul,
|
||||||
|
genderNumber: { gender: "fem", number: "plural" },
|
||||||
|
result: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "بندې", f: "bánde" },
|
||||||
|
gender: "fem",
|
||||||
|
number: "plural",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "ش", f: "sh" }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: stureyKedul,
|
||||||
|
genderNumber: { gender: "masc", number: "plural" },
|
||||||
|
result: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "ستړي", f: "stúRee" },
|
||||||
|
gender: "masc",
|
||||||
|
number: "plural",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "ش", f: "sh" }],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
tests.forEach(x => {
|
||||||
|
test(x.title, () => {
|
||||||
|
x.tests.forEach(y => {
|
||||||
|
expect(getRootStem({
|
||||||
|
verb: y.verb,
|
||||||
|
aspect: "perfective",
|
||||||
|
type: "basic",
|
||||||
|
rs: "stem",
|
||||||
|
voice: "active",
|
||||||
|
genderNumber: y.genderNumber || {
|
||||||
|
gender: "masc",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
})).toEqual(y.result);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("perfective roots", () => {
|
||||||
|
const tests: {
|
||||||
|
title: string,
|
||||||
|
tests: {
|
||||||
|
verb: T.VerbEntry,
|
||||||
|
genderNumber?: T.GenderNumber,
|
||||||
|
result: T.RootsStemsOutput,
|
||||||
|
}[],
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
title: "is the imprefective root with an oo- prefix for regular verbs",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: ganul,
|
||||||
|
result: [
|
||||||
|
[ooPH],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "ګڼل", f: "gaNul" }],
|
||||||
|
short: [{ p: "ګڼ", f: "gaN" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: wahul,
|
||||||
|
result: [
|
||||||
|
[ooPH],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "وهل", f: "wahul" }],
|
||||||
|
short: [{ p: "وه", f: "wah" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "is the irregular perfective root if the entry has a ssp/ssf",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: wurul,
|
||||||
|
result: [
|
||||||
|
[{ type: "PH", ps: { p: "یو", f: "yó" }}],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "ړل", f: "Rul" }],
|
||||||
|
short: [{ p: "ړ", f: "R" }],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "includes extra irregular short roots for kawul verbs",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: kawulDyn,
|
||||||
|
result: [
|
||||||
|
[ooPH],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "کړل", f: "kRul" }],
|
||||||
|
short: [{ p: "کړ", f: "kR" }],
|
||||||
|
mini: [{ p: "ک", f: "k" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "doesn't have a perfective head for kawul stative",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: kawulStat,
|
||||||
|
result: [
|
||||||
|
[],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "کړل", f: "kRul" }],
|
||||||
|
short: [{ p: "کړ", f: "kR" }],
|
||||||
|
mini: [{ p: "ک", f: "k" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "broken apart with complement seperately in the perfective",
|
||||||
|
tests: [
|
||||||
|
{
|
||||||
|
verb: bandawul,
|
||||||
|
genderNumber: { gender: "masc", number: "singular" },
|
||||||
|
result: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "بند", f: "bánd" },
|
||||||
|
gender: "masc",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "کړل", f: "kRul" }],
|
||||||
|
short: [{ p: "کړ", f: "kR" }],
|
||||||
|
mini: [{ p: "ک", f: "k" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: bandedul,
|
||||||
|
genderNumber: { gender: "fem", number: "plural" },
|
||||||
|
result: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "بندې", f: "bánde" },
|
||||||
|
gender: "fem",
|
||||||
|
number: "plural",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "شول", f: "shwul" }],
|
||||||
|
short: [{ p: "شو", f: "shw" }],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verb: stureyKedul,
|
||||||
|
genderNumber: { gender: "masc", number: "plural" },
|
||||||
|
result: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "ستړي", f: "stúRee" },
|
||||||
|
gender: "masc",
|
||||||
|
number: "plural",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "شول", f: "shwul" }],
|
||||||
|
short: [{ p: "شو", f: "shw" }],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
tests.forEach(x => {
|
||||||
|
test(x.title, () => {
|
||||||
|
x.tests.forEach(y => {
|
||||||
|
expect(getRootStem({
|
||||||
|
verb: y.verb,
|
||||||
|
aspect: "perfective",
|
||||||
|
type: "basic",
|
||||||
|
rs: "root",
|
||||||
|
voice: "active",
|
||||||
|
genderNumber: y.genderNumber || {
|
||||||
|
gender: "masc",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
})).toEqual(y.result);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
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 ی - ey", () => {
|
||||||
|
@ -97,7 +809,19 @@ describe("past participles", () => {
|
||||||
number: "plural",
|
number: "plural",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
test("kawul/kedul verbs have an irregular pprt fields that give us the irregular past participle", () => {
|
test("special short form with تلل - tlul", () => {
|
||||||
|
expect(getPastParticiple(tlul, "active", { gender: "masc", number: "plural" }))
|
||||||
|
.toEqual({
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [{ p: "تللي", f: "tlúlee" }],
|
||||||
|
short: [{ p: "تلي", f: "túlee" }],
|
||||||
|
},
|
||||||
|
gender: "masc",
|
||||||
|
number: "plural",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test("kawul/kedul/raatlul verbs have an irregular pprt fields that give us the irregular past participle", () => {
|
||||||
expect(getPastParticiple(kawulDyn, "active", { gender: "masc", number: "singular" }))
|
expect(getPastParticiple(kawulDyn, "active", { gender: "masc", number: "singular" }))
|
||||||
.toEqual({
|
.toEqual({
|
||||||
type: "VB",
|
type: "VB",
|
||||||
|
@ -127,7 +851,118 @@ describe("past participles", () => {
|
||||||
number: "plural",
|
number: "plural",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
test("stative compounds weld the complement to the kawul/kedul participle", () => {
|
||||||
|
expect(getPastParticiple(bandawul, "active", { gender: "fem", number: "singular" }))
|
||||||
|
.toEqual({
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "بنده", f: "banda" },
|
||||||
|
gender: "fem",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "کړې", f: "kúRe" }],
|
||||||
|
gender: "fem",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(getPastParticiple(bandedul, "active", { gender: "fem", number: "plural" }))
|
||||||
|
.toEqual({
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "بندې", f: "bande" },
|
||||||
|
gender: "fem",
|
||||||
|
number: "plural",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "شوې", f: "shúwe" }],
|
||||||
|
gender: "fem",
|
||||||
|
number: "plural",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test("for passive with simple verbs, long perfective root welded to kedul participle", () => {
|
||||||
|
expect(getPastParticiple(ganul, "passive", { gender: "fem", number: "singular" }))
|
||||||
|
.toEqual({
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "ګڼل", f: "gaNul" }],
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "شوې", f: "shúwe" }],
|
||||||
|
gender: "fem",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test("special passive forms for kawul verbs - kRul perfective root + shúwey", () => {
|
||||||
|
expect(getPastParticiple(kawulStat, "passive", { gender: "masc", number: "singular"}))
|
||||||
|
.toEqual({
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "کړل", f: "kRul" }],
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "شوی", f: "shúwey" }],
|
||||||
|
gender: "masc",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(getPastParticiple(kawulDyn, "passive", { gender: "masc", number: "singular"}))
|
||||||
|
.toEqual({
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "کړل", f: "kRul" }],
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "شوی", f: "shúwey" }],
|
||||||
|
gender: "masc",
|
||||||
|
number: "singular",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(getPastParticiple(bandawul, "passive", { gender: "fem", number: "plural" }))
|
||||||
|
.toEqual({
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "welded",
|
||||||
|
left: {
|
||||||
|
type: "NComp",
|
||||||
|
comp: {
|
||||||
|
type: "AdjComp",
|
||||||
|
ps: { p: "بندې", f: "bande" },
|
||||||
|
gender: "fem",
|
||||||
|
number: "plural",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ p: "کړل", f: "kRul" }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "VB",
|
||||||
|
ps: [{ "p": "شوې", "f": "shúwe" }],
|
||||||
|
gender: "fem",
|
||||||
|
number: "plural"
|
||||||
|
},
|
||||||
|
});
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// const ooPh: T.PH = {
|
// const ooPh: T.PH = {
|
||||||
|
|
|
@ -11,13 +11,15 @@ import {
|
||||||
} from "../p-text-helpers";
|
} from "../p-text-helpers";
|
||||||
import * as T from "../../../types";
|
import * as T from "../../../types";
|
||||||
import { makePsString, removeFVarientsFromVerb } from "../accent-and-ps-utils";
|
import { makePsString, removeFVarientsFromVerb } from "../accent-and-ps-utils";
|
||||||
import { accentOnNFromEnd, accentSyllable, removeAccents } from "../accent-helpers";
|
import { accentOnNFromEnd, countSyllables, removeAccents } from "../accent-helpers";
|
||||||
import { isKawulVerb, isTlulVerb } from "../type-predicates";
|
import { isKawulVerb, isTlulVerb } from "../type-predicates";
|
||||||
import { vEntry, addAbilityEnding, weld, removeL, addTrailingAccent, tlulPerfectiveStem, getLongVB, possiblePPartLengths, isStatComp, statCompImperfectiveSpace, makeComplement } from "./rs-helpers";
|
import { vEntry, addAbilityEnding, weld, removeL, addTrailingAccent, tlulPerfectiveStem, getLongVB, possiblePPartLengths, isStatComp, statCompImperfectiveSpace, makeComplement, vTransitivity } from "./rs-helpers";
|
||||||
import { inflectPattern3 } from "./new-inflectors";
|
import { inflectPattern3 } from "./new-inflectors";
|
||||||
|
|
||||||
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 statVerb = {
|
||||||
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"});
|
intransitive: 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"}),
|
||||||
|
transitive: 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 shwulVB: T.VBBasic = {
|
const shwulVB: T.VBBasic = {
|
||||||
type: "VB",
|
type: "VB",
|
||||||
|
@ -54,9 +56,7 @@ export function getRootStem({ verb, rs, aspect, type, genderNumber, voice }: {
|
||||||
? aspect === "imperfective"
|
? aspect === "imperfective"
|
||||||
? getImperfectiveStem(v, genderNumber)
|
? getImperfectiveStem(v, genderNumber)
|
||||||
: getPerfectiveStem(v, genderNumber)
|
: getPerfectiveStem(v, genderNumber)
|
||||||
: aspect === "imperfective"
|
: getRoot(v, genderNumber, aspect);
|
||||||
? getImperfectiveRoot(v, genderNumber)
|
|
||||||
: getPerfectiveRoot(v, genderNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAbilityRs(
|
function getAbilityRs(
|
||||||
|
@ -66,13 +66,10 @@ function getAbilityRs(
|
||||||
voice: T.Voice,
|
voice: T.Voice,
|
||||||
genderNum: T.GenderNumber,
|
genderNum: T.GenderNumber,
|
||||||
): [[] | [T.VHead], [T.VB, T.VBA]] {
|
): [[] | [T.VHead], [T.VB, T.VBA]] {
|
||||||
const losesAspect = isTlulVerb(verb) || (isStatComp(verb) && verb.entry.c?.includes("intrans."));
|
const losesAspect = isTlulVerb(verb) || (isStatComp(verb) && vTransitivity(verb) === "intransitive");
|
||||||
const [vhead, [basicroot]] = voice === "passive"
|
const [vhead, [basicroot]] = voice === "passive"
|
||||||
// passive ability loses aspect
|
|
||||||
? getPassiveRs(verb, "imperfective", "root", genderNum)
|
? getPassiveRs(verb, "imperfective", "root", genderNum)
|
||||||
: aspect === "imperfective" || losesAspect
|
: getRoot(verb, genderNum, losesAspect ? "imperfective" : aspect);
|
||||||
? getImperfectiveRoot(verb, genderNum)
|
|
||||||
: getPerfectiveRoot(verb, genderNum);
|
|
||||||
return [
|
return [
|
||||||
vhead,
|
vhead,
|
||||||
[
|
[
|
||||||
|
@ -88,6 +85,16 @@ export function getPastParticiple(verb: T.VerbEntry, voice: T.Voice, { gender, n
|
||||||
if (voice === "passive") {
|
if (voice === "passive") {
|
||||||
return getPassivePp(v, { gender, number });
|
return getPassivePp(v, { gender, number });
|
||||||
}
|
}
|
||||||
|
if (isStatComp(v) && v.complement) {
|
||||||
|
return weld(
|
||||||
|
makeComplement(v.complement, { gender, number }),
|
||||||
|
getPastParticiple(
|
||||||
|
statVerb[vTransitivity(verb)],
|
||||||
|
voice,
|
||||||
|
{ gender, number },
|
||||||
|
) as T.VBGenNum,
|
||||||
|
);
|
||||||
|
}
|
||||||
if (verb.entry.pprtp && verb.entry.pprtf) {
|
if (verb.entry.pprtp && verb.entry.pprtf) {
|
||||||
const base = makePsString(verb.entry.pprtp, verb.entry.pprtf);
|
const base = makePsString(verb.entry.pprtp, verb.entry.pprtf);
|
||||||
return {
|
return {
|
||||||
|
@ -97,28 +104,19 @@ export function getPastParticiple(verb: T.VerbEntry, voice: T.Voice, { gender, n
|
||||||
number,
|
number,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const basicRoot = getImperfectiveRoot(removeFVarientsFromVerb(verb), { gender, number })[1][0];
|
const basicRoot = getRoot(removeFVarientsFromVerb(verb), { gender, number }, "imperfective")[1][0];
|
||||||
const longRoot = getLongVB(basicRoot);
|
const longRoot = getLongVB(basicRoot);
|
||||||
const rootWLengths = possiblePPartLengths(longRoot);
|
const rootWLengths = possiblePPartLengths(longRoot);
|
||||||
|
/* istanbul ignore next */
|
||||||
if ("right" in rootWLengths) {
|
if ("right" in rootWLengths) {
|
||||||
return {
|
throw new Error("should not have welded here");
|
||||||
...rootWLengths,
|
}
|
||||||
right: {
|
return {
|
||||||
...rootWLengths.right,
|
...rootWLengths,
|
||||||
ps: addTail(rootWLengths.right.ps),
|
ps: addTail(rootWLengths.ps),
|
||||||
gender,
|
gender,
|
||||||
number,
|
number,
|
||||||
},
|
};
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
...rootWLengths,
|
|
||||||
ps: addTail(rootWLengths.ps),
|
|
||||||
gender,
|
|
||||||
number,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function addTail(ps: T.SingleOrLengthOpts<T.PsString[]>): T.SingleOrLengthOpts<T.PsString[]> {
|
function addTail(ps: T.SingleOrLengthOpts<T.PsString[]>): T.SingleOrLengthOpts<T.PsString[]> {
|
||||||
if ("long" in ps) {
|
if ("long" in ps) {
|
||||||
|
@ -133,97 +131,87 @@ export function getPastParticiple(verb: T.VerbEntry, voice: T.Voice, { gender, n
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPassivePp(verb: T.VerbEntryNoFVars, genderNumber: T.GenderNumber): T.WeldedGN {
|
function getPassivePp(verb: T.VerbEntryNoFVars, genderNumber: T.GenderNumber): T.WeldedGN {
|
||||||
const basicRoot = getImperfectiveRoot(verb, genderNumber)[1][0];
|
if (isStatComp(verb) && verb.complement) {
|
||||||
|
return weld(
|
||||||
|
makeComplement(verb.complement, genderNumber),
|
||||||
|
getPassivePp(statVerb.transitive, genderNumber),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
const basicRoot = getRoot(verb, genderNumber, isKawulVerb(verb) ? "perfective" : "imperfective")[1][0];
|
||||||
const longRoot = getLongVB(basicRoot);
|
const longRoot = getLongVB(basicRoot);
|
||||||
const kedulVb: T.VBGenNum = getPastParticiple(kedulStat, "active", genderNumber) as T.VBGenNum;
|
const kedulVb: T.VBGenNum = getPastParticiple(statVerb.intransitive, "active", genderNumber) as T.VBGenNum;
|
||||||
return weld(longRoot, kedulVb);
|
return weld(longRoot, kedulVb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: could combine these two functions...
|
|
||||||
function getPassiveRs(verb: T.VerbEntryNoFVars, aspect: T.Aspect, rs: "root" | "stem", genderNumber: T.GenderNumber): [[] | [T.VHead], [T.VBA]] {
|
function getPassiveRs(verb: T.VerbEntryNoFVars, aspect: T.Aspect, rs: "root" | "stem", genderNumber: T.GenderNumber): [[] | [T.VHead], [T.VBA]] {
|
||||||
const [vHead, [basicRoot]] = (aspect === "imperfective"
|
const [vHead, [basicRoot]] = getRoot(verb, genderNumber, aspect);
|
||||||
? getImperfectiveRoot
|
|
||||||
: getPerfectiveRoot
|
|
||||||
)(verb, genderNumber);
|
|
||||||
const longRoot = getLongVB(basicRoot);
|
const longRoot = getLongVB(basicRoot);
|
||||||
const kedulVba = getRootStem({ verb: kedulStat, aspect, rs, type: "basic", voice: "active", genderNumber: { gender: "masc", number: "singular" }})[1][0] as T.VBBasic;
|
const kedulVba = getRootStem({ verb: statVerb.intransitive, aspect, rs, type: "basic", voice: "active", genderNumber: { gender: "masc", number: "singular" }})[1][0] as T.VBBasic;
|
||||||
return [
|
return [
|
||||||
vHead,
|
vHead,
|
||||||
[weld(longRoot, kedulVba)],
|
[weld(longRoot, kedulVba)],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImperfectiveRoot(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber): [[], [T.VBA]] {
|
function getRoot(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber, aspect: T.Aspect): [[T.VHead] | [], [T.VBA]] {
|
||||||
if (verb.complement && isStatComp(verb) && statCompImperfectiveSpace(verb)) {
|
if (verb.complement && isStatComp(verb) && (aspect === "perfective" || statCompImperfectiveSpace(verb))) {
|
||||||
const auxStem = getImperfectiveRoot(verb.entry.c?.includes("intrans.")
|
const auxStem = getRoot(
|
||||||
? kedulStat
|
statVerb[vTransitivity(verb)],
|
||||||
: kawulStat
|
genderNum,
|
||||||
, genderNum)[1][0];
|
aspect,
|
||||||
return [
|
)[1][0] as T.VBBasic;
|
||||||
[],
|
const comp = makeComplement(verb.complement, genderNum);
|
||||||
[
|
return aspect === "perfective"
|
||||||
weld(
|
? [[comp], [auxStem]]
|
||||||
makeComplement(verb.complement, genderNum),
|
: [
|
||||||
auxStem as T.VBBasic,
|
[],
|
||||||
),
|
[
|
||||||
],
|
weld(
|
||||||
];
|
makeComplement(verb.complement, genderNum),
|
||||||
|
auxStem as T.VBBasic,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
const infinitive = accentOnNFromEnd(makePsString(verb.entry.p, verb.entry.f), 0);
|
const base = aspect === "imperfective"
|
||||||
return [
|
? accentOnNFromEnd(makePsString(verb.entry.p, verb.entry.f), 0)
|
||||||
[],
|
: removeAccents(
|
||||||
[
|
(verb.entry.prp && verb.entry.prf)
|
||||||
{
|
? makePsString(verb.entry.prp, verb.entry.prf)
|
||||||
type: "VB",
|
: makePsString(verb.entry.p, verb.entry.f)
|
||||||
ps: {
|
);
|
||||||
long: [infinitive],
|
const [perfectiveHead, rest] = aspect === "perfective"
|
||||||
short: [addTrailingAccent(removeL(infinitive))],
|
? getPerfectiveHead(base, verb)
|
||||||
},
|
: [undefined, base];
|
||||||
},
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPerfectiveRoot(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber): [[T.VHead] | [], [T.VBA]] {
|
|
||||||
if (verb.complement && isStatComp(verb)) {
|
|
||||||
const auxStem = getPerfectiveRoot(verb.entry.c?.includes("intrans.")
|
|
||||||
? kedulStat
|
|
||||||
: kawulStat,
|
|
||||||
genderNum)[1][0];
|
|
||||||
return [
|
|
||||||
[makeComplement(verb.complement, genderNum)],
|
|
||||||
[auxStem as T.VBBasic],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
const base = removeAccents(
|
|
||||||
(verb.entry.prp && verb.entry.prf)
|
|
||||||
? makePsString(verb.entry.prp, verb.entry.prf)
|
|
||||||
: makePsString(verb.entry.p, verb.entry.f)
|
|
||||||
);
|
|
||||||
const [perfectiveHead, rest] = getPerfectiveHead(base, verb);
|
|
||||||
return [
|
return [
|
||||||
perfectiveHead ? [perfectiveHead] : [],
|
perfectiveHead ? [perfectiveHead] : [],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: "VB",
|
type: "VB",
|
||||||
ps: {
|
ps: aspect === "imperfective"
|
||||||
long: [rest],
|
? {
|
||||||
short: [removeL(rest)],
|
long: [rest],
|
||||||
...isKawulVerb(verb) ? {
|
short: [addTrailingAccent(removeL(rest))],
|
||||||
mini: [{ p: "ک", f: "k" }],
|
}
|
||||||
} : {},
|
: {
|
||||||
},
|
long: [rest],
|
||||||
|
short: [removeL(rest)],
|
||||||
|
...(aspect === "perfective" && isKawulVerb(verb)) ? {
|
||||||
|
mini: [{ p: "ک", f: "k" }],
|
||||||
|
} : {},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImperfectiveStem(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber): [[], [T.VB]] {
|
function getImperfectiveStem(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber): [[], [T.VB]] {
|
||||||
if (verb.complement && isStatComp(verb) && statCompImperfectiveSpace(verb)) {
|
const statComp = isStatComp(verb);
|
||||||
const auxStem = getImperfectiveStem(verb.entry.c?.includes("intrans.")
|
if (verb.complement && statComp && statCompImperfectiveSpace(verb)) {
|
||||||
? kedulStat
|
const auxStem = getImperfectiveStem(
|
||||||
: kawulStat,
|
statVerb[vTransitivity(verb)],
|
||||||
genderNum)[1][0];
|
genderNum,
|
||||||
|
)[1][0];
|
||||||
return [
|
return [
|
||||||
[],
|
[],
|
||||||
[
|
[
|
||||||
|
@ -245,12 +233,17 @@ function getImperfectiveStem(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
const rawBase = removeL(makePsString(verb.entry.p, verb.entry.f));
|
const extraRawBase = removeL(makePsString(verb.entry.p, verb.entry.f));
|
||||||
if (verb.entry.c?.includes("intrans.") && rawBase.p.endsWith("ېد")) {
|
// welded stative -awul verbs should always have a trailing accent
|
||||||
const shortBase = trimOffPs(rawBase, 1, 2);
|
const rawBase = isKawulVerb(verb) || statComp || (countSyllables(extraRawBase) > 1 && extraRawBase.f.endsWith("aw"))
|
||||||
|
? addTrailingAccent(extraRawBase)
|
||||||
|
: extraRawBase;
|
||||||
|
if (vTransitivity(verb) === "intransitive" && extraRawBase.p.endsWith("ېد")) {
|
||||||
|
// TODO: Factor out into a function
|
||||||
|
const shortBase = trimOffPs(extraRawBase, 2, 2);
|
||||||
const long: T.PsString[] = [concatPsString(
|
const long: T.PsString[] = [concatPsString(
|
||||||
shortBase,
|
shortBase,
|
||||||
{ p: "ږ", f: "éG" },
|
{ p: "ېږ", f: "éG" },
|
||||||
)];
|
)];
|
||||||
const short: T.PsString[] | undefined = (verb.entry.shortIntrans)
|
const short: T.PsString[] | undefined = (verb.entry.shortIntrans)
|
||||||
? [shortBase]
|
? [shortBase]
|
||||||
|
@ -277,10 +270,7 @@ function getImperfectiveStem(verb: T.VerbEntryNoFVars, genderNum: T.GenderNumber
|
||||||
|
|
||||||
function getPerfectiveStem(verb: T.VerbEntryNoFVars, genderNum: { gender: T.Gender, number: T.NounNumber }): [[T.VHead] | [], [T.VB]] {
|
function getPerfectiveStem(verb: T.VerbEntryNoFVars, genderNum: { gender: T.Gender, number: T.NounNumber }): [[T.VHead] | [], [T.VB]] {
|
||||||
if (verb.complement && isStatComp(verb)) {
|
if (verb.complement && isStatComp(verb)) {
|
||||||
const auxStem = getPerfectiveStem(verb.entry.c?.includes("intrans.")
|
const auxStem = getPerfectiveStem(statVerb[vTransitivity(verb)], genderNum)[1][0];
|
||||||
? kedulStat
|
|
||||||
: kawulStat,
|
|
||||||
genderNum)[1][0];
|
|
||||||
return [
|
return [
|
||||||
[makeComplement(verb.complement, genderNum)],
|
[makeComplement(verb.complement, genderNum)],
|
||||||
[auxStem as T.VBBasic],
|
[auxStem as T.VBBasic],
|
||||||
|
@ -319,10 +309,10 @@ function getPerfectiveHead(base: T.PsString, { entry }: T.VerbEntryNoFVars): [T.
|
||||||
if (entry.separationAtP && entry.separationAtF) {
|
if (entry.separationAtP && entry.separationAtF) {
|
||||||
const ph: T.PH = {
|
const ph: T.PH = {
|
||||||
type: "PH",
|
type: "PH",
|
||||||
ps: {
|
ps: accentOnNFromEnd({
|
||||||
p: base.p.slice(0, entry.separationAtP),
|
p: base.p.slice(0, entry.separationAtP),
|
||||||
f: accentSyllable(base.f.slice(0, entry.separationAtF)),
|
f: base.f.slice(0, entry.separationAtF),
|
||||||
},
|
}, 0),
|
||||||
};
|
};
|
||||||
const rest = {
|
const rest = {
|
||||||
p: base.p.slice(entry.separationAtP),
|
p: base.p.slice(entry.separationAtP),
|
||||||
|
|
|
@ -51,7 +51,7 @@ export function vEntry(e: any, c?: any): T.VerbEntryNoFVars {
|
||||||
return {
|
return {
|
||||||
entry: removeFVarients(e),
|
entry: removeFVarients(e),
|
||||||
...c ? {
|
...c ? {
|
||||||
c,
|
complement: c,
|
||||||
} : {},
|
} : {},
|
||||||
} as T.VerbEntryNoFVars;
|
} as T.VerbEntryNoFVars;
|
||||||
}
|
}
|
||||||
|
@ -108,9 +108,17 @@ export function verbEndingConcat(ps: T.PsString[], end: T.PsString[]): T.PsStrin
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function weld(left: T.Welded["left"], right: T.VBGenNum): T.WeldedGN;
|
// TODO: THIS IS UGGGGLY NEED TO THINK THROUGH THE TYPING ON THE WELDING
|
||||||
export function weld(left: T.Welded["left"], right: T.VBBasic): T.Welded;
|
export function weld(left: T.Welded["left"], right: T.VBGenNum | T.WeldedGN): T.WeldedGN;
|
||||||
export function weld(left: T.Welded["left"], right: T.VBBasic | T.VBGenNum): T.Welded | T.WeldedGN {
|
export function weld(left: T.Welded["left"], right: T.VBBasic | T.NComp | T.Welded): T.Welded;
|
||||||
|
export function weld(left: T.Welded["left"], right: T.VBBasic | T.VBGenNum | T.Welded | T.NComp | T.WeldedGN): T.Welded | T.WeldedGN {
|
||||||
|
if (right.type === "welded") {
|
||||||
|
return weld(weld(left, right.left), right.right);
|
||||||
|
}
|
||||||
|
/* istanbul ignore next */
|
||||||
|
if (right.type === "NComp") {
|
||||||
|
throw new Error("can't weld a complement on the right side");
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
type: "welded",
|
type: "welded",
|
||||||
left: removeAccentsFromLeft(left),
|
left: removeAccentsFromLeft(left),
|
||||||
|
@ -154,13 +162,22 @@ export function addTrailingAccent(ps: T.PsString): T.PsString {
|
||||||
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
|
||||||
|
*
|
||||||
|
* @param v
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function vTransitivity(v: T.VerbEntry): "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: { gender: T.Gender, number: T.NounNumber }): [[T.PH], [T.VB]] {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
type: "PH",
|
type: "PH",
|
||||||
ps: inflectPattern1({ p: "لاړ", f: "laaR" }, person).map(x => concatPsString(x, " "))[0],
|
ps: inflectPattern1({ p: "لاړ", f: "láaR" }, person).map(x => concatPsString(x, " "))[0],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
@ -214,6 +231,15 @@ export function possiblePPartLengths(vba: T.VBNoLenghts<T.VBA>): T.VBA {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const infinitive = vba.ps[0];
|
const infinitive = vba.ps[0];
|
||||||
|
if (infinitive.f === "tlúl") {
|
||||||
|
return {
|
||||||
|
type: "VB",
|
||||||
|
ps: {
|
||||||
|
long: [infinitive],
|
||||||
|
short: [{ p: "تل", f: "túl" }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
const [trimP, trimF] = (infinitive.p.slice(-4) === "ښودل" && infinitive.p.length > 4 && infinitive.p !== "کېښودل" && infinitive.p !== "کښېښودل")
|
const [trimP, trimF] = (infinitive.p.slice(-4) === "ښودل" && infinitive.p.length > 4 && infinitive.p !== "کېښودل" && infinitive.p !== "کښېښودل")
|
||||||
// special thing for اېښودل - پرېښودل
|
// special thing for اېښودل - پرېښودل
|
||||||
? [3, 4]
|
? [3, 4]
|
||||||
|
|
Loading…
Reference in New Issue