summaryrefslogtreecommitdiffstats
path: root/solver.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-10-18 21:02:31 +0200
committerEddy Pedroni <eddy@0xf7.com>2022-10-18 21:02:31 +0200
commit7bc31c0d156feb0cf07949a439b6d29fb07d6b45 (patch)
tree1ad1494ee27248ff2c8d878adc0d8fb495200d55 /solver.py
parent0d07220aeceae94fc05b12c4c98bec9ee28026b4 (diff)
Added common-nouns list, minor bugfixes
Diffstat (limited to 'solver.py')
-rw-r--r--solver.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/solver.py b/solver.py
index 4c302b5..7935204 100644
--- a/solver.py
+++ b/solver.py
@@ -48,14 +48,18 @@ def solve(query):
# full solution
decArt = tables.ARTICLES[query.article][query.case][gender]
+
adjEnding = tables.ADJ_ENDINGS[query.article][query.case][gender]
+ if adjEnding[0] == query.adjective[-1]:
+ adjEnding = adjEnding[1:]
+
decNoun = query.noun[nounKey]
# noun details
basicArt = tables.ARTICLES['bestimmter Artikel']['Nominativ'][gender]
basicNoun = query.noun[f"nom-{'plu' if query.cardinality == 'Plural' else 'sin'}"]
- if decNoun == "_":
+ if decNoun == "—":
raise Exception("Invalid query")
return Solution(f"{decArt} {query.adjective}{adjEnding} {decNoun}".strip(),