131 lines
2.9 KiB
TypeScript
131 lines
2.9 KiB
TypeScript
export enum ReviewMode {
|
|
GER_TO_LAT,
|
|
LAT_TO_GER,
|
|
};
|
|
|
|
export enum VocabType {
|
|
NOMEN,
|
|
VERB,
|
|
ADJEKTIV,
|
|
ADVERB
|
|
};
|
|
|
|
export interface INomenData {
|
|
grundform: string;
|
|
genitiv: string;
|
|
genus: string;
|
|
};
|
|
|
|
export interface IVerbData {
|
|
grundform: string;
|
|
// 1. Person
|
|
praesens: string;
|
|
perfekt: string;
|
|
ppp: string;
|
|
};
|
|
|
|
export interface IAdjektivData {
|
|
grundform: string;
|
|
nominativ_a: string;
|
|
nominativ_b: string;
|
|
};
|
|
|
|
export interface IVocab {
|
|
// If a word has multiple meanings
|
|
german: string[];
|
|
hint?: string;
|
|
mnemonic?: string;
|
|
|
|
type: VocabType;
|
|
latin: INomenData | IVerbData | IAdjektivData;
|
|
|
|
// This number is unique across all vocabulary items
|
|
id: number;
|
|
};
|
|
|
|
// What kind of question should be answered
|
|
export enum ReviewQType {
|
|
GERMAN,
|
|
|
|
NOMEN_GENITIV,
|
|
NOMEN_GENUS,
|
|
|
|
ADJ_NOM_A,
|
|
ADJ_NOM_B,
|
|
|
|
VERB_PRAESENS,
|
|
VERB_PERFEKT,
|
|
VERB_PPP
|
|
};
|
|
|
|
export interface IReviewCard {
|
|
question: string;
|
|
// If a question can have multiple answers
|
|
answers: string[];
|
|
|
|
qtype: ReviewQType;
|
|
|
|
// Identical to its corresponding IVocab item
|
|
id: number;
|
|
};
|
|
|
|
export function reviewQTypeToStr(type: ReviewQType): string {
|
|
switch (type) {
|
|
case ReviewQType.GERMAN:
|
|
return "Übersetzung";
|
|
case ReviewQType.NOMEN_GENITIV:
|
|
return "Genitiv";
|
|
case ReviewQType.NOMEN_GENUS:
|
|
return "Genus";
|
|
case ReviewQType.ADJ_NOM_A:
|
|
// TODO
|
|
return "Nominativ A";
|
|
case ReviewQType.ADJ_NOM_B:
|
|
// TODO
|
|
return "Nominativ B";
|
|
case ReviewQType.VERB_PRAESENS:
|
|
return "1. Person Präsens";
|
|
case ReviewQType.VERB_PERFEKT:
|
|
return "1. Person Perfekt";
|
|
case ReviewQType.VERB_PPP:
|
|
// TODO
|
|
return "PPP";
|
|
}
|
|
}
|
|
|
|
// Turn a vocabulaty item into a series of questions about the item
|
|
export function vocabToReviewCard(vocab: IVocab): IReviewCard[] {
|
|
switch (vocab.type) {
|
|
case VocabType.NOMEN:
|
|
const latin = vocab.latin as INomenData;
|
|
return [{
|
|
// Latin -> German
|
|
question: latin.grundform,
|
|
answers: vocab.german,
|
|
qtype: ReviewQType.GERMAN,
|
|
id: vocab.id,
|
|
}, {
|
|
// Latin -> Genitiv
|
|
question: latin.grundform,
|
|
answers: [latin.genitiv],
|
|
qtype: ReviewQType.NOMEN_GENITIV,
|
|
id: vocab.id,
|
|
}, {
|
|
// Latin -> Genus
|
|
question: latin.grundform,
|
|
answers: [latin.genus],
|
|
qtype: ReviewQType.NOMEN_GENUS,
|
|
id: vocab.id,
|
|
}];
|
|
default:
|
|
return [];
|
|
}
|
|
}
|
|
|
|
export function typeToPoints(type: VocabType) {
|
|
switch (type) {
|
|
// Nomen: 2P + 1 (Wenn richtig)
|
|
//
|
|
}
|
|
};
|