- Refactor codebase into src/ (preprocessing, translation, assembly) - Add pipeline/ scripts for individual stages - Externalize configuration to config/config.yaml - Fix Cover Image preservation - Update documentation and manuals
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""验证 manifest 数据和 _build_prompt 输出"""
|
|
import json
|
|
|
|
manifest_file = "cache/manifests/Empire of AI Dreams and Nightmares in Sam Altmans OpenAI (Karen Hao)_chinese_manifest.json"
|
|
with open(manifest_file, 'r') as f:
|
|
data = json.load(f)
|
|
|
|
items = data.get('items', [])
|
|
|
|
# 找一个有占位符的 item
|
|
target = None
|
|
for item in items:
|
|
if item.get('placeholder_map') and len(item['placeholder_map']) > 0:
|
|
inner = {k: v for k, v in item['placeholder_map'].items() if not k.startswith('_')}
|
|
if inner:
|
|
target = item
|
|
break
|
|
|
|
if target:
|
|
print("=== TARGET ITEM ===")
|
|
print(f"global_id: {target['global_id']}")
|
|
print(f"status: {target['status']}")
|
|
print(f"clean_text: {target['clean_text'][:80]}...")
|
|
print(f"text_with_placeholders: '{target['text_with_placeholders'][:80]}...'")
|
|
print(f"placeholder_map: {target['placeholder_map']}")
|
|
print()
|
|
|
|
# 模拟 _build_prompt 的行为
|
|
text_with_ph = target['text_with_placeholders']
|
|
if text_with_ph:
|
|
prompt_line = f"{target['global_id']} [BODY] {text_with_ph}"
|
|
else:
|
|
prompt_line = f"{target['global_id']} [BODY] {target['clean_text']}"
|
|
|
|
print("=== SIMULATED PROMPT LINE ===")
|
|
print(prompt_line[:150])
|
|
print()
|
|
|
|
# 检查 text_with_placeholders 是否包含 φ
|
|
has_phi = 'φ' in (text_with_ph or '')
|
|
print(f"text_with_placeholders contains φ: {has_phi}")
|
|
else:
|
|
print("No item with placeholders found")
|