Preserve semantic note layouts and checkpoint on provider quota failures

This commit is contained in:
Kai Tan
2026-10-08 09:35:22 +08:00
parent 4f124a0335
commit cab13568df
9 changed files with 111 additions and 7 deletions
+2 -1
View File
@@ -29,7 +29,8 @@ def sanitize_automatic_terms(terms, ambiguous_aliases):
keep = []
for alias in term.get('aliases', []):
unsafe = alias.casefold() in COMMON_ALIASES or re.fullmatch(r'[a-z]+', alias)
if re.fullmatch(r'[A-Za-z][A-Za-z.-]*', alias) and alias != term['source']:
alias_core = re.sub(r'^(?:the|a|an)\s+', '', alias, flags=re.IGNORECASE)
if re.fullmatch(r'[A-Za-z][A-Za-z.-]*', alias_core) and alias != term['source']:
acronym = bool(re.fullmatch(r'[A-Z][A-Z.-]+', alias))
nickname = 'nickname' in term.get('notes', '').casefold() and alias in term.get('notes', '')
if not acronym and not nickname: