- 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
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""验证 manifest 加载后 ManifestItem 对象的 text_with_placeholders"""
|
|
import sys
|
|
sys.path.insert(0, '.')
|
|
|
|
from src.manifest_manager import ManifestManager
|
|
|
|
manifest = ManifestManager("cache/manifests/Empire of AI Dreams and Nightmares in Sam Altmans OpenAI (Karen Hao)_chinese_manifest.json")
|
|
manifest.load()
|
|
|
|
# 获取有占位符的 item
|
|
items = manifest.get_items(status="pending")
|
|
if not items:
|
|
items = manifest.get_items() # 任意状态
|
|
|
|
target = None
|
|
for item in items:
|
|
if item.placeholder_map:
|
|
inner = {k: v for k, v in item.placeholder_map.items() if not k.startswith('_')}
|
|
if inner:
|
|
target = item
|
|
break
|
|
|
|
if target:
|
|
print("=== ManifestItem OBJECT ===")
|
|
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] if target.text_with_placeholders else 'EMPTY'}...'")
|
|
print(f"placeholder_map: {target.placeholder_map}")
|
|
print()
|
|
|
|
# 检查是否包含 φ
|
|
twp = target.text_with_placeholders
|
|
has_phi = 'φ' in twp if twp else False
|
|
print(f"text_with_placeholders contains φ: {has_phi}")
|
|
print(f"text_with_placeholders length: {len(twp) if twp else 0}")
|
|
else:
|
|
print("No target item found with placeholders")
|