scripts: Include mnemonics

This commit is contained in:
Alexander Polynomdivision 2018-10-21 22:44:20 +02:00
parent fe007a2c02
commit 54d039435c

View File

@ -43,11 +43,8 @@ def csv_to_vocab(filename, type, from_id):
if (skip < 4):
continue
# The nouns are special
row = preprocess_row(raw) if type == TYPE_NOUNS else raw
# Remove any whitespaces in front of or after the string
row = [col.strip() for col in row]
row = [col.strip() for col in raw]
grundform = row[0]
hint = ""
@ -68,22 +65,28 @@ def csv_to_vocab(filename, type, from_id):
bedeutungen.append(row[4])
if (row[5] != ""):
bedeutungen.append(row[5])
if (row[6] != ""):
bedeutungen.append(row[6])
if (row[7] != ""):
mnemonic = row[7]
latin["genitiv"] = genitiv
latin["genus"] = genus
elif (type == TYPE_VERBS):
# Verb
praesens = row[1]
perfekt = row[2]
bedeutungen = [row[3]]
bedeutungen = [row[2]]
if (row[3] != ""):
bedeutungen.append(row[3])
if (row[4] != ""):
bedeutungen.append(row[4])
if (row[5] != ""):
bedeutungen.append(row[5])
if (row[6] != ""):
mnemonic = row[6]
latin["praesens"] = praesens
latin["perfekt"] = perfekt
latin["ppp"] = ""
#latin["perfekt"] = perfekt
elif (type == TYPE_ADJECTIVES):
# Adjektiv
endung_f = row[1]
@ -94,6 +97,9 @@ def csv_to_vocab(filename, type, from_id):
if (row[5] != ""):
bedeutungen.append(row[5])
if (row[6] != ""):
mnemonic = row[6]
latin["endung_f"] = endung_f
latin["endung_n"] = endung_n
elif (type == TYPE_ADVERBS):
@ -103,8 +109,15 @@ def csv_to_vocab(filename, type, from_id):
bedeutungen.append(row[2])
if (row[3] != ""):
bedeutungen.append(row[3])
if (row[4] != ""):
bedeutungen.append(row[4])
if (row[5] != ""):
mnemonic = row[5]
if mnemonic != "":
print("Found mnemonic for:", latin["grundform"])
# TODO: Hints and mnemonics
vocab.append({
"id": id,
"german": bedeutungen,