From b9fa82f82b943cd1675ccc04835432e6f91a9cc2 Mon Sep 17 00:00:00 2001 From: AntonObersteiner Date: Mon, 3 Jun 2024 11:02:01 +0200 Subject: [PATCH] integrate the hidden data --- generate.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/generate.py b/generate.py index 06b4192..c748306 100755 --- a/generate.py +++ b/generate.py @@ -38,6 +38,13 @@ Maybe you can filter it with regular expressions? Good luck. # fünf Tatverdächtige # Uhrzeiten, siehe Infos von Verantwortlichen # Groß-Klein-Schreibung +hidden_data = [ + "Anna Bartel hat den Zweitversuch nicht bestanden.", + "Student Boris Parsch mit Matrikelnummer hat den Zweitversuch nicht bestanden.", + "Studentin Carola Winter mit Matrikel-Nr. 4940456 hat den 2. Versuch nicht bestanden.", + "Student:in Dennis Meier hat den 2. Versuch nicht bestanden.", + "Elisa Menniz, MatrNr. 5143424 hat den Zweitversuch nicht bestanden.", +] network = Network( start = Choice( @@ -51,7 +58,7 @@ network = Network( student_mit = get_names("nachnamen.csv"), ), student_mit = Choice( - matr_nr = ["mit "], + matr_nr = ["mit ", ", "], ), matr_nr = Choice( matr_number = ["Matrikelnummer ", "Matrikel-Nummer ", "MatrNr. ", "Matrikel-Nr. "], @@ -77,12 +84,19 @@ network = Network( ), ) -def generate_text(number_of_lines = 100): +def pop_hidden_data(): + global hidden_data + index = randint(0, len(hidden_data) - 1) + return hidden_data.pop(index) + +def generate_text(number_of_lines = 200): result = "" - for i in range(200): + for i in range(number_of_lines): emissions, _ = network.choose() line = ''.join(emissions) result += line + "\n" + if random() < len(hidden_data) / (number_of_lines - i): + result += pop_hidden_data() + "\n" return result def read_template(filename = "./template.html"):