139_spanish-voice-trainer/main.py

27 lines
No EOL
892 B
Python

# main.py
import asyncio
from database.connection import init_db
from core.bulk_importer import BulkImporter
from core.clean_glossary import GlossaryCleaner
async def rebuild_pipeline():
print("🚀 Initiating Clean Reconstruction Pipeline...")
# 1. This will automatically recreate the blank .db file and all tables
init_db()
# 2. Run the layout-aware bulk import from the PDF layout text
importer = BulkImporter()
pdf_file = "aula_int_plus_1_glos_en_alfa.pdf"
textbook = "Aula Internacional Plus 1"
importer.import_pdf_glossary(pdf_file, textbook)
# 3. Immediately run the metadata preservation and text cleaning pass
cleaner = GlossaryCleaner()
cleaner.process_database_clean()
print("\n✨ Database completely rebuilt with pristine structured data!")
if __name__ == "__main__":
asyncio.run(rebuild_pipeline())