Plural inflection of Pattern 3 animated nouns
ie - سیلانیان سیلانیانې
This commit is contained in:
parent
09d9ea5737
commit
539f7eefdb
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "1.2.8",
|
||||
"version": "1.2.9",
|
||||
"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",
|
||||
|
|
|
@ -1127,6 +1127,10 @@ test("splitPsByVarients", () => {
|
|||
test("endsWith", () => {
|
||||
expect(endsWith({ p: "ی", f: "ey" }, { p: "سړی", f: "saRey" }))
|
||||
.toBe(true);
|
||||
expect(endsWith({ p: "ی", f: "éy" }, { p: "سړی", f: "saRey" }))
|
||||
.toBe(true);
|
||||
expect(endsWith({ p: "ی", f: "éy" }, { p: "سړی", f: "saRey" }, true))
|
||||
.toBe(false);
|
||||
// f variations should be removed in case of using DictionaryEntry
|
||||
expect(endsWith({ p: "ی", f: "ey" }, { p: "سړی", f: "saRey, saRaayyy" }))
|
||||
.toBe(true);
|
||||
|
|
|
@ -1004,7 +1004,7 @@ export function endsWith(
|
|||
(("p" in ending) ? ps.p.slice(-ending.p.length) === ending.p : true)
|
||||
&&
|
||||
((fEnd) ?
|
||||
((matchAccent ? f.slice(-fEnd.length) : removeAccents(f.slice(-fEnd.length))) === fEnd)
|
||||
((matchAccent ? f.slice(-fEnd.length) : removeAccents(f.slice(-fEnd.length))) === (matchAccent ? fEnd : removeAccents(fEnd)))
|
||||
: true)
|
||||
);
|
||||
}
|
|
@ -412,42 +412,41 @@ const nouns: Array<{
|
|||
},
|
||||
},
|
||||
},
|
||||
// with irregular Pashto plural
|
||||
// TODO: This should work with words like پلویان but not with words like ترورزامن
|
||||
// {
|
||||
// in: {"ts":1527820130,"i":2561,"p":"پلوی","f":"palawéy","g":"palawey","e":"adherent, supporter; the outside or further ox in a team of oxes grinding or threshing","c":"n. m. anim. unisex","ppp":"پلویان","ppf":"palawiyáan"},
|
||||
// out: {
|
||||
// inflections: {
|
||||
// masc: [
|
||||
// [{ p: "پلوی", f: "palawéy" }],
|
||||
// [{ p: "پلوي", f: "palawée" }],
|
||||
// [{ p: "پلویو", f: "palawiyo" }, { p: "پلوو", f: "palawó" }],
|
||||
// ],
|
||||
// fem: [
|
||||
// [{ p: "پلوۍ", f: "palawúy" }],
|
||||
// [{ p: "پلوۍ", f: "palawúy" }],
|
||||
// [{ p: "پلویو", f: "palawúyo" }, { p: "پلوو", f: "palawó" }],
|
||||
// ],
|
||||
// },
|
||||
// plural: {
|
||||
// masc: [
|
||||
// [{ p: "پلویان", f: "palawiyáan" }],
|
||||
// [{ p: "پلویانو", f: "palawiyáano" }],
|
||||
// ],
|
||||
// fem: [
|
||||
// [{ p: "پلویانې", f: "palawiyáane" }],
|
||||
// [{ p: "پلویانو", f: "palawiyáano" }],
|
||||
// ],
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// with #3 pattern anim unisex
|
||||
{
|
||||
in: {"ts":1527820130,"i":2561,"p":"پلوی","f":"palawéy","g":"palawey","e":"adherent, supporter; the outside or further ox in a team of oxes grinding or threshing","c":"n. m. anim. unisex"},
|
||||
out: {
|
||||
inflections: {
|
||||
masc: [
|
||||
[{ p: "پلوی", f: "palawéy" }],
|
||||
[{ p: "پلوي", f: "palawée" }],
|
||||
[{ p: "پلویو", f: "palawiyo" }, { p: "پلوو", f: "palawó" }],
|
||||
],
|
||||
fem: [
|
||||
[{ p: "پلوۍ", f: "palawúy" }],
|
||||
[{ p: "پلوۍ", f: "palawúy" }],
|
||||
[{ p: "پلویو", f: "palawúyo" }, { p: "پلوو", f: "palawó" }],
|
||||
],
|
||||
},
|
||||
plural: {
|
||||
masc: [
|
||||
[{ p: "پلویان", f: "palawiyáan" }],
|
||||
[{ p: "پلویانو", f: "palawiyáano" }],
|
||||
],
|
||||
fem: [
|
||||
[{ p: "پلویانې", f: "palawiyáane" }],
|
||||
[{ p: "پلویانو", f: "palawiyáano" }],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
// ## MASCULINE
|
||||
// Masculine regular ending in ی
|
||||
{
|
||||
in: {
|
||||
ts: 1527815251,
|
||||
p: "سړی",
|
||||
f: "saRey",
|
||||
f: "saRéy",
|
||||
g: "",
|
||||
e: "man",
|
||||
c: "n. m.",
|
||||
|
@ -456,11 +455,31 @@ const nouns: Array<{
|
|||
out: {
|
||||
inflections: {
|
||||
masc: [
|
||||
[{p: "سړی", f: "saRey"}],
|
||||
[{p: "سړي", f: "saRee"}],
|
||||
[{p: "سړی", f: "saRéy"}],
|
||||
[{p: "سړي", f: "saRée"}],
|
||||
[{p: "سړیو", f: "saRiyo"}, {p: "سړو", f: "saRo"}],
|
||||
],
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
// Masculine #3 anim
|
||||
// TODO: Also do Fem #3 anim!
|
||||
{
|
||||
in: {"ts":1527819801,"i":8082,"p":"سیلانی","f":"seylaanéy","g":"seylaaney","e":"tourist, sightseer, visitor","c":"n. m. anim."},
|
||||
out: {
|
||||
inflections: {
|
||||
masc: [
|
||||
[{ p: "سیلانی", f: "seylaanéy" }],
|
||||
[{ p: "سیلاني", f: "seylaanée" }],
|
||||
[{ p: "سیلانیو", f: "seylaaniyo" }, { p: "سیلانو", f: "seylaano" }],
|
||||
],
|
||||
},
|
||||
plural: {
|
||||
masc: [
|
||||
[{ p: "سیلانیان", f: "seylaaniyáan" }],
|
||||
[{ p: "سیلانیانو", f: "seylaaniyáano" }],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
// Masculine regular ending in ی with emphasis on end
|
||||
|
|
|
@ -20,6 +20,7 @@ import {
|
|||
endsInShwa,
|
||||
splitPsByVarients,
|
||||
removeEndTick,
|
||||
endsWith,
|
||||
} from "./p-text-helpers";
|
||||
import {
|
||||
hasAccents,
|
||||
|
@ -463,6 +464,24 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
|||
fem: addSecondInf(concatPsString(base, { p: "انې", f: "áane" })),
|
||||
};
|
||||
}
|
||||
function addAnimN3UnisexPluralSuffix(): T.UnisexSet<T.PluralInflectionSet> {
|
||||
const b = removeAccents(w);
|
||||
const base = {
|
||||
p: b.p.slice(0, -1),
|
||||
f: b.f.slice(0, -2),
|
||||
};
|
||||
return {
|
||||
masc: [
|
||||
[concatPsString(base, { p: "یان", f: "iyáan" })],
|
||||
[concatPsString(base, { p: "یانو", f: "iyáano" })],
|
||||
// TODO: or use addSecondInf method above?
|
||||
],
|
||||
fem: [
|
||||
[concatPsString(base, { p: "یانې", f: "iyáane" })],
|
||||
[concatPsString(base, { p: "یانو", f: "iyáano" })],
|
||||
],
|
||||
};
|
||||
}
|
||||
function addFemLongVowelSuffix(): T.PluralInflectionSet {
|
||||
const base = removeEndTick(makePsString(w.p, w.f));
|
||||
const baseWOutAccents = removeAccents(base);
|
||||
|
@ -513,6 +532,10 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
|||
if (shortSquish && !anim) {
|
||||
return { arabicPlural, plural: { masc: addMascPluralSuffix(anim, shortSquish) }};
|
||||
}
|
||||
// TODO: Does the amount of syllables matter for this?
|
||||
if (endsWith({ p: "ی", f: "éy" }, w, true) && w.c?.includes("anim.")) {
|
||||
return { arabicPlural, plural: addAnimN3UnisexPluralSuffix() };
|
||||
}
|
||||
// usually shortSquish nouns would never have arabicPlurals -- so we don't have to worry about catching
|
||||
// arabic plurals for the animat ones, right?
|
||||
}
|
||||
|
@ -528,6 +551,19 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
|||
},
|
||||
};
|
||||
}
|
||||
if (
|
||||
type === "masc noun" &&
|
||||
endsWith({ p: "ی", f: "éy" }, w, true) &&
|
||||
anim
|
||||
) {
|
||||
const { masc, ...rest } = addAnimN3UnisexPluralSuffix();
|
||||
return {
|
||||
arabicPlural,
|
||||
plural: {
|
||||
masc,
|
||||
},
|
||||
};
|
||||
}
|
||||
// TODO: What about endings in long ee / animate at inanimate
|
||||
if (type === "fem noun" && endsInAaOrOo(w) && (!w.infap)) {
|
||||
return {
|
||||
|
|
|
@ -408,6 +408,8 @@ export interface ArrayFixed<T, L extends number> extends Array<T> {
|
|||
length: L;
|
||||
}
|
||||
|
||||
export type Wrapper<T> = T & { __brand: "wrapped" };
|
||||
|
||||
export type ArrayOneOrMore<T> = {
|
||||
0: T
|
||||
} & Array<T>
|
||||
|
|
Loading…
Reference in New Issue