+
diff --git a/src/lib/phrase-building/compile-vp.ts b/src/lib/phrase-building/compile-vp.ts
index 166e86e..a90e819 100644
--- a/src/lib/phrase-building/compile-vp.ts
+++ b/src/lib/phrase-building/compile-vp.ts
@@ -5,7 +5,8 @@ import {
grammarUnits,
getVerbBlockPosFromPerson,
} from "@lingdocs/pashto-inflector";
-import { hasBaParticle, psRemove } from "@lingdocs/pashto-inflector/dist/lib/p-text-helpers";
+import { hasBaParticle } from "@lingdocs/pashto-inflector/dist/lib/p-text-helpers";
+import { removeBa } from "./vp-tools";
type ListOfEntities = (T.PsString & { isVerbPrefix?: boolean, prefixFollowedByParticle?: boolean })[][];
@@ -134,7 +135,7 @@ function compileVerbWNegative(head: T.PsString | undefined, restRaw: T.PsString[
} {
const hasBa = hasBaParticle(restRaw[0]);
const rest = hasBa
- ? restRaw.map(ps => psRemove(ps, concatPsString(grammarUnits.baParticle, " ")))
+ ? restRaw.map(removeBa)
: restRaw;
if (!negative) {
return {
diff --git a/src/lib/phrase-building/render-vp.ts b/src/lib/phrase-building/render-vp.ts
index 05ac690..4c8b73a 100644
--- a/src/lib/phrase-building/render-vp.ts
+++ b/src/lib/phrase-building/render-vp.ts
@@ -15,10 +15,12 @@ import {
getLong,
} from "../text-tools";
import {
- getPersonFromNP,
+ getPersonFromNP, removeBa,
} from "./vp-tools";
import { isPattern4Entry } from "../type-predicates";
+// TODO: ISSUE GETTING SPLIT HEAD NOT MATCHING WITH FUTURE VERBS
+
export function renderVP(VP: VPSelection): VPRendered {
// Sentence Rules Logic
const isPast = isPastTense(VP.verb.tense);
@@ -249,8 +251,9 @@ function removeHead(head: T.PsString, rest: T.SingleOrLengthOpts
):
} : {},
}
}
- return rest.map((ps) => {
- const pMatches = removeAccents(ps.p.slice(0, head.p.length)) === removeAccents(head.p);
+ return rest.map((psRaw) => {
+ const ps = removeBa(psRaw);
+ const pMatches = removeAccents(ps.p.slice(0, head.p.length)) === head.p
const fMatches = removeAccents(ps.f.slice(0, head.f.length)) === removeAccents(head.f);
if (!(pMatches && fMatches)) {
throw new Error(`split head does not match - ${JSON.stringify(ps)} ${JSON.stringify(head)}`);
diff --git a/src/lib/phrase-building/vp-tools.ts b/src/lib/phrase-building/vp-tools.ts
index 05b4eb8..a9e6cd1 100644
--- a/src/lib/phrase-building/vp-tools.ts
+++ b/src/lib/phrase-building/vp-tools.ts
@@ -1,6 +1,9 @@
import {
Types as T,
+ concatPsString,
+ grammarUnits,
} from "@lingdocs/pashto-inflector";
+import { psRemove } from "@lingdocs/pashto-inflector/dist/lib/p-text-helpers";
export function getPersonFromNP(np: NPSelection): T.Person;
export function getPersonFromNP(np: NPSelection | ObjectNP): T.Person | undefined;
@@ -18,4 +21,8 @@ export function getPersonFromNP(np: NPSelection | ObjectNP): T.Person | undefine
return np.number === "plural"
? (np.gender === "masc" ? T.Person.ThirdPlurMale : T.Person.ThirdPlurFemale)
: (np.gender === "masc" ? T.Person.ThirdSingMale : T.Person.ThirdSingFemale);
+}
+
+export function removeBa(ps: T.PsString): T.PsString {
+ return psRemove(ps, concatPsString(grammarUnits.baParticle, " "));
}
\ No newline at end of file