Improve EPUB restoration, book terminology and Calibre QA workflow
This commit is contained in:
@@ -3,6 +3,7 @@ from typing import List, Dict, Any, Optional
|
||||
from bs4 import BeautifulSoup
|
||||
from loguru import logger
|
||||
|
||||
from src.common.html import parse_html, translation_targets
|
||||
from src.common.data_model import BookStructure, ManifestEntry, BookProfile
|
||||
from src.preprocessing.format_extractor import FormatExtractor
|
||||
from src.common.utils import setup_logger
|
||||
@@ -56,10 +57,10 @@ class FineGrainedExtractor:
|
||||
doc_type = self._classify_document(file_path)
|
||||
|
||||
# Parse HTML
|
||||
soup = BeautifulSoup(resource.content, 'html.parser')
|
||||
soup = parse_html(resource.content)
|
||||
target_tags = ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li']
|
||||
|
||||
for element in soup.find_all(target_tags):
|
||||
for element in translation_targets(soup):
|
||||
# Ensure element has ID (should have been done by Cleaner)
|
||||
element_id = element.get('id')
|
||||
if not element_id:
|
||||
|
||||
Reference in New Issue
Block a user