mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-27 15:05:38 -04:00
(de)(nouns) update and add templates
This commit is contained in:
parent
5952b3f8c9
commit
49be129029
@ -1,3 +1,6 @@
|
|||||||
masc fem neutr mascPl femPl neutrPl
|
masc fem neutr mascPl femPl neutrPl
|
||||||
-mann -frau -person -männer -frauen -leute
|
der -mann die -frau die -person die -männer die -frauen die -leute
|
||||||
- -in -In/-:in/-*in -e -innen -Innen/-:innen/-*innen
|
der - die -in das -y/de -e/din -nin/dens -ens/der:die -:in/der_die -_in/der*die -*in die -en die -innen die -ys/die -erne/die -ninnen/die -ense/die -:innen/die -_innen/die -*innen
|
||||||
|
der - die -in das -y/de -ere/din -nin/dens -ens/der:die -:in/der_die -_in/der*die -*in die -e die -innen die -ys/die -erne/die -ninnen/die -ense/die -:innen/die -_innen/die -*innen
|
||||||
|
der -e die -in das -y/de -ere/din -nin/dens -ens/der:die -:in/der_die -_in/der*die -*in die -en die -innen die -ys/die -erne/die -erninnen/die -ense/die -:innen/die -_innen/die -*innen
|
||||||
|
der -er die -erin das -y/de -ere/din -ernin/dens -ens/der:die -er:in/der_die -er_in/der*die -er*in die -er die -erinnen die -ys/de -erne/die -erninnen/die -ense/die -er:innen/die -er_innen/die -er*innen
|
||||||
|
|
@ -875,6 +875,8 @@ export interface NounRaw {
|
|||||||
declension: unknown;
|
declension: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gendersWithNumerus = ['masc', 'fem', 'neutr', 'mascPl', 'femPl', 'neutrPl'] as const;
|
||||||
|
|
||||||
export class Noun {
|
export class Noun {
|
||||||
id: string;
|
id: string;
|
||||||
masc: string[];
|
masc: string[];
|
||||||
@ -914,7 +916,7 @@ export class Noun {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const field of ['masc', 'fem', 'neutr', 'mascPl', 'femPl', 'neutrPl'] as const) {
|
for (const field of gendersWithNumerus) {
|
||||||
for (const value of this[field]) {
|
for (const value of this[field]) {
|
||||||
const v = value.toLowerCase();
|
const v = value.toLowerCase();
|
||||||
if (filter.startsWith('-') && v.endsWith(filter.substring(1))) {
|
if (filter.startsWith('-') && v.endsWith(filter.substring(1))) {
|
||||||
@ -947,21 +949,32 @@ export class NounTemplate {
|
|||||||
this.neutrPl = neutrPl;
|
this.neutrPl = neutrPl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static from(data: Record<typeof gendersWithNumerus[number], string>): NounTemplate {
|
||||||
|
return new NounTemplate(
|
||||||
|
data.masc.split('/'),
|
||||||
|
data.fem.split('/'),
|
||||||
|
data.neutr.split('/'),
|
||||||
|
data.mascPl.split('/'),
|
||||||
|
data.femPl.split('/'),
|
||||||
|
data.neutrPl.split('/'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fill(stem: string) {
|
fill(stem: string) {
|
||||||
return {
|
return {
|
||||||
masc: this.masc.map((e) => stem + e),
|
masc: this.masc.map((e) => e.replace('-', stem)),
|
||||||
fem: this.fem.map((e) => stem + e),
|
fem: this.fem.map((e) => e.replace('-', stem)),
|
||||||
neutr: this.neutr.map((e) => stem + e),
|
neutr: this.neutr.map((e) => e.replace('-', stem)),
|
||||||
mascPl: this.mascPl.map((e) => stem + e),
|
mascPl: this.mascPl.map((e) => e.replace('-', stem)),
|
||||||
femPl: this.femPl.map((e) => stem + e),
|
femPl: this.femPl.map((e) => e.replace('-', stem)),
|
||||||
neutrPl: this.neutrPl.map((e) => stem + e),
|
neutrPl: this.neutrPl.map((e) => e.replace('-', stem)),
|
||||||
base: null,
|
base: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
return [this.masc, this.fem, this.neutr, this.mascPl, this.femPl, this.neutrPl]
|
return [this.masc, this.fem, this.neutr, this.mascPl, this.femPl, this.neutrPl]
|
||||||
.map((es) => es.map((e) => `-${e}`).join('/'))
|
.map((es) => es.join('/'))
|
||||||
.join(', ')
|
.join(', ')
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,7 @@ export const examples = buildList(function* () {
|
|||||||
import nounTemplatesRaw from '../data/nouns/nounTemplates.tsv';
|
import nounTemplatesRaw from '../data/nouns/nounTemplates.tsv';
|
||||||
export const nounTemplates = buildList(function* () {
|
export const nounTemplates = buildList(function* () {
|
||||||
for (const t of nounTemplatesRaw) {
|
for (const t of nounTemplatesRaw) {
|
||||||
yield new NounTemplate(
|
yield NounTemplate.from(t);
|
||||||
t.masc.replace(/-/g, '').split('/'),
|
|
||||||
t.fem.replace(/-/g, '').split('/'),
|
|
||||||
t.neutr.replace(/-/g, '').split('/'),
|
|
||||||
t.mascPl.replace(/-/g, '').split('/'),
|
|
||||||
t.femPl.replace(/-/g, '').split('/'),
|
|
||||||
t.neutrPl.replace(/-/g, '').split('/'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user