issue splitting psWords like óo`arzee

This commit is contained in:
adueck 2023-01-26 17:39:33 +05:00
parent f25ebaaf62
commit 2cd82bfde4
6 changed files with 25 additions and 5 deletions

4
package-lock.json generated
View File

@ -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": {

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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", () => {

View File

@ -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++;