feat: Update year normalization logic to reflect US-style pronunciation for years 1100-1999; adjust related tests for consistency

This commit is contained in:
JB
2025-12-16 08:52:03 -08:00
parent 015435adb6
commit 08ebedc177
6 changed files with 22 additions and 15 deletions
+2 -1
View File
@@ -92,7 +92,8 @@ def update_settings() -> ResponseReturnValue:
for key in _NORMALIZATION_BOOLEAN_KEYS:
current[key] = _extract_checkbox(key, bool(current.get(key, True)))
for key in _NORMALIZATION_STRING_KEYS:
current[key] = (form.get(key) or "").strip()
if hasattr(form, "__contains__") and key in form:
current[key] = (form.get(key) or "").strip()
# Integrations
current["integrations"] = current.get("integrations", {})
+6
View File
@@ -316,6 +316,12 @@ def normalize_setting_value(key: str, value: Any, defaults: Dict[str, Any]) -> A
if normalized_mode in {"off", "spacy", "llm"}:
return normalized_mode
return defaults[key]
if key == "normalization_numbers_year_style":
if isinstance(value, str):
normalized_style = value.strip().lower()
if normalized_style in {"american", "off"}:
return normalized_style
return defaults[key]
if key == "llm_context_mode":
if isinstance(value, str):
normalized_scope = value.strip().lower()