bugs with the new complement/accent functionality - proper verbInfo

This commit is contained in:
lingdocs 2022-07-23 15:41:15 -05:00
parent 6355bf9f1a
commit ffdd244f6f
6 changed files with 27 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "3.4.9", "version": "3.5.0",
"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",

View File

@ -459,12 +459,7 @@ function createComplementRetroactively(complement: T.DictionaryEntry | undefined
if (!complement) { if (!complement) {
throw new Error("error creating complement from head - no complement in verb entry"); throw new Error("error creating complement from head - no complement in verb entry");
} }
if (isNounEntry(complement)) { // very important to have this before isNounEntry! (ie لېونی - n. m. anim unisex / adj. needs to be recognized as an adjective first!)
return {
type: "complement",
selection: makeNounSelection(complement, undefined, undefined),
};
}
if (isAdjectiveEntry(complement)) { if (isAdjectiveEntry(complement)) {
if (person === undefined) { if (person === undefined) {
throw new Error("there needs to be a complement person for rendering an adjective complement"); throw new Error("there needs to be a complement person for rendering an adjective complement");
@ -478,6 +473,12 @@ function createComplementRetroactively(complement: T.DictionaryEntry | undefined
}, },
}; };
} }
if (isNounEntry(complement)) {
return {
type: "complement",
selection: makeNounSelection(complement, undefined, undefined),
};
}
if (isLocativeAdverbEntry(complement)) { if (isLocativeAdverbEntry(complement)) {
return { return {
type: "complement", type: "complement",

View File

@ -499,7 +499,7 @@ function getVerbRoots(entry: T.DictionaryEntryNoFVars, transitivity: T.Transitiv
const comp = complementInflects(complement) ? unisexInfToObjectMatrix(complement) : complement.masc[0][0]; const comp = complementInflects(complement) ? unisexInfToObjectMatrix(complement) : complement.masc[0][0];
const t = getAuxTransitivity(transitivity); const t = getAuxTransitivity(transitivity);
const aux = stativeAux[t].info.root.imperfective const aux = stativeAux[t].info.root.imperfective
return concatPsString(comp, " ", aux) as T.OptionalPersonInflections<T.LengthOptions<T.PsString>>; return concatPsString(removeAccentsFull(comp), " ", aux) as T.OptionalPersonInflections<T.LengthOptions<T.PsString>>;
} }
return shortAndLong(entry); return shortAndLong(entry);
})(); })();
@ -546,7 +546,19 @@ function getVerbRoots(entry: T.DictionaryEntryNoFVars, transitivity: T.Transitiv
perfective, perfective,
perfectiveSplit, perfectiveSplit,
}; };
} }
function removeAccentsFull(p: T.OptionalPersonInflections<T.PsString>): T.OptionalPersonInflections<T.PsString> {
if ("mascPlur" in p) {
return {
"mascSing": removeAccents(p.mascSing),
"mascPlur": removeAccents(p.mascPlur),
"femSing": removeAccents(p.femSing),
"femPlur": removeAccents(p.femPlur),
}
};
return removeAccents(p);
}
/** /**
* Returns the stems (imperfective and perfective) of a given verb * Returns the stems (imperfective and perfective) of a given verb
@ -588,7 +600,7 @@ function getVerbStems(entry: T.DictionaryEntryNoFVars, root: T.VerbRootSet, tran
if (complement && spaceInForm(root.imperfective)) { if (complement && spaceInForm(root.imperfective)) {
const comp = complementInflects(complement) ? unisexInfToObjectMatrix(complement) : complement.masc[0][0]; const comp = complementInflects(complement) ? unisexInfToObjectMatrix(complement) : complement.masc[0][0];
return concatPsString( return concatPsString(
comp, removeAccentsFull(comp),
" ", " ",
stativeAux[auxTransitivity].info.stem.imperfective as T.PsString, stativeAux[auxTransitivity].info.stem.imperfective as T.PsString,
); );
@ -734,7 +746,7 @@ function getParticiple(entry: T.DictionaryEntryNoFVars, stem: T.VerbStemSet, inf
const comp = compInflects ? unisexInfToObjectMatrix(complement) : complement.masc[0][0]; const comp = compInflects ? unisexInfToObjectMatrix(complement) : complement.masc[0][0];
const aux = stativeAux[auxTransitivity].info.participle[tense] as T.PsString; const aux = stativeAux[auxTransitivity].info.participle[tense] as T.PsString;
return concatPsString( return concatPsString(
comp, removeAccentsFull(comp),
" ", " ",
compInflects compInflects
? unisexInfToObjectMatrix(inflectYey(aux) as T.UnisexInflections) ? unisexInfToObjectMatrix(inflectYey(aux) as T.UnisexInflections)

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,7 @@
*/ */
module.exports = [ module.exports = [
1658537932357, // لېونی کېدل
1588760879818, // احساسېدل - to feel, be sensed 1588760879818, // احساسېدل - to feel, be sensed
1577223176187, // ادا کېدل - to be set forth, given, rendered (service), performed, fulfilled, expressed, said, done 1577223176187, // ادا کېدل - to be set forth, given, rendered (service), performed, fulfilled, expressed, said, done
1527814793, // اړېدل - to need, to be forced, to have to, to experience a need 1527814793, // اړېدل - to need, to be forced, to have to, to experience a need

View File

@ -7,6 +7,7 @@
*/ */
module.exports = [ module.exports = [
1658537998960, // لېونی کول
1527812403, // بچ کول - to save, protect, guard, spare, rescue, economize 1527812403, // بچ کول - to save, protect, guard, spare, rescue, economize
1577299232429, // بدلول - to change, to adapt, exchange, replace 1577299232429, // بدلول - to change, to adapt, exchange, replace
1527815728, // بلدول - to familiarize with, to acquaint, orient, to train 1527815728, // بلدول - to familiarize with, to acquaint, orient, to train