diff --git a/package.json b/package.json
index a373fb5..3b894d2 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
- "version": "2.5.4",
+ "version": "2.5.5",
"author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com",
diff --git a/src/components/np-picker/NPPicker.tsx b/src/components/np-picker/NPPicker.tsx
index f5c3dea..fa00e1c 100644
--- a/src/components/np-picker/NPPicker.tsx
+++ b/src/components/np-picker/NPPicker.tsx
@@ -90,6 +90,7 @@ function NPPicker(props: {
const clearButton = (!props.cantClear && !props.is2ndPersonPicker && !isDynamicComplement)
?
:
;
+ const possesiveLabel = props.np?.type === "participle" ? "Subj/Obj" : "Possesor";
return <>
@@ -124,7 +125,7 @@ function NPPicker(props: {
background: (props.np.possesor?.shrunken && !props.isShrunk) ? shrunkenBackground : "inherit",
}}>
-
Possesive:
+
{possesiveLabel}:
{(props.np.possesor && !props.isShrunk) &&
{!props.np.possesor.shrunken ? "🪄" : "👶"}
}
@@ -147,7 +148,7 @@ function NPPicker(props: {
/>
}
{(npType === "noun" || npType === "participle") && props.np && !addingPoss &&
- setAddingPoss(true)}>+ Possesive
+ setAddingPoss(true)}>+ {possesiveLabel}
}
{(npType === "pronoun" && props.np?.type === "pronoun")
?
): string | undefined
}
}
-function addPossesors(possesor: T.Rendered | undefined, base: string | undefined): string | undefined {
+function addPossesors(possesor: T.Rendered | undefined, base: string | undefined, type: "noun" | "participle"): string | undefined {
function removeArticles(s: string): string {
return s.replace("(the) ", "").replace("(a/the) ", "");
}
if (!base) return undefined;
if (!possesor) return base;
if (possesor.type === "pronoun") {
- return `${pronounPossEng(possesor.person)} ${removeArticles(base)}`;
+ return type === "noun"
+ ? `${pronounPossEng(possesor.person)} ${removeArticles(base)}`
+ : `(${pronounPossEng(possesor.person)}) ${removeArticles(base)} (${possesor.e})`
}
const possesorE = getEnglishFromRendered(possesor);
if (!possesorE) return undefined;
- return `${possesorE}'s ${removeArticles(base)}`;
+ return type === "noun"
+ ? `${possesorE}'s ${removeArticles(base)}`
+ : `(${possesorE}'s) ${removeArticles(base)} (${possesorE})`;
}
function pronounPossEng(p: T.Person): string {
@@ -143,10 +147,10 @@ export function getEnglishFromRendered(r: T.Rendered;
- return addPossesors(np.possesor?.np, addArticlesAndAdjs(np));
+ return addPossesors(np.possesor?.np, addArticlesAndAdjs(np), r.type);
}
// TODO: possesives in English for participles and pronouns too!
return r.e;
diff --git a/src/lib/phrase-building/render-ep.ts b/src/lib/phrase-building/render-ep.ts
index b36ca15..87d7e27 100644
--- a/src/lib/phrase-building/render-ep.ts
+++ b/src/lib/phrase-building/render-ep.ts
@@ -23,6 +23,7 @@ export function renderEP(EP: T.EPSelectionComplete): T.EPRendered {
: EP.predicate.type === "NP"
? getPersonFromNP(EP.predicate.selection)
: getPersonFromNP(EP.subject);
+ const kingIsParticiple = EP[king].type === "participle";
return {
type: "EPRendered",
king: EP.predicate.type === "Complement" ? "subject" : "predicate",
@@ -31,7 +32,10 @@ export function renderEP(EP: T.EPSelectionComplete): T.EPRendered {
? renderNPSelection(EP.predicate.selection, false, true, "subject", "king")
: renderEqCompSelection(EP.predicate.selection, kingPerson),
equative: renderEquative(EP.equative, kingPerson),
- englishBase: equativeBuilders[EP.equative.tense](kingPerson, EP.equative.negative),
+ englishBase: equativeBuilders[EP.equative.tense](
+ kingIsParticiple ? T.Person.ThirdSingMale : kingPerson,
+ EP.equative.negative,
+ ),
omitSubject: EP.omitSubject,
};
}
@@ -133,7 +137,7 @@ function isThirdPersonSing(p: T.Person): boolean {
return p === T.Person.ThirdSingMale || p === T.Person.ThirdPlurFemale;
}
function not(n: boolean): string {
- return n ? "not " : "";
+ return n ? " not " : "";
}
function getEnglishConj(p: T.Person, e: string | T.EnglishBlock): string {
diff --git a/src/lib/phrase-building/render-np.ts b/src/lib/phrase-building/render-np.ts
index 81e54cf..00a8c6a 100644
--- a/src/lib/phrase-building/render-np.ts
+++ b/src/lib/phrase-building/render-np.ts
@@ -9,7 +9,9 @@ import {
concatPsString,
psStringFromEntry,
} from "../p-text-helpers";
-import { parseEc } from "../misc-helpers";
+import {
+ getEnglishParticiple,
+} from "../../lib/np-tools";
import { getEnglishWord } from "../get-english-word";
import { renderAdjectiveSelection } from "./render-adj";
import { isPattern5Entry, isUnisexAnimNounEntry } from "../type-predicates";
@@ -83,11 +85,11 @@ function renderParticipleSelection(p: T.ParticipleSelection, inflected: boolean,
// TODO: More robust inflection of inflecting pariticiples - get from the conjugation engine
ps: [psStringFromEntry(p.verb.entry)].map(ps => inflected ? concatPsString(ps, { p: "Ùˆ", f: "o" }) : ps),
e: getEnglishParticiple(p.verb.entry),
- possesor: renderPossesor(p.possesor, role),
+ possesor: renderPossesor(p.possesor, "subj/obj"),
};
}
-function renderPossesor(possesor: T.PossesorSelection | undefined, possesorRole: "servant" | "king" | "none"): T.RenderedPossesorSelection | undefined {
+function renderPossesor(possesor: T.PossesorSelection | undefined, possesorRole: "servant" | "king" | "none" | "subj/obj"): T.RenderedPossesorSelection | undefined {
if (!possesor) return undefined;
const isSingUnisexAnim5PatternNoun = (possesor.np.type === "noun"
&& possesor.np.number === "singular"
@@ -99,9 +101,9 @@ function renderPossesor(possesor: T.PossesorSelection | undefined, possesorRole:
np: renderNPSelection(
possesor.np,
!isSingUnisexAnim5PatternNoun,
- false,
+ possesorRole === "subj/obj" ? true : false,
"subject",
- possesorRole,
+ possesorRole === "subj/obj" ? "none" : possesorRole,
),
};
}
@@ -118,20 +120,6 @@ function getInf(infs: T.InflectorOutput, t: "plural" | "arabicPlural" | "inflect
return [];
}
-
-function getEnglishParticiple(entry: T.DictionaryEntry): string {
- if (!entry.ec) {
- console.log("errored participle");
- console.log(entry);
- throw new Error("no english information for participle");
- }
- const ec = parseEc(entry.ec);
- const participle = ec[2];
- return (entry.ep)
- ? `${participle} ${entry.ep}`
- : participle;
-}
-
function getEnglishFromNoun(entry: T.DictionaryEntry, number: T.NounNumber): string {
const articles = {
singular: "(a/the)",