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,31 @@
|
||||
import re
|
||||
from src.format_extractor import FormatExtractor
|
||||
|
||||
extractor = FormatExtractor()
|
||||
|
||||
cases = [
|
||||
("<p>“But what is the goal?” <em>Amodei</em>...</p>", "Quoted text with em"),
|
||||
("<p>Q. What is artificial intelligence?</p>", "Simple Q&A"),
|
||||
("<p>Text <i>italic</i> followed by dots...</p>", "Italic with trailing dots"),
|
||||
]
|
||||
|
||||
for html, desc in cases:
|
||||
print(f"--- Testing: {desc} ---")
|
||||
print(f"HTML: {html}")
|
||||
clean, text_ph, ph_map, p_type, anchors = extractor.extract(html)
|
||||
|
||||
# Validation logic from FormatExtractor.extract
|
||||
stripped_text = re.sub(r'φ/?[0-9]+φ', '', text_ph)
|
||||
stripped_text = re.sub(r'\s+', ' ', stripped_text).strip()
|
||||
clean_normalized = re.sub(r'\s+', ' ', clean).strip()
|
||||
|
||||
print(f"Clean: '{clean_normalized}'")
|
||||
print(f"Stripped: '{stripped_text}'")
|
||||
print(f"Text ph: '{text_ph}'")
|
||||
print(f"Map: {ph_map}")
|
||||
|
||||
if clean_normalized == stripped_text:
|
||||
print("✅ SUCCESS")
|
||||
else:
|
||||
print("❌ FAILED")
|
||||
print()
|
||||
Reference in New Issue
Block a user