scripts: Include mnemonics
This commit is contained in:
parent
fe007a2c02
commit
54d039435c
@ -43,11 +43,8 @@ def csv_to_vocab(filename, type, from_id):
|
|||||||
if (skip < 4):
|
if (skip < 4):
|
||||||
continue
|
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
|
# 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]
|
grundform = row[0]
|
||||||
hint = ""
|
hint = ""
|
||||||
@ -68,22 +65,28 @@ def csv_to_vocab(filename, type, from_id):
|
|||||||
bedeutungen.append(row[4])
|
bedeutungen.append(row[4])
|
||||||
if (row[5] != ""):
|
if (row[5] != ""):
|
||||||
bedeutungen.append(row[5])
|
bedeutungen.append(row[5])
|
||||||
|
if (row[6] != ""):
|
||||||
|
bedeutungen.append(row[6])
|
||||||
|
|
||||||
|
if (row[7] != ""):
|
||||||
|
mnemonic = row[7]
|
||||||
|
|
||||||
latin["genitiv"] = genitiv
|
latin["genitiv"] = genitiv
|
||||||
latin["genus"] = genus
|
latin["genus"] = genus
|
||||||
elif (type == TYPE_VERBS):
|
elif (type == TYPE_VERBS):
|
||||||
# Verb
|
# Verb
|
||||||
praesens = row[1]
|
praesens = row[1]
|
||||||
perfekt = row[2]
|
bedeutungen = [row[2]]
|
||||||
bedeutungen = [row[3]]
|
if (row[3] != ""):
|
||||||
|
bedeutungen.append(row[3])
|
||||||
if (row[4] != ""):
|
if (row[4] != ""):
|
||||||
bedeutungen.append(row[4])
|
bedeutungen.append(row[4])
|
||||||
if (row[5] != ""):
|
|
||||||
bedeutungen.append(row[5])
|
|
||||||
|
|
||||||
|
if (row[6] != ""):
|
||||||
|
mnemonic = row[6]
|
||||||
|
|
||||||
latin["praesens"] = praesens
|
latin["praesens"] = praesens
|
||||||
latin["perfekt"] = perfekt
|
#latin["perfekt"] = perfekt
|
||||||
latin["ppp"] = ""
|
|
||||||
elif (type == TYPE_ADJECTIVES):
|
elif (type == TYPE_ADJECTIVES):
|
||||||
# Adjektiv
|
# Adjektiv
|
||||||
endung_f = row[1]
|
endung_f = row[1]
|
||||||
@ -94,6 +97,9 @@ def csv_to_vocab(filename, type, from_id):
|
|||||||
if (row[5] != ""):
|
if (row[5] != ""):
|
||||||
bedeutungen.append(row[5])
|
bedeutungen.append(row[5])
|
||||||
|
|
||||||
|
if (row[6] != ""):
|
||||||
|
mnemonic = row[6]
|
||||||
|
|
||||||
latin["endung_f"] = endung_f
|
latin["endung_f"] = endung_f
|
||||||
latin["endung_n"] = endung_n
|
latin["endung_n"] = endung_n
|
||||||
elif (type == TYPE_ADVERBS):
|
elif (type == TYPE_ADVERBS):
|
||||||
@ -103,8 +109,15 @@ def csv_to_vocab(filename, type, from_id):
|
|||||||
bedeutungen.append(row[2])
|
bedeutungen.append(row[2])
|
||||||
if (row[3] != ""):
|
if (row[3] != ""):
|
||||||
bedeutungen.append(row[3])
|
bedeutungen.append(row[3])
|
||||||
|
if (row[4] != ""):
|
||||||
# TODO: Hints and mnemonics
|
bedeutungen.append(row[4])
|
||||||
|
|
||||||
|
if (row[5] != ""):
|
||||||
|
mnemonic = row[5]
|
||||||
|
|
||||||
|
if mnemonic != "":
|
||||||
|
print("Found mnemonic for:", latin["grundform"])
|
||||||
|
|
||||||
vocab.append({
|
vocab.append({
|
||||||
"id": id,
|
"id": id,
|
||||||
"german": bedeutungen,
|
"german": bedeutungen,
|
||||||
|
Reference in New Issue
Block a user