fix bundled plural issue

This commit is contained in:
adueck 2025-01-18 16:29:01 -05:00
parent bae7caac49
commit 898042131c
7 changed files with 21 additions and 20 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "pashto-inflector-website",
"version": "7.7.8",
"version": "7.7.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pashto-inflector-website",
"version": "7.7.8",
"version": "7.7.9",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.2",
"bootstrap": "4.6.1",

View File

@ -1,6 +1,6 @@
{
"name": "pashto-inflector-website",
"version": "7.7.8",
"version": "7.7.9",
"type": "module",
"scripts": {
"patch": "npm version patch --no-git-tag-version && cd src/lib && npm version patch --no-git-tag-version && cd ../components && npm version patch --no-git-tag-version",

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/ps-react",
"version": "7.7.8",
"version": "7.7.9",
"description": "Pashto inflector library module with React components",
"main": "dist/components/library-cjs.js",
"module": "dist/components/library.js",

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/inflect",
"version": "7.7.8",
"version": "7.7.9",
"description": "Pashto inflector library",
"main": "dist/lib/library.cjs",
"module": "dist/lib/library.js",

View File

@ -15,6 +15,7 @@ import {
removeAccents,
} from "./accent-helpers";
import * as T from "../../types";
import { isMascNounEntry, isPattern1Entry } from "./type-predicates";
function makePashtoPlural(
word: T.DictionaryEntryNoFVars
@ -35,11 +36,9 @@ function makePashtoPlural(
}
function makeBundledPlural(
word: T.DictionaryEntryNoFVars
word: T.DictionaryEntry
): T.PluralInflections | undefined {
if (!endsInConsonant(word) || !word.c?.includes("n.")) {
return undefined;
}
if (isMascNounEntry(word) && isPattern1Entry(word) && endsInConsonant(word)) {
const w = makePsString(word.p, word.f);
const base = countSyllables(w) === 1 ? accentOnNFromEnd(w, 0) : w;
return {
@ -48,6 +47,9 @@ function makeBundledPlural(
[concatPsString(base, { p: "و", f: "o" })],
],
};
} else {
return undefined;
}
}
function makeArabicPlural(

View File

@ -957,9 +957,6 @@ const nouns: {
plural: {
masc: [[{ p: "غرونه", f: "ghróona" }], [{ 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 thay're animate

View File

@ -29,7 +29,9 @@ export function isKawulVerb(e: T.VerbEntry | T.VerbDictionaryEntry): boolean {
return ["کول", "راکول", "درکول", "ورکول"].includes(entry.p);
}
export function isNounEntry(e: T.Entry | T.DictionaryEntry): e is T.NounEntry {
export function isNounEntry(
e: T.Entry | T.DictionaryEntry | T.DictionaryEntryNoFVars
): e is T.NounEntry {
if ("entry" in e) return false;
return !!(e.c && (e.c.includes("n. m.") || e.c.includes("n. f.")));
}
@ -116,7 +118,7 @@ export function isVerbEntry(
}
export function isMascNounEntry(
e: T.InflectableEntry | T.DictionaryEntry
e: T.InflectableEntry | T.DictionaryEntry | T.DictionaryEntryNoFVars
): e is T.MascNounEntry {
return !!e.c && e.c.includes("n. m.");
}