import re from src.format_extractor import FormatExtractor extractor = FormatExtractor() cases = [ ("
“But what is the goal?” Amodei...
", "Quoted text with em"), ("Q. What is artificial intelligence?
", "Simple Q&A"), ("Text italic followed by dots...
", "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()