2026-06-12 11:58:47 +00:00
|
|
|
# main.py
|
2026-06-13 02:03:58 +00:00
|
|
|
import asyncio
|
2026-06-13 07:02:06 +00:00
|
|
|
from database.connection import init_db
|
|
|
|
|
from core.bulk_importer import BulkImporter
|
2026-06-13 09:59:02 +00:00
|
|
|
from core.clean_glossary import GlossaryCleaner
|
2026-06-12 11:58:47 +00:00
|
|
|
|
2026-06-13 09:59:02 +00:00
|
|
|
async def rebuild_pipeline():
|
|
|
|
|
print("🚀 Initiating Clean Reconstruction Pipeline...")
|
|
|
|
|
|
|
|
|
|
# 1. This will automatically recreate the blank .db file and all tables
|
2026-06-13 07:02:06 +00:00
|
|
|
init_db()
|
2026-06-12 11:58:47 +00:00
|
|
|
|
2026-06-13 09:59:02 +00:00
|
|
|
# 2. Run the layout-aware bulk import from the PDF layout text
|
2026-06-13 07:02:06 +00:00
|
|
|
importer = BulkImporter()
|
|
|
|
|
pdf_file = "aula_int_plus_1_glos_en_alfa.pdf"
|
|
|
|
|
textbook = "Aula Internacional Plus 1"
|
|
|
|
|
|
|
|
|
|
importer.import_pdf_glossary(pdf_file, textbook)
|
2026-06-13 09:59:02 +00:00
|
|
|
|
|
|
|
|
# 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!")
|
2026-06-12 11:58:47 +00:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2026-06-13 09:59:02 +00:00
|
|
|
asyncio.run(rebuild_pipeline())
|