fix accent issue

This commit is contained in:
lingdocs 2021-09-22 13:21:59 -04:00
parent da12c7f62b
commit 5cae22bde7
3 changed files with 26 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "1.0.6", "version": "1.0.7",
"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",

View File

@ -202,6 +202,24 @@ const adjectives: Array<{
}, },
}, },
}, },
// without accents
{
in: {"ts":1527812796,"i":8574,"p":"ښه","f":"xu","g":"xu","e":"good","c":"adj."},
out: {
inflections: {
masc: [
[{ p: "ښه", f: "xu" }],
[{ p: "ښه", f: "xu" }],
[{ p: "ښو", f: "xo" }],
],
fem: [
[{ p: "ښه", f: "xa" }],
[{ p: "ښې", f: "xe" }],
[{ p: "ښو", f: "xo" }],
],
},
},
},
// adjective non-inflecting // adjective non-inflecting
{ {
in: { in: {

View File

@ -203,18 +203,19 @@ export function inflectRegularYeyUnisex(p: string, f: string): T.UnisexInflectio
export function inflectRegularShwaEndingUnisex(pr: string, fr: string): T.UnisexInflections { export function inflectRegularShwaEndingUnisex(pr: string, fr: string): T.UnisexInflections {
const { p, f } = removeAccents(makePsString(pr, fr)); const { p, f } = removeAccents(makePsString(pr, fr));
const accented = fr.slice(-1) === "ú";
const baseP = p.slice(0, -1); const baseP = p.slice(0, -1);
const baseF = f.slice(0, -1); const baseF = f.slice(0, -1);
return { return {
masc: [ masc: [
[{p: `${baseP}ه`, f: `${baseF}ú`}], [{p: `${baseP}ه`, f: `${baseF}${accented ? "ú" : "u"}`}],
[{p: `${baseP}ه`, f: `${baseF}ú`}], [{p: `${baseP}ه`, f: `${baseF}${accented ? "ú" : "u"}`}],
[{p: `${baseP}و`, f: `${baseF}ó`}], [{p: `${baseP}و`, f: `${baseF}${accented ? "ó" : "o"}`}],
], ],
fem: [ fem: [
[{p: `${baseP}ه`, f: `${baseF}á`}], [{p: `${baseP}ه`, f: `${baseF}${accented ? "á" : "a"}`}],
[{p: `${baseP}ې`, f: `${baseF}é`}], [{p: `${baseP}ې`, f: `${baseF}${accented ? "é" : "e"}`}],
[{p: `${baseP}و`, f: `${baseF}ó`}], [{p: `${baseP}و`, f: `${baseF}${accented ? "ó" : "o"}`}],
], ],
}; };
} }