Add name alias support for biblical biographies

Handle alternate name forms like "Noah or Noe" by adding BIOGRAPHY_ALIASES
dictionary. Updated get_biography() and has_biography() to check aliases
when exact match not found.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-22 15:53:16 -05:00
parent 0b46f7e7d7
commit 9232c66409
+30 -3
View File
@@ -592,19 +592,46 @@ BIOGRAPHIES = {
}
# Alias mapping for alternate name forms
BIOGRAPHY_ALIASES = {
"Noah or Noe": "Noah",
"Noe": "Noah",
"Sarah": "Abraham's wife Sarah",
}
def get_biography(person_name: str) -> dict:
"""
Get biographical information for a biblical figure.
Handles alternate name forms through the BIOGRAPHY_ALIASES mapping.
Args:
person_name: Name of the person (e.g., "Abraham", "David")
person_name: Name of the person (e.g., "Abraham", "David", "Noah or Noe")
Returns:
Dictionary with biography info, or None if not found
"""
return BIOGRAPHIES.get(person_name)
# Try exact match first
bio = BIOGRAPHIES.get(person_name)
if bio:
return bio
# Try aliases
canonical_name = BIOGRAPHY_ALIASES.get(person_name)
if canonical_name:
return BIOGRAPHIES.get(canonical_name)
return None
def has_biography(person_name: str) -> bool:
"""Check if a person has detailed biographical information."""
return person_name in BIOGRAPHIES
# Check exact match
if person_name in BIOGRAPHIES:
return True
# Check aliases
canonical_name = BIOGRAPHY_ALIASES.get(person_name)
if canonical_name and canonical_name in BIOGRAPHIES:
return True
return False