160 lines
3.8 KiB
Python
160 lines
3.8 KiB
Python
|
|
||
|
from choice_network import Choice, FixedText, RandInt, Network
|
||
|
|
||
|
def get_names(filename, pad = " "):
|
||
|
lines = []
|
||
|
with open(filename) as file:
|
||
|
lines = file.read().split("\n")
|
||
|
names = [
|
||
|
name + pad
|
||
|
for name in lines
|
||
|
if len(name) > 1
|
||
|
]
|
||
|
return names
|
||
|
|
||
|
greeting = (
|
||
|
"""
|
||
|
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ß
|
||
|
|
||
|
""", """
|
||
|
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
|
||
|
""")
|
||
|
|
||
|
hidden_data = [
|
||
|
("Anna Bartel: Zweitversuch nicht bestanden.",
|
||
|
"Anna Bartel: second attempt not passed."),
|
||
|
("Boris Parsch: Zweitversuch nicht bestanden.",
|
||
|
"Boris Parsch: second attempt not passed."),
|
||
|
("Charlotte Winter: 2. Versuch nicht bestanden.",
|
||
|
"Charlotte Winter: 2nd attempt not passed."),
|
||
|
("Dennis Meier: 2. Versuch nicht bestanden.",
|
||
|
"Dennis Meier: 2nd attempt not passed."),
|
||
|
("Elisa Menniz: Zweitversuch nicht bestanden.",
|
||
|
"Elisa Menniz: second attempt not passed."),
|
||
|
(f"Anna Bartel: Prüfung um 13:00.",
|
||
|
f"Anna Bartel: exam, 13:00."),
|
||
|
(f"Boris Parsch: Prüfung um 14:00.",
|
||
|
f"Boris Parsch: exam, 14:00."),
|
||
|
(f"Charlotte Winter: Prüfung um 13:30.",
|
||
|
f"Charlotte Winter: exam, 13:30."),
|
||
|
(f"Dennis Meier: Prüfung um 10:00.",
|
||
|
f"Dennis Meier: exam, 10:00."),
|
||
|
(f"Elisa Menniz: Prüfung um 14:30.",
|
||
|
f"Elisa Menniz: exam, 14:30."),
|
||
|
(f"Anna Bartel: blaue Augen.",
|
||
|
f"Anna Bartel: blue eyes."),
|
||
|
(f"Boris Parsch: blaue Augen.",
|
||
|
f"Boris Parsch: blue eyes."),
|
||
|
(f"Charlotte Winter: blaue Augen.",
|
||
|
f"Charlotte Winter: blue eyes."),
|
||
|
(f"Dennis Meier: grüne Augen.",
|
||
|
f"Dennis Meier: green eyes."),
|
||
|
(f"Elisa Menniz: grüne Augen.",
|
||
|
f"Elisa Menniz: green eyes."),
|
||
|
]
|
||
|
|
||
|
network = Network(
|
||
|
start = Choice(
|
||
|
student = [""],
|
||
|
),
|
||
|
student = Choice(
|
||
|
last_name = get_names("vornamen.csv"),
|
||
|
),
|
||
|
last_name = Choice(
|
||
|
student_mit = get_names("nachnamen.csv", pad = ""),
|
||
|
),
|
||
|
student_mit = Choice(
|
||
|
hat_den = [""],
|
||
|
),
|
||
|
hat_den = Choice(
|
||
|
versuch = [": ",],
|
||
|
prüfungszeit = [(f": Prüfung um ", f": exam, ")],
|
||
|
augenfarbe = [": ",],
|
||
|
),
|
||
|
augenfarbe = Choice(
|
||
|
augen = [
|
||
|
("grüne ", "green "),
|
||
|
("braune ", "brown "),
|
||
|
("blaue ", "blue "),
|
||
|
],
|
||
|
),
|
||
|
augen = FixedText(
|
||
|
stop = ("Augen.", "eyes."),
|
||
|
),
|
||
|
prüfungszeit = Choice(
|
||
|
uhr = [
|
||
|
"09:00",
|
||
|
"09:30",
|
||
|
"10:00",
|
||
|
"10:30",
|
||
|
"11:00",
|
||
|
"11:30",
|
||
|
"12:00",
|
||
|
"12:30",
|
||
|
"13:00",
|
||
|
"13:30",
|
||
|
"14:00",
|
||
|
"14:30",
|
||
|
"15:00",
|
||
|
"15:30",
|
||
|
],
|
||
|
),
|
||
|
uhr = FixedText(
|
||
|
stop = (" Uhr.", "."),
|
||
|
),
|
||
|
versuch = Choice(
|
||
|
nicht = [
|
||
|
("Erstversuch ", "first attempt "),
|
||
|
("1. Versuch ", "1st attempt "),
|
||
|
],
|
||
|
bestanden = [
|
||
|
("Erstversuch ", "first attempt "),
|
||
|
("1. Versuch ", "1st attempt "),
|
||
|
("Zweitversuch ", "second attempt "),
|
||
|
("2. Versuch ", "2nd attempt "),
|
||
|
],
|
||
|
),
|
||
|
nicht = Choice(
|
||
|
bestanden = [
|
||
|
("nicht ", "not "),
|
||
|
""
|
||
|
],
|
||
|
),
|
||
|
bestanden = FixedText(
|
||
|
stop = ("bestanden.", "passed."),
|
||
|
),
|
||
|
)
|
||
|
|