better inflection on irregulars
This commit is contained in:
parent
803ad8c78e
commit
f25ebaaf62
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.7.4",
|
||||
"version": "5.7.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.7.4",
|
||||
"version": "5.7.5",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.7.4",
|
||||
"version": "5.7.5",
|
||||
"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.4",
|
||||
"version": "5.7.5",
|
||||
"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.4",
|
||||
"version": "5.7.5",
|
||||
"description": "Pashto inflector library",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/lib/library.d.ts",
|
||||
|
|
|
@ -600,7 +600,7 @@ const nouns: {
|
|||
masc: [
|
||||
[{ p: "غر", f: "ghar" }],
|
||||
[{ p: "غره", f: "ghru" }],
|
||||
[{ p: "غرو", f: "ghró" }],
|
||||
[{ p: "غرو", f: "ghro" }],
|
||||
],
|
||||
},
|
||||
plural: {
|
||||
|
@ -625,13 +625,13 @@ const nouns: {
|
|||
// TODO: use smarter system using new isType5Entry predicates, to allow for not using the redundant one syllable accents with these
|
||||
masc: [
|
||||
[{ p: "خر", f: "khur" }],
|
||||
[{ p: "خره", f: "khrú" }],
|
||||
[{ p: "خرو", f: "khró" }],
|
||||
[{ p: "خره", f: "khru" }],
|
||||
[{ p: "خرو", f: "khro" }],
|
||||
],
|
||||
fem: [
|
||||
[{ p: "خره", f: "khrá" }],
|
||||
[{ p: "خرې", f: "khré" }],
|
||||
[{ p: "خرو", f: "khró" }],
|
||||
[{ p: "خره", f: "khra" }],
|
||||
[{ p: "خرې", f: "khre" }],
|
||||
[{ p: "خرو", f: "khro" }],
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -1232,6 +1232,23 @@ const nouns: {
|
|||
},
|
||||
out: false,
|
||||
},
|
||||
{
|
||||
in: {"ts":1610795367898,"i":6978,"p":"رشوت خور","f":"rishwat khór","g":"rishwatkhor","e":"bribe-taker, corrupt","r":4,"c":"n. m. anim. unisex / adj.","infap":"رشوت خواره","infaf":"rishwat khwaaru","infbp":"رشوت خور","infbf":"rishwat khwar"},
|
||||
out: {
|
||||
inflections: {
|
||||
masc: [
|
||||
[{p: "رشوت خور", f: "rishwat khór"}],
|
||||
[{p: "رشوت خواره", f: "rishwat khwaarú"}],
|
||||
[{p: "رشوت خورو", f: "rishwat khwaró"}],
|
||||
],
|
||||
fem: [
|
||||
[{p: "رشوت خوره", f: "rishwat khwará"}],
|
||||
[{p: "رشوت خورې", f: "rishwat khwaré"}],
|
||||
[{p: "رشوت خورو", f: "rishwat khwaró"}],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const others: T.DictionaryEntry[] = [
|
||||
|
|
|
@ -31,6 +31,7 @@ import {
|
|||
} from "./accent-helpers";
|
||||
import * as T from "../../types";
|
||||
import { splitFIntoPhonemes } from "./phonetics-to-diacritics";
|
||||
import { splitPsString } from "./splitPsString";
|
||||
|
||||
const endingInSingleARegex = /[^a]'?’?[aá]'?’?$/;
|
||||
const endingInHeyOrAynRegex = /[^ا][هع]$/;
|
||||
|
@ -184,18 +185,18 @@ function handleFemNoun(word: T.DictionaryEntryNoFVars): T.InflectorOutput {
|
|||
// LEVEL 3 FUNCTIONS
|
||||
function inflectIrregularUnisex(p: string, f: string, inflections: Array<{p: string, f: string}>): T.Inflections {
|
||||
const inf1 = removeAccents(inflections[1]);
|
||||
const inf0syls = splitFIntoPhonemes(inflections[0].f);
|
||||
const inf0f = accentFSylsOnNFromEnd(inf0syls, 0);
|
||||
const inf0 = removeAccents(inflections[0]);
|
||||
const inf0fSyls = splitUpSyllables(inf0.f).length;
|
||||
return {
|
||||
masc: [
|
||||
[{p, f}],
|
||||
[{p: inflections[0].p, f: inf0f, }],
|
||||
[{p: `${inf1.p}و`, f: `${inf1.f}ó`}],
|
||||
[{p: inflections[0].p, f: `${inf0.f.slice(0, -1)}${inf0fSyls === 1 ? "u" : "ú"}` }],
|
||||
[{p: `${inf1.p}و`, f: `${inf1.f}${inf0fSyls === 1 ? "o" : "ó"}`}],
|
||||
],
|
||||
fem: [
|
||||
[{p: `${inf1.p}ه`, f: `${inf1.f}á`}],
|
||||
[{p: `${inf1.p}ې`, f: `${inf1.f}é`}],
|
||||
[{p: `${inf1.p}و`, f: `${inf1.f}ó`}],
|
||||
[{p: `${inf1.p}ه`, f: `${inf1.f}${inf0fSyls === 1 ? "a" : "á"}`}],
|
||||
[{p: `${inf1.p}ې`, f: `${inf1.f}${inf0fSyls === 1 ? "e" : "é"}`}],
|
||||
[{p: `${inf1.p}و`, f: `${inf1.f}${inf0fSyls === 1 ? "o" : "ó"}`}],
|
||||
],
|
||||
};
|
||||
}
|
||||
|
@ -324,14 +325,14 @@ function inflectRegularEmphasizedYeyMasc(p: string, f: string): T.Inflections {
|
|||
}
|
||||
|
||||
function inflectIrregularMasc(p: string, f: string, inflections: Array<{p: string, f: string}>): T.Inflections {
|
||||
const inf0f = splitUpSyllables(inflections[0].f).length > 1
|
||||
? accentFSylsOnNFromEnd(inflections[0].f, 0)
|
||||
: inflections[0].f
|
||||
let inf0f = removeAccents(inflections[0].f);
|
||||
const inf0syls = splitUpSyllables(f).length;
|
||||
const inf1f = removeAccents(inflections[1].f);
|
||||
return {
|
||||
masc: [
|
||||
[{p, f}],
|
||||
[{p: inflections[0].p, f: inf0f}],
|
||||
[{p: `${inflections[1].p}و`, f: `${removeAccents(inflections[1].f)}ó`}],
|
||||
[{p: inflections[0].p, f: `${inf0f.slice(0, -1)}${inf0syls === 1 ? "u" : "ú"}`}],
|
||||
[{p: `${inflections[1].p}و`, f: `${inf1f}${inf0syls === 1 ? "o" : "ó"}`}],
|
||||
],
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue