From 9232c6640982eae77dfe20ab3e79bbf1d0061b51 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 22 Nov 2025 15:53:16 -0500 Subject: [PATCH] Add name alias support for biblical biographies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- kjvstudy_org/biblical_biographies.py | 33 +++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/kjvstudy_org/biblical_biographies.py b/kjvstudy_org/biblical_biographies.py index 1960848..4111a3a 100644 --- a/kjvstudy_org/biblical_biographies.py +++ b/kjvstudy_org/biblical_biographies.py @@ -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