Prefer Chinese company names in IPO reports
Request: - Update the selected analyst reports so stock/company names include Chinese names and use Chinese names first. Changes: - Updated the selected T0 reports for 01392, 06067, 06106, and 06132 to show Chinese company names in the title and summary, with English names in parentheses. - Added company_name_zh to the analyst dataset so report generation has access to Chinese names. - Updated the report generator to prefer Chinese company names and fall back to English names only when Chinese names are unavailable. - Filled Chinese company names for the selected tickers in ipo_master and refreshed snapshots. Verification: - Compiled build_analysis_dataset.py and generate_ipo_report.py. - Ran generator dry-runs for 06132 and 01392 to confirm Chinese-first output. - Ran SQLite integrity_check and foreign_key_check. - Ran git diff --check. Next useful context: - Future generated analyst reports now use company_name_zh first when available.
This commit is contained in:
@@ -150,6 +150,14 @@ def fmt_int(value: int | None) -> str:
|
||||
return f"{value:,}"
|
||||
|
||||
|
||||
def company_display_name(record: dict[str, str]) -> str:
|
||||
chinese_name = record.get("company_name_zh") or ""
|
||||
english_name = record.get("company_name_en") or ""
|
||||
if chinese_name and english_name:
|
||||
return f"{chinese_name}({english_name})"
|
||||
return chinese_name or english_name or "未记录"
|
||||
|
||||
|
||||
def parse_date(value: str) -> datetime | None:
|
||||
if not value:
|
||||
return None
|
||||
@@ -407,14 +415,17 @@ def build_report(record: dict[str, str], rows: list[dict[str, str]], stage: str,
|
||||
|
||||
paths = source_paths(record, stage)
|
||||
source_lines = [f"- `{path}`" for path in paths] or ["- 本阶段没有记录来源路径。"]
|
||||
company_name = company_display_name(record)
|
||||
title_name = record.get("company_name_zh") or record.get("company_name_en") or ""
|
||||
title_prefix = f"{ticker} {title_name}" if title_name else ticker
|
||||
|
||||
lines = [
|
||||
f"# {ticker} IPO 分析报告",
|
||||
f"# {title_prefix} IPO 分析报告",
|
||||
"",
|
||||
"## 摘要",
|
||||
"",
|
||||
f"- 股票代码:`{ticker}`",
|
||||
f"- 公司:{fmt_value(record['company_name_en'])}",
|
||||
f"- 公司:{company_name}",
|
||||
f"- 分析阶段:`{stage}`",
|
||||
f"- 报告生成时间:`{as_of}`",
|
||||
f"- 模型数据时间:`{dataset_as_of}`",
|
||||
|
||||
Reference in New Issue
Block a user