translate hidden_data and impl. translation print

This commit is contained in:
AntonObersteiner 2024-06-03 13:55:37 +02:00
parent 63af3f72f8
commit bb523e2c47

View file

@ -49,21 +49,36 @@ in the menu 'List' (bottom right).
# Groß-Klein-Schreibung # Groß-Klein-Schreibung
date = "05.06.2024" date = "05.06.2024"
hidden_data = [ hidden_data = [
"Anna Bartel: Zweitversuch nicht bestanden.", "Anna Bartel: Zweitversuch nicht bestanden.\n"
"Boris Parsch: Zweitversuch nicht bestanden.", "Anna Bartel: second attempt not passed.",
"Carola Winter: 2. Versuch nicht bestanden.", "Boris Parsch: Zweitversuch nicht bestanden.\n"
"Dennis Meier: 2. Versuch nicht bestanden.", "Boris Parsch: second attempt not passed.",
"Elisa Menniz: Zweitversuch nicht bestanden.", "Carola Winter: 2. Versuch nicht bestanden.\n"
f"Anna Bartel: Prüfung am {date} um 13:00.", "Carola Winter: 2nd attempt not passed.",
f"Boris Parsch: Prüfung am {date} um 14:00.", "Dennis Meier: 2. Versuch nicht bestanden.\n"
f"Carola Winter: Prüfung am {date} um 13:30.", "Dennis Meier: 2nd attempt not passed.",
f"Dennis Meier: Prüfung am {date} um 10:00.", "Elisa Menniz: Zweitversuch nicht bestanden.\n"
f"Elisa Menniz: Prüfung am {date} um 14:30.", "Elisa Menniz: second attempt not passed.",
f"Anna Bartel: blaue Augen.", f"Anna Bartel: Prüfung am {date} um 13:00.\n"
f"Boris Parsch: blaue Augen.", f"Anna Bartel: exam on {date}, 13:00.",
f"Carola Winter: blaue Augen.", f"Boris Parsch: Prüfung am {date} um 14:00.\n"
f"Dennis Meier: grüne Augen.", f"Boris Parsch: exam on {date}, 14:00.",
f"Elisa Menniz: grüne Augen.", f"Carola Winter: Prüfung am {date} um 13:30.\n"
f"Carola Winter: exam on {date}, 13:30.",
f"Dennis Meier: Prüfung am {date} um 10:00.\n"
f"Dennis Meier: exam on {date}, 10:00.",
f"Elisa Menniz: Prüfung am {date} um 14:30.\n"
f"Elisa Menniz: exam on {date}, 14:30.",
f"Anna Bartel: blaue Augen.\n"
f"Anna Bartel: blue eyes.",
f"Boris Parsch: blaue Augen.\n"
f"Boris Parsch: blue eyes.",
f"Carola Winter: blaue Augen.\n"
f"Carola Winter: blue eyes.",
f"Dennis Meier: grüne Augen.\n"
f"Dennis Meier: green eyes.",
f"Elisa Menniz: grüne Augen.\n"
f"Elisa Menniz: green eyes.",
] ]
network = Network( network = Network(
@ -117,14 +132,14 @@ network = Network(
), ),
versuch = Choice( versuch = Choice(
nicht = [ nicht = [
("Erstversuch ", "first attempt"), ("Erstversuch ", "first attempt "),
("1. Versuch ", "1st attempt"), ("1. Versuch ", "1st attempt "),
], ],
bestanden = [ bestanden = [
("Erstversuch ", "first attempt"), ("Erstversuch ", "first attempt "),
("1. Versuch ", "1st attempt"), ("1. Versuch ", "1st attempt "),
("Zweitversuch ", "second attempt"), ("Zweitversuch ", "second attempt "),
("2. Versuch ", "2nd attempt"), ("2. Versuch ", "2nd attempt "),
], ],
), ),
nicht = Choice( nicht = Choice(
@ -147,8 +162,18 @@ def generate_text(number_of_lines = 200):
result = "" result = ""
for i in range(number_of_lines): for i in range(number_of_lines):
emissions, _ = network.choose() emissions, _ = network.choose()
line = ''.join(emissions) german = ""
result += line + "\n" english = ""
for emission in emissions:
match emission:
case (ger, eng):
german += ger
english += eng
case both:
german += both
english += both
result += german + "\n"
result += english + "\n"
if random() < len(hidden_data) / (number_of_lines - i): if random() < len(hidden_data) / (number_of_lines - i):
result += pop_hidden_data() + "\n" result += pop_hidden_data() + "\n"
return result return result