add accent on uy endings
This commit is contained in:
parent
6a3fda7212
commit
d2083c9c96
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"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",
|
||||
|
|
|
@ -158,15 +158,15 @@ export function randomNumber(minInclusive: number, maxExclusive: number): number
|
|||
* @param possiblePerson
|
||||
* @param existingPerson
|
||||
*/
|
||||
export function personIsAllowed(possiblePerson: T.Person, existingPerson: T.Person): boolean {
|
||||
export function personIsAllowed(possiblePerson: T.Person, existingPerson?: T.Person): boolean {
|
||||
const isFirstPerson = (p: T.Person) => [0, 1, 6, 7].includes(p);
|
||||
const isSecondPerson = (p: T.Person) => [2, 3, 8, 9].includes(p);
|
||||
// can't have both subject and object be 1st person
|
||||
if (isFirstPerson(possiblePerson) && isFirstPerson(existingPerson)) {
|
||||
if (isFirstPerson(possiblePerson) && (existingPerson && isFirstPerson(existingPerson))) {
|
||||
return false;
|
||||
}
|
||||
// can't have both subject and object be 2nd person
|
||||
if (isSecondPerson(possiblePerson) && isSecondPerson(existingPerson)) {
|
||||
if (isSecondPerson(possiblePerson) && (existingPerson && isSecondPerson(existingPerson))) {
|
||||
return false;
|
||||
}
|
||||
// otherwise it's ok
|
||||
|
@ -178,7 +178,7 @@ export function personIsAllowed(possiblePerson: T.Person, existingPerson: T.Pers
|
|||
*
|
||||
* @param other
|
||||
*/
|
||||
export function randomPerson(other: T.Person): T.Person {
|
||||
export function randomPerson(other?: T.Person): T.Person {
|
||||
let newPerson: T.Person;
|
||||
do {
|
||||
newPerson = randomNumber(0, 12);
|
||||
|
|
|
@ -202,6 +202,31 @@ const adjectives: Array<{
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
in: {
|
||||
ts: 1527812792,
|
||||
p: "ښایسته",
|
||||
f: "xaaystu",
|
||||
g: "xaaystu",
|
||||
e: "beautiful",
|
||||
c: "adj.",
|
||||
i: 1,
|
||||
},
|
||||
out: {
|
||||
inflections: {
|
||||
masc: [
|
||||
[{p: "ښایسته", f: "xaaystu"}],
|
||||
[{p: "ښایسته", f: "xaaystu"}],
|
||||
[{p: "ښایستو", f: "xaaysto"}],
|
||||
],
|
||||
fem: [
|
||||
[{p: "ښایسته", f: "xaaysta"}],
|
||||
[{p: "ښایستې", f: "xaayste"}],
|
||||
[{p: "ښایستو", f: "xaaysto"}],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
// numbers should inflect just like adjectives
|
||||
{
|
||||
in: {"ts":1588688995113,"i":8176,"p":"شپږ","f":"shpuG","g":"shpug","e":"six","c":"num."},
|
||||
|
@ -1018,8 +1043,8 @@ const nouns: Array<{
|
|||
inflections: {
|
||||
fem: [
|
||||
[{p: "دوستي", f: "dostee"}],
|
||||
[{p: "دوستۍ", f: "dostuy"}],
|
||||
[{p: "دوستیو", f: "dostuyo"}],
|
||||
[{p: "دوستۍ", f: "dostúy"}],
|
||||
[{p: "دوستیو", f: "dostúyo"}],
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -1038,9 +1063,9 @@ const nouns: Array<{
|
|||
out: {
|
||||
inflections: {
|
||||
fem: [
|
||||
[{p: "کرسۍ", f: "kUrsuy"}],
|
||||
[{p: "کرسۍ", f: "kUrsuy"}],
|
||||
[{p: "کرسیو", f: "kUrsuyo"}, { p: "کرسو", f: "kUrso"}],
|
||||
[{p: "کرسۍ", f: "kUrsúy"}],
|
||||
[{p: "کرسۍ", f: "kUrsúy"}],
|
||||
[{p: "کرسیو", f: "kUrsúyo"}, { p: "کرسو", f: "kUrso"}],
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -379,21 +379,21 @@ function inflectRegularInanEeFem(p: string, f: string): T.Inflections {
|
|||
return {
|
||||
fem: [
|
||||
[{p, f}],
|
||||
[{p: `${baseP}ۍ`, f: `${baseF}uy`}],
|
||||
[{p: `${baseP}یو`, f: `${baseF}uyo`}],
|
||||
[{p: `${baseP}ۍ`, f: `${baseF}úy`}],
|
||||
[{p: `${baseP}یو`, f: `${baseF}úyo`}],
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
function inflectRegularUyFem(p: string, f: string): T.Inflections {
|
||||
const baseP = p.slice(0, -1);
|
||||
const baseF = f.slice(0, -2);
|
||||
const baseF = removeAccents(f.slice(0, -2));
|
||||
return {
|
||||
fem: [
|
||||
[{p, f}],
|
||||
[{p, f}],
|
||||
[{p, f: `${baseF}úy`}],
|
||||
[{p, f: `${baseF}úy`}],
|
||||
[
|
||||
{p: `${baseP}یو`, f: `${baseF}uyo`},
|
||||
{p: `${baseP}یو`, f: `${baseF}úyo`},
|
||||
{p: `${baseP}و`, f: `${baseF}o`},
|
||||
],
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue