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", "name": "pashto-inflector-website",
"version": "7.7.8", "version": "7.7.9",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pashto-inflector-website", "name": "pashto-inflector-website",
"version": "7.7.8", "version": "7.7.9",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.15.2", "@fortawesome/fontawesome-free": "^5.15.2",
"bootstrap": "4.6.1", "bootstrap": "4.6.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "pashto-inflector-website", "name": "pashto-inflector-website",
"version": "7.7.8", "version": "7.7.9",
"type": "module", "type": "module",
"scripts": { "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", "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", "name": "@lingdocs/ps-react",
"version": "7.7.8", "version": "7.7.9",
"description": "Pashto inflector library module with React components", "description": "Pashto inflector library module with React components",
"main": "dist/components/library-cjs.js", "main": "dist/components/library-cjs.js",
"module": "dist/components/library.js", "module": "dist/components/library.js",

View File

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

View File

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

View File

@ -957,9 +957,6 @@ const nouns: {
plural: { plural: {
masc: [[{ p: "غرونه", f: "ghróona" }], [{ p: "غرونو", f: "ghróono" }]], 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 // 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); 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; if ("entry" in e) return false;
return !!(e.c && (e.c.includes("n. m.") || e.c.includes("n. f."))); return !!(e.c && (e.c.includes("n. m.") || e.c.includes("n. f.")));
} }
@ -116,7 +118,7 @@ export function isVerbEntry(
} }
export function isMascNounEntry( export function isMascNounEntry(
e: T.InflectableEntry | T.DictionaryEntry e: T.InflectableEntry | T.DictionaryEntry | T.DictionaryEntryNoFVars
): e is T.MascNounEntry { ): e is T.MascNounEntry {
return !!e.c && e.c.includes("n. m."); return !!e.c && e.c.includes("n. m.");
} }