summaryrefslogtreecommitdiffstats
path: root/query.py
diff options
context:
space:
mode:
Diffstat (limited to 'query.py')
-rw-r--r--query.py21
1 files changed, 21 insertions, 0 deletions
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