feat: Don't forget about the adverbs
This commit is contained in:
parent
2971069954
commit
d6f5ef4cc5
@ -29,6 +29,10 @@ export interface IAdjektivData {
|
|||||||
endung_n: string;
|
endung_n: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface IAdverbData {
|
||||||
|
grundform: string;
|
||||||
|
};
|
||||||
|
|
||||||
export interface IVocab {
|
export interface IVocab {
|
||||||
// If a word has multiple meanings
|
// If a word has multiple meanings
|
||||||
german: string[];
|
german: string[];
|
||||||
@ -36,7 +40,7 @@ export interface IVocab {
|
|||||||
mnemonic?: string;
|
mnemonic?: string;
|
||||||
|
|
||||||
type: VocabType;
|
type: VocabType;
|
||||||
latin: INomenData | IVerbData | IAdjektivData;
|
latin: INomenData | IVerbData | IAdjektivData | IAdverbData;
|
||||||
|
|
||||||
// This number is unique across all vocabulary items
|
// This number is unique across all vocabulary items
|
||||||
id: number;
|
id: number;
|
||||||
@ -152,9 +156,14 @@ export function vocabToReviewCard(vocab: IVocab): IReviewCard[] {
|
|||||||
qtype: ReviewQType.ADJ_ENDUNG_N,
|
qtype: ReviewQType.ADJ_ENDUNG_N,
|
||||||
id: vocab.id,
|
id: vocab.id,
|
||||||
}];
|
}];
|
||||||
default:
|
case VocabType.ADVERB:
|
||||||
// TODO: Remove after removing Adverbien
|
return [{
|
||||||
return [];
|
// Latin -> German
|
||||||
|
question: vocab.latin.grundform,
|
||||||
|
answers: vocab.german,
|
||||||
|
qtype: ReviewQType.GERMAN,
|
||||||
|
id: vocab.id,
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ const LevelPageWithRouter = withRouter(
|
|||||||
<b>Endung neutrum:</b> {aData.endung_n}
|
<b>Endung neutrum:</b> {aData.endung_n}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>;
|
</div>;
|
||||||
default:
|
case VocabType.ADVERB:
|
||||||
return <div />;
|
return <div />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,9 @@ import CloseIcon from "@material-ui/icons/Close";
|
|||||||
|
|
||||||
import { withRouter } from "react-router-dom";
|
import { withRouter } from "react-router-dom";
|
||||||
|
|
||||||
import { IVocab, IReviewCard, vocabToReviewCard, reviewQTypeToStr } from "../models/vocab";
|
import {
|
||||||
|
IVocab, IReviewCard, vocabToReviewCard, reviewQTypeToStr, VocabType
|
||||||
|
} from "../models/vocab";
|
||||||
import { ReviewType, IReviewMetadata } from "../models/review";
|
import { ReviewType, IReviewMetadata } from "../models/review";
|
||||||
|
|
||||||
import { levW } from "../algorithms/levenshtein";
|
import { levW } from "../algorithms/levenshtein";
|
||||||
@ -139,10 +141,6 @@ const ReviewPageWithRouter = withRouter(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
vocabFromId = (id: number): IVocab | {} => {
|
|
||||||
return this.vocab.find((el) => el.id === this.props.current.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// When a vocabulary item has been answered, we need to update
|
// When a vocabulary item has been answered, we need to update
|
||||||
// the group's SuperMemo2-data.
|
// the group's SuperMemo2-data.
|
||||||
// We update based on the following State-Machine: (C = Correct; W = Wrong)
|
// We update based on the following State-Machine: (C = Correct; W = Wrong)
|
||||||
@ -275,12 +273,25 @@ const ReviewPageWithRouter = withRouter(
|
|||||||
|
|
||||||
const { question, qtype } = this.props.current;
|
const { question, qtype } = this.props.current;
|
||||||
const questionTitle = `${question} (${reviewQTypeToStr(qtype)})`;
|
const questionTitle = `${question} (${reviewQTypeToStr(qtype)})`;
|
||||||
// TODO/NOTE: This assumes that each vocabulary item gets mapped to
|
|
||||||
// exactly 3 review cards
|
// NOTE: This assumes that adverbs get mapped to only 1 card,
|
||||||
|
// while every other type of vocabulary gets mapped to
|
||||||
|
// exactly 3 cards each.
|
||||||
// NOTE: The 'numCards === 0 ?' is neccessary as (for some reasdn) numCards
|
// NOTE: The 'numCards === 0 ?' is neccessary as (for some reasdn) numCards
|
||||||
// starts of by being 0, which results in progress === -Inifinity.
|
// starts of by being 0, which results in progress === -Inifinity.
|
||||||
// That looks weird as the user sees the progressbar jump.
|
// That looks weird as the user sees the progressbar jump.
|
||||||
const numCards = this.vocab.length * 3;
|
// NOTE: The arrow function needs the ': number' annotation as TS
|
||||||
|
// will then deduce the type of acc and curr to be '1|3',
|
||||||
|
// leads to compiler warnings, as a, b element {1, 3} is not
|
||||||
|
// element {1, 3}.
|
||||||
|
const numCards = this.vocab.map((vocab): number => {
|
||||||
|
if (vocab.type === VocabType.ADVERB) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}).reduce((acc, curr) => acc + curr);
|
||||||
|
|
||||||
const progress = numCards === 0 ? (
|
const progress = numCards === 0 ? (
|
||||||
0
|
0
|
||||||
) : (
|
) : (
|
||||||
|
@ -7,6 +7,7 @@ import pymongo
|
|||||||
TYPE_NOUNS = 0
|
TYPE_NOUNS = 0
|
||||||
TYPE_VERBS = 1
|
TYPE_VERBS = 1
|
||||||
TYPE_ADJECTIVES = 2
|
TYPE_ADJECTIVES = 2
|
||||||
|
TYPE_ADVERB = 3
|
||||||
|
|
||||||
PATH_TO_VOCAB = "../data/vocab"
|
PATH_TO_VOCAB = "../data/vocab"
|
||||||
|
|
||||||
@ -92,6 +93,13 @@ def csv_to_vocab(filename, type, from_id):
|
|||||||
|
|
||||||
latin["endung_f"] = endung_f
|
latin["endung_f"] = endung_f
|
||||||
latin["endung_n"] = endung_n
|
latin["endung_n"] = endung_n
|
||||||
|
elif (type == TYPE_ADVERB):
|
||||||
|
# Adverb
|
||||||
|
bedeutungen = [row[1]]
|
||||||
|
if (row[2] != ""):
|
||||||
|
bedeutungen.append(row[2])
|
||||||
|
if (row[3] != ""):
|
||||||
|
bedeutungen.append(row[3])
|
||||||
|
|
||||||
# TODO: Hints and mnemonics
|
# TODO: Hints and mnemonics
|
||||||
vocab.append({
|
vocab.append({
|
||||||
@ -130,6 +138,11 @@ adj, last_id = csv_to_vocab("Adjektive.csv", TYPE_ADJECTIVES, last_id)
|
|||||||
vocab += adj
|
vocab += adj
|
||||||
id = last_id
|
id = last_id
|
||||||
|
|
||||||
|
log("Adverbs...", tabs=1)
|
||||||
|
adj, last_id = csv_to_vocab("Adverbien.csv", TYPE_ADVERBS, last_id)
|
||||||
|
vocab += adj
|
||||||
|
|
||||||
|
|
||||||
# Connect to the database
|
# Connect to the database
|
||||||
log("Inserting vocabulary into database")
|
log("Inserting vocabulary into database")
|
||||||
log("Connecting...", tabs=1)
|
log("Connecting...", tabs=1)
|
||||||
|
Reference in New Issue
Block a user