more on english verb conjugation
This commit is contained in:
parent
608253556d
commit
ee109b2669
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/pashto-inflector",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "0.6.2",
|
"version": "0.6.3",
|
||||||
"author": "lingdocs.com",
|
"author": "lingdocs.com",
|
||||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||||
"homepage": "https://verbs.lingdocs.com",
|
"homepage": "https://verbs.lingdocs.com",
|
||||||
|
|
|
@ -14,7 +14,11 @@ test("parseEc should work", () => {
|
||||||
expect(parseEc("walk")).toEqual(["walk", "walks", "walking", "walked", "walked"]);
|
expect(parseEc("walk")).toEqual(["walk", "walks", "walking", "walked", "walked"]);
|
||||||
expect(parseEc("scare")).toEqual(["scare", "scares", "scaring", "scared", "scared"]);
|
expect(parseEc("scare")).toEqual(["scare", "scares", "scaring", "scared", "scared"]);
|
||||||
expect(parseEc("study")).toEqual(["study","studies","studying","studied","studied"]);
|
expect(parseEc("study")).toEqual(["study","studies","studying","studied","studied"]);
|
||||||
|
expect(parseEc("cry")).toEqual(["cry", "cries", "crying", "cried", "cried"]);
|
||||||
|
expect(parseEc("die")).toEqual(["die", "dies", "dying", "died", "died"]);
|
||||||
expect(parseEc("play")).toEqual(["play","plays","playing","played","played"]);
|
expect(parseEc("play")).toEqual(["play","plays","playing","played","played"]);
|
||||||
|
// if there are only four items the perfect will be the same as the simple past
|
||||||
|
expect(parseEc("think,thinks,thinking,thought")).toEqual(["think","thinks","thinking","thought","thought"]);
|
||||||
expect(parseEc("sew,sews,sewing,sewed,sown")).toEqual(["sew", "sews", "sewing", "sewed", "sown"]);
|
expect(parseEc("sew,sews,sewing,sewed,sown")).toEqual(["sew", "sews", "sewing", "sewed", "sown"]);
|
||||||
expect(parseEc(" sew, sews,sewing ,sewed, sown")).toEqual(["sew", "sews", "sewing", "sewed", "sown"]);
|
expect(parseEc(" sew, sews,sewing ,sewed, sown")).toEqual(["sew", "sews", "sewing", "sewed", "sown"]);
|
||||||
});
|
});
|
|
@ -223,15 +223,21 @@ export function parseEc(ec: string): T.EnglishVerbConjugationEc {
|
||||||
const b = s.slice(0, -1);
|
const b = s.slice(0, -1);
|
||||||
return [`${s}`, `${b}ies`, `${s}ing`, `${b}ied`, `${b}ied`];
|
return [`${s}`, `${b}ies`, `${s}ing`, `${b}ied`, `${b}ied`];
|
||||||
}
|
}
|
||||||
|
if (s.slice(-2) === "ie" && !isVowel(s.slice(-3)[0])) {
|
||||||
|
const b = s.slice(0, -2);
|
||||||
|
return [`${s}`, `${s}s`, `${b}ying`, `${s}d`, `${s}d`];
|
||||||
|
}
|
||||||
const b = (s.slice(-1) === "e")
|
const b = (s.slice(-1) === "e")
|
||||||
? s.slice(0, -1)
|
? s.slice(0, -1)
|
||||||
: s;
|
: s;
|
||||||
return [`${s}`, `${s}s`, `${b}ing`, `${b}ed`, `${b}ed`];
|
return [`${s}`, `${s}s`, `${b}ing`, `${b}ed`, `${b}ed`];
|
||||||
}
|
}
|
||||||
const items = ec.split(",").map(x => x.trim());
|
const items = ec.split(",").map(x => x.trim());
|
||||||
return (items.length !== 5)
|
return (items.length === 4)
|
||||||
? makeRegularConjugations(items[0])
|
? [items[0], items[1], items[2], items[3], items[3]]
|
||||||
: [items[0], items[1], items[2], items[3], items[4]];
|
: (items.length === 5)
|
||||||
|
? [items[0], items[1], items[2], items[3], items[4]]
|
||||||
|
: makeRegularConjugations(items[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// not being used
|
// not being used
|
||||||
|
|
|
@ -54,6 +54,9 @@ const getAayTail = (type: T.AayTail): T.PsString => (
|
||||||
);
|
);
|
||||||
|
|
||||||
export function conjugateVerb(entry: T.DictionaryEntry, aayTailType: T.AayTail, complement?: T.DictionaryEntry, verbInfo?: T.NonComboVerbInfo): T.VerbOutput {
|
export function conjugateVerb(entry: T.DictionaryEntry, aayTailType: T.AayTail, complement?: T.DictionaryEntry, verbInfo?: T.NonComboVerbInfo): T.VerbOutput {
|
||||||
|
if (!(entry.c && entry.c.slice(0, 2) === "v.")) {
|
||||||
|
throw new Error("not a verb");
|
||||||
|
};
|
||||||
const irregularConj = checkForIrregularConjugation(entry);
|
const irregularConj = checkForIrregularConjugation(entry);
|
||||||
if (irregularConj) {
|
if (irregularConj) {
|
||||||
return irregularConj;
|
return irregularConj;
|
||||||
|
|
Loading…
Reference in New Issue