- /api/professional_report_reference accepts languages [zh,en]; one packet, zh byte-identical, markdown_en + reader_dasha_applicability_en, or english_unavailable when a Chinese character would leak. - pl9_reader_english renders the parity volume with report_language=en and a fixed term table; yoga_engine carries combination_en / effects_en / strength_en. - 75 fictional charts: zero Han, same line count, same numbers outside yoga tables. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
245 lines
16 KiB
Python
245 lines
16 KiB
Python
"""Fixed English text for the Chinese labels in the PL9 reader volume.
|
||
|
||
Two sources of Chinese reach the reader: labels hard-coded in
|
||
``pl9_reader_export.render_pl9_parity_markdown`` and short texts the engine
|
||
modules write in Chinese (dosha summaries, Jaimini karaka roles, method notes,
|
||
aspect names). Both are listed here. Templated engine texts are matched with
|
||
regular expressions; everything else is an exact phrase.
|
||
|
||
Rules for entries: no Chinese in a value, and every number in the Chinese text
|
||
appears in the English text in the same order, so the two editions carry the
|
||
same numbers (tests/test_report_english_edition.py checks both).
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import re
|
||
|
||
_PHRASES: dict[str, str] = {
|
||
# ── chapter and section headings ──
|
||
"## 出生资料与图盘": "## Birth Data and Charts",
|
||
"## 行星、星宿与宫位解释": "## Planets, Nakshatras and Houses",
|
||
"## 强度、关系与 Ashtakavarga 技术页": "## Strength, Relationships and Ashtakavarga",
|
||
"## 标准 Dasha 表格页": "## Standard Dasha Tables",
|
||
"## 原版 Dasha 日期表(同案 PL9 数据)": "## Original Dasha Date Tables (same chart)",
|
||
"## 原版 Dasha 日期表": "## Original Dasha Date Tables",
|
||
"## Saturn 与 KP 支持页": "## Saturn and KP",
|
||
"## 年度图盘与 Tajika": "## Annual Charts and Tajika",
|
||
"## Bhavesh、Dosha 与 Yoga 解释页": "## Bhavesh, Dosha and Yoga",
|
||
"## 大运解释": "## Dasha Interpretation",
|
||
"出生资料补充": "Birth Particulars (supplement)",
|
||
"Birth Chart 行星原始位置": "Birth Chart Planetary Positions",
|
||
"行星主星与状态": "Planet Lords and Dignity",
|
||
"Sudarshan Chakra 资料": "Sudarshan Chakra",
|
||
"Upagraha / Sub-Planets 点位": "Upagraha / Sub-Planet Positions",
|
||
"特殊上升与派生点补充": "Special Lagnas and Points (supplement)",
|
||
"敏感点与特殊落点": "Sensitive Points and Special Placements",
|
||
"本命与分盘北印度图盘": "Natal and Divisional Charts (North Indian)",
|
||
" 数值位置表": " Position Table",
|
||
"Shadbala / Bhava Bala 摘要": "Shadbala / Bhava Bala Summary",
|
||
"Avastha 行星状态": "Avastha Planetary States",
|
||
"Bhava Bala 十二宫力量": "Bhava Bala Strength of the Twelve Houses",
|
||
"Planetary Friendship 矩阵源数据": "Planetary Friendship Matrix",
|
||
"相位矩阵": "Aspect Matrix",
|
||
"Jaimini Karaka、Arudha Pada 与特殊 Lagna": "Jaimini Karakas, Arudha Padas and Special Lagnas",
|
||
"Ashtakavarga 完整宫位分数": "Ashtakavarga Full House Scores",
|
||
"Vimsopaka / Pushkara / Vargottama 辅助强度": "Vimsopaka / Pushkara / Vargottama Supporting Strength",
|
||
"Ashtakavarga Pinda 与 Shodhya/Yoga Pinda 数值表。": "Ashtakavarga Pinda and Shodhya / Yoga Pinda values.",
|
||
"Ashtakavarga Shodhya / Yoga Pinda 原始值": "Ashtakavarga Shodhya / Yoga Pinda Raw Values",
|
||
"Chakra 图阵页": "Chakra Diagrams",
|
||
"以下表格保留同一命盘原版报告中的完整可见日期和星座边界,便于逐项读取与校对。":
|
||
"The tables below keep every visible date and sign boundary from the original report for this chart, for line-by-line reading and checking.",
|
||
"KP 原版细格": "KP Original Detail Grid",
|
||
"Varshaphala 基础资料与年度行星表": "Varshaphala Basics and Annual Planet Table",
|
||
"Varshaphala 年度结果解释": "Varshaphala Annual Results",
|
||
"Annual Dasha 结果解释": "Annual Dasha Results",
|
||
"Mudda / Patyayini 年度 Dasha 表": "Mudda / Patyayini Annual Dasha Table",
|
||
"Patyayini / Patyamsha ending-date 表": "Patyayini / Patyamsha Ending-Date Table",
|
||
"Tajika Yoga Presence 对照表": "Tajika Yoga Presence Comparison",
|
||
"Tajika Yoga Presence 表": "Tajika Yoga Presence Table",
|
||
"Sahams 点位表": "Saham Positions",
|
||
"公开 Panchavargiya 数值复核边界": "Public Panchavargiya Value Check",
|
||
"年度特殊点": "Annual Special Points",
|
||
"Tripataki Chakra 年盘落点": "Tripataki Chakra Annual Placements",
|
||
"年度月返照图盘数据": "Monthly Returns within the Year",
|
||
"生命周期年度返照图盘数据": "Lifetime Annual Return Charts",
|
||
"出生地八年年度总览": "Eight-Year Overview (birthplace)",
|
||
"现居地八年年度总览": "Eight-Year Overview (current residence)",
|
||
"年度北印度图盘": "Annual Charts (North Indian)",
|
||
" 年度 Varshaphala / Tajika 细项": " Annual Varshaphala / Tajika Details",
|
||
"年度行星资料": "Annual Planet Data",
|
||
"Annual Dasha 阶段表": "Annual Dasha Periods",
|
||
"年度行星扩展字段": "Annual Planet Extras",
|
||
"年度锚点": "Annual Anchors",
|
||
"年度行星资料": "Annual Planet Data",
|
||
"年度结果": "Annual Results",
|
||
"宫主(Bhavesh)落宫解释": "House Lords (Bhavesh) by Placement",
|
||
"Bhavesh 宫主逐宫解释": "Bhavesh House by House",
|
||
"Dosha 逐项事实与解释": "Dosha Facts and Notes",
|
||
"传统辅助建议": "Traditional Supportive Practices",
|
||
# ── table headers ──
|
||
"| 行星 | 星座主 | 星宿主 | 分主 | 分分主 | 尊贵状态 | 力量比 |":
|
||
"| Planet | Sign lord | Star lord | Sub lord | Sub-sub lord | Dignity | Strength ratio |",
|
||
"星座主、星宿主、分主、分分主:这颗行星所在星座、星宿与 KP 细分各自的主星。力量比:六维力量与所需力量之比,1 以上为达标。":
|
||
"Sign lord, star lord, sub lord and sub-sub lord: the rulers of the planet's sign, nakshatra and KP subdivisions. Strength ratio: Shadbala against the required strength; 1 or above meets it.",
|
||
"| 对象 | 落座 | 落座度数 | 黄经 | 整宫宫位 |": "| Body | Sign | Degree in sign | Longitude | Whole-sign house |",
|
||
"| House | Sign | Lord | Score | 关键因素 |": "| House | Sign | Lord | Score | Key factors |",
|
||
"| House | Sign | SAV | BAV/承接 | Full with Lagna |": "| House | Sign | SAV | BAV / carry | Full with Lagna |",
|
||
"| 序号 | 主运 | 起始 | 结束 | 年数 |": "| No. | Mahadasha | Start | End | Years |",
|
||
"| Vimshottari AD | 主运 | 子运 | 起始 | 结束 |": "| Vimshottari AD | Mahadasha | Antardasha | Start | End |",
|
||
"| Vimshottari PD | 主运 | 子运 | 次子运 | 起始 | 结束 |": "| Vimshottari PD | Mahadasha | Antardasha | Pratyantardasha | Start | End |",
|
||
"| 序号 | 主星/星座 | 起始 | 结束 | 年数 |": "| No. | Lord / sign | Start | End | Years |",
|
||
"| AD/child | 主层 | 子层 | 起始 | 结束 |": "| AD/child | Main period | Sub-period | Start | End |",
|
||
"| 主运 | 起始年龄 | 子段 | 起始 | 结束 |": "| Mahadasha | Starting age | Sub-period | Start | End |",
|
||
"| 项目 | 锚点 | 年度主题 |": "| Item | Anchor | Theme of the year |",
|
||
"| 阶段 | 主星 | 年盘宫位 | 日期边界 | 主题 |": "| Period | Lord | Annual house | Date range | Theme |",
|
||
"| balance profile | 主星 | 开始 | 结束 | 边界口径 |": "| Balance | Lord | Start | End | Boundary basis |",
|
||
"| 主层 | 子层 | 边界 | 边界语义 |": "| Main period | Sub-period | Boundary | Boundary meaning |",
|
||
"| Yoga | 结果 | 形成行星 | 相位运动(入相/分离) |": "| Yoga | Result | Forming planets | Motion (applying / separating) |",
|
||
"| Saham | 星座 | 星座内度数 |": "| Saham | Sign | Degree in sign |",
|
||
"| 项目 | 结果 |": "| Item | Result |",
|
||
"| 月份 | 本地时刻 | 年盘上升 | 上升度数 | 行星黄经(度) |": "| Month | Local time | Annual ascendant | Ascendant degree | Planet longitudes (deg) |",
|
||
"| 年龄 | 年份 | 年返时刻 | 上升 | 上升度数 | 行星黄经(度) |": "| Age | Year | Return time | Ascendant | Ascendant degree | Planet longitudes (deg) |",
|
||
"| 年份 | 年龄 | 年返时刻 | 年盘上升 |": "| Year | Age | Return time | Annual ascendant |",
|
||
"| 项目 | 数值 |": "| Item | Value |",
|
||
"| 行星 | 星座 | 落座度数 | 黄经 |": "| Planet | Sign | Degree in sign | Longitude |",
|
||
"| 点位 | 星座 | 落座度数 | 黄经 | 守护星 |": "| Point | Sign | Degree in sign | Longitude | Ruler |",
|
||
"| 月份 | 本地时刻 | 年盘上升 | 上升度数 |": "| Month | Local time | Annual ascendant | Ascendant degree |",
|
||
"| 对象 | 建议 | 宝石/次数 |": "| For | Suggestion | Gem / count |",
|
||
"| 公开复核状态 |": "| Public check status |",
|
||
"| 覆盖行星 |": "| Planets covered |",
|
||
"| 已匹配分量 |": "| Components matched |",
|
||
"| 已匹配总分 |": "| Totals matched |",
|
||
"| 可直接用于公式升级 |": "| Usable for formula upgrade |",
|
||
"| 年返上升 |": "| Annual ascendant |",
|
||
# ── labelled lines ──
|
||
"- 姓名:": "- Name: ",
|
||
"- 出生:": "- Born: ",
|
||
"- 计算口径:": "- Calculation settings: ",
|
||
"- Shadbala 方法:": "- Shadbala method: ",
|
||
"- 外部边界:": "- Method note: ",
|
||
"- 方法:": "- Method: ",
|
||
"- BAV 校验:": "- BAV check: ",
|
||
"- 当前阶段:": "- Current phase: ",
|
||
"- 是否 active:": "- Active: ",
|
||
"- 摘要:": "- Summary: ",
|
||
"- 年返上升:": "- Annual ascendant: ",
|
||
# ── birth-parameter row labels ──
|
||
"| 出生日期 |": "| Birth date |",
|
||
"| 出生时间 |": "| Birth time |",
|
||
"| 出生星期 |": "| Weekday |",
|
||
"| 出生地点 |": "| Birthplace |",
|
||
"| 城市 |": "| City |",
|
||
"| 省州 |": "| State / province |",
|
||
"| 国家 |": "| Country |",
|
||
"| 纬度 |": "| Latitude |",
|
||
"| 经度 |": "| Longitude |",
|
||
"| 时区 |": "| Time zone |",
|
||
"| 岁差名称 |": "| Ayanamsa name |",
|
||
"| 岁差值 |": "| Ayanamsa value |",
|
||
"| 岁差 |": "| Ayanamsa |",
|
||
"| 交点模式 |": "| Node mode |",
|
||
"| 宫位系统 |": "| House system |",
|
||
"| 综合性质 |": "| Overall quality |",
|
||
"| 吉性要素数量 |": "| Auspicious elements |",
|
||
"| 要素总数 |": "| Total elements |",
|
||
# ── annual labels and values ──
|
||
"Muntha 所在星座的守护星(当前本地口径)": "Ruler of the Muntha sign (current local method)",
|
||
"两种计算口径给出的年主不同,暂不合并": "The two methods give different year lords; not merged",
|
||
"(两者不同)": " (they differ)",
|
||
"太阳返照": "Solar return",
|
||
"另一口径": "Other method",
|
||
"入相": "applying",
|
||
"分离": "separating",
|
||
# ── public status words (renderer helpers) ──
|
||
"由生命周期图盘页承接": "carried by the lifetime chart pages",
|
||
"外部回放待校对": "external replay pending",
|
||
"外部行为参考": "reference rule",
|
||
"参数敏感": "parameter-sensitive",
|
||
"需补资料": "needs more data",
|
||
"已生成": "generated",
|
||
"已核验": "verified",
|
||
"需校对": "to be checked",
|
||
"不适用": "not applicable",
|
||
"已形成": "formed",
|
||
"未形成": "not formed",
|
||
"待补充": "pending",
|
||
"证据口径": "Evidence basis",
|
||
"证据标签": "Evidence basis",
|
||
"源数据未提供宝石或次数": "No gem or repetition count supplied",
|
||
"一致": "match",
|
||
"参考": "reference",
|
||
"未列": "not listed",
|
||
# ── engine texts (fixed) ──
|
||
"Shadbala六重力量(absolute Virupas; precise Sthana/Dig/Kala/Drik; bounded BPHS Chesta)":
|
||
"Shadbala six-fold strength, in Virupas, combining Sthana, Dig, Kala, Drik and BPHS Chesta",
|
||
"Chesta remains cross-engine method-conflicted; totals inherit that boundary.":
|
||
"Chesta Bala depends on the calculation method, so compare totals within the same method.",
|
||
"Shadbala六重力量": "Shadbala six-fold strength",
|
||
"Ashtakavarga八分法(BPHS/PVR书例校准v2.1)": "Ashtakavarga eight-fold method (calibrated to BPHS / PVR book examples, v2.1)",
|
||
"吉(Subha)": "Auspicious (Subha)",
|
||
"中(Mixed)": "Mixed",
|
||
"凶(Asubha)": "Inauspicious (Asubha)",
|
||
"无Kaal Sarp Dosha": "No Kaal Sarp Dosha",
|
||
"无Mangal Dosha(Mars不在煞宫)": "No Mangal Dosha (Mars is not in a dosha house)",
|
||
"无Pitra Dosha明显迹象": "No clear sign of Pitra Dosha",
|
||
"Rahu位置未知,无法判断Kaal Sarp Dosha": "Rahu's position is unknown; Kaal Sarp Dosha cannot be judged",
|
||
"Sun位置未知,无法判断Pitra Dosha": "The Sun's position is unknown; Pitra Dosha cannot be judged",
|
||
"Moon星座未知,无法判断Sade Sati": "The Moon's sign is unknown; Sade Sati cannot be judged",
|
||
"Mars在自身星座,部分缓和": "Mars in its own sign, partly mitigated",
|
||
"Mars擢升,完全解除": "Mars exalted, fully cancelled",
|
||
# Jaimini karakas (scripts/jaimini.py KARAKA_CN / KARAKA_DOMAINS)
|
||
"灵魂星AK": "Atmakaraka AK",
|
||
"事业星AmK": "Amatyakaraka AmK",
|
||
"兄弟星BK": "Bhratrikaraka BK",
|
||
"母亲星MK": "Matrikaraka MK",
|
||
"子女星PK": "Putrakaraka PK",
|
||
"障碍星GK": "Gnatikaraka GK",
|
||
"配偶星DK": "Darakaraka DK",
|
||
"父亲星PiK": "Pitrukaraka PiK",
|
||
"灵魂使命、核心自我、人生最高目标": "Soul purpose, core self, highest aim in life",
|
||
"事业方向、主要谋士、权力代理": "Career direction, chief adviser, agent of power",
|
||
"兄弟姐妹、勇气、冒险精神": "Siblings, courage, spirit of adventure",
|
||
"母亲、家庭根基、情感安全感": "Mother, family roots, emotional security",
|
||
"子女、创造力、学生、智能成果": "Children, creativity, students, intellectual output",
|
||
"竞争对手、疾病、障碍、转化力量": "Rivals, illness, obstacles, transforming force",
|
||
"配偶特质、伴侣关系、婚姻质量": "Spouse's nature, partnership, quality of marriage",
|
||
"父亲、祖先业力、传统传承": "Father, ancestral karma, tradition",
|
||
# planets and signs, if any Chinese form slipped through a table cell
|
||
"北交点/罗睺": "Rahu",
|
||
"南交点/计都": "Ketu",
|
||
"北交点": "Rahu",
|
||
"南交点": "Ketu",
|
||
}
|
||
|
||
PHRASES_EN: list[tuple[str, str]] = sorted(_PHRASES.items(), key=lambda item: len(item[0]), reverse=True)
|
||
|
||
# Templated engine texts. Applied before the phrase table.
|
||
REGEX_EN: list[tuple[re.Pattern[str], str]] = [
|
||
# scripts/pl9_reader_export.py: f"第{house}宫主:{lord}"
|
||
(re.compile(r"第(\d+)宫主:"), r"Lord of house \1: "),
|
||
# scripts/aspects.py / jyotish_engine.py: f"{n}宫相位"
|
||
(re.compile(r"(\d+)宫相位"), r"\1th-house aspect"),
|
||
# scripts/yogas_doshas.py Mangal Dosha summary
|
||
(re.compile(r"(无|有)Mangal Dosha——Mars在(\d+)宫([A-Za-z]+),严重程度:([A-Za-z_]+)"),
|
||
lambda m: f"{'No' if m.group(1) == '无' else 'Has'} Mangal Dosha: Mars in house {m.group(2)} {m.group(3)}, severity: {m.group(4)}"),
|
||
# Kaal Sarp summaries
|
||
(re.compile(r"完全Kaal Sarp Dosha——所有(\d+)颗行星在Rahu\((\d+)\)—Ketu轴线之间"),
|
||
r"Full Kaal Sarp Dosha: all \1 planets between the Rahu (\2)–Ketu axis"),
|
||
(re.compile(r"部分Kaal Sarp Dosha——(\d+)/(\d+)颗行星在轴线之间"),
|
||
r"Partial Kaal Sarp Dosha: \1/\2 planets between the axis"),
|
||
# Pitra Dosha indicators
|
||
(re.compile(r"([A-Za-z]+)\((\d+)宫\)克Sun\((\d+)宫\)"), r"\1 (house \2) afflicts the Sun (house \3)"),
|
||
(re.compile(r"Sun\((\d+)宫\)与Rahu\((\d+)宫\)合相/相邻"), r"Sun (house \1) conjunct or next to Rahu (house \2)"),
|
||
(re.compile(r"有Pitra Dosha迹象:"), "Signs of Pitra Dosha: "),
|
||
# Sade Sati framework summary
|
||
(re.compile(r"Sade Sati阶段框架:上升期=([A-Za-z]+),高峰期=([A-Za-z]+)(最困难),下降期=([A-Za-z]+);需结合Saturn实际位置判断是否在进行中"),
|
||
r"Sade Sati phases: rising = \1, peak = \2 (hardest), setting = \3; whether it is under way depends on Saturn's actual position"),
|
||
# Yoga strength words left over when a rule has no strength_en: whole table cells only.
|
||
(re.compile(r"(?<=\| )中强(?= \|)"), "Moderately strong"),
|
||
(re.compile(r"(?<=\| )中弱(?= \|)"), "Moderately weak"),
|
||
(re.compile(r"(?<=\| )强(?= \|)"), "Strong"),
|
||
(re.compile(r"(?<=\| )中(?= \|)"), "Moderate"),
|
||
(re.compile(r"(?<=\| )弱(?= \|)"), "Weak"),
|
||
]
|