[de][pronouns] make slashes work

This commit is contained in:
Andrea Vos 2021-08-19 17:56:21 +02:00
parent af1d94dc36
commit 2f48f4ca8b
2 changed files with 23 additions and 18 deletions

View File

@ -15,7 +15,7 @@ pronouns:
examples: ['er&sie', 'er&dey', 'sie&xier']
null: false
emoji: false
slashes: true
slashes: ['pronoun_n', 'possessive', 'pronoun_d', 'pronoun_a']
avoiding: false
others: 'Andere Pronomen'

View File

@ -72,23 +72,28 @@ export const buildPronoun = (pronouns, path) => {
}
const p = path.split('/').filter(s => !!s);
if (!pronoun && process.env.CONFIG.pronouns.slashes !== false && p.length === MORPHEMES.length) {
pronoun = new Pronoun(
`${p[0]}/${p[1]}`,
'',
false,
buildDict(function*() {
let i = 0;
for (let m of MORPHEMES) {
yield [m, p[i++]];
}
}),
[ p[p.length - 1].endsWith('selves') ], // TODO English specific, extract somewhere
[ false ],
[],
'__generator__',
false,
)
if (!pronoun && process.env.CONFIG.pronouns.slashes !== false) {
const slashMorphemes = process.env.CONFIG.pronouns.slashes === true
? MORPHEMES
: process.env.CONFIG.pronouns.slashes;
if (p.length === slashMorphemes.length) {
pronoun = new Pronoun(
`${p[0]}/${p[1]}`,
'',
false,
buildDict(function*() {
for (let m of MORPHEMES) {
const index = slashMorphemes.indexOf(m)
yield [m, index === -1 ? '' : p[index]];
}
}),
[ p[p.length - 1].endsWith('selves') ], // TODO English specific, extract somewhere
[ false ],
[],
'__generator__',
false,
)
}
}
return pronoun;