From 2cd82bfde48de461774e8da9dcbd816d881e1815 Mon Sep 17 00:00:00 2001 From: adueck Date: Thu, 26 Jan 2023 17:39:33 +0500 Subject: [PATCH] =?UTF-8?q?issue=20splitting=20psWords=20like=20=C3=B3o`ar?= =?UTF-8?q?zee?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- package.json | 2 +- src/components/package.json | 2 +- src/lib/package.json | 2 +- src/lib/src/splitPsString.test.ts | 11 +++++++++++ src/lib/src/splitPsString.ts | 9 +++++++++ 6 files changed, 25 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7f30b89..d332cd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pashto-inflector", - "version": "5.7.5", + "version": "5.7.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pashto-inflector", - "version": "5.7.5", + "version": "5.7.6", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index aa7b15b..095e612 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pashto-inflector", - "version": "5.7.5", + "version": "5.7.6", "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/package.json b/src/components/package.json index 19b5760..8148f0c 100644 --- a/src/components/package.json +++ b/src/components/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/ps-react", - "version": "5.7.5", + "version": "5.7.6", "description": "Pashto inflector library module with React components", "main": "dist/components/library.js", "module": "dist/components/library.js", diff --git a/src/lib/package.json b/src/lib/package.json index 6fe6749..b7fd387 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/inflect", - "version": "5.7.5", + "version": "5.7.6", "description": "Pashto inflector library", "main": "dist/index.js", "types": "dist/lib/library.d.ts", diff --git a/src/lib/src/splitPsString.test.ts b/src/lib/src/splitPsString.test.ts index 230d313..dc55d10 100644 --- a/src/lib/src/splitPsString.test.ts +++ b/src/lib/src/splitPsString.test.ts @@ -90,6 +90,17 @@ const toTest: { input: { p: "د ... په شان", f: "du ... pu shaan" }, result: [{ p: "د", f: "du" }, { p: "په", f: "pu" }, { p: "شان", f: "shaan" }], }, + { + input: { p: "و ارزي", f: "óo`arzee" }, + result: [{ p: "و ارزي", f: "óo`arzee" }], + }, + { + input: { p: "هغه و ارزي", f: "hagha óo`arzee" }, + result: [ + { p: "هغه", f: "hagha" }, + { p: "و ارزي", f: "óo`arzee" }, + ], + }, ]; test("splitPsString should work", () => { diff --git a/src/lib/src/splitPsString.ts b/src/lib/src/splitPsString.ts index 834be0d..905e9f5 100644 --- a/src/lib/src/splitPsString.ts +++ b/src/lib/src/splitPsString.ts @@ -34,6 +34,15 @@ export function splitPsString(ps: T.PsStringNoFVars): T.PsWord[] { fIndex++; } while (pIndex < pWords.length && fIndex < fWords.length) { + if (pWords[pIndex] === "و" && pWords[pIndex+1] && fWords[fIndex].startsWith("óo`")) { + psWords.push({ + p: `${pWords[pIndex]} ${pWords[pIndex+1]}`, + f: fWords[fIndex], + }); + pIndex += 2; + fIndex++; + continue; + } if (fWords[fIndex] === "..." && pWords[pIndex] === "...") { pIndex++; fIndex++;