handle sandwiches in word split
This commit is contained in:
parent
752482b00a
commit
488966e0fd
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.7.1",
|
||||
"version": "5.7.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.7.1",
|
||||
"version": "5.7.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.7.1",
|
||||
"version": "5.7.2",
|
||||
"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",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/ps-react",
|
||||
"version": "5.7.1",
|
||||
"version": "5.7.2",
|
||||
"description": "Pashto inflector library module with React components",
|
||||
"main": "dist/components/library.js",
|
||||
"module": "dist/components/library.js",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/inflect",
|
||||
"version": "5.7.1",
|
||||
"version": "5.7.2",
|
||||
"description": "Pashto inflector library",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/lib/library.d.ts",
|
||||
|
|
|
@ -86,6 +86,10 @@ const toTest: {
|
|||
f: "kawul",
|
||||
}],
|
||||
},
|
||||
{
|
||||
input: { p: "د ... په شان", f: "du ... pu shaan" },
|
||||
result: [{ p: "د", f: "du" }, { p: "په", f: "pu" }, { p: "شان", f: "shaan" }],
|
||||
},
|
||||
];
|
||||
|
||||
test("splitPsString should work", () => {
|
||||
|
|
|
@ -34,9 +34,15 @@ export function splitPsString(ps: T.PsStringNoFVars): T.PsWord[] {
|
|||
fIndex++;
|
||||
}
|
||||
while (pIndex < pWords.length && fIndex < fWords.length) {
|
||||
if (fWords[fIndex] === "..." && pWords[pIndex] === "...") {
|
||||
pIndex++;
|
||||
fIndex++;
|
||||
continue;
|
||||
}
|
||||
if (fWords[fIndex].includes("-")) {
|
||||
processHyphen();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
psWords.push({
|
||||
p: pWords[pIndex],
|
||||
f: fWords[fIndex],
|
||||
|
@ -44,7 +50,6 @@ export function splitPsString(ps: T.PsStringNoFVars): T.PsWord[] {
|
|||
pIndex++;
|
||||
fIndex++;
|
||||
}
|
||||
}
|
||||
// should have processed all the p an f words
|
||||
if (pIndex !== pWords.length || fIndex !== fWords.length) {
|
||||
throw new Error("spacing discrepency");
|
||||
|
|
Loading…
Reference in New Issue