BabelDOC 0.4.22__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/workflows/codeql.yml +1 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/workflows/docs.yml +2 -2
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/workflows/labeler.yml +1 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/workflows/lint.yml +1 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/workflows/pr-lint.yml +2 -2
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/workflows/publish-to-pypi.yml +5 -5
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/workflows/test.yml +2 -2
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.gitignore +4 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/PKG-INFO +22 -42
- {babeldoc-0.4.22 → babeldoc-0.5.1}/README.md +21 -41
- babeldoc-0.5.1/babeldoc/__init__.py +1 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/const.py +1 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/rpc_doclayout6.py +127 -3
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/babelpdf/base14.py +14 -3
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/converter.py +19 -12
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/__init__.py +18 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/backend/pdf_creater.py +535 -140
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/frontend/il_creater.py +510 -46
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/il_version_1.py +419 -29
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/il_version_1.rnc +100 -20
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/il_version_1.rng +255 -67
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/il_version_1.xsd +153 -38
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/add_debug_information.py +32 -8
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/detect_scanned_file.py +24 -16
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/il_translator.py +5 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/il_translator_llm_only.py +5 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/paragraph_finder.py +112 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/styles_and_formulas.py +457 -57
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/typesetting.py +202 -18
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/extract_char.py +7 -3
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/formular_helper.py +1 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/layout_helper.py +204 -40
- babeldoc-0.5.1/babeldoc/format/pdf/document_il/utils/matrix_helper.py +335 -0
- babeldoc-0.5.1/babeldoc/format/pdf/document_il/utils/spatial_analyzer.py +158 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/high_level.py +48 -13
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/pdfinterp.py +59 -54
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/translation_config.py +26 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/main.py +76 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/converter.py +35 -6
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdfinterp.py +3 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/pyproject.toml +2 -2
- babeldoc-0.4.22/babeldoc/__init__.py +0 -1
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.cursorignore +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/PULL_REQUEST_TEMPLATE/pr_form.yml +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/dependabot.yml +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/labels.yml +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.github/release-drafter.yml +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/.pre-commit-config.yaml +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/LICENSE +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/assets/assets.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/assets/embedding_assets_metadata.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/asynchronize/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/babeldoc_exception/BabelDOCException.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/babeldoc_exception/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/README.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/base_doclayout.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/doclayout.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/rpc_doclayout.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/rpc_doclayout2.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/rpc_doclayout3.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/rpc_doclayout4.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/rpc_doclayout5.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/rpc_doclayout7.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/docvision/table_detection/rapidocr.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/babelpdf/encoding.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/babelpdf/utils.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/backend/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/frontend/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/automatic_term_extractor.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/layout_parser.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/remove_descent.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/midend/table_parser.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/fontmap.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/mupdf_helper.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/paragraph_helper.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/style_helper.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/utils/zstd_helper.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/document_il/xml_converter.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/result_merger.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/format/pdf/split_manager.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/glossary.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/LICENSE +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/_saslprep.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/arcfour.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/ascii85.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/casting.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/ccitt.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/78-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/78-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/78-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/78-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/78-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/78-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/78ms-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/78ms-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/83pv-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/83pv-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/90ms-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/90ms-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/90msp-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/90msp-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/90pv-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/90pv-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Add-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Add-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Add-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Add-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/B5pc-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/B5pc-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/CNS-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/CNS-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/CNS1-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/CNS1-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/CNS2-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/CNS2-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/ETHK-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/ETHK-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/ETen-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/ETen-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/ETenms-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/ETenms-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Ext-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Ext-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Ext-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Ext-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GB-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GB-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GB-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GB-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBK-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBK-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBK2K-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBK2K-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBKp-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBKp-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBT-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBT-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBT-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBT-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBTpc-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBTpc-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBpc-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/GBpc-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKdla-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKdla-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKdlb-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKdlb-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKgccs-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKgccs-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKm314-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKm314-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKm471-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKm471-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKscs-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/HKscs-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Hankaku-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Hankaku-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Hiragana-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Hiragana-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSC-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSC-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSC-Johab-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSC-Johab-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSCms-UHC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSCms-UHC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSCpc-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/KSCpc-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Katakana-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Katakana-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/NWP-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/NWP-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/README.txt +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Roman-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/Roman-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniCNS-UCS2-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniCNS-UCS2-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniCNS-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniCNS-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniCNS-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniCNS-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniCNS-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniCNS-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniGB-UCS2-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniGB-UCS2-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniGB-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniGB-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniGB-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniGB-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniGB-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniGB-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UCS2-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UCS2-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniKS-UCS2-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniKS-UCS2-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniKS-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniKS-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniKS-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniKS-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniKS-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/UniKS-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/WP-Symbol-H.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/WP-Symbol-V.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/to-unicode-Adobe-CNS1.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/to-unicode-Adobe-GB1.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Japan1.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Korea1.pickle.gz +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/cmapdb.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/data_structures.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/encodingdb.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/fontmetrics.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/glyphlist.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/high_level.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/image.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/jbig2.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/latin_enc.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/layout.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/lzw.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdfcolor.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdfdevice.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdfdocument.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdfexceptions.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdffont.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdfpage.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdfparser.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/pdftypes.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/psexceptions.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/psparser.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/py.typed +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/runlength.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/settings.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/pdfminer/utils.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/progress_monitor.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/tools/generate_font_metadata.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/tools/italic_assistance.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/tools/italic_recognize_tool.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/translator/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/translator/cache.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/translator/translator.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/utils/__init__.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/utils/atomic_integer.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/babeldoc/utils/priority_thread_pool_executor.py +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/CODE_OF_CONDUCT.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/CONTRIBUTING.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/CONTRIBUTOR_REWARD.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/ImplementationDetails/AsyncTranslate/AsyncTranslate.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/ImplementationDetails/ILTranslator/ILTranslator.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/ImplementationDetails/PDFCreation/PDFCreation.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/ImplementationDetails/PDFParsing/PDFParsing.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/ImplementationDetails/ParagraphFinding/ParagraphFinding.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/ImplementationDetails/README.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/ImplementationDetails/StylesAndFormulas/StylesAndFormulas.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/ImplementationDetails/Typesetting/Typesetting.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/README.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/deploy.sh +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/example/demo_glossary.csv +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-banner.png +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.png +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.svg +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-big-logo-with-transparent-background.png +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-big-logo-with-transparent-background.svg +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-big-logo.png +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-contributor_reward_example.png +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-preview.gif +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-small-logo-with-transparent-background.png +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-small-logo-with-transparent-background.svg +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/images/babeldoc-small-logo.png +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/index.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/intro-to-pdf-object.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/requirements.txt +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/docs/supported_languages.md +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/mkdocs.yml +0 -0
- {babeldoc-0.4.22 → babeldoc-0.5.1}/tests/test_translation_cache_cleanup.py +0 -0
|
@@ -55,7 +55,7 @@ jobs:
|
|
|
55
55
|
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
|
|
56
56
|
steps:
|
|
57
57
|
- name: Checkout repository
|
|
58
|
-
uses: actions/checkout@
|
|
58
|
+
uses: actions/checkout@v5
|
|
59
59
|
|
|
60
60
|
# Initializes the CodeQL tools for scanning.
|
|
61
61
|
- name: Initialize CodeQL
|
|
@@ -9,7 +9,7 @@ jobs:
|
|
|
9
9
|
deploy:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
|
-
- uses: actions/checkout@
|
|
12
|
+
- uses: actions/checkout@v5
|
|
13
13
|
with:
|
|
14
14
|
fetch-depth: 0
|
|
15
15
|
- name: Configure Git Credentials
|
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
git config user.name github-actions[bot]
|
|
18
18
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
19
19
|
- name: Setup uv with Python 3.12
|
|
20
|
-
uses: astral-sh/setup-uv@
|
|
20
|
+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
|
|
21
21
|
with:
|
|
22
22
|
python-version: "3.12"
|
|
23
23
|
enable-cache: true
|
|
@@ -9,7 +9,7 @@ jobs:
|
|
|
9
9
|
name: runner / ruff
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
|
-
- uses: actions/checkout@
|
|
12
|
+
- uses: actions/checkout@v5
|
|
13
13
|
|
|
14
14
|
- name: Install Python
|
|
15
15
|
uses: actions/setup-python@v5
|
|
@@ -34,7 +34,7 @@ jobs:
|
|
|
34
34
|
name: runner / autocorrect
|
|
35
35
|
runs-on: ubuntu-latest
|
|
36
36
|
steps:
|
|
37
|
-
- uses: actions/checkout@
|
|
37
|
+
- uses: actions/checkout@v5
|
|
38
38
|
- name: AutoCorrect
|
|
39
39
|
uses: huacnlee/autocorrect-action@bf91ab3904c2908dd8e71312a8a83ed1eb632997 # v2.13.3
|
|
40
40
|
- name: Report ReviewDog
|
|
@@ -28,14 +28,14 @@ jobs:
|
|
|
28
28
|
outputs:
|
|
29
29
|
is_release: ${{ steps.check-version.outputs.tag }}
|
|
30
30
|
steps:
|
|
31
|
-
- uses: actions/checkout@
|
|
31
|
+
- uses: actions/checkout@v5
|
|
32
32
|
with:
|
|
33
33
|
persist-credentials: true
|
|
34
34
|
fetch-depth: 2
|
|
35
35
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
36
36
|
|
|
37
37
|
- name: Setup uv with Python 3.12
|
|
38
|
-
uses: astral-sh/setup-uv@
|
|
38
|
+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
|
|
39
39
|
with:
|
|
40
40
|
python-version: "3.12"
|
|
41
41
|
enable-cache: true
|
|
@@ -90,7 +90,7 @@ jobs:
|
|
|
90
90
|
|
|
91
91
|
steps:
|
|
92
92
|
- name: Download all the dists
|
|
93
|
-
uses: actions/download-artifact@
|
|
93
|
+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
|
|
94
94
|
with:
|
|
95
95
|
name: python-package-distributions
|
|
96
96
|
path: dist/
|
|
@@ -114,7 +114,7 @@ jobs:
|
|
|
114
114
|
|
|
115
115
|
steps:
|
|
116
116
|
- name: Download all the dists
|
|
117
|
-
uses: actions/download-artifact@
|
|
117
|
+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
|
|
118
118
|
with:
|
|
119
119
|
name: python-package-distributions
|
|
120
120
|
path: dist/
|
|
@@ -139,7 +139,7 @@ jobs:
|
|
|
139
139
|
contents: write
|
|
140
140
|
pull-requests: write
|
|
141
141
|
steps:
|
|
142
|
-
- uses: actions/checkout@
|
|
142
|
+
- uses: actions/checkout@v5
|
|
143
143
|
with:
|
|
144
144
|
persist-credentials: true
|
|
145
145
|
fetch-depth: 2
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
19
19
|
|
|
20
20
|
steps:
|
|
21
|
-
- uses: actions/checkout@
|
|
21
|
+
- uses: actions/checkout@v5
|
|
22
22
|
with:
|
|
23
23
|
persist-credentials: false
|
|
24
24
|
- name: Cached Assets
|
|
@@ -28,7 +28,7 @@ jobs:
|
|
|
28
28
|
path: ~/.cache/babeldoc
|
|
29
29
|
key: babeldoc-assets-${{ hashFiles('babeldoc/assets/embedding_assets_metadata.py') }}
|
|
30
30
|
- name: Setup uv with Python ${{ matrix.python-version }}
|
|
31
|
-
uses: astral-sh/setup-uv@
|
|
31
|
+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
|
|
32
32
|
with:
|
|
33
33
|
python-version: ${{ matrix.python-version }}
|
|
34
34
|
enable-cache: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: BabelDOC
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Yet Another Document Translator
|
|
5
5
|
Project-URL: Homepage, https://github.com/funstory-ai/BabelDOC
|
|
6
6
|
Project-URL: Issues, https://github.com/funstory-ai/BabelDOC/issues
|
|
@@ -218,6 +218,13 @@ uv run babeldoc --files example.pdf --files example2.pdf --openai --openai-model
|
|
|
218
218
|
- `--auto-enable-ocr-workaround`: Enable automatic OCR workaround (default: False). If a document is detected as heavily scanned, this will attempt to enable OCR processing and skip further scan detection. See "Important Interaction Note" below for crucial details on how this interacts with `--ocr-workaround` and `--skip-scanned-detection`.
|
|
219
219
|
- `--primary-font-family`: Override primary font family for translated text. Choices: 'serif' for serif fonts, 'sans-serif' for sans-serif fonts, 'script' for script/italic fonts. If not specified, uses automatic font selection based on original text properties.
|
|
220
220
|
- `--only-include-translated-page`: Only include translated pages in the output PDF. This option is only effective when `--pages` is used. (default: False)
|
|
221
|
+
- `--merge-alternating-line-numbers`: Enable post-processing to merge alternating line-number layouts (keep the number paragraph as an independent paragraph b; merge adjacent text paragraphs a and c across it when `layout_id` and `xobj_id` match, digits are ASCII and spaces only). Default: off.
|
|
222
|
+
- `--skip-form-render`: Skip form rendering (default: False). When enabled, PDF forms will not be rendered in the output.
|
|
223
|
+
- `--skip-curve-render`: Skip curve rendering (default: False). When enabled, PDF curves will not be rendered in the output.
|
|
224
|
+
- `--only-parse-generate-pdf`: Only parse PDF and generate output PDF without translation (default: False). This skips all translation-related processing including layout analysis, paragraph finding, style processing, and translation itself. Useful for testing PDF parsing and reconstruction functionality.
|
|
225
|
+
- `--remove-non-formula-lines`: Remove non-formula lines from paragraph areas (default: False). This removes decorative lines that are not part of formulas, while protecting lines in figure/table areas. Useful for cleaning up documents with decorative elements that interfere with text flow.
|
|
226
|
+
- `--non-formula-line-iou-threshold`: IoU threshold for detecting paragraph overlap when removing non-formula lines (default: 0.9). Higher values are more conservative and will remove fewer lines.
|
|
227
|
+
- `--figure-table-protection-threshold`: IoU threshold for protecting lines in figure/table areas when removing non-formula lines (default: 0.9). Higher values provide more protection for structural elements in figures and tables.
|
|
221
228
|
|
|
222
229
|
- `--rpc-doclayout`: RPC service host address for document layout analysis (default: None)
|
|
223
230
|
- `--working-dir`: Working directory for translation. If not set, use temp directory.
|
|
@@ -338,6 +345,12 @@ ocr_workaround = false # Use OCR workaround for scanned PDFs
|
|
|
338
345
|
rpc_doclayout = "" # RPC service host for document layout analysis
|
|
339
346
|
working_dir = "" # Working directory for translation
|
|
340
347
|
auto_enable_ocr_workaround = false # Enable automatic OCR workaround for scanned PDFs. See docs for interaction with ocr_workaround and skip_scanned_detection.
|
|
348
|
+
skip_form_render = false # Skip form rendering (default: False)
|
|
349
|
+
skip_curve_render = false # Skip curve rendering (default: False)
|
|
350
|
+
only_parse_generate_pdf = false # Only parse PDF and generate output PDF without translation (default: False)
|
|
351
|
+
remove_non_formula_lines = false # Remove non-formula lines from paragraph areas (default: False)
|
|
352
|
+
non_formula_line_iou_threshold = 0.2 # IoU threshold for paragraph overlap detection (default: 0.2)
|
|
353
|
+
figure_table_protection_threshold = 0.3 # IoU threshold for figure/table protection (default: 0.3)
|
|
341
354
|
|
|
342
355
|
# Translation service
|
|
343
356
|
openai = true
|
|
@@ -363,48 +376,10 @@ report-interval = 0.5
|
|
|
363
376
|
|
|
364
377
|
## Python API
|
|
365
378
|
|
|
366
|
-
|
|
367
|
-
>
|
|
368
|
-
> 1. Before pdf2zh 2.0 is released, you can temporarily use BabelDOC's Python API. However, after pdf2zh 2.0 is released, please directly use pdf2zh's Python API.
|
|
369
|
-
>
|
|
370
|
-
> 2. This project's Python API does not guarantee any compatibility. However, the Python API from pdf2zh will guarantee a certain level of compatibility.
|
|
371
|
-
>
|
|
372
|
-
> 3. We do not provide any technical support for the BabelDOC API.
|
|
373
|
-
>
|
|
374
|
-
> 4. When performing secondary development, please refer to [pdf2zh 2.0 high level](https://github.com/PDFMathTranslate/PDFMathTranslate-next/blob/main/pdf2zh_next/high_level.py) and ensure that BabelDOC runs in a subprocess.
|
|
375
|
-
|
|
376
|
-
You can refer to the example in [main.py](https://github.com/funstory-ai/yadt/blob/main/babeldoc/main.py) to use BabelDOC's Python API.
|
|
377
|
-
|
|
378
|
-
Please note:
|
|
379
|
-
|
|
380
|
-
1. Make sure call `babeldoc.format.pdf.high_level.init()` before using the API
|
|
381
|
-
|
|
382
|
-
2. The current `TranslationConfig` does not fully validate input parameters, so you need to ensure the validity of input parameters
|
|
383
|
-
|
|
384
|
-
3. For offline assets management, you can use the following functions:
|
|
385
|
-
```python
|
|
386
|
-
# Generate an offline assets package
|
|
387
|
-
from pathlib import Path
|
|
388
|
-
import babeldoc.assets.assets
|
|
389
|
-
|
|
390
|
-
# Generate package to a specific directory
|
|
391
|
-
# path is optional, default is ~/.cache/babeldoc/assets/offline_assets_{hash}.zip
|
|
392
|
-
babeldoc.assets.assets.generate_offline_assets_package(Path("/path/to/output/dir"))
|
|
393
|
-
|
|
394
|
-
# Restore from a package file
|
|
395
|
-
# path is optional, default is ~/.cache/babeldoc/assets/offline_assets_{hash}.zip
|
|
396
|
-
babeldoc.assets.assets.restore_offline_assets_package(Path("/path/to/offline_assets_package.zip"))
|
|
397
|
-
|
|
398
|
-
# You can also restore from a directory containing the offline assets package
|
|
399
|
-
# The tool will automatically find the correct package file based on the hash
|
|
400
|
-
babeldoc.assets.assets.restore_offline_assets_package(Path("/path/to/directory"))
|
|
401
|
-
```
|
|
379
|
+
The current recommended way to call BabelDOC in Python is to call the `high_level.do_translate_async_stream` function of [pdf2zh next](https://github.com/PDFMathTranslate/PDFMathTranslate-next).
|
|
402
380
|
|
|
403
|
-
> [!
|
|
404
|
-
>
|
|
405
|
-
> 1. The offline assets package name cannot be modified because the file list hash is encoded in the name.
|
|
406
|
-
> 2. When using in production environments, it's recommended to pre-generate the assets package and include it with your application distribution.
|
|
407
|
-
> 3. The package verification ensures that all required assets are intact and match their expected checksums.
|
|
381
|
+
> [!WARNING]
|
|
382
|
+
> **All APIs of BabelDOC should be considered as internal APIs, and any direct use of BabelDOC is not supported.**
|
|
408
383
|
|
|
409
384
|
## Background
|
|
410
385
|
|
|
@@ -459,6 +434,11 @@ And meet the following requirements:
|
|
|
459
434
|
|
|
460
435
|
This project uses a combination of [Semantic Versioning](https://semver.org/) and [Pride Versioning](https://pridever.org/). The version number format is: "0.MAJOR.MINOR".
|
|
461
436
|
|
|
437
|
+
> [!NOTE]
|
|
438
|
+
>
|
|
439
|
+
> The API compatibility here mainly refers to the compatibility with [pdf2zh_next](https://github.com/PDFMathTranslate/PDFMathTranslate-next).
|
|
440
|
+
|
|
441
|
+
|
|
462
442
|
- MAJOR: Incremented by 1 when API incompatible changes are made or when proud improvements are implemented.
|
|
463
443
|
|
|
464
444
|
- MINOR: Incremented by 1 when any API compatible changes are made.
|
|
@@ -162,6 +162,13 @@ uv run babeldoc --files example.pdf --files example2.pdf --openai --openai-model
|
|
|
162
162
|
- `--auto-enable-ocr-workaround`: Enable automatic OCR workaround (default: False). If a document is detected as heavily scanned, this will attempt to enable OCR processing and skip further scan detection. See "Important Interaction Note" below for crucial details on how this interacts with `--ocr-workaround` and `--skip-scanned-detection`.
|
|
163
163
|
- `--primary-font-family`: Override primary font family for translated text. Choices: 'serif' for serif fonts, 'sans-serif' for sans-serif fonts, 'script' for script/italic fonts. If not specified, uses automatic font selection based on original text properties.
|
|
164
164
|
- `--only-include-translated-page`: Only include translated pages in the output PDF. This option is only effective when `--pages` is used. (default: False)
|
|
165
|
+
- `--merge-alternating-line-numbers`: Enable post-processing to merge alternating line-number layouts (keep the number paragraph as an independent paragraph b; merge adjacent text paragraphs a and c across it when `layout_id` and `xobj_id` match, digits are ASCII and spaces only). Default: off.
|
|
166
|
+
- `--skip-form-render`: Skip form rendering (default: False). When enabled, PDF forms will not be rendered in the output.
|
|
167
|
+
- `--skip-curve-render`: Skip curve rendering (default: False). When enabled, PDF curves will not be rendered in the output.
|
|
168
|
+
- `--only-parse-generate-pdf`: Only parse PDF and generate output PDF without translation (default: False). This skips all translation-related processing including layout analysis, paragraph finding, style processing, and translation itself. Useful for testing PDF parsing and reconstruction functionality.
|
|
169
|
+
- `--remove-non-formula-lines`: Remove non-formula lines from paragraph areas (default: False). This removes decorative lines that are not part of formulas, while protecting lines in figure/table areas. Useful for cleaning up documents with decorative elements that interfere with text flow.
|
|
170
|
+
- `--non-formula-line-iou-threshold`: IoU threshold for detecting paragraph overlap when removing non-formula lines (default: 0.9). Higher values are more conservative and will remove fewer lines.
|
|
171
|
+
- `--figure-table-protection-threshold`: IoU threshold for protecting lines in figure/table areas when removing non-formula lines (default: 0.9). Higher values provide more protection for structural elements in figures and tables.
|
|
165
172
|
|
|
166
173
|
- `--rpc-doclayout`: RPC service host address for document layout analysis (default: None)
|
|
167
174
|
- `--working-dir`: Working directory for translation. If not set, use temp directory.
|
|
@@ -282,6 +289,12 @@ ocr_workaround = false # Use OCR workaround for scanned PDFs
|
|
|
282
289
|
rpc_doclayout = "" # RPC service host for document layout analysis
|
|
283
290
|
working_dir = "" # Working directory for translation
|
|
284
291
|
auto_enable_ocr_workaround = false # Enable automatic OCR workaround for scanned PDFs. See docs for interaction with ocr_workaround and skip_scanned_detection.
|
|
292
|
+
skip_form_render = false # Skip form rendering (default: False)
|
|
293
|
+
skip_curve_render = false # Skip curve rendering (default: False)
|
|
294
|
+
only_parse_generate_pdf = false # Only parse PDF and generate output PDF without translation (default: False)
|
|
295
|
+
remove_non_formula_lines = false # Remove non-formula lines from paragraph areas (default: False)
|
|
296
|
+
non_formula_line_iou_threshold = 0.2 # IoU threshold for paragraph overlap detection (default: 0.2)
|
|
297
|
+
figure_table_protection_threshold = 0.3 # IoU threshold for figure/table protection (default: 0.3)
|
|
285
298
|
|
|
286
299
|
# Translation service
|
|
287
300
|
openai = true
|
|
@@ -307,48 +320,10 @@ report-interval = 0.5
|
|
|
307
320
|
|
|
308
321
|
## Python API
|
|
309
322
|
|
|
310
|
-
|
|
311
|
-
>
|
|
312
|
-
> 1. Before pdf2zh 2.0 is released, you can temporarily use BabelDOC's Python API. However, after pdf2zh 2.0 is released, please directly use pdf2zh's Python API.
|
|
313
|
-
>
|
|
314
|
-
> 2. This project's Python API does not guarantee any compatibility. However, the Python API from pdf2zh will guarantee a certain level of compatibility.
|
|
315
|
-
>
|
|
316
|
-
> 3. We do not provide any technical support for the BabelDOC API.
|
|
317
|
-
>
|
|
318
|
-
> 4. When performing secondary development, please refer to [pdf2zh 2.0 high level](https://github.com/PDFMathTranslate/PDFMathTranslate-next/blob/main/pdf2zh_next/high_level.py) and ensure that BabelDOC runs in a subprocess.
|
|
319
|
-
|
|
320
|
-
You can refer to the example in [main.py](https://github.com/funstory-ai/yadt/blob/main/babeldoc/main.py) to use BabelDOC's Python API.
|
|
321
|
-
|
|
322
|
-
Please note:
|
|
323
|
-
|
|
324
|
-
1. Make sure call `babeldoc.format.pdf.high_level.init()` before using the API
|
|
325
|
-
|
|
326
|
-
2. The current `TranslationConfig` does not fully validate input parameters, so you need to ensure the validity of input parameters
|
|
327
|
-
|
|
328
|
-
3. For offline assets management, you can use the following functions:
|
|
329
|
-
```python
|
|
330
|
-
# Generate an offline assets package
|
|
331
|
-
from pathlib import Path
|
|
332
|
-
import babeldoc.assets.assets
|
|
333
|
-
|
|
334
|
-
# Generate package to a specific directory
|
|
335
|
-
# path is optional, default is ~/.cache/babeldoc/assets/offline_assets_{hash}.zip
|
|
336
|
-
babeldoc.assets.assets.generate_offline_assets_package(Path("/path/to/output/dir"))
|
|
337
|
-
|
|
338
|
-
# Restore from a package file
|
|
339
|
-
# path is optional, default is ~/.cache/babeldoc/assets/offline_assets_{hash}.zip
|
|
340
|
-
babeldoc.assets.assets.restore_offline_assets_package(Path("/path/to/offline_assets_package.zip"))
|
|
341
|
-
|
|
342
|
-
# You can also restore from a directory containing the offline assets package
|
|
343
|
-
# The tool will automatically find the correct package file based on the hash
|
|
344
|
-
babeldoc.assets.assets.restore_offline_assets_package(Path("/path/to/directory"))
|
|
345
|
-
```
|
|
323
|
+
The current recommended way to call BabelDOC in Python is to call the `high_level.do_translate_async_stream` function of [pdf2zh next](https://github.com/PDFMathTranslate/PDFMathTranslate-next).
|
|
346
324
|
|
|
347
|
-
> [!
|
|
348
|
-
>
|
|
349
|
-
> 1. The offline assets package name cannot be modified because the file list hash is encoded in the name.
|
|
350
|
-
> 2. When using in production environments, it's recommended to pre-generate the assets package and include it with your application distribution.
|
|
351
|
-
> 3. The package verification ensures that all required assets are intact and match their expected checksums.
|
|
325
|
+
> [!WARNING]
|
|
326
|
+
> **All APIs of BabelDOC should be considered as internal APIs, and any direct use of BabelDOC is not supported.**
|
|
352
327
|
|
|
353
328
|
## Background
|
|
354
329
|
|
|
@@ -403,6 +378,11 @@ And meet the following requirements:
|
|
|
403
378
|
|
|
404
379
|
This project uses a combination of [Semantic Versioning](https://semver.org/) and [Pride Versioning](https://pridever.org/). The version number format is: "0.MAJOR.MINOR".
|
|
405
380
|
|
|
381
|
+
> [!NOTE]
|
|
382
|
+
>
|
|
383
|
+
> The API compatibility here mainly refers to the compatibility with [pdf2zh_next](https://github.com/PDFMathTranslate/PDFMathTranslate-next).
|
|
384
|
+
|
|
385
|
+
|
|
406
386
|
- MAJOR: Incremented by 1 when API incompatible changes are made or when proud improvements are implemented.
|
|
407
387
|
|
|
408
388
|
- MINOR: Incremented by 1 when any API compatible changes are made.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.1"
|
|
@@ -2,6 +2,7 @@ import base64
|
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
4
|
import threading
|
|
5
|
+
import unicodedata
|
|
5
6
|
from concurrent.futures import ThreadPoolExecutor
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
|
|
@@ -25,6 +26,8 @@ from babeldoc.format.pdf.document_il.utils.extract_char import (
|
|
|
25
26
|
from babeldoc.format.pdf.document_il.utils.extract_char import (
|
|
26
27
|
process_page_chars_to_lines,
|
|
27
28
|
)
|
|
29
|
+
from babeldoc.format.pdf.document_il.utils.fontmap import FontMapper
|
|
30
|
+
from babeldoc.format.pdf.document_il.utils.layout_helper import SPACE_REGEX
|
|
28
31
|
from babeldoc.format.pdf.document_il.utils.mupdf_helper import get_no_rotation_img
|
|
29
32
|
|
|
30
33
|
logger = logging.getLogger(__name__)
|
|
@@ -64,11 +67,21 @@ def encode_image(image) -> bytes:
|
|
|
64
67
|
f"(Attempt {retry_state.attempt_number}/3)"
|
|
65
68
|
),
|
|
66
69
|
)
|
|
70
|
+
def clip_num(num: float, min_value: float, max_value: float) -> float:
|
|
71
|
+
"""Clip a number to a specified range."""
|
|
72
|
+
if num < min_value:
|
|
73
|
+
return min_value
|
|
74
|
+
elif num > max_value:
|
|
75
|
+
return max_value
|
|
76
|
+
return num
|
|
77
|
+
|
|
78
|
+
|
|
67
79
|
def predict_layout(
|
|
68
80
|
image,
|
|
69
81
|
host: str = "http://localhost:8000",
|
|
70
82
|
_imgsz: int = 1024,
|
|
71
83
|
lines=None,
|
|
84
|
+
font_mapper: FontMapper | None = None,
|
|
72
85
|
):
|
|
73
86
|
"""Predict document layout using OCR line information (RPC service)."""
|
|
74
87
|
|
|
@@ -86,20 +99,30 @@ def predict_layout(
|
|
|
86
99
|
min_y = min(b.y for b in boxes)
|
|
87
100
|
max_y = max(b.y2 for b in boxes)
|
|
88
101
|
|
|
102
|
+
image_height, image_width = image.shape[:2]
|
|
103
|
+
|
|
89
104
|
# Transform to image pixel coordinates
|
|
90
105
|
min_x = min_x / 72 * DPI
|
|
91
106
|
max_x = max_x / 72 * DPI
|
|
92
107
|
min_y = min_y / 72 * DPI
|
|
93
108
|
max_y = max_y / 72 * DPI
|
|
94
109
|
|
|
95
|
-
image_height = image.shape[0]
|
|
96
110
|
min_y, max_y = image_height - max_y, image_height - min_y
|
|
97
111
|
|
|
98
112
|
box_volume = (max_x - min_x) * (max_y - min_y)
|
|
99
113
|
if box_volume < 1:
|
|
100
114
|
return None
|
|
101
115
|
|
|
102
|
-
|
|
116
|
+
min_x = clip_num(min_x, 0, image_width - 1)
|
|
117
|
+
max_x = clip_num(max_x, 0, image_width - 1)
|
|
118
|
+
min_y = clip_num(min_y, 0, image_height - 1)
|
|
119
|
+
max_y = clip_num(max_y, 0, image_height - 1)
|
|
120
|
+
|
|
121
|
+
filtered_text = filter_text(line.text, font_mapper)
|
|
122
|
+
if not filtered_text:
|
|
123
|
+
return None
|
|
124
|
+
|
|
125
|
+
return {"box": [min_x, min_y, max_x, max_y], "text": filtered_text}
|
|
103
126
|
|
|
104
127
|
formatted_results = [convert_line(l) for l in lines]
|
|
105
128
|
formatted_results = [r for r in formatted_results if r is not None]
|
|
@@ -261,6 +284,17 @@ class ResultContainer:
|
|
|
261
284
|
self.result = YoloResult(boxes_data=np.array([]), names=[])
|
|
262
285
|
|
|
263
286
|
|
|
287
|
+
def filter_text(txt: str, font_mapper: FontMapper):
|
|
288
|
+
normalize = unicodedata.normalize("NFKC", txt)
|
|
289
|
+
unicodes = []
|
|
290
|
+
for c in normalize:
|
|
291
|
+
if font_mapper.has_char(c):
|
|
292
|
+
unicodes.append(c)
|
|
293
|
+
normalize = "".join(unicodes)
|
|
294
|
+
result = SPACE_REGEX.sub(" ", normalize).strip()
|
|
295
|
+
return result
|
|
296
|
+
|
|
297
|
+
|
|
264
298
|
class RpcDocLayoutModel(DocLayoutModel):
|
|
265
299
|
"""DocLayoutModel implementation that uses RPC service."""
|
|
266
300
|
|
|
@@ -283,6 +317,10 @@ class RpcDocLayoutModel(DocLayoutModel):
|
|
|
283
317
|
self._stride = 32 # Default stride value
|
|
284
318
|
self._names = ["text", "title", "list", "table", "figure"]
|
|
285
319
|
self.lock = threading.Lock()
|
|
320
|
+
self.font_mapper = None
|
|
321
|
+
|
|
322
|
+
def init_font_mapper(self, translation_config):
|
|
323
|
+
self.font_mapper = FontMapper(translation_config)
|
|
286
324
|
|
|
287
325
|
@property
|
|
288
326
|
def stride(self) -> int:
|
|
@@ -356,6 +394,84 @@ class RpcDocLayoutModel(DocLayoutModel):
|
|
|
356
394
|
boxes = (boxes - [pad_x, pad_y, pad_x, pad_y]) / gain
|
|
357
395
|
return boxes
|
|
358
396
|
|
|
397
|
+
def calculate_iou(self, box1, box2):
|
|
398
|
+
"""Calculate IoU between two boxes in xyxy format."""
|
|
399
|
+
x1_1, y1_1, x2_1, y2_1 = box1
|
|
400
|
+
x1_2, y1_2, x2_2, y2_2 = box2
|
|
401
|
+
|
|
402
|
+
# Calculate intersection area
|
|
403
|
+
x1_inter = max(x1_1, x1_2)
|
|
404
|
+
y1_inter = max(y1_1, y1_2)
|
|
405
|
+
x2_inter = min(x2_1, x2_2)
|
|
406
|
+
y2_inter = min(y2_1, y2_2)
|
|
407
|
+
|
|
408
|
+
if x2_inter <= x1_inter or y2_inter <= y1_inter:
|
|
409
|
+
return 0.0
|
|
410
|
+
|
|
411
|
+
intersection = (x2_inter - x1_inter) * (y2_inter - y1_inter)
|
|
412
|
+
|
|
413
|
+
# Calculate union area
|
|
414
|
+
area1 = (x2_1 - x1_1) * (y2_1 - y1_1)
|
|
415
|
+
area2 = (x2_2 - x1_2) * (y2_2 - y1_2)
|
|
416
|
+
union = area1 + area2 - intersection
|
|
417
|
+
|
|
418
|
+
return intersection / union if union > 0 else 0.0
|
|
419
|
+
|
|
420
|
+
def is_subset(self, inner_box, outer_box):
|
|
421
|
+
"""Check if inner_box is a subset of outer_box."""
|
|
422
|
+
x1_inner, y1_inner, x2_inner, y2_inner = inner_box
|
|
423
|
+
x1_outer, y1_outer, x2_outer, y2_outer = outer_box
|
|
424
|
+
|
|
425
|
+
return (
|
|
426
|
+
x1_inner >= x1_outer
|
|
427
|
+
and y1_inner >= y1_outer
|
|
428
|
+
and x2_inner <= x2_outer
|
|
429
|
+
and y2_inner <= y2_outer
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
def expand_box_to_contain(self, box_to_expand, box_to_contain):
|
|
433
|
+
"""Expand box_to_expand to fully contain box_to_contain."""
|
|
434
|
+
x1_expand, y1_expand, x2_expand, y2_expand = box_to_expand
|
|
435
|
+
x1_contain, y1_contain, x2_contain, y2_contain = box_to_contain
|
|
436
|
+
|
|
437
|
+
return [
|
|
438
|
+
min(x1_expand, x1_contain),
|
|
439
|
+
min(y1_expand, y1_contain),
|
|
440
|
+
max(x2_expand, x2_contain),
|
|
441
|
+
max(y2_expand, y2_contain),
|
|
442
|
+
]
|
|
443
|
+
|
|
444
|
+
def post_process_boxes(self, merged_boxes: list[YoloBox], names: dict[int, str]):
|
|
445
|
+
"""Post-process merged boxes to handle text and paragraph_hybrid overlaps."""
|
|
446
|
+
for i, text_box in enumerate(merged_boxes):
|
|
447
|
+
text_label = names.get(text_box.cls, "")
|
|
448
|
+
if "text" not in text_label:
|
|
449
|
+
continue
|
|
450
|
+
|
|
451
|
+
for j, para_box in enumerate(merged_boxes):
|
|
452
|
+
if i == j:
|
|
453
|
+
continue
|
|
454
|
+
|
|
455
|
+
para_label = names.get(para_box.cls, "")
|
|
456
|
+
if "paragraph_hybrid" not in para_label:
|
|
457
|
+
continue
|
|
458
|
+
|
|
459
|
+
# Calculate IoU
|
|
460
|
+
iou = self.calculate_iou(text_box.xyxy, para_box.xyxy)
|
|
461
|
+
|
|
462
|
+
# Check if IoU > 0.95 and paragraph is not subset of text
|
|
463
|
+
if iou > 0.95 and not self.is_subset(para_box.xyxy, text_box.xyxy):
|
|
464
|
+
# Expand text box to contain paragraph_hybrid
|
|
465
|
+
expanded_box = self.expand_box_to_contain(
|
|
466
|
+
text_box.xyxy, para_box.xyxy
|
|
467
|
+
)
|
|
468
|
+
merged_boxes[i] = YoloBox(
|
|
469
|
+
None,
|
|
470
|
+
np.array(expanded_box),
|
|
471
|
+
text_box.conf,
|
|
472
|
+
text_box.cls,
|
|
473
|
+
)
|
|
474
|
+
|
|
359
475
|
def predict_image(
|
|
360
476
|
self,
|
|
361
477
|
image,
|
|
@@ -376,7 +492,12 @@ class RpcDocLayoutModel(DocLayoutModel):
|
|
|
376
492
|
with ThreadPoolExecutor(max_workers=2) as ex:
|
|
377
493
|
if lines:
|
|
378
494
|
future1 = ex.submit(
|
|
379
|
-
predict_layout,
|
|
495
|
+
predict_layout,
|
|
496
|
+
image_proc,
|
|
497
|
+
self.host1,
|
|
498
|
+
imgsz,
|
|
499
|
+
lines,
|
|
500
|
+
self.font_mapper,
|
|
380
501
|
)
|
|
381
502
|
future2 = ex.submit(predict_layout2, image_proc, self.host2, imgsz)
|
|
382
503
|
|
|
@@ -429,6 +550,9 @@ class RpcDocLayoutModel(DocLayoutModel):
|
|
|
429
550
|
# Sort boxes by confidence desc (YoloResult expects sorted list)
|
|
430
551
|
merged_boxes.sort(key=lambda b: b.conf, reverse=True)
|
|
431
552
|
|
|
553
|
+
# Post-process boxes to handle text and paragraph_hybrid overlaps
|
|
554
|
+
self.post_process_boxes(merged_boxes, names)
|
|
555
|
+
|
|
432
556
|
return YoloResult(boxes=merged_boxes, names=names)
|
|
433
557
|
|
|
434
558
|
def predict(self, image, imgsz=1024, **kwargs) -> list[YoloResult]: # type: ignore[override]
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from .encoding import win_ansi
|
|
2
|
+
|
|
1
3
|
base14_bbox = {
|
|
2
4
|
"Courier-BoldOblique": [
|
|
3
5
|
(0, 0, 0, 0),
|
|
@@ -1965,6 +1967,15 @@ base14_name = {
|
|
|
1965
1967
|
}
|
|
1966
1968
|
|
|
1967
1969
|
|
|
1968
|
-
def get_base14_bbox(family
|
|
1969
|
-
|
|
1970
|
-
|
|
1970
|
+
def get_base14_bbox(family):
|
|
1971
|
+
bbox = []
|
|
1972
|
+
if family in base14_bbox:
|
|
1973
|
+
base = base14_bbox[family]
|
|
1974
|
+
for name in win_ansi:
|
|
1975
|
+
cur_bbox = (0, 0, 0, 0)
|
|
1976
|
+
if name:
|
|
1977
|
+
index = base14_name.get(name)
|
|
1978
|
+
if index:
|
|
1979
|
+
cur_bbox = base[index]
|
|
1980
|
+
bbox.append(cur_bbox)
|
|
1981
|
+
return bbox
|
|
@@ -9,6 +9,7 @@ from babeldoc.format.pdf.document_il.frontend.il_creater import ILCreater
|
|
|
9
9
|
from babeldoc.pdfminer.converter import PDFConverter
|
|
10
10
|
from babeldoc.pdfminer.layout import LTChar
|
|
11
11
|
from babeldoc.pdfminer.layout import LTComponent
|
|
12
|
+
from babeldoc.pdfminer.layout import LTCurve
|
|
12
13
|
from babeldoc.pdfminer.layout import LTFigure
|
|
13
14
|
from babeldoc.pdfminer.layout import LTLine
|
|
14
15
|
from babeldoc.pdfminer.layout import LTPage
|
|
@@ -115,6 +116,7 @@ class PDFConverterEx(PDFConverter):
|
|
|
115
116
|
graphicstate,
|
|
116
117
|
self.il_creater.xobj_id,
|
|
117
118
|
font_id,
|
|
119
|
+
self.il_creater.get_render_order_and_increase(),
|
|
118
120
|
)
|
|
119
121
|
self.cur_item.add(item)
|
|
120
122
|
item.cid = cid # hack 插入原字符编码
|
|
@@ -139,6 +141,7 @@ class AWLTChar(LTChar):
|
|
|
139
141
|
graphicstate: PDFGraphicState,
|
|
140
142
|
xobj_id: int,
|
|
141
143
|
font_id: str,
|
|
144
|
+
render_order: int,
|
|
142
145
|
) -> None:
|
|
143
146
|
LTText.__init__(self)
|
|
144
147
|
self._text = text
|
|
@@ -149,6 +152,7 @@ class AWLTChar(LTChar):
|
|
|
149
152
|
self.xobj_id = xobj_id
|
|
150
153
|
self.adv = textwidth * fontsize * scaling
|
|
151
154
|
self.aw_font_id = font_id
|
|
155
|
+
self.render_order = render_order
|
|
152
156
|
# compute the boundary rectangle.
|
|
153
157
|
if font.is_vertical():
|
|
154
158
|
# vertical
|
|
@@ -378,18 +382,21 @@ class TranslateConverter(PDFConverterEx):
|
|
|
378
382
|
# 图表
|
|
379
383
|
self.il_creater.on_pdf_figure(child)
|
|
380
384
|
pass
|
|
381
|
-
elif isinstance(child, LTLine): # 线条
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
385
|
+
# elif isinstance(child, LTLine): # 线条
|
|
386
|
+
# continue
|
|
387
|
+
# layout = self.layout[ltpage.pageid]
|
|
388
|
+
# # ltpage.height 可能是 fig 里面的高度,这里统一用 layout.shape
|
|
389
|
+
# h, w = layout.shape
|
|
390
|
+
# # 读取当前线条在 layout 中的类别
|
|
391
|
+
# cx, cy = np.clip(int(child.x0), 0, w - 1), np.clip(int(child.y0), 0, h - 1)
|
|
392
|
+
# cls = layout[cy, cx]
|
|
393
|
+
# if vstk and cls == xt_cls: # 公式线条
|
|
394
|
+
# vlstk.append(child)
|
|
395
|
+
# else: # 全局线条
|
|
396
|
+
# lstk.append(child)
|
|
397
|
+
elif isinstance(child, LTCurve):
|
|
398
|
+
self.il_creater.on_lt_curve(child)
|
|
399
|
+
pass
|
|
393
400
|
else:
|
|
394
401
|
pass
|
|
395
402
|
return
|