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