summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adjectives.json1
-rw-r--r--kasus.py33
-rw-r--r--nouns.json1
-rw-r--r--query.py21
-rw-r--r--solver.py3
5 files changed, 59 insertions, 0 deletions
diff --git a/adjectives.json b/adjectives.json
new file mode 100644
index 0000000..26febff
--- /dev/null
+++ b/adjectives.json
@@ -0,0 +1 @@
+["schön"]
diff --git a/kasus.py b/kasus.py
new file mode 100644
index 0000000..ba286eb
--- /dev/null
+++ b/kasus.py
@@ -0,0 +1,33 @@
+from colorama import Fore, Back, Style
+
+import query
+import solver
+
+total = 0
+correct = 0
+
+while True:
+ case, article, number, adjective, noun = query.get()
+
+ parameters = f"{Fore.MAGENTA}{case}, {Fore.BLUE}{article}, {Fore.YELLOW}{number}{Style.RESET_ALL}"
+ queryString = f"{noun}, {adjective}"
+
+ total += 1
+ print(f"{Style.BRIGHT}--- Übung {total} ---{Style.NORMAL}")
+ print(parameters)
+ print(queryString)
+ print()
+
+ response = input("> ")
+
+ solution = solver.solve(case, article, number, adjective, noun)
+ print(f"{Style.BRIGHT}", end="")
+
+ if response == solution:
+ correct += 1
+ print(f"{Fore.GREEN}Richtig ({correct}/{total})")
+ else:
+ print(f"{Fore.RED}Falsch ({correct}/{total}):{Style.RESET_ALL} {solution}")
+
+ print(f"{Style.RESET_ALL}")
+
diff --git a/nouns.json b/nouns.json
new file mode 100644
index 0000000..ce56ce0
--- /dev/null
+++ b/nouns.json
@@ -0,0 +1 @@
+[{"Hund"}]
diff --git a/query.py b/query.py
new file mode 100644
index 0000000..c89b3a7
--- /dev/null
+++ b/query.py
@@ -0,0 +1,21 @@
+import json
+import random
+
+CASES = ["Nominativ", "Akkusativ", "Dativ", "Genitiv"]
+ARTICLES = ["bestimmter", "unbestimmter", "kein"]
+CARDINALITIES = ["Singular"] * 3 + ["Plural"]
+
+with open("adjectives.json", "r") as f:
+ ADJECTIVES = json.load(f)
+
+with open("nouns.json", "r") as f:
+ NOUNS = json.load(f)
+
+def get():
+ case = random.choice(CASES)
+ article = random.choice(ARTICLES)
+ cardinality = random.choice(CARDINALITIES)
+ adjective = random.choice(ADJECTIVES)
+ noun = random.choice(NOUNS)
+
+ return case, article, cardinality, adjective, noun
diff --git a/solver.py b/solver.py
new file mode 100644
index 0000000..e322c8c
--- /dev/null
+++ b/solver.py
@@ -0,0 +1,3 @@
+
+def solve(case, article, number, adjective, noun):
+ return ""