File size: 906 Bytes
11133c9 54b2662 b91b0a5 c429a2d 54b2662 11133c9 54b2662 11133c9 b91b0a5 11133c9 b91b0a5 11133c9 b91b0a5 11133c9 b91b0a5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from docling_processor import DoclingProcessor
# Cấu hình đường dẫn
PDF_FILE = "" # File đơn lẻ (để trống nếu muốn parse cả thư mục)
SOURCE_DIR = "data/data_raw" # Thư mục chứa PDFs
OUTPUT_DIR = "data" # Thư mục xuất Markdown
USE_OCR = False # Bật OCR cho PDF scan
if __name__ == "__main__":
processor = DoclingProcessor(OUTPUT_DIR, use_ocr=USE_OCR)
if PDF_FILE:
# Parse 1 file đơn lẻ
print(f"Đang xử lý: {PDF_FILE}")
result = processor.parse_document(PDF_FILE)
print("Xong!" if result else "Lỗi hoặc bỏ qua")
else:
# Parse cả thư mục
print(f"Đang xử lý thư mục: {SOURCE_DIR}")
r = processor.parse_directory(SOURCE_DIR)
print(f"Tổng: {r['total']} | Thành công: {r['parsed']} | Bỏ qua: {r['skipped']} | Lỗi: {r['errors']}")
|