integrate the hidden data
This commit is contained in:
parent
e0e6f60196
commit
b9fa82f82b
20
generate.py
20
generate.py
|
@ -38,6 +38,13 @@ Maybe you can filter it with regular expressions? Good luck.
|
||||||
# fünf Tatverdächtige
|
# fünf Tatverdächtige
|
||||||
# Uhrzeiten, siehe Infos von Verantwortlichen
|
# Uhrzeiten, siehe Infos von Verantwortlichen
|
||||||
# Groß-Klein-Schreibung
|
# 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(
|
network = Network(
|
||||||
start = Choice(
|
start = Choice(
|
||||||
|
@ -51,7 +58,7 @@ network = Network(
|
||||||
student_mit = get_names("nachnamen.csv"),
|
student_mit = get_names("nachnamen.csv"),
|
||||||
),
|
),
|
||||||
student_mit = Choice(
|
student_mit = Choice(
|
||||||
matr_nr = ["mit "],
|
matr_nr = ["mit ", ", "],
|
||||||
),
|
),
|
||||||
matr_nr = Choice(
|
matr_nr = Choice(
|
||||||
matr_number = ["Matrikelnummer ", "Matrikel-Nummer ", "MatrNr. ", "Matrikel-Nr. "],
|
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 = ""
|
result = ""
|
||||||
for i in range(200):
|
for i in range(number_of_lines):
|
||||||
emissions, _ = network.choose()
|
emissions, _ = network.choose()
|
||||||
line = ''.join(emissions)
|
line = ''.join(emissions)
|
||||||
result += line + "\n"
|
result += line + "\n"
|
||||||
|
if random() < len(hidden_data) / (number_of_lines - i):
|
||||||
|
result += pop_hidden_data() + "\n"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def read_template(filename = "./template.html"):
|
def read_template(filename = "./template.html"):
|
||||||
|
|
Loading…
Reference in a new issue