英文漏译改在渲染侧查表,测试不再放行 PyJHora 子进程。

冻结的 jaimini.py 恢复成 staging 原样。缺译单元格写成固定标记,不再留空。

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jesse-ux
2026-10-22 09:58:09 +08:00
co-authored by Grok (agent loop) Cursor
parent 7876c0b4ac
commit adfa98bf97
11 changed files with 378 additions and 89 deletions
+42 -17
View File
@@ -26,6 +26,12 @@ try: # scripts/ on sys.path
from narayana_legacy_label import LEGACY_NOTE_EN, LEGACY_NOTE_ZH
except ImportError: # pragma: no cover - package import
from scripts.narayana_legacy_label import LEGACY_NOTE_EN, LEGACY_NOTE_ZH
try: # scripts/ on sys.path
from report_render.english_gaps import english_effects, first_clean_english
from report_render.karaka_domains import KARAKA_DOMAIN_EN
except ImportError: # pragma: no cover - package import
from scripts.report_render.english_gaps import english_effects, first_clean_english
from scripts.report_render.karaka_domains import KARAKA_DOMAIN_EN
import re
SIGNS: list[str] = []
@@ -1573,9 +1579,14 @@ def render_pl9_parity_markdown(packet: dict) -> str:
if not isinstance(row, dict):
continue
karaka_name = name if _lang == 'en' else (row.get('cn_name') or name)
domain = row.get('domain_en') if _lang == 'en' else row.get('domain')
if _lang == 'en' and domain and re.search(r'[\u4e00-\u9fff]', str(domain)):
domain = ''
if _lang == 'en':
domain = first_clean_english(
KARAKA_DOMAIN_EN.get(str(name), ''),
field='domain',
chinese=row.get('domain'),
)
else:
domain = row.get('domain')
lines.append(
f"| {_cell(karaka_name)} | {_cell(_token(row.get('planet')))} | "
f"{_cell(_degree(row.get('degree_in_sign') or row.get('sign_degree')))} | "
@@ -2120,9 +2131,14 @@ def render_pl9_parity_markdown(packet: dict) -> str:
# Customer tables retain computed boundaries and reference points;
# print-layout rows deliberately blank repeated values.
kantaka_rows = _list(timeline.get('kantaka_rows')) or _list(display_rows.get('kantaka'))
sade_summary = sade_sati.get('summary_en') if _lang == 'en' else sade_sati.get('summary')
if _lang == 'en' and sade_summary and re.search(r'[\u4e00-\u9fff]', str(sade_summary)):
sade_summary = ''
if _lang == 'en':
sade_summary = first_clean_english(
sade_sati.get('summary_en'),
field='summary',
chinese=sade_sati.get('summary'),
)
else:
sade_summary = sade_sati.get('summary')
lines.extend([
'### p121-p122 Sade Sati / Dhayya / Kantaka Saturn',
'',
@@ -3029,9 +3045,14 @@ def render_pl9_parity_markdown(packet: dict) -> str:
for fact_key in ('mars_house', 'mars_sign', 'sun_house', 'sun_sign', 'rahu_house', 'ketu_house', 'moon_sign', 'severity', 'type'):
if row.get(fact_key) not in (None, ''):
fact_bits.append(f"{fact_key}={_token(row.get(fact_key))}")
summary = row.get('summary_en') if _lang == 'en' else row.get('summary')
if _lang == 'en' and summary and re.search(r'[\u4e00-\u9fff]', str(summary)):
summary = ''
if _lang == 'en':
summary = first_clean_english(
row.get('summary_en'),
field='summary',
chinese=row.get('summary'),
)
else:
summary = row.get('summary')
joiner = '; ' if _lang == 'en' else ';'
lines.append(
f"| {_cell(label)} | {_cell(detected)} | {_cell(joiner.join(map(str, fact_bits)) or '-')} | {_cell(summary)} |"
@@ -3118,15 +3139,19 @@ def render_pl9_parity_markdown(packet: dict) -> str:
])
for row in group_rows:
if _lang == 'en':
effects = row.get('effects_en') if isinstance(row.get('effects_en'), list) else []
effects = [item for item in effects if not re.search(r'[\u4e00-\u9fff]', str(item))]
effects = english_effects(row.get('effects_en'), row.get('effects'))
yoga_name = row.get('name') or row.get('type')
combination = row.get('combination_en')
if not combination or re.search(r'[\u4e00-\u9fff]', str(combination)):
combination = ''
strength = row.get('strength_en') or strength_en_map.get(str(row.get('strength') or ''))
if not strength or re.search(r'[\u4e00-\u9fff]', str(strength)):
strength = ''
combination = first_clean_english(
row.get('combination_en'),
field='combination',
chinese=row.get('combination'),
)
strength = first_clean_english(
row.get('strength_en'),
strength_en_map.get(str(row.get('strength') or ''), ''),
field='strength',
chinese=row.get('strength'),
)
else:
effects = row.get('effects') if isinstance(row.get('effects'), list) else []
yoga_name = row.get('name_cn') or row.get('name') or row.get('type')