fix(report): project annual sections and thicken dasha reading
完整数据版第二轮。年运章写出资料包里已有的节,没有数据的不新算。大运解释补回可能段落。瑜伽作用不再断言寿命。术语替换不进标识符。罗睺和计都不写守护第未列出宫。未合入 staging。
This commit is contained in:
@@ -95,9 +95,17 @@ def _sanitize_pl9_ai_density_markdown(markdown: str, title: str = "印度占星
|
||||
"""Keep the parity volume's facts while removing internal-only labels."""
|
||||
|
||||
try:
|
||||
from pl9_language_terms import normalize_zh_markdown_terms
|
||||
from pl9_language_terms import (
|
||||
normalize_zh_markdown_terms,
|
||||
replace_natural_language_term,
|
||||
strip_han_plural_s,
|
||||
)
|
||||
except ModuleNotFoundError: # pragma: no cover - package import compatibility
|
||||
from scripts.pl9_language_terms import normalize_zh_markdown_terms
|
||||
from scripts.pl9_language_terms import (
|
||||
normalize_zh_markdown_terms,
|
||||
replace_natural_language_term,
|
||||
strip_han_plural_s,
|
||||
)
|
||||
|
||||
text = _sanitize_pl9_public_markdown(markdown)
|
||||
replacements = {
|
||||
@@ -141,9 +149,6 @@ def _sanitize_pl9_ai_density_markdown(markdown: str, title: str = "印度占星
|
||||
"functional_role_not_returned": "功能属性未单独返回",
|
||||
"natural_benefic": "自然吉星",
|
||||
"natural_malefic": "自然凶星",
|
||||
"functional_benefic": "功能吉星",
|
||||
"functional_malefic": "功能凶星",
|
||||
"functional_neutral": "功能中性",
|
||||
"current_dasha": "当前 Dasha",
|
||||
"birth_balance": "出生余额",
|
||||
"Cycle / phase": "周期 / 阶段",
|
||||
@@ -196,6 +201,12 @@ def _sanitize_pl9_ai_density_markdown(markdown: str, title: str = "印度占星
|
||||
}
|
||||
for raw, public in replacements.items():
|
||||
text = text.replace(raw, public)
|
||||
for raw, public in (
|
||||
("functional_benefic", "功能吉星"),
|
||||
("functional_malefic", "功能凶星"),
|
||||
("functional_neutral", "功能中性"),
|
||||
):
|
||||
text = replace_natural_language_term(text, raw, public)
|
||||
text = re.sub(
|
||||
r"\n## Bhavesh House-Lord Interpretations\n\n.*?(?=\n## |\Z)",
|
||||
"\n",
|
||||
@@ -218,7 +229,7 @@ def _sanitize_pl9_ai_density_markdown(markdown: str, title: str = "印度占星
|
||||
text = text.replace("Planetary", "行星")
|
||||
text = text.replace("Planets", "行星")
|
||||
text = text.replace("Planet", "行星")
|
||||
text = text.replace("Sign", "星座")
|
||||
text = replace_natural_language_term(text, "Sign", "星座")
|
||||
text = text.replace("Degree in sign", "落座度数")
|
||||
text = text.replace("Degree", "度数")
|
||||
text = text.replace("Longitude", "黄经")
|
||||
@@ -451,12 +462,12 @@ def _sanitize_pl9_ai_density_markdown(markdown: str, title: str = "印度占星
|
||||
"weak": "弱",
|
||||
"medium": "中等",
|
||||
"strong": "强",
|
||||
"house condition": "宫位条件",
|
||||
"house ": "第",
|
||||
" condition": "宫条件",
|
||||
}
|
||||
text = replace_natural_language_term(text, "house condition", "宫位条件")
|
||||
for raw, public in zh_heading_repairs.items():
|
||||
text = text.replace(raw, public)
|
||||
text = replace_natural_language_term(text, " condition", "宫条件")
|
||||
zh_public_key_repairs = {
|
||||
"mangal_dosha": "火星婚姻煞",
|
||||
"kaal_sarp_dosha": "时蛇煞",
|
||||
@@ -506,7 +517,7 @@ def _sanitize_pl9_ai_density_markdown(markdown: str, title: str = "印度占星
|
||||
]
|
||||
)
|
||||
text = re.sub(r"^#\s+.*$", summary, text, count=1, flags=re.MULTILINE)
|
||||
return text + "\n"
|
||||
return strip_han_plural_s(text) + "\n"
|
||||
|
||||
|
||||
|
||||
@@ -1001,7 +1012,8 @@ def _sanitize_pl9_ai_density_markdown_en(markdown: str, title: str = "Vedic Astr
|
||||
"王权/事业": "authority/career",
|
||||
"天象格局": "configuration",
|
||||
"子女/创造": "children/creativity",
|
||||
"寿命/健康": "longevity/health",
|
||||
"体质参考": "constitution reference",
|
||||
"寿命/健康": "constitution reference",
|
||||
"愿望/收益": "desire/gains",
|
||||
"解脱/内在": "moksha/inner life",
|
||||
"贵人/助力": "patronage/support",
|
||||
@@ -1494,10 +1506,18 @@ def _render_pl9_ai_density_raw_data_markdown_en(packet: dict) -> str:
|
||||
stripped = value.strip()
|
||||
translated = EFFECTS_EN.get(stripped)
|
||||
if translated:
|
||||
return translated
|
||||
try:
|
||||
from pl9_language_terms import soften_lifespan_wording
|
||||
except ModuleNotFoundError: # pragma: no cover
|
||||
from scripts.pl9_language_terms import soften_lifespan_wording
|
||||
return soften_lifespan_wording(translated, "en")
|
||||
# 已是英文短语(无 CJK)时原样透传,避免被误当占位删掉。
|
||||
if re.search(r"[A-Za-z]", stripped) and not re.search(r"[\u4e00-\u9fff]", stripped):
|
||||
return stripped
|
||||
try:
|
||||
from pl9_language_terms import soften_lifespan_wording
|
||||
except ModuleNotFoundError: # pragma: no cover
|
||||
from scripts.pl9_language_terms import soften_lifespan_wording
|
||||
return soften_lifespan_wording(stripped, "en")
|
||||
return ""
|
||||
|
||||
def table(headers: list[str], rows: list[list[Any]]) -> str:
|
||||
|
||||
Reference in New Issue
Block a user