From adc375f2ce8864e31596d1dc51a7fedbfc1d0e8d Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Mon, 2 May 2022 15:53:37 -0500 Subject: [PATCH] up --- src/lib/compliment-tools.ts | 43 ------------------------------------- src/types/gramm-types.d.ts | 5 +++++ yarn.lock | 8 +++---- 3 files changed, 9 insertions(+), 47 deletions(-) delete mode 100644 src/lib/compliment-tools.ts create mode 100644 src/types/gramm-types.d.ts diff --git a/src/lib/compliment-tools.ts b/src/lib/compliment-tools.ts deleted file mode 100644 index 3f72504..0000000 --- a/src/lib/compliment-tools.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { - Types as T, - getEnglishWord, - inflectWord, - isUnisexSet, - personGender, - personIsPlural, - typePredicates as tp, - psStringFromEntry, -} from "@lingdocs/pashto-inflector"; - -export function evaluateCompliment(c: Compliment, person: T.Person): { ps: T.PsString[], e: string } { - const e = getEnglishWord(c.entry); - if (!e || typeof e !== "string") { - console.log(e); - throw new Error("error getting english for compliment"); - } - if (tp.isLocativeAdverbEntry(c.entry)) { - return { - ps: [psStringFromEntry(c.entry)], - e, - }; - } - if (tp.isAdjectiveEntry(c.entry)) { - const infs = inflectWord(c.entry); - if (!infs) return { - ps: [psStringFromEntry(c.entry)], - e, - } - if (!infs.inflections || !isUnisexSet(infs.inflections)) { - throw new Error("error getting inflections for adjective, looks like a noun's inflections"); - } - return { - ps: chooseInflection(infs.inflections, person), - e, - }; - } - throw new Error("noun complements not yet implemented"); -} - -function chooseInflection(inflections: T.UnisexSet, pers: T.Person): T.ArrayOneOrMore { - return inflections[personGender(pers)][personIsPlural(pers) ? 1 : 0]; -} \ No newline at end of file diff --git a/src/types/gramm-types.d.ts b/src/types/gramm-types.d.ts new file mode 100644 index 0000000..46b657e --- /dev/null +++ b/src/types/gramm-types.d.ts @@ -0,0 +1,5 @@ +type Pronoun = { + type: "pronoun", + pronounType: "near" | "far", + person: import("@lingdocs/pashto-inflector").Types.Person, +}; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index a1c2b80..79f9123 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1684,10 +1684,10 @@ pbf "^3.2.1" rambda "^6.7.0" -"@lingdocs/pashto-inflector@^2.3.4": - version "2.3.4" - resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-2.3.4.tgz#041c829a3a23c4ce5cadb4dfac0d50da6b583bc6" - integrity sha512-QaXKkzlucTd7PxiHr/MS9pl9wX6Zf+1doxD2k5vnER/FHgZWkKilr/4bIqQTTKW0zcxGupqd4ejyN6ynAZcsjQ== +"@lingdocs/pashto-inflector@^2.3.5": + version "2.3.5" + resolved "https://npm.lingdocs.com/@lingdocs%2fpashto-inflector/-/pashto-inflector-2.3.5.tgz#2fc387f470f403eb12a82848b4d380c66aa4677c" + integrity sha512-e8JB4WRBGoI0qvrd2wfdhDusk0fFNUyfkl05WoRSZp7JCijvouFbutev3SNP8guQFx3KmvrLdDUx7xhnQfYvng== dependencies: classnames "^2.2.6" pbf "^3.2.1"