summaryrefslogtreecommitdiffstats
path: root/kasus.py
blob: 68b0be0d43f7b4fa4e64206c97b73d43fcd2896c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from colorama import Fore, Back, Style
import readline

import solver

total = 0
correct = 0

while True:
    query, solution = solver.get()

    parameters = f"{Fore.MAGENTA}{query.case}, {Fore.BLUE}{query.article}, {Fore.YELLOW}{query.cardinality}{Style.RESET_ALL}"
    queryString = f"{query.noun['nom-sin']}, {query.adjective}"

    total += 1
    print(f"{Style.BRIGHT}--- Übung {total} ---{Style.NORMAL}")
    print(parameters)
    print(queryString)
    print()

    response = input("> ")

    print(f"{Style.BRIGHT}", end="")

    if solution.evaluate(response):
        correct += 1
        print(f"{Fore.GREEN}Richtig ({correct}/{total}):{Style.RESET_ALL} {solution.noun}")
    else:
        print(f"{Fore.RED}Falsch ({correct}/{total}):{Style.RESET_ALL} {solution.full}, {solution.noun}")