more work on basic verb parsing

This commit is contained in:
adueck 2023-08-16 11:48:48 +04:00
parent f53c81e14d
commit b384771db5
12 changed files with 1995 additions and 140 deletions

View File

@ -28,7 +28,7 @@
"react-bootstrap": "^1.5.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
"typescript": "^4.2.3",
"typescript": "^5.1.6",
"web-vitals": "^1.0.1"
},
"scripts": {
@ -77,4 +77,4 @@
]
},
"dependencies": {}
}
}

View File

@ -471,7 +471,7 @@ function getPassiveRs(
}
// TODO: This is a nasty and messy way to do it with the length options included
function getPerfectiveHead(
export function getPerfectiveHead(
base: T.PsString,
v: T.VerbEntryNoFVars
): [T.PH, T.PsString] | [undefined, T.PsString] {

View File

@ -25,6 +25,9 @@ import {
splitPsByVarients,
endsWith,
trimOffPs,
undoAaXuPattern,
prevValNotA,
lastVowelNotA,
} from "./p-text-helpers";
import * as T from "../../types";
import { pastEndings } from "./grammar-units";
@ -1665,3 +1668,17 @@ test("endsWith", () => {
);
expect(endsWith({ f: ["d", "D"] })({ p: "چت", f: "chat" })).toBe(false);
});
test("undoAaXuPattern", () => {
expect(undoAaXuPattern("تور")).toBe(false);
expect(undoAaXuPattern("پښتان")).toBe(false);
expect(undoAaXuPattern("کاوه")).toBe("کو");
expect(undoAaXuPattern("وواته")).toBe("ووت");
expect(undoAaXuPattern("واسته")).toBe("وست");
expect(undoAaXuPattern("لیده")).toBe(false);
});
test("lastVowelNotA", () => {
expect(lastVowelNotA("raat")).toBe(true);
expect(lastVowelNotA("oowat")).toBe(false);
});

View File

@ -1224,3 +1224,29 @@ export function getShort<U extends object>(a: T.SingleOrLengthOpts<U>): U {
export function capitalizeFirstLetter(string: string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
/**
* For use with the
*/
export function undoAaXuPattern(p: string): false | string {
if (p.at(-1) !== "ه") {
return false;
}
const chars = p.split("");
const prevVowel = chars.findIndex((c) => ["ی", "ې", "ا"].includes(c));
if (prevVowel === -1) {
return false;
}
if (p[prevVowel] !== "ا") {
return false;
}
return p.slice(0, prevVowel) + p.slice(prevVowel + 1, -1);
}
export function lastVowelNotA(g: string): boolean {
const matches = g.match(/ee|aa|i|u|o|oo|U|e|a/g);
if (!matches) {
return true;
}
return matches[matches.length - 1] !== "a";
}

View File

@ -0,0 +1,554 @@
const b = [
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to come",
ec: "come,comes,coming,came,come",
f: "raatlúl",
g: "raatlul",
noOo: true,
p: "راتلل",
pprtf: "raaghúlay",
pprtp: "راغلی",
prf: "ráaghlul",
prp: "راغلل",
psf: "raadz",
psp: "راځ",
r: 4,
separationAtF: 3,
separationAtP: 2,
ssf: "ráash",
ssp: "راش",
tppf: "ráaghay",
tppp: "راغی",
ts: 1527815216,
},
},
},
person: 4,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to come",
ec: "come,comes,coming,came,come",
f: "raatlúl",
g: "raatlul",
noOo: true,
p: "راتلل",
pprtf: "raaghúlay",
pprtp: "راغلی",
prf: "ráaghlul",
prp: "راغلل",
psf: "raadz",
psp: "راځ",
r: 4,
separationAtF: 3,
separationAtP: 2,
ssf: "ráash",
ssp: "راش",
tppf: "ráaghay",
tppp: "راغی",
ts: 1527815216,
},
},
},
person: 5,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to come",
ec: "come,comes,coming,came,come",
f: "raatlúl",
g: "raatlul",
noOo: true,
p: "راتلل",
pprtf: "raaghúlay",
pprtp: "راغلی",
prf: "ráaghlul",
prp: "راغلل",
psf: "raadz",
psp: "راځ",
r: 4,
separationAtF: 3,
separationAtP: 2,
ssf: "ráash",
ssp: "راش",
tppf: "ráaghay",
tppp: "راغی",
ts: 1527815216,
},
},
},
person: 10,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to come",
ec: "come,comes,coming,came,come",
f: "raatlúl",
g: "raatlul",
noOo: true,
p: "راتلل",
pprtf: "raaghúlay",
pprtp: "راغلی",
prf: "ráaghlul",
prp: "راغلل",
psf: "raadz",
psp: "راځ",
r: 4,
separationAtF: 3,
separationAtP: 2,
ssf: "ráash",
ssp: "راش",
tppf: "ráaghay",
tppp: "راغی",
ts: 1527815216,
},
},
},
person: 11,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to become _____",
ec: "become",
f: "kedul",
g: "kedul",
noOo: true,
p: "کېدل",
pprtf: "shúway",
pprtp: "شوی",
prf: "shwul",
prp: "شول",
r: 2,
ssf: "sh",
ssp: "ش",
ts: 1581086654898,
},
},
},
person: 4,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to become _____",
ec: "become",
f: "kedul",
g: "kedul",
noOo: true,
p: "کېدل",
pprtf: "shúway",
pprtp: "شوی",
prf: "shwul",
prp: "شول",
r: 2,
ssf: "sh",
ssp: "ش",
ts: 1581086654898,
},
},
},
person: 5,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to become _____",
ec: "become",
f: "kedul",
g: "kedul",
noOo: true,
p: "کېدل",
pprtf: "shúway",
pprtp: "شوی",
prf: "shwul",
prp: "شول",
r: 2,
ssf: "sh",
ssp: "ش",
ts: 1581086654898,
},
},
},
person: 10,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to become _____",
ec: "become",
f: "kedul",
g: "kedul",
noOo: true,
p: "کېدل",
pprtf: "shúway",
pprtp: "شوی",
prf: "shwul",
prp: "شول",
r: 2,
ssf: "sh",
ssp: "ش",
ts: 1581086654898,
},
},
},
person: 11,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
diacExcept: true,
e: "to happen, occur",
ec: "happen",
f: "kedul",
g: "kedul",
p: "کېدل",
pprtf: "shúway",
pprtp: "شوی",
prf: "óoshwul",
prp: "وشول",
r: 2,
separationAtF: 2,
separationAtP: 1,
ssf: "óosh",
ssp: "وش",
ts: 1527812754,
},
},
},
person: 4,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
diacExcept: true,
e: "to happen, occur",
ec: "happen",
f: "kedul",
g: "kedul",
p: "کېدل",
pprtf: "shúway",
pprtp: "شوی",
prf: "óoshwul",
prp: "وشول",
r: 2,
separationAtF: 2,
separationAtP: 1,
ssf: "óosh",
ssp: "وش",
ts: 1527812754,
},
},
},
person: 5,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
diacExcept: true,
e: "to happen, occur",
ec: "happen",
f: "kedul",
g: "kedul",
p: "کېدل",
pprtf: "shúway",
pprtp: "شوی",
prf: "óoshwul",
prp: "وشول",
r: 2,
separationAtF: 2,
separationAtP: 1,
ssf: "óosh",
ssp: "وش",
ts: 1527812754,
},
},
},
person: 10,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
diacExcept: true,
e: "to happen, occur",
ec: "happen",
f: "kedul",
g: "kedul",
p: "کېدل",
pprtf: "shúway",
pprtp: "شوی",
prf: "óoshwul",
prp: "وشول",
r: 2,
separationAtF: 2,
separationAtP: 1,
ssf: "óosh",
ssp: "وش",
ts: 1527812754,
},
},
},
person: 11,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to come / go over to (third person or place)",
ec: "come,comes,coming,came,come",
f: "wărtlul",
g: "wartlul",
noOo: true,
p: "ورتلل",
pprtf: "wărghúlay",
pprtp: "ورغلی",
prf: "wárghlul",
prp: "ورغلل",
psf: "wărdz",
psp: "ورځ",
r: 4,
separationAtF: 3,
separationAtP: 2,
ssf: "wársh",
ssp: "ورش",
tppf: "wărghay",
tppp: "ورغی",
ts: 1585228579997,
},
},
},
person: 4,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to come / go over to (third person or place)",
ec: "come,comes,coming,came,come",
f: "wărtlul",
g: "wartlul",
noOo: true,
p: "ورتلل",
pprtf: "wărghúlay",
pprtp: "ورغلی",
prf: "wárghlul",
prp: "ورغلل",
psf: "wărdz",
psp: "ورځ",
r: 4,
separationAtF: 3,
separationAtP: 2,
ssf: "wársh",
ssp: "ورش",
tppf: "wărghay",
tppp: "ورغی",
ts: 1585228579997,
},
},
},
person: 5,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to come / go over to (third person or place)",
ec: "come,comes,coming,came,come",
f: "wărtlul",
g: "wartlul",
noOo: true,
p: "ورتلل",
pprtf: "wărghúlay",
pprtp: "ورغلی",
prf: "wárghlul",
prp: "ورغلل",
psf: "wărdz",
psp: "ورځ",
r: 4,
separationAtF: 3,
separationAtP: 2,
ssf: "wársh",
ssp: "ورش",
tppf: "wărghay",
tppp: "ورغی",
ts: 1585228579997,
},
},
},
person: 10,
type: "VB",
},
],
[
null,
{
info: {
aspect: "perfective",
base: "stem",
type: "verb",
verb: {
entry: {
c: "v. intrans.",
e: "to come / go over to (third person or place)",
ec: "come,comes,coming,came,come",
f: "wărtlul",
g: "wartlul",
noOo: true,
p: "ورتلل",
pprtf: "wărghúlay",
pprtp: "ورغلی",
prf: "wárghlul",
prp: "ورغلل",
psf: "wărdz",
psp: "ورځ",
r: 4,
separationAtF: 3,
separationAtP: 2,
ssf: "wársh",
ssp: "ورش",
tppf: "wărghay",
tppp: "ورغی",
ts: 1585228579997,
},
},
},
person: 11,
type: "VB",
},
],
];

View File

@ -0,0 +1,193 @@
import * as T from "../../../types";
export const raatlul = {
entry: {
ts: 1527815216,
i: 6926,
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úlay",
tppp: "راغی",
tppf: "ráaghay",
noOo: true,
separationAtP: 2,
separationAtF: 3,
ec: "come,comes,coming,came,come",
},
} as T.VerbEntry;
export const tlul = {
entry: {
ts: 1527815348,
i: 3820,
p: "تلل",
f: "tlul",
g: "tlul",
e: "to go",
r: 4,
c: "v. intrans.",
psp: "ځ",
psf: "dz",
ssp: "لاړ ش",
ssf: "láaR sh",
prp: "لاړل",
prf: "láaRul",
tppp: "لاړ",
tppf: "laaR",
separationAtP: 2,
separationAtF: 3,
ec: "go,goes,going,went,gone",
},
} as T.VerbEntry;
export const wartlul = {
entry: {
ts: 1585228579997,
i: 14924,
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úlay",
tppp: "ورغی",
tppf: "wărghay",
noOo: true,
separationAtP: 2,
separationAtF: 3,
ec: "come,comes,coming,came,come",
},
} as T.VerbEntry;
export const dartlul = {
entry: {
ts: 1585228551150,
i: 6320,
p: "درتلل",
f: "dărtlul",
g: "dartlul",
e: "to come (to you / second person)",
r: 3,
c: "v. intrans.",
psp: "درځ",
psf: "dărdz",
ssp: "درش",
ssf: "dársh",
prp: "درغلل",
prf: "dárghlul",
pprtp: "درغلی",
pprtf: "dărghúlay",
tppp: "درغی",
tppf: "dărghay",
noOo: true,
separationAtP: 2,
separationAtF: 3,
ec: "come,comes,coming,came,come",
},
} as T.VerbEntry;
export const kedulStat = {
entry: {
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úway",
noOo: true,
ec: "become",
},
} as T.VerbEntry;
export const kedulDyn = {
entry: {
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úway",
diacExcept: true,
ec: "happen",
separationAtP: 1,
separationAtF: 2,
},
} as T.VerbEntry;
export const kawulStat = {
entry: {
ts: 1579015359582,
i: 11112,
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úRay",
noOo: true,
ec: "make,makes,making,made,made",
},
} as T.VerbEntry;
export const kawulDyn = {
entry: {
ts: 1527812752,
i: 11113,
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",
},
} as T.VerbEntry;

View File

@ -3,7 +3,7 @@ import verbs from "../../../verbs";
import * as T from "../../../types";
import { isAdjectiveEntry, isNounEntry } from "../type-predicates";
import { removeFVarientsFromVerb } from "../accent-and-ps-utils";
import { splitVarients } from "../p-text-helpers";
import { splitVarients, undoAaXuPattern } from "../p-text-helpers";
import { arraysHaveCommon } from "../misc-helpers";
export function lookup(s: Partial<T.DictionaryEntry>): T.DictionaryEntry[] {
@ -48,64 +48,93 @@ export function verbLookup(input: string): T.VerbEntry[] {
// if theres no legit verb ending and no tpp possibilities, just return an empty array
const sWoutOo = s.startsWith("و") ? s.slice(1) : undefined;
const checkTpp = shouldCheckTpp(input);
const fromAawu = checkTpp && undoAaXuPattern(input);
const inputWoutOo =
checkTpp && input.startsWith("و") ? input.slice(1) : undefined;
// TODO: don't do this blindly, but check if it could actually be added
const sAddedAa = "ا" + s;
// for لواته -> to search for tpp الواته
const inputAddedAa = "ا" + input;
// TODO: don't do the slice of and checking for useless things when you have a NON verb ending (like with the tpp)
if (s.endsWith("ېږ")) {
return verbs.filter(
sWoutOo
? ({ entry }) =>
[s, sWoutOo].includes(entry.p.slice(0, -1)) ||
[s.slice(0, -1) + "دل", sWoutOo.slice(0, -1) + "دل"].includes(
entry.p
) ||
[s, sWoutOo].includes(entry.p) ||
(entry.psp && [s, sWoutOo].includes(entry.psp)) ||
[s, sWoutOo, sAddedAa].includes(entry.p.slice(0, -1)) ||
[
s.slice(0, -1) + "دل",
sWoutOo.slice(0, -1) + "دل",
sAddedAa.slice(0, -1) + "دل",
].includes(entry.p) ||
[s, sWoutOo, sAddedAa].includes(entry.p) ||
(entry.psp && [s, sWoutOo, sAddedAa].includes(entry.psp)) ||
entry.prp === s ||
entry.ssp === s
: ({ entry }) =>
entry.p.slice(0, -1) === s ||
entry.p === s.slice(0, -1) + "دل" ||
entry.p === s ||
entry.psp === s ||
entry.prp === s ||
entry.ssp === s
[s, sAddedAa].includes(entry.p.slice(0, -1)) ||
[s.slice(0, -1) + "دل", sAddedAa.slice(0, -1) + "دل"].includes(
entry.p
) ||
[s, sAddedAa].includes(entry.p) ||
[s, sAddedAa].includes(entry.psp || "") ||
[s, sAddedAa].includes(entry.prp || "") ||
[s, sAddedAa].includes(entry.ssp || "")
);
}
return verbs.filter(
sWoutOo
? ({ entry }) =>
[s, sWoutOo].includes(entry.p.slice(0, -1)) ||
[s, sWoutOo, sAddedAa].includes(entry.p.slice(0, -1)) ||
// for short intransitive forms
[s, sWoutOo].includes(entry.p.slice(0, -3)) ||
[s, sWoutOo].includes(entry.p) ||
(entry.psp && [s, sWoutOo].includes(entry.psp)) ||
[s, sWoutOo, sAddedAa].includes(entry.p.slice(0, -3)) ||
[s, sWoutOo, sAddedAa].includes(entry.p) ||
(entry.psp && [s, sWoutOo, sAddedAa].includes(entry.psp)) ||
(checkTpp &&
[
input.slice(1),
fromAawu && fromAawu.slice(-1),
inputAddedAa,
].includes(entry.p.slice(0, -1))) ||
(entry.tppp &&
arraysHaveCommon(
[input, inputWoutOo],
[input, inputWoutOo, sAddedAa],
splitVarients(entry.tppp)
)) ||
entry.prp === s ||
entry.ssp === s ||
arraysHaveCommon(
[s, sAddedAa, "و" + s],
[entry.prp, entry.prp?.slice(0, -1)]
) ||
[s, sAddedAa].includes(entry.ssp || "") ||
(entry.separationAtP &&
(entry.p.slice(entry.separationAtP) === s ||
entry.psp?.slice(entry.separationAtP) === s))
: ({ entry }) =>
entry.p.slice(0, -1) === s ||
[s, sAddedAa].includes(entry.p.slice(0, -1)) ||
// for short intransitive forms
entry.p.slice(0, -3) === s ||
entry.p === s ||
[s, sAddedAa].includes(entry.p.slice(0, -3)) ||
[s, sAddedAa].includes(entry.p) ||
(checkTpp &&
[input, fromAawu, sAddedAa].includes(entry.p.slice(0, -1))) ||
(entry.tppp &&
arraysHaveCommon(
[input, inputWoutOo],
[input, inputWoutOo, sAddedAa, inputAddedAa],
splitVarients(entry.tppp)
)) ||
entry.psp === s ||
entry.prp === s ||
entry.ssp === s ||
[s, sAddedAa].includes(entry.psp || "") ||
arraysHaveCommon(
[entry.prp, entry.prp?.slice(0, -1)],
[s, sAddedAa, "و" + s]
) ||
[s, sAddedAa, "و" + s].includes(entry.ssp || "") ||
(entry.separationAtP &&
(entry.p.slice(entry.separationAtP) === s ||
entry.psp?.slice(entry.separationAtP) === s))
entry.psp?.slice(entry.separationAtP) === s ||
(entry.prp &&
[
entry.prp.slice(entry.separationAtP),
entry.prp.slice(entry.separationAtP).slice(0, -1),
].includes(s)) ||
(entry.ssp && entry.ssp.slice(entry.separationAtP) === s)))
);
}

View File

@ -3,6 +3,8 @@ import { verbLookup } from "./lookup";
import { parseNP } from "./parse-np";
import { parseVP } from "./parse-vp";
// شو should not be sheyaano !!
export function parsePhrase(
s: T.Token[],
lookup: (s: Partial<T.DictionaryEntry>) => T.DictionaryEntry[]

View File

@ -1,5 +1,13 @@
/* eslint-disable jest/valid-title */
import * as T from "../../../types";
import {
dartlul,
kedulDyn,
kedulStat,
tlul,
wartlul,
raatlul,
} from "./irreg-verbs";
import { verbLookup, wordQuery } from "./lookup";
import { parseVerb } from "./parse-verb";
import { tokenizer } from "./tokenizer";
@ -16,7 +24,11 @@ const prexodul = wordQuery("پرېښودل", "verb");
const xodul = wordQuery("ښودل", "verb");
const kexodul = wordQuery("کېښودل", "verb");
const katul = wordQuery("کتل", "verb");
const tlul = wordQuery("تلل", "verb");
const watul = wordQuery("وتل", "verb");
const wurul = wordQuery("وړل", "verb");
const akheestul = wordQuery("اخیستل", "verb");
const alwatul = wordQuery("الوتل", "verb");
// const dartlul = wordQuery("درتلل", "verb");
// todo alwatul waalwatul akhistul azmoyul etc
@ -115,13 +127,34 @@ const tests: {
{
ph: undefined,
root: {
persons: [T.Person.FirstPlurMale, T.Person.FirstPlurFemale],
persons: [
T.Person.FirstPlurMale,
T.Person.FirstPlurFemale,
T.Person.ThirdSingMale,
],
aspects: ["imperfective", "perfective"],
},
verb: leekul,
},
],
},
{
input: "ولیکلو",
output: [
{
ph: "و",
root: {
persons: [
T.Person.FirstPlurMale,
T.Person.FirstPlurFemale,
T.Person.ThirdSingMale,
],
aspects: ["perfective"],
},
verb: leekul,
},
],
},
{
input: "لیکل",
output: [
@ -542,6 +575,123 @@ const tests: {
},
],
},
{
input: "واخلم",
output: [
{
ph: "وا",
stem: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: akheestul,
},
],
},
{
input: "خلم",
output: [
{
ph: undefined,
stem: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: akheestul,
},
],
},
{
input: "اخیستم",
output: [
{
ph: undefined,
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["imperfective", "perfective"],
},
verb: akheestul,
},
],
},
{
input: "واخیستم",
output: [
{
ph: "وا",
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: akheestul,
},
],
},
{
input: "واخیستلم",
output: [
{
ph: "وا",
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: akheestul,
},
],
},
{
input: "خیستلم",
output: [
{
ph: undefined,
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: akheestul,
},
],
},
{
input: "الوځې",
output: [
{
ph: undefined,
stem: {
persons: [T.Person.SecondSingMale, T.Person.SecondSingFemale],
aspects: ["imperfective", "perfective"],
},
verb: alwatul,
},
],
},
{
input: "والوځې",
output: [
{
ph: "وا",
stem: {
persons: [T.Person.SecondSingMale, T.Person.SecondSingFemale],
aspects: ["perfective"],
},
verb: alwatul,
},
],
},
{
input: "لوځې",
output: [
{
ph: undefined,
stem: {
persons: [T.Person.SecondSingMale, T.Person.SecondSingFemale],
aspects: ["perfective"],
},
verb: alwatul,
},
],
},
],
},
{
@ -654,16 +804,202 @@ const tests: {
},
],
},
],
},
{
label: "verbs with abrupt 3rd pers sing past endings",
cases: [
{
input: "لاړلم",
output: [
{
ph: "لا",
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: tlul,
},
],
},
{
input: "لاړم",
output: [
{
ph: "لا",
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: tlul,
},
],
},
{
input: "لاړو",
output: [
{
ph: "لا",
root: {
persons: [
T.Person.FirstPlurMale,
T.Person.FirstPlurFemale,
T.Person.ThirdSingMale,
],
aspects: ["perfective"],
},
verb: tlul,
},
],
},
{
input: "لاړه",
output: [
{
ph: "لا",
root: {
persons: [T.Person.ThirdSingFemale, T.Person.ThirdSingMale],
aspects: ["perfective"],
},
verb: tlul,
},
],
},
{
input: "ړلم",
output: [
{
ph: undefined,
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: tlul,
},
{
ph: undefined,
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: wurul,
},
],
},
{
input: "ړم",
output: [
{
ph: undefined,
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: tlul,
},
{
ph: undefined,
root: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: wurul,
},
],
},
{
input: "والووت",
output: [
{
ph: "وا",
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["perfective"],
},
verb: alwatul,
},
],
},
{
input: "والواته",
output: [
{
ph: "وا",
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["perfective"],
},
verb: alwatul,
},
],
},
{
input: "لواته",
output: [
{
ph: undefined,
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["perfective"],
},
verb: alwatul,
},
],
},
{
input: "راشې",
output: [
{
ph: "را",
stem: {
persons: [T.Person.SecondSingMale, T.Person.SecondSingFemale],
aspects: ["perfective"],
},
verb: raatlul,
},
],
},
{
input: "ورشې",
output: [
{
ph: "ور",
stem: {
persons: [T.Person.SecondSingMale, T.Person.SecondSingFemale],
aspects: ["perfective"],
},
verb: wartlul,
},
],
},
{
input: "یوسم",
output: [
{
ph: "یو",
stem: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: wurul,
},
],
},
{
input: "سم",
output: [
{
ph: undefined,
stem: {
persons: [T.Person.FirstSingMale, T.Person.FirstSingFemale],
aspects: ["perfective"],
},
verb: wurul,
},
],
},
// TOOD: would be more robust if it looked for this without excetions // same as واخیست etc
// {
// input: "لاړ",
// output: [
// {
// ph: undefined,
// ph: "لا",
// root: {
// persons: [T.Person.ThirdSingMale],
// aspects: ["perfective"],
@ -674,8 +1010,456 @@ const tests: {
// },
],
},
{
label: "verbs with different 3rd pers sing past endings",
cases: [
{
input: "رسېد",
output: [
{
ph: undefined,
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["imperfective", "perfective"],
},
verb: rasedul,
},
],
},
{
input: "ورسېد",
output: [
{
ph: "و",
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["perfective"],
},
verb: rasedul,
},
],
},
{
input: "کېناسته",
output: [
{
ph: "کې",
root: {
persons: [T.Person.ThirdSingMale, T.Person.ThirdSingFemale],
aspects: ["imperfective", "perfective"],
},
verb: kenaastul,
},
],
},
{
input: "کېناست",
output: [
{
ph: "کې",
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["imperfective", "perfective"],
},
verb: kenaastul,
},
],
},
{
input: "کېناستو",
output: [
{
ph: "کې",
root: {
persons: [
T.Person.ThirdSingMale,
T.Person.FirstPlurMale,
T.Person.FirstPlurFemale,
],
aspects: ["imperfective", "perfective"],
},
verb: kenaastul,
},
],
},
{
input: "ووتلو",
output: [
{
ph: "و",
root: {
persons: [
T.Person.ThirdSingMale,
T.Person.FirstPlurMale,
T.Person.FirstPlurFemale,
],
aspects: ["perfective"],
},
verb: watul,
},
],
},
{
input: "ووتو",
output: [
{
ph: "و",
root: {
persons: [
T.Person.ThirdSingMale,
T.Person.FirstPlurMale,
T.Person.FirstPlurFemale,
],
aspects: ["perfective"],
},
verb: watul,
},
],
},
{
input: "ووته",
output: [
{
ph: "و",
root: {
persons: [T.Person.ThirdSingFemale],
aspects: ["perfective"],
},
verb: watul,
},
],
},
{
input: "واته",
output: [
{
ph: undefined,
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["imperfective", "perfective"],
},
verb: watul,
},
],
},
{
input: "ووت",
output: [
{
ph: undefined,
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["imperfective", "perfective"],
},
verb: watul,
},
],
},
{
input: "وووت",
output: [
{
ph: "و",
root: {
persons: [T.Person.ThirdSingMale],
aspects: ["perfective"],
},
verb: watul,
},
],
},
{
input: "ورسېد",
output: [
{
ph: "و",
root: {
persons: [T.Person.ThirdSingMale],