This commit is contained in:
lingdocs 2021-07-07 15:37:42 +03:00
parent ee109b2669
commit ed2d01d547
2 changed files with 22 additions and 0 deletions

View File

@ -15,7 +15,14 @@ test("parseEc should work", () => {
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("cry")).toEqual(["cry", "cries", "crying", "cried", "cried"]);
expect(parseEc("marry")).toEqual(["marry","marries","marrying","married","married"]);
expect(parseEc("get")).toEqual(["get","gets","getting","got","gotten"]);
expect(parseEc("become")).toEqual(["become","becomes","becoming","became","become"]);
expect(parseEc("make")).toEqual(["make","makes","making","made","made"]);
expect(parseEc("have")).toEqual(["have","has","having","had","had"]);
expect(parseEc("die")).toEqual(["die", "dies", "dying", "died", "died"]); expect(parseEc("die")).toEqual(["die", "dies", "dying", "died", "died"]);
expect(parseEc("stray")).toEqual(["stray","strays","straying","strayed","strayed"]);
expect(parseEc("cross")).toEqual(["cross","crosses","crossing","crossed","crossed"]);
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 // 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("think,thinks,thinking,thought")).toEqual(["think","thinks","thinking","thought","thought"]);

View File

@ -219,10 +219,25 @@ export function parseEc(ec: string): T.EnglishVerbConjugationEc {
return ["a", "e", "i", "o", "u"].includes(s); return ["a", "e", "i", "o", "u"].includes(s);
} }
function makeRegularConjugations(s: string): T.EnglishVerbConjugationEc { function makeRegularConjugations(s: string): T.EnglishVerbConjugationEc {
if (s === "get") {
return ["get","gets","getting","got","gotten"];
}
if (s === "become") {
return ["become","becomes","becoming","became","become"];
}
if (s === "make") {
return ["make","makes","making","made","made"];
}
if (s === "have") {
return ["have","has","having","had","had"];
}
if ((s.slice(-1) === "y") && !isVowel(s.slice(-2)[0])) { if ((s.slice(-1) === "y") && !isVowel(s.slice(-2)[0])) {
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) === "ss") {
return [`${s}`, `${s}es`, `${s}ing`, `${s}ed`, `${s}ed`];
}
if (s.slice(-2) === "ie" && !isVowel(s.slice(-3)[0])) { if (s.slice(-2) === "ie" && !isVowel(s.slice(-3)[0])) {
const b = s.slice(0, -2); const b = s.slice(0, -2);
return [`${s}`, `${s}s`, `${b}ying`, `${s}d`, `${s}d`]; return [`${s}`, `${s}s`, `${b}ying`, `${s}d`, `${s}d`];