Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Reconstructing Arabic PDFs to Word (.docx): Solving Ligatures, BiDi & Tables in Python

说明与用途

将阿拉伯语 PDF 转换为 Word 需要恢复连字、正确处理双向文本和表格。四阶段流水线实现 100% 准确率。

问题

Arabic PDFs often produce disconnected letters, reversed text, and broken tables when converted to editable Word documents.

结果

The pipeline achieves 100 % fidelity, restoring ligatures, correct RTL flow, and intact tables in the resulting Word document.

工作流

  • Stage 1: Detect layout and boundaries using line segmentation and Hough transform, clustering boxes with DBSCAN.
  • Stage 2: Apply high‑precision Arabic OCR (Tesseract/Transformer) and score tokens.
  • Stage 3: Restore ligatures via Unicode normalization, reshape with arabic_reshaper, and reorder with ICU/pybidi.
  • Stage 4: Generate native RTL Word document with python‑docx, inserting <w:bidi/> attributes and reversing table columns.

证据

Disconnected letters: Isolated Arabic glyphs instead of fluid cursive words (م ح م د instead of محمد).

来源

Reversed text: Numbers, punctuation, and entire sentences flipped left-to-right (.ءاروجلإا ليلدت).

来源

The crucial step that 90% of open-source converters fail to implement is configuring Microsoft Word's underlying OpenXML schema for native Arabic RTL paragraphs and tables.

来源

  • 记录日期: 2026-11-02T16:13:49.688Z