more
This commit is contained in:
parent
623db598bb
commit
878b39b654
File diff suppressed because it is too large
Load Diff
|
@ -630,6 +630,152 @@ test("special endings", () => {
|
|||
});
|
||||
});
|
||||
|
||||
test("imperative tenses", () => {
|
||||
expect(renderVerb({
|
||||
verb: wahul,
|
||||
tense: "imperfectiveImperative",
|
||||
person: T.Person.SecondSingMale,
|
||||
voice: "active",
|
||||
})).toEqual({
|
||||
hasBa: false,
|
||||
vbs: [
|
||||
[],
|
||||
[
|
||||
{ type: "VB", ps: [{ p: "وهه", f: "wahá" } ], person: 2},
|
||||
],
|
||||
],
|
||||
});
|
||||
expect(renderVerb({
|
||||
verb: wahul,
|
||||
tense: "perfectiveImperative",
|
||||
person: T.Person.SecondSingFemale,
|
||||
voice: "active",
|
||||
})).toEqual({
|
||||
hasBa: false,
|
||||
vbs: [
|
||||
[ooPh],
|
||||
[
|
||||
{ type: "VB", ps: [{ p: "وهه", f: "waha" }], person: 3 },
|
||||
],
|
||||
],
|
||||
});
|
||||
expect(renderVerb({
|
||||
verb: wahul,
|
||||
tense: "imperfectiveImperative",
|
||||
person: T.Person.SecondPlurMale,
|
||||
voice: "active",
|
||||
})).toEqual({
|
||||
hasBa: false,
|
||||
vbs: [
|
||||
[],
|
||||
[
|
||||
{ type: "VB", ps: [{ p: "وهئ", f: "wahéyy" } ], person: 8 },
|
||||
],
|
||||
],
|
||||
});
|
||||
expect(renderVerb({
|
||||
verb: wahul,
|
||||
tense: "perfectiveImperative",
|
||||
person: T.Person.SecondPlurFemale,
|
||||
voice: "active",
|
||||
})).toEqual({
|
||||
hasBa: false,
|
||||
vbs: [
|
||||
[ooPh],
|
||||
[
|
||||
{ type: "VB", ps: [{ p: "وهئ", f: "waheyy" }], person: 9 },
|
||||
],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
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,
|
||||
},
|
||||
],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
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,
|
||||
|
@ -790,40 +936,6 @@ test("perfect tenses", () => {
|
|||
});
|
||||
});
|
||||
|
||||
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,
|
||||
},
|
||||
],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
test("ending on complex verbs", () => {
|
||||
expect(renderVerb({
|
||||
verb: stureyKawul,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import * as T from "../../../types";
|
||||
import {
|
||||
getVerbBlockPosFromPerson,
|
||||
isSecondPerson,
|
||||
personGender,
|
||||
personNumber,
|
||||
} from "../misc-helpers";
|
||||
|
@ -12,21 +13,20 @@ import {
|
|||
presentEndings,
|
||||
pastEndings,
|
||||
equativeEndings,
|
||||
imperativeEndings,
|
||||
} from "../grammar-units";
|
||||
import { isKawulVerb, isAbilityTense, isPerfectTense, isTlulVerb } from "../type-predicates";
|
||||
import { isKawulVerb, isAbilityTense, isPerfectTense, isTlulVerb, isImperativeTense } from "../type-predicates";
|
||||
import { tenseHasBa } from "../phrase-building/vp-tools";
|
||||
import { isPastTense } from "../phrase-building/vp-tools";
|
||||
import { makePsString, removeFVarients } from "../accent-and-ps-utils";
|
||||
import { getPastParticiple, getRootStem } from "./roots-and-stems";
|
||||
import { getAspect, isKedul, perfectTenseToEquative, verbEndingConcat } from "./rs-helpers";
|
||||
import { accentOnNFromEnd, removeAccents } from "../accent-helpers";
|
||||
// TODO: problem with laaR - no perfective split
|
||||
// TODO: non past compounds with different object
|
||||
// TODO: coverage of rs-helpers
|
||||
import { accentOnNFromEnd, accentPsSyllable, removeAccents } from "../accent-helpers";
|
||||
|
||||
// TODO: problem with laaR - no perfective split
|
||||
export function renderVerb({ verb, tense, person, voice, presObj }: {
|
||||
verb: T.VerbEntry,
|
||||
tense: T.VerbTense | T.PerfectTense | T.AbilityTense, // TODO: make T.Tense
|
||||
tense: T.VerbTense | T.PerfectTense | T.AbilityTense | T.ImperativeTense, // TODO: make T.Tense
|
||||
person: T.Person,
|
||||
voice: T.Voice,
|
||||
presObj?: T.Person,
|
||||
|
@ -46,6 +46,7 @@ export function renderVerb({ verb, tense, person, voice, presObj }: {
|
|||
number: personNumber(rootPerson),
|
||||
};
|
||||
const aspect = getAspect(tense);
|
||||
const isImperative = isImperativeTense(tense);
|
||||
const type = isAbilityTense(tense) ? "ability" : "basic";
|
||||
|
||||
// #1 get the appropriate root / stem
|
||||
|
@ -58,7 +59,7 @@ export function renderVerb({ verb, tense, person, voice, presObj }: {
|
|||
genderNumber,
|
||||
});
|
||||
// #2 add the verb ending to it
|
||||
const ending = getEnding(person, isPast);
|
||||
const ending = getEnding(person, isPast, isImperative, aspect);
|
||||
return {
|
||||
hasBa,
|
||||
vbs: [
|
||||
|
@ -167,7 +168,17 @@ function addEnding({ verb, rs, ending, person, pastThird, aspect, basicForm }: {
|
|||
}
|
||||
}
|
||||
|
||||
function getEnding(person: T.Person, isPast: boolean) {
|
||||
function getEnding(person: T.Person, isPast: boolean, isImperative: boolean, aspect: T.Aspect) {
|
||||
if (isImperative) {
|
||||
if (!isSecondPerson(person)) {
|
||||
throw new Error("imperative forms must be second person");
|
||||
}
|
||||
const number = personNumber(person);
|
||||
const ends = imperativeEndings[0][number === "singular" ? 0 : 1];
|
||||
return aspect === "imperfective"
|
||||
? ends.map(e => accentPsSyllable(e))
|
||||
: ends;
|
||||
}
|
||||
const [row, col] = getVerbBlockPosFromPerson(person);
|
||||
return isPast ? {
|
||||
long: pastEndings.long[row][col],
|
||||
|
|
|
@ -273,9 +273,10 @@ export function getLongVB(vb: T.VBA): T.VBNoLenghts<T.VBA> {
|
|||
};
|
||||
}
|
||||
|
||||
export function getAspect(tense: T.VerbTense | T.AbilityTense): T.Aspect {
|
||||
export function getAspect(tense: T.VerbTense | T.AbilityTense | T.ImperativeTense): T.Aspect {
|
||||
const t = tense.replace("Modal", "");
|
||||
if (["presentVerb", "imperfectiveFuture", "imperfectivePast", "habitualImperfectivePast"].includes(t)) {
|
||||
const imperfectives: Parameters<typeof getAspect>[0][] = ["presentVerb", "imperfectiveFuture", "imperfectivePast", "habitualImperfectivePast", "imperfectiveImperative"];
|
||||
if (imperfectives.includes(t as Parameters<typeof getAspect>[0])) {
|
||||
return "imperfective";
|
||||
} else {
|
||||
return "perfective";
|
||||
|
|
Loading…
Reference in New Issue