Compare commits
10 commits
03c2329c7b
...
a3d057d5b0
Author | SHA1 | Date | |
---|---|---|---|
a3d057d5b0 | |||
742843cc78 | |||
6345a765d8 | |||
428d549b91 | |||
c6d2415271 | |||
e71e30ce86 | |||
b4104d1717 | |||
1f52d02dda | |||
efd2146962 | |||
8d3f799ff6 |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,4 +2,4 @@
|
||||||
*.swo
|
*.swo
|
||||||
|
|
||||||
__pycache__
|
__pycache__
|
||||||
deploy/index.html
|
deploy/*/index.html
|
||||||
|
|
2086
deploy/de/regexr.css
Normal file
2086
deploy/de/regexr.css
Normal file
File diff suppressed because it is too large
Load diff
21008
deploy/de/regexr.js
Normal file
21008
deploy/de/regexr.js
Normal file
File diff suppressed because it is too large
Load diff
1
deploy/de/regexr.js.map
Normal file
1
deploy/de/regexr.js.map
Normal file
File diff suppressed because one or more lines are too long
2086
deploy/en/regexr.css
Normal file
2086
deploy/en/regexr.css
Normal file
File diff suppressed because it is too large
Load diff
21008
deploy/en/regexr.js
Normal file
21008
deploy/en/regexr.js
Normal file
File diff suppressed because it is too large
Load diff
1
deploy/en/regexr.js.map
Normal file
1
deploy/en/regexr.js.map
Normal file
File diff suppressed because one or more lines are too long
8
deploy/index.html
Normal file
8
deploy/index.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<a href="./de/index.html"> Deutsch </a>
|
||||||
|
<br />
|
||||||
|
<a href="./en/index.html"> English </a>
|
||||||
|
</body>
|
||||||
|
</html>
|
107
generate.py
107
generate.py
|
@ -15,11 +15,12 @@ def get_names(filename, pad = " "):
|
||||||
]
|
]
|
||||||
return names
|
return names
|
||||||
|
|
||||||
greeting = """
|
greeting = {"": """
|
||||||
Re: AW: Studierendenabfrage
|
Re: AW: Studierendenabfrage
|
||||||
von: Prüfungsverwaltung
|
von: Prüfungsverwaltung
|
||||||
---------
|
---------
|
||||||
Englisch version below.
|
English-only version at cc.ifsr.de/en, this page is bilingual.
|
||||||
|
Eine nur auf deutsch formulierte Variante ist unter cc.ifsr.de/de
|
||||||
|
|
||||||
Hallo,
|
Hallo,
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ Vielleicht können Sie die ja mit regulären Ausdrücken filtern.
|
||||||
Das funktioniert wie normale Text-Suche, nur etwas flexibler:
|
Das funktioniert wie normale Text-Suche, nur etwas flexibler:
|
||||||
(Erst|Zweit)versuch z.B. würde sowohl 'Erstversuch'
|
(Erst|Zweit)versuch z.B. würde sowohl 'Erstversuch'
|
||||||
als auch 'Zweitversuch' markieren.
|
als auch 'Zweitversuch' markieren.
|
||||||
.+ akzeptiert alle Zeichen, das können Sie an die 'Expression'
|
.* akzeptiert alle Zeichen, das können Sie an die 'Expression'
|
||||||
(oben auf der Seite) vorn anfügen,
|
(oben auf der Seite) vorn anfügen,
|
||||||
um im Menü 'List' unten rechts den Anfang der Zeile zu sehen.
|
um im Menü 'List' unten rechts den Anfang der Zeile zu sehen.
|
||||||
Sie sollten etwa 5 Studierende finden.
|
Sie sollten etwa 5 Studierende finden.
|
||||||
|
@ -39,24 +40,61 @@ Viel Spaß
|
||||||
|
|
||||||
=== ENGLISCH VERSION ===
|
=== ENGLISCH VERSION ===
|
||||||
Hi,
|
Hi,
|
||||||
|
|
||||||
there is no database for this exam, so I added our digitized notes below,
|
there is no database for this exam, so I added our digitized notes below,
|
||||||
always with the auto-generated english translation.
|
always with the auto-generated english translation.
|
||||||
Maybe you can filter it with regular expressions?
|
Maybe you can filter it with regular expressions?
|
||||||
They are like normal text-search but more flexible:
|
They are like normal text-search but more flexible:
|
||||||
E.g.: (Erst|Zweit)versuch would select both words:
|
E.g.: (Erst|Zweit)versuch would select both words:
|
||||||
'Erstversuch' (first attempt) and 'Zweitversuch' (second attempt).
|
'Erstversuch' (first attempt) and 'Zweitversuch' (second attempt).
|
||||||
.+ will accept any text, you can add it at the start of the expression
|
.* will accept any text, you can add it at the start of the expression
|
||||||
(top of page)
|
(top of page) to see the whole line in the menu 'List' (bottom right).
|
||||||
to see the whole line in the menu 'List' (bottom right).
|
|
||||||
You should find approximately 5 students.
|
You should find approximately 5 students.
|
||||||
|
|
||||||
Good Luck
|
Good Luck
|
||||||
"""
|
""", "de": """
|
||||||
|
Re: AW: Studierendenabfrage
|
||||||
|
von: Prüfungsverwaltung
|
||||||
|
---------
|
||||||
|
|
||||||
|
Hallo,
|
||||||
|
|
||||||
|
Zur angefragten Prüfung gibt es leider noch keine Datenbank,
|
||||||
|
daher unten angefügt unsere Notizen aus Prüfungsakten und Personendatenbank.
|
||||||
|
Vielleicht können Sie die ja mit regulären Ausdrücken filtern.
|
||||||
|
Das funktioniert wie normale Text-Suche, nur etwas flexibler:
|
||||||
|
(Erst|Zweit)versuch z.B. würde sowohl 'Erstversuch'
|
||||||
|
als auch 'Zweitversuch' markieren.
|
||||||
|
.* akzeptiert alle Zeichen, das können Sie an die 'Expression'
|
||||||
|
(oben auf der Seite) vorn anfügen,
|
||||||
|
um im Menü 'List' unten rechts den Anfang der Zeile zu sehen.
|
||||||
|
Sie sollten etwa 5 Studierende finden.
|
||||||
|
|
||||||
|
Viel Spaß
|
||||||
|
|
||||||
|
""", "en": """
|
||||||
|
Re: AW: Student data request
|
||||||
|
from: Exam management
|
||||||
|
---------
|
||||||
|
|
||||||
|
Hi,
|
||||||
|
|
||||||
|
there is no database for this exam, so I added our digitized notes below .
|
||||||
|
Maybe you can filter it with regular expressions?
|
||||||
|
They are like normal text-search but more flexible:
|
||||||
|
E.g.: /(first|second) attempt/ would select both:
|
||||||
|
'first attempt' and 'second attempt'.
|
||||||
|
.* will accept any text, you can add it at the start of the expression
|
||||||
|
(top of page) to see the whole line in the menu 'List' (bottom right).
|
||||||
|
You should find approximately 5 students.
|
||||||
|
|
||||||
|
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
|
||||||
date = "05.06.2024"
|
date = "06.06.2024"
|
||||||
hidden_data = [
|
hidden_data = [
|
||||||
"Anna Bartel: Zweitversuch nicht bestanden.\n"
|
"Anna Bartel: Zweitversuch nicht bestanden.\n"
|
||||||
"Anna Bartel: second attempt not passed.",
|
"Anna Bartel: second attempt not passed.",
|
||||||
|
@ -68,16 +106,16 @@ hidden_data = [
|
||||||
"Dennis Meier: 2nd attempt not passed.",
|
"Dennis Meier: 2nd attempt not passed.",
|
||||||
"Elisa Menniz: Zweitversuch nicht bestanden.\n"
|
"Elisa Menniz: Zweitversuch nicht bestanden.\n"
|
||||||
"Elisa Menniz: second attempt not passed.",
|
"Elisa Menniz: second attempt not passed.",
|
||||||
f"Anna Bartel: Prüfung am {date} um 13:00.\n"
|
f"Anna Bartel: Prüfung um 13:00.\n"
|
||||||
f"Anna Bartel: exam on {date}, 13:00.",
|
f"Anna Bartel: exam, 13:00.",
|
||||||
f"Boris Parsch: Prüfung am {date} um 14:00.\n"
|
f"Boris Parsch: Prüfung um 14:00.\n"
|
||||||
f"Boris Parsch: exam on {date}, 14:00.",
|
f"Boris Parsch: exam, 14:00.",
|
||||||
f"Charlotte Winter: Prüfung am {date} um 13:30.\n"
|
f"Charlotte Winter: Prüfung um 13:30.\n"
|
||||||
f"Charlotte Winter: exam on {date}, 13:30.",
|
f"Charlotte Winter: exam, 13:30.",
|
||||||
f"Dennis Meier: Prüfung am {date} um 10:00.\n"
|
f"Dennis Meier: Prüfung um 10:00.\n"
|
||||||
f"Dennis Meier: exam on {date}, 10:00.",
|
f"Dennis Meier: exam, 10:00.",
|
||||||
f"Elisa Menniz: Prüfung am {date} um 14:30.\n"
|
f"Elisa Menniz: Prüfung um 14:30.\n"
|
||||||
f"Elisa Menniz: exam on {date}, 14:30.",
|
f"Elisa Menniz: exam, 14:30.",
|
||||||
f"Anna Bartel: blaue Augen.\n"
|
f"Anna Bartel: blaue Augen.\n"
|
||||||
f"Anna Bartel: blue eyes.",
|
f"Anna Bartel: blue eyes.",
|
||||||
f"Boris Parsch: blaue Augen.\n"
|
f"Boris Parsch: blaue Augen.\n"
|
||||||
|
@ -105,7 +143,7 @@ network = Network(
|
||||||
),
|
),
|
||||||
hat_den = Choice(
|
hat_den = Choice(
|
||||||
versuch = [": ",],
|
versuch = [": ",],
|
||||||
prüfungszeit = [(f": Prüfung am {date} um ", f": exam on {date}, ")],
|
prüfungszeit = [(f": Prüfung um ", f": exam, ")],
|
||||||
augenfarbe = [": ",],
|
augenfarbe = [": ",],
|
||||||
),
|
),
|
||||||
augenfarbe = Choice(
|
augenfarbe = Choice(
|
||||||
|
@ -162,12 +200,12 @@ network = Network(
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def pop_hidden_data():
|
def generate_text(number_of_lines = 200, language = None):
|
||||||
global hidden_data
|
""" language can be None (both), "en" or "de".
|
||||||
index = randint(0, len(hidden_data) - 1)
|
"""
|
||||||
return hidden_data.pop(index)
|
local_hidden_data = hidden_data[:]
|
||||||
|
do_german = not language or language == "de"
|
||||||
def generate_text(number_of_lines = 200):
|
do_english = not language or language == "en"
|
||||||
result = ""
|
result = ""
|
||||||
for i in range(number_of_lines):
|
for i in range(number_of_lines):
|
||||||
emissions, _ = network.choose()
|
emissions, _ = network.choose()
|
||||||
|
@ -181,10 +219,14 @@ def generate_text(number_of_lines = 200):
|
||||||
case both:
|
case both:
|
||||||
german += both
|
german += both
|
||||||
english += both
|
english += both
|
||||||
result += german + "\n"
|
if do_german: result += german + "\n"
|
||||||
result += english + "\n"
|
if do_english: result += english + "\n"
|
||||||
if random() < len(hidden_data) / (number_of_lines - i):
|
if random() < len(local_hidden_data) / (number_of_lines - i):
|
||||||
result += pop_hidden_data() + "\n"
|
index = randint(0, len(local_hidden_data) - 1)
|
||||||
|
hidden_line = local_hidden_data.pop(index)
|
||||||
|
german, english = hidden_line.split("\n")
|
||||||
|
if do_german: result += german + "\n"
|
||||||
|
if do_english: result += english + "\n"
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def read_template(filename = "./template.html"):
|
def read_template(filename = "./template.html"):
|
||||||
|
@ -197,10 +239,11 @@ def write_index(text, filename = "./deploy/index.html"):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
template = read_template()
|
template = read_template()
|
||||||
generated = generate_text()
|
for language in ["de", "en"]:
|
||||||
generated = greeting + "\n" + generated
|
generated = generate_text(language = language)
|
||||||
|
generated = greeting[language] + "\n" + generated
|
||||||
text = template.replace("<replace with text>", generated)
|
text = template.replace("<replace with text>", generated)
|
||||||
write_index(text)
|
write_index(text, filename = f"./deploy/{language}/index.html")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue