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",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "1.2.8",
|
"version": "1.2.9",
|
||||||
"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",
|
||||||
|
|
|
@ -1127,6 +1127,10 @@ test("splitPsByVarients", () => {
|
||||||
test("endsWith", () => {
|
test("endsWith", () => {
|
||||||
expect(endsWith({ p: "ی", f: "ey" }, { p: "سړی", f: "saRey" }))
|
expect(endsWith({ p: "ی", f: "ey" }, { p: "سړی", f: "saRey" }))
|
||||||
.toBe(true);
|
.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
|
// f variations should be removed in case of using DictionaryEntry
|
||||||
expect(endsWith({ p: "ی", f: "ey" }, { p: "سړی", f: "saRey, saRaayyy" }))
|
expect(endsWith({ p: "ی", f: "ey" }, { p: "سړی", f: "saRey, saRaayyy" }))
|
||||||
.toBe(true);
|
.toBe(true);
|
||||||
|
|
|
@ -1004,7 +1004,7 @@ export function endsWith(
|
||||||
(("p" in ending) ? ps.p.slice(-ending.p.length) === ending.p : true)
|
(("p" in ending) ? ps.p.slice(-ending.p.length) === ending.p : true)
|
||||||
&&
|
&&
|
||||||
((fEnd) ?
|
((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)
|
: true)
|
||||||
);
|
);
|
||||||
}
|
}
|
|
@ -412,42 +412,41 @@ const nouns: Array<{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// with irregular Pashto plural
|
// with #3 pattern anim unisex
|
||||||
// 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"},
|
||||||
// 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: {
|
||||||
// out: {
|
inflections: {
|
||||||
// inflections: {
|
masc: [
|
||||||
// masc: [
|
[{ p: "پلوی", f: "palawéy" }],
|
||||||
// [{ p: "پلوی", f: "palawéy" }],
|
[{ p: "پلوي", f: "palawée" }],
|
||||||
// [{ p: "پلوي", f: "palawée" }],
|
[{ p: "پلویو", f: "palawiyo" }, { p: "پلوو", f: "palawó" }],
|
||||||
// [{ p: "پلویو", f: "palawiyo" }, { p: "پلوو", f: "palawó" }],
|
],
|
||||||
// ],
|
fem: [
|
||||||
// fem: [
|
[{ p: "پلوۍ", f: "palawúy" }],
|
||||||
// [{ p: "پلوۍ", f: "palawúy" }],
|
[{ p: "پلوۍ", f: "palawúy" }],
|
||||||
// [{ p: "پلوۍ", f: "palawúy" }],
|
[{ p: "پلویو", f: "palawúyo" }, { p: "پلوو", f: "palawó" }],
|
||||||
// [{ p: "پلویو", f: "palawúyo" }, { p: "پلوو", f: "palawó" }],
|
],
|
||||||
// ],
|
},
|
||||||
// },
|
plural: {
|
||||||
// plural: {
|
masc: [
|
||||||
// masc: [
|
[{ p: "پلویان", f: "palawiyáan" }],
|
||||||
// [{ p: "پلویان", f: "palawiyáan" }],
|
[{ p: "پلویانو", f: "palawiyáano" }],
|
||||||
// [{ p: "پلویانو", f: "palawiyáano" }],
|
],
|
||||||
// ],
|
fem: [
|
||||||
// fem: [
|
[{ p: "پلویانې", f: "palawiyáane" }],
|
||||||
// [{ p: "پلویانې", f: "palawiyáane" }],
|
[{ p: "پلویانو", f: "palawiyáano" }],
|
||||||
// [{ p: "پلویانو", f: "palawiyáano" }],
|
],
|
||||||
// ],
|
},
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// },
|
|
||||||
// ## MASCULINE
|
// ## MASCULINE
|
||||||
// Masculine regular ending in ی
|
// Masculine regular ending in ی
|
||||||
{
|
{
|
||||||
in: {
|
in: {
|
||||||
ts: 1527815251,
|
ts: 1527815251,
|
||||||
p: "سړی",
|
p: "سړی",
|
||||||
f: "saRey",
|
f: "saRéy",
|
||||||
g: "",
|
g: "",
|
||||||
e: "man",
|
e: "man",
|
||||||
c: "n. m.",
|
c: "n. m.",
|
||||||
|
@ -456,11 +455,31 @@ const nouns: Array<{
|
||||||
out: {
|
out: {
|
||||||
inflections: {
|
inflections: {
|
||||||
masc: [
|
masc: [
|
||||||
[{p: "سړی", f: "saRey"}],
|
[{p: "سړی", f: "saRéy"}],
|
||||||
[{p: "سړي", f: "saRee"}],
|
[{p: "سړي", f: "saRée"}],
|
||||||
[{p: "سړیو", f: "saRiyo"}, {p: "سړو", f: "saRo"}],
|
[{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
|
// Masculine regular ending in ی with emphasis on end
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {
|
||||||
endsInShwa,
|
endsInShwa,
|
||||||
splitPsByVarients,
|
splitPsByVarients,
|
||||||
removeEndTick,
|
removeEndTick,
|
||||||
|
endsWith,
|
||||||
} from "./p-text-helpers";
|
} from "./p-text-helpers";
|
||||||
import {
|
import {
|
||||||
hasAccents,
|
hasAccents,
|
||||||
|
@ -463,6 +464,24 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
||||||
fem: addSecondInf(concatPsString(base, { p: "انې", f: "áane" })),
|
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 {
|
function addFemLongVowelSuffix(): T.PluralInflectionSet {
|
||||||
const base = removeEndTick(makePsString(w.p, w.f));
|
const base = removeEndTick(makePsString(w.p, w.f));
|
||||||
const baseWOutAccents = removeAccents(base);
|
const baseWOutAccents = removeAccents(base);
|
||||||
|
@ -513,6 +532,10 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
||||||
if (shortSquish && !anim) {
|
if (shortSquish && !anim) {
|
||||||
return { arabicPlural, plural: { masc: addMascPluralSuffix(anim, shortSquish) }};
|
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
|
// usually shortSquish nouns would never have arabicPlurals -- so we don't have to worry about catching
|
||||||
// arabic plurals for the animat ones, right?
|
// 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
|
// TODO: What about endings in long ee / animate at inanimate
|
||||||
if (type === "fem noun" && endsInAaOrOo(w) && (!w.infap)) {
|
if (type === "fem noun" && endsInAaOrOo(w) && (!w.infap)) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -408,6 +408,8 @@ export interface ArrayFixed<T, L extends number> extends Array<T> {
|
||||||
length: L;
|
length: L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Wrapper<T> = T & { __brand: "wrapped" };
|
||||||
|
|
||||||
export type ArrayOneOrMore<T> = {
|
export type ArrayOneOrMore<T> = {
|
||||||
0: T
|
0: T
|
||||||
} & Array<T>
|
} & Array<T>
|
||||||
|
|
Loading…
Reference in New Issue