feat: Add lore pack, UI adjustments, requirements.txt and INSTALL.md
This commit is contained in:
@@ -115,4 +115,22 @@ def is_answer_correct(user_input: str, canonical: str, accepted_raw: str | None
|
||||
if dist <= max_allowed:
|
||||
return True
|
||||
|
||||
# Support compound answers connected by 'und' / 'and' (e.g. "Mantikor und Feuerkrabbe")
|
||||
for sep in (" und ", " and "):
|
||||
if sep in target:
|
||||
parts = [p.strip() for p in target.split(sep) if len(p.strip()) >= 3]
|
||||
if len(parts) == 2:
|
||||
u_words = u.split()
|
||||
matched_both = True
|
||||
for part in parts:
|
||||
if part in u:
|
||||
continue
|
||||
# Check fuzzy match against tokens or reversed order
|
||||
part_matched = any(levenshtein_distance(w, part) <= (1 if len(part) <= 6 else 2) for w in u_words)
|
||||
if not part_matched:
|
||||
matched_both = False
|
||||
break
|
||||
if matched_both:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user