rough add of bundled plurals
This commit is contained in:
parent
9e41a7968c
commit
7806ce8e49
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "pashto-inflector",
|
||||
"version": "5.2.1",
|
||||
"version": "5.3.0",
|
||||
"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.2.1",
|
||||
"version": "5.3.0",
|
||||
"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.2.1",
|
||||
"version": "5.3.0",
|
||||
"description": "Pashto inflector library",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/lib/library.d.ts",
|
||||
|
|
|
@ -14,10 +14,10 @@ import {
|
|||
} from "./pashto-inflector";
|
||||
import * as T from "../../types";
|
||||
|
||||
const adjectives: Array<{
|
||||
const adjectives: {
|
||||
in: T.DictionaryEntry,
|
||||
out: T.InflectorOutput,
|
||||
}> = [
|
||||
}[] = [
|
||||
// irregular adj.
|
||||
{
|
||||
in: {
|
||||
|
@ -334,10 +334,10 @@ const adjectives: Array<{
|
|||
},
|
||||
];
|
||||
|
||||
const nouns: Array<{
|
||||
const nouns: {
|
||||
in: T.DictionaryEntry,
|
||||
out: T.InflectorOutput,
|
||||
}> = [
|
||||
}[] = [
|
||||
// ## UNISEX
|
||||
// Unisex noun irregular
|
||||
{
|
||||
|
@ -453,6 +453,12 @@ const nouns: Array<{
|
|||
[{p: "چرګانو", f: "churgáano"}],
|
||||
],
|
||||
},
|
||||
bundledPlural: {
|
||||
masc: [
|
||||
[{ p: "چرګه", f: "chúrga" }],
|
||||
[{ p: "چرګو", f: "chúrgo" }],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
// with #3 pattern anim unisex
|
||||
|
@ -603,6 +609,12 @@ const nouns: Array<{
|
|||
[{ p: "غرونو", f: "ghróono" }],
|
||||
],
|
||||
},
|
||||
bundledPlural: {
|
||||
masc: [
|
||||
[{ p: "غره", f: "ghára" }],
|
||||
[{ p: "غرو", f: "gháro" }],
|
||||
],
|
||||
}
|
||||
},
|
||||
},
|
||||
// should NOT do the oona plural with the squish nouns, when they're animate
|
||||
|
@ -726,6 +738,12 @@ const nouns: Array<{
|
|||
[{ p: "کتابونو", f: "kitaabóono" }],
|
||||
],
|
||||
},
|
||||
bundledPlural: {
|
||||
masc: [
|
||||
[{ p: "کتابه", f: "kitaaba" }],
|
||||
[{ p: "کتابو", f: "kitaabo" }],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -737,6 +755,12 @@ const nouns: Array<{
|
|||
[{ p: "غاښونو", f: "ghaaxóono" }],
|
||||
],
|
||||
},
|
||||
bundledPlural: {
|
||||
masc: [
|
||||
[{ p: "غاښه", f: "gháaxa" }],
|
||||
[{ p: "غاښو", f: "gháaxo" }],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -770,6 +794,12 @@ const nouns: Array<{
|
|||
[{ p: "لوونو", f: "lawóono" }],
|
||||
],
|
||||
},
|
||||
bundledPlural: {
|
||||
masc: [
|
||||
[{ p: "لوه", f: "láwa" }],
|
||||
[{ p: "لوو", f: "láwo" }],
|
||||
],
|
||||
}
|
||||
},
|
||||
},
|
||||
// ## FEMININE
|
||||
|
@ -908,6 +938,12 @@ const nouns: Array<{
|
|||
[{ p: "تبلیغونو", f: "tableeghóono" }],
|
||||
],
|
||||
},
|
||||
bundledPlural: {
|
||||
masc: [
|
||||
[{ p: "تبلیغه", f: "tableegha" }],
|
||||
[{ p: "تبلیغو", f: "tableegho" }],
|
||||
],
|
||||
},
|
||||
arabicPlural: {
|
||||
masc: [
|
||||
[{ p: "تبلیغات", f: "tableegháat" }],
|
||||
|
@ -972,6 +1008,12 @@ const nouns: Array<{
|
|||
[{ p: "حالونو", f: "haalóono" }],
|
||||
],
|
||||
},
|
||||
bundledPlural: {
|
||||
masc: [
|
||||
[{ p: "حاله", f: "háala" }],
|
||||
[{ p: "حالو", f: "háalo" }],
|
||||
],
|
||||
},
|
||||
arabicPlural: {
|
||||
masc: [
|
||||
[{ p: "احوال", f: "ahwáal" }],
|
||||
|
|
|
@ -23,12 +23,15 @@ import {
|
|||
import { makePsString, removeFVarients } from "./accent-and-ps-utils";
|
||||
import {
|
||||
accentFSylsOnNFromEnd,
|
||||
accentOnNFromEnd,
|
||||
countSyllables,
|
||||
hasAccents,
|
||||
removeAccents,
|
||||
splitUpSyllables,
|
||||
} from "./accent-helpers";
|
||||
import * as T from "../../types";
|
||||
import { splitFIntoPhonemes } from "./phonetics-to-diacritics";
|
||||
import { isNounEntry } from "./type-predicates";
|
||||
|
||||
const endingInSingleARegex = /[^a]'?’?[aá]'?’?$/;
|
||||
const endingInHeyOrAynRegex = /[^ا][هع]$/;
|
||||
|
@ -420,6 +423,22 @@ function makePashtoPlural(word: T.DictionaryEntryNoFVars): T.PluralInflections |
|
|||
return undefined;
|
||||
}
|
||||
|
||||
function makeBundledPlural(word: T.DictionaryEntryNoFVars): T.PluralInflections | undefined {
|
||||
if (!endsInConsonant(word) || !word.c?.includes("n.")) {
|
||||
return undefined;
|
||||
}
|
||||
const w = makePsString(word.p, word.f);
|
||||
const base = countSyllables(w) === 1
|
||||
? accentOnNFromEnd(w, 0)
|
||||
: w;
|
||||
return {
|
||||
masc: [
|
||||
[concatPsString(base, { p: "ه", f: "a" })],
|
||||
[concatPsString(base, { p: "و", f: "o" })],
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
function makeArabicPlural(word: T.DictionaryEntryNoFVars): T.PluralInflections | undefined {
|
||||
if (!(word.apf && word.app)) return undefined;
|
||||
const w = makePsString(word.app, word.apf);
|
||||
|
@ -438,7 +457,7 @@ function makeArabicPlural(word: T.DictionaryEntryNoFVars): T.PluralInflections |
|
|||
return { masc: value };
|
||||
}
|
||||
|
||||
function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections } | { arabicPlural: T.PluralInflections } | undefined {
|
||||
function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections, bundledPlural?: T.PluralInflections } | { arabicPlural: T.PluralInflections, bundledPlural?: T.PluralInflections } | undefined {
|
||||
function addSecondInf(plur: T.ArrayOneOrMore<T.PsString> | T.PsString): T.PluralInflectionSet {
|
||||
if (!Array.isArray(plur)) {
|
||||
return addSecondInf([plur]);
|
||||
|
@ -457,6 +476,7 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
|||
}
|
||||
const arabicPlural = makeArabicPlural(w);
|
||||
const pashtoPlural = makePashtoPlural(w);
|
||||
const bundledPlural = makeBundledPlural(w);
|
||||
function addMascPluralSuffix(animate?: boolean, shortSquish?: boolean): T.PluralInflectionSet {
|
||||
if (shortSquish && (w.infap === undefined || w.infaf === undefined)) {
|
||||
throw new Error(`no irregular inflection info for ${w.p} - ${w.ts}`);
|
||||
|
@ -559,7 +579,7 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
|||
if (type === "unisex noun") {
|
||||
// doesn't need to be labelled anim - because it's only with animate nouns that you get the unisex - I THINK
|
||||
if (endsInConsonant(w) && (!w.infap)) {
|
||||
return { arabicPlural, plural: addAnimUnisexPluralSuffix() };
|
||||
return { arabicPlural, bundledPlural, plural: addAnimUnisexPluralSuffix() };
|
||||
}
|
||||
if (shortSquish && !anim) {
|
||||
return { arabicPlural, plural: { masc: addMascPluralSuffix(anim, shortSquish) }};
|
||||
|
@ -577,6 +597,7 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
|||
) {
|
||||
return {
|
||||
arabicPlural,
|
||||
bundledPlural,
|
||||
plural: {
|
||||
masc: addMascPluralSuffix(anim, shortSquish),
|
||||
},
|
||||
|
@ -620,7 +641,7 @@ function makePlural(w: T.DictionaryEntryNoFVars): { plural: T.PluralInflections
|
|||
};
|
||||
}
|
||||
if (arabicPlural) {
|
||||
return { arabicPlural, plural: pashtoPlural };
|
||||
return { arabicPlural, plural: pashtoPlural, bundledPlural };
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -378,10 +378,12 @@ export type PluralInflections = GenderedSet<PluralInflectionSet>;
|
|||
export type InflectorOutput = {
|
||||
arabicPlural: PluralInflections,
|
||||
plural?: PluralInflections,
|
||||
bundledPlural?: PluralInflections,
|
||||
inflections?: Inflections,
|
||||
} | {
|
||||
plural: PluralInflections,
|
||||
arabicPlural?: PluralInflections,
|
||||
bundledPlural?: PluralInflections,
|
||||
inflections?: Inflections,
|
||||
} | {
|
||||
inflections: Inflections,
|
||||
|
@ -436,7 +438,7 @@ export type Wrapper<T> = T & { __brand: "wrapped" };
|
|||
|
||||
export type ArrayOneOrMore<T> = {
|
||||
0: T
|
||||
} & Array<T>
|
||||
} & T[];
|
||||
|
||||
export type RootsOrStemsToHighlight = ("imperfective root" | "perfective root" | "imperfective stem" | "perfective stem" | "past participle")[];
|
||||
|
||||
|
|
Loading…
Reference in New Issue