feat: Release v0.10 - Modular Architecture & External Config
- 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
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import re
|
||||
from src.format_restorer import FormatRestorer
|
||||
|
||||
restorer = FormatRestorer()
|
||||
|
||||
# 模拟一个真实场景
|
||||
text_with_ph = '"But what is the goal?" φ1φAmodeiφ/1φ...'
|
||||
placeholder_map = {
|
||||
'1': '<em>',
|
||||
'/1': '</em>'
|
||||
}
|
||||
|
||||
print("Input text:", text_with_ph)
|
||||
print("Placeholder map:", placeholder_map)
|
||||
|
||||
# 手动执行 restorer 的验证逻辑
|
||||
inner_map = {k: v for k, v in placeholder_map.items() if not k.startswith("_")}
|
||||
print("Inner map keys:", set(inner_map.keys()))
|
||||
|
||||
found_ids = set(re.findall(r'φ(/?\d+)φ', text_with_ph))
|
||||
print("Found IDs in text:", found_ids)
|
||||
|
||||
expected_ids = set(inner_map.keys())
|
||||
print("Expected IDs:", expected_ids)
|
||||
|
||||
missing_ids = expected_ids - found_ids
|
||||
print("Missing IDs:", missing_ids)
|
||||
|
||||
# 调用 restore
|
||||
html, success = restorer.restore(text_with_ph, placeholder_map)
|
||||
print(f"\nResult: success={success}")
|
||||
print(f"HTML: {html}")
|
||||
Reference in New Issue
Block a user