BabelDOC 0.4.1__tar.gz → 0.4.3__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.1 → babeldoc-0.4.3}/PKG-INFO +1 -1
- babeldoc-0.4.3/babeldoc/__init__.py +1 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/const.py +1 -1
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/docvision/rpc_doclayout2.py +1 -1
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/frontend/il_creater.py +1 -1
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/styles_and_formulas.py +98 -69
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/typesetting.py +11 -8
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/utils/formular_helper.py +31 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/utils/layout_helper.py +2 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/high_level.py +9 -1
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/main.py +1 -1
- {babeldoc-0.4.1 → babeldoc-0.4.3}/pyproject.toml +2 -2
- {babeldoc-0.4.1 → babeldoc-0.4.3}/uv.lock +1 -1
- babeldoc-0.4.1/babeldoc/__init__.py +0 -1
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.cursorignore +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/PULL_REQUEST_TEMPLATE/pr_form.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/dependabot.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/labels.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/release-drafter.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/workflows/codeql.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/workflows/docs.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/workflows/labeler.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/workflows/lint.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/workflows/pr-lint.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/workflows/publish-to-pypi.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.github/workflows/test.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.gitignore +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/.pre-commit-config.yaml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/LICENSE +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/README.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/assets/assets.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/assets/embedding_assets_metadata.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/asynchronize/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/babeldoc_exception/BabelDOCException.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/babeldoc_exception/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/docvision/README.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/docvision/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/docvision/base_doclayout.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/docvision/doclayout.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/docvision/rpc_doclayout.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/docvision/table_detection/rapidocr.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/converter.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/backend/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/backend/pdf_creater.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/frontend/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/il_version_1.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/il_version_1.rnc +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/il_version_1.rng +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/il_version_1.xsd +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/add_debug_information.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/automatic_term_extractor.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/detect_scanned_file.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/il_translator.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/il_translator_llm_only.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/layout_parser.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/paragraph_finder.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/remove_descent.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/table_parser.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/utils/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/utils/fontmap.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/utils/mupdf_helper.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/utils/paragraph_helper.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/utils/style_helper.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/utils/zstd_helper.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/xml_converter.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/pdfinterp.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/result_merger.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/split_manager.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/translation_config.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/glossary.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/LICENSE +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/_saslprep.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/arcfour.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/ascii85.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/casting.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/ccitt.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/78-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/78-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/78-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/78-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/78-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/78-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/78ms-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/78ms-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/83pv-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/83pv-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/90ms-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/90ms-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/90msp-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/90msp-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/90pv-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/90pv-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Add-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Add-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Add-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Add-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/B5pc-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/B5pc-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/CNS-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/CNS-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/CNS1-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/CNS1-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/CNS2-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/CNS2-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/ETHK-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/ETHK-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/ETen-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/ETen-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/ETenms-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/ETenms-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Ext-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Ext-RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Ext-RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Ext-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GB-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GB-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GB-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GB-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBK-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBK-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBK2K-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBK2K-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBKp-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBKp-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBT-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBT-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBT-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBT-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBTpc-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBTpc-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBpc-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/GBpc-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKdla-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKdla-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKdlb-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKdlb-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKgccs-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKgccs-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKm314-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKm314-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKm471-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKm471-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKscs-B5-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/HKscs-B5-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Hankaku-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Hankaku-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Hiragana-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Hiragana-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSC-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSC-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSC-Johab-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSC-Johab-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSCms-UHC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSCms-UHC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSCpc-EUC-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/KSCpc-EUC-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Katakana-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Katakana-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/NWP-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/NWP-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/README.txt +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/RKSJ-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/RKSJ-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Roman-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/Roman-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniCNS-UCS2-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniCNS-UCS2-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniCNS-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniCNS-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniCNS-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniCNS-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniCNS-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniCNS-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniGB-UCS2-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniGB-UCS2-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniGB-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniGB-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniGB-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniGB-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniGB-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniGB-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UCS2-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UCS2-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniKS-UCS2-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniKS-UCS2-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniKS-UTF16-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniKS-UTF16-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniKS-UTF32-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniKS-UTF32-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniKS-UTF8-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/UniKS-UTF8-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/WP-Symbol-H.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/WP-Symbol-V.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/to-unicode-Adobe-CNS1.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/to-unicode-Adobe-GB1.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Japan1.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Korea1.pickle.gz +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/cmapdb.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/converter.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/data_structures.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/encodingdb.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/fontmetrics.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/glyphlist.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/high_level.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/image.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/jbig2.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/latin_enc.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/layout.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/lzw.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdfcolor.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdfdevice.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdfdocument.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdfexceptions.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdffont.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdfinterp.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdfpage.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdfparser.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/pdftypes.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/psexceptions.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/psparser.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/py.typed +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/runlength.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/settings.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/pdfminer/utils.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/progress_monitor.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/tools/generate_font_metadata.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/tools/italic_assistance.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/tools/italic_recognize_tool.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/translator/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/translator/cache.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/translator/translator.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/utils/__init__.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/utils/atomic_integer.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/utils/priority_thread_pool_executor.py +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/CODE_OF_CONDUCT.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/CONTRIBUTING.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/CONTRIBUTOR_REWARD.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/ImplementationDetails/AsyncTranslate/AsyncTranslate.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/ImplementationDetails/ILTranslator/ILTranslator.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/ImplementationDetails/PDFCreation/PDFCreation.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/ImplementationDetails/PDFParsing/PDFParsing.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/ImplementationDetails/ParagraphFinding/ParagraphFinding.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/ImplementationDetails/README.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/ImplementationDetails/StylesAndFormulas/StylesAndFormulas.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/ImplementationDetails/Typesetting/Typesetting.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/README.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/deploy.sh +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/example/demo_glossary.csv +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-banner.png +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.png +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.svg +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-big-logo-with-transparent-background.png +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-big-logo-with-transparent-background.svg +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-big-logo.png +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-contributor_reward_example.png +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-preview.gif +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-small-logo-with-transparent-background.png +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-small-logo-with-transparent-background.svg +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/images/babeldoc-small-logo.png +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/index.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/intro-to-pdf-object.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/requirements.txt +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/docs/supported_languages.md +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/mkdocs.yml +0 -0
- {babeldoc-0.4.1 → babeldoc-0.4.3}/tests/test_translation_config.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.3"
|
|
@@ -286,7 +286,7 @@ class RpcDocLayoutModel(DocLayoutModel):
|
|
|
286
286
|
translate_config,
|
|
287
287
|
save_debug_image,
|
|
288
288
|
):
|
|
289
|
-
with ThreadPoolExecutor(max_workers=
|
|
289
|
+
with ThreadPoolExecutor(max_workers=128) as executor:
|
|
290
290
|
yield from executor.map(
|
|
291
291
|
self.predict_page,
|
|
292
292
|
pages,
|
|
@@ -656,7 +656,7 @@ class ILCreater:
|
|
|
656
656
|
_, encoding = self.mupdf.xref_get_key(xref_id, "Encoding")
|
|
657
657
|
if encoding == "/Identity-H" or encoding == "/Identity-V":
|
|
658
658
|
encoding_length = 2
|
|
659
|
-
|
|
659
|
+
elif encoding == "/WinAnsiEncoding":
|
|
660
660
|
encoding_length = 1
|
|
661
661
|
else:
|
|
662
662
|
_, to_unicode_id = self.mupdf.xref_get_key(xref_id, "ToUnicode")
|
{babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/styles_and_formulas.py
RENAMED
|
@@ -19,15 +19,14 @@ from babeldoc.format.pdf.document_il.utils.formular_helper import (
|
|
|
19
19
|
is_formulas_middle_char,
|
|
20
20
|
)
|
|
21
21
|
from babeldoc.format.pdf.document_il.utils.formular_helper import is_formulas_start_char
|
|
22
|
+
from babeldoc.format.pdf.document_il.utils.formular_helper import update_formula_data
|
|
22
23
|
from babeldoc.format.pdf.document_il.utils.layout_helper import LEFT_BRACKET
|
|
23
24
|
from babeldoc.format.pdf.document_il.utils.layout_helper import RIGHT_BRACKET
|
|
24
25
|
from babeldoc.format.pdf.document_il.utils.layout_helper import build_layout_index
|
|
26
|
+
from babeldoc.format.pdf.document_il.utils.layout_helper import calculate_iou_for_boxes
|
|
25
27
|
from babeldoc.format.pdf.document_il.utils.layout_helper import (
|
|
26
28
|
calculate_y_iou_for_boxes,
|
|
27
29
|
)
|
|
28
|
-
from babeldoc.format.pdf.document_il.utils.layout_helper import (
|
|
29
|
-
formular_height_ignore_char,
|
|
30
|
-
)
|
|
31
30
|
from babeldoc.format.pdf.document_il.utils.layout_helper import is_bullet_point
|
|
32
31
|
from babeldoc.format.pdf.document_il.utils.layout_helper import is_same_style
|
|
33
32
|
from babeldoc.format.pdf.translation_config import TranslationConfig
|
|
@@ -40,6 +39,9 @@ class StylesAndFormulas:
|
|
|
40
39
|
self.translation_config = translation_config
|
|
41
40
|
self.font_mapper = FontMapper(translation_config)
|
|
42
41
|
|
|
42
|
+
def update_formula_data(self, formula: PdfFormula):
|
|
43
|
+
update_formula_data(formula)
|
|
44
|
+
|
|
43
45
|
def process(self, document: Document):
|
|
44
46
|
with self.translation_config.progress_monitor.stage_start(
|
|
45
47
|
self.stage_name,
|
|
@@ -50,6 +52,12 @@ class StylesAndFormulas:
|
|
|
50
52
|
self.process_page(page)
|
|
51
53
|
pbar.advance()
|
|
52
54
|
|
|
55
|
+
def update_all_formula_data(self, page: Page):
|
|
56
|
+
for para in page.pdf_paragraph:
|
|
57
|
+
for comp in para.pdf_paragraph_composition:
|
|
58
|
+
if comp.pdf_formula:
|
|
59
|
+
self.update_formula_data(comp.pdf_formula)
|
|
60
|
+
|
|
53
61
|
def process_page(self, page: Page):
|
|
54
62
|
"""处理页面,包括公式识别和偏移量计算"""
|
|
55
63
|
build_layout_index(page)
|
|
@@ -59,7 +67,9 @@ class StylesAndFormulas:
|
|
|
59
67
|
self.merge_overlapping_formulas(page)
|
|
60
68
|
# self.process_page_offsets(page)
|
|
61
69
|
self.process_translatable_formulas(page)
|
|
70
|
+
self.update_all_formula_data(page)
|
|
62
71
|
self.process_page_offsets(page)
|
|
72
|
+
self.update_all_formula_data(page)
|
|
63
73
|
self.process_page_styles(page)
|
|
64
74
|
|
|
65
75
|
# clean up to save memory
|
|
@@ -468,6 +478,8 @@ class StylesAndFormulas:
|
|
|
468
478
|
return
|
|
469
479
|
|
|
470
480
|
for paragraph in page.pdf_paragraph:
|
|
481
|
+
if paragraph.debug_id is None:
|
|
482
|
+
continue
|
|
471
483
|
if not paragraph.pdf_paragraph_composition:
|
|
472
484
|
continue
|
|
473
485
|
|
|
@@ -491,22 +503,28 @@ class StylesAndFormulas:
|
|
|
491
503
|
comp = paragraph.pdf_paragraph_composition[j]
|
|
492
504
|
if comp.pdf_line:
|
|
493
505
|
for char in reversed(comp.pdf_line.pdf_character):
|
|
506
|
+
if not char.pdf_character_id:
|
|
507
|
+
continue
|
|
494
508
|
# 检查 y 坐标是否接近,判断是否在同一行
|
|
495
509
|
left_iou = calculate_y_iou_for_boxes(char.box, formula.box)
|
|
496
510
|
if left_iou > 0.6:
|
|
497
511
|
left_char = char
|
|
498
512
|
break
|
|
513
|
+
break
|
|
499
514
|
|
|
500
515
|
# 查找右边最近的同一行的文本
|
|
501
516
|
for j in range(i + 1, len(paragraph.pdf_paragraph_composition)):
|
|
502
517
|
comp = paragraph.pdf_paragraph_composition[j]
|
|
503
518
|
if comp.pdf_line:
|
|
504
519
|
for char in comp.pdf_line.pdf_character:
|
|
520
|
+
if not char.pdf_character_id:
|
|
521
|
+
continue
|
|
505
522
|
# 检查 y 坐标是否接近,判断是否在同一行
|
|
506
523
|
right_iou = calculate_y_iou_for_boxes(char.box, formula.box)
|
|
507
524
|
if right_iou > 0.6:
|
|
508
525
|
right_char = char
|
|
509
526
|
break
|
|
527
|
+
break
|
|
510
528
|
|
|
511
529
|
# If both text segments exist, keep the one with higher IOU
|
|
512
530
|
if left_char and right_char:
|
|
@@ -590,33 +608,11 @@ class StylesAndFormulas:
|
|
|
590
608
|
self.update_line_data(new_line)
|
|
591
609
|
return PdfParagraphComposition(pdf_line=new_line)
|
|
592
610
|
|
|
593
|
-
def update_formula_data(self, formula: PdfFormula):
|
|
594
|
-
min_x = min(char.visual_bbox.box.x for char in formula.pdf_character)
|
|
595
|
-
max_x = max(char.visual_bbox.box.x2 for char in formula.pdf_character)
|
|
596
|
-
if not all(map(formular_height_ignore_char, formula.pdf_character)):
|
|
597
|
-
min_y = min(
|
|
598
|
-
char.visual_bbox.box.y
|
|
599
|
-
for char in formula.pdf_character
|
|
600
|
-
if not formular_height_ignore_char(char)
|
|
601
|
-
)
|
|
602
|
-
max_y = max(
|
|
603
|
-
char.visual_bbox.box.y2
|
|
604
|
-
for char in formula.pdf_character
|
|
605
|
-
if not formular_height_ignore_char(char)
|
|
606
|
-
)
|
|
607
|
-
else:
|
|
608
|
-
min_y = min(char.visual_bbox.box.y for char in formula.pdf_character)
|
|
609
|
-
max_y = max(char.visual_bbox.box.y2 for char in formula.pdf_character)
|
|
610
|
-
formula.box = Box(min_x, min_y, max_x, max_y)
|
|
611
|
-
if not formula.y_offset:
|
|
612
|
-
formula.y_offset = 0
|
|
613
|
-
if not formula.x_offset:
|
|
614
|
-
formula.x_offset = 0
|
|
615
|
-
if not formula.x_advance:
|
|
616
|
-
formula.x_advance = 0
|
|
617
|
-
|
|
618
611
|
def is_translatable_formula(self, formula: PdfFormula) -> bool:
|
|
619
612
|
"""判断公式是否只包含需要正常翻译的字符(数字、空格和英文逗号)"""
|
|
613
|
+
if all(char.formula_layout_id for char in formula.pdf_character):
|
|
614
|
+
return False
|
|
615
|
+
|
|
620
616
|
text = "".join(char.char_unicode for char in formula.pdf_character)
|
|
621
617
|
if formula.y_offset > 0.1:
|
|
622
618
|
return False
|
|
@@ -727,8 +723,11 @@ class StylesAndFormulas:
|
|
|
727
723
|
|
|
728
724
|
def merge_overlapping_formulas(self, page: Page):
|
|
729
725
|
"""
|
|
730
|
-
|
|
731
|
-
|
|
726
|
+
合并符合以下条件的公式:
|
|
727
|
+
1. x 轴重叠且 y 轴有交集的相邻公式,或者
|
|
728
|
+
2. x 轴相邻且 y 轴 IOU > 0.5 的相邻公式,或者
|
|
729
|
+
3. 所有字符的 layout id 都相同的相邻公式,或者
|
|
730
|
+
4. 任意两个公式的 IOU > 0.8
|
|
732
731
|
角标可能会被识别成单独的公式,需要合并
|
|
733
732
|
"""
|
|
734
733
|
if not page.pdf_paragraph:
|
|
@@ -738,46 +737,76 @@ class StylesAndFormulas:
|
|
|
738
737
|
if not paragraph.pdf_paragraph_composition:
|
|
739
738
|
continue
|
|
740
739
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
740
|
+
# 重复执行合并过程,直到没有更多可以合并的公式
|
|
741
|
+
merged = True
|
|
742
|
+
while merged:
|
|
743
|
+
merged = False
|
|
744
|
+
for i in range(len(paragraph.pdf_paragraph_composition)):
|
|
745
|
+
if merged:
|
|
746
|
+
break
|
|
747
|
+
comp1 = paragraph.pdf_paragraph_composition[i]
|
|
748
|
+
if comp1.pdf_formula is None:
|
|
749
|
+
continue
|
|
750
|
+
|
|
751
|
+
for j in range(i + 1, len(paragraph.pdf_paragraph_composition)):
|
|
752
|
+
comp2 = paragraph.pdf_paragraph_composition[j]
|
|
753
|
+
if comp2.pdf_formula is None:
|
|
754
|
+
continue
|
|
755
|
+
|
|
756
|
+
formula1 = comp1.pdf_formula
|
|
757
|
+
formula2 = comp2.pdf_formula
|
|
758
|
+
|
|
759
|
+
# 检查合并条件:
|
|
760
|
+
# 1. x 轴重叠且 y 轴有交集,或者
|
|
761
|
+
# 2. x 轴相邻且 y 轴 IOU > 0.5,或者
|
|
762
|
+
# 3. 所有字符的 layout id 都相同,或者
|
|
763
|
+
# 4. 任意两个公式的 IOU > 0.8
|
|
764
|
+
should_merge = (
|
|
765
|
+
(
|
|
766
|
+
j == i + 1
|
|
767
|
+
and (
|
|
768
|
+
(
|
|
769
|
+
self.is_x_axis_contained(
|
|
770
|
+
formula1.box, formula2.box
|
|
771
|
+
)
|
|
772
|
+
and self.has_y_intersection(
|
|
773
|
+
formula1.box, formula2.box
|
|
774
|
+
)
|
|
775
|
+
)
|
|
776
|
+
or (
|
|
777
|
+
self.is_x_axis_adjacent(
|
|
778
|
+
formula1.box, formula2.box
|
|
779
|
+
)
|
|
780
|
+
and self.calculate_y_iou(
|
|
781
|
+
formula1.box, formula2.box
|
|
782
|
+
)
|
|
783
|
+
> 0.5
|
|
784
|
+
)
|
|
785
|
+
)
|
|
786
|
+
)
|
|
787
|
+
or (self._have_same_layout_ids(formula1, formula2, page))
|
|
788
|
+
or (
|
|
789
|
+
calculate_iou_for_boxes(formula1.box, formula2.box)
|
|
790
|
+
> 0.8
|
|
791
|
+
)
|
|
792
|
+
or (
|
|
793
|
+
calculate_iou_for_boxes(formula2.box, formula1.box)
|
|
794
|
+
> 0.8
|
|
795
|
+
)
|
|
796
|
+
)
|
|
769
797
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
798
|
+
if should_merge:
|
|
799
|
+
# 合并公式
|
|
800
|
+
merged_formula = self.merge_formulas(formula1, formula2)
|
|
801
|
+
paragraph.pdf_paragraph_composition[i] = (
|
|
802
|
+
PdfParagraphComposition(
|
|
803
|
+
pdf_formula=merged_formula,
|
|
804
|
+
)
|
|
805
|
+
)
|
|
806
|
+
# 删除第二个公式
|
|
807
|
+
del paragraph.pdf_paragraph_composition[j]
|
|
808
|
+
merged = True
|
|
809
|
+
break
|
|
781
810
|
|
|
782
811
|
def _have_same_layout_ids(
|
|
783
812
|
self, formula1: PdfFormula, formula2: PdfFormula, page: Page
|
|
@@ -15,6 +15,7 @@ from babeldoc.format.pdf.document_il import PdfParagraphComposition
|
|
|
15
15
|
from babeldoc.format.pdf.document_il import PdfStyle
|
|
16
16
|
from babeldoc.format.pdf.document_il import il_version_1
|
|
17
17
|
from babeldoc.format.pdf.document_il.utils.fontmap import FontMapper
|
|
18
|
+
from babeldoc.format.pdf.document_il.utils.formular_helper import update_formula_data
|
|
18
19
|
from babeldoc.format.pdf.translation_config import TranslationConfig
|
|
19
20
|
from babeldoc.format.pdf.translation_config import WatermarkOutputMode
|
|
20
21
|
|
|
@@ -349,11 +350,12 @@ class TypesettingUnit:
|
|
|
349
350
|
|
|
350
351
|
return box
|
|
351
352
|
elif self.formular:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
formular_box
|
|
356
|
-
|
|
353
|
+
return self.formular.box
|
|
354
|
+
# if self.formular.x_offset <= 0.5:
|
|
355
|
+
# return self.formular.box
|
|
356
|
+
# formular_box = copy.copy(self.formular.box)
|
|
357
|
+
# formular_box.x2 += self.formular.x_advance
|
|
358
|
+
# return formular_box
|
|
357
359
|
elif self.unicode:
|
|
358
360
|
char_width = self.font.char_lengths(self.unicode, self.font_size)[0]
|
|
359
361
|
if self.x is None or self.y is None or self.scale is None:
|
|
@@ -406,8 +408,8 @@ class TypesettingUnit:
|
|
|
406
408
|
elif self.formular:
|
|
407
409
|
# 创建新的公式对象,保持内部字符的相对位置
|
|
408
410
|
new_chars = []
|
|
409
|
-
min_x =
|
|
410
|
-
min_y =
|
|
411
|
+
min_x = self.formular.box.x
|
|
412
|
+
min_y = self.formular.box.y
|
|
411
413
|
|
|
412
414
|
for char in self.formular.pdf_character:
|
|
413
415
|
# 计算相对位置
|
|
@@ -481,6 +483,7 @@ class TypesettingUnit:
|
|
|
481
483
|
y_offset=self.formular.y_offset * scale,
|
|
482
484
|
x_advance=self.formular.x_advance * scale,
|
|
483
485
|
)
|
|
486
|
+
update_formula_data(new_formula)
|
|
484
487
|
return TypesettingUnit(formular=new_formula)
|
|
485
488
|
|
|
486
489
|
elif self.unicode:
|
|
@@ -819,7 +822,7 @@ class Typesetting:
|
|
|
819
822
|
# 更新 x 坐标
|
|
820
823
|
current_x = relocated_unit.box.x2
|
|
821
824
|
if prev_x > current_x:
|
|
822
|
-
logger.warning(f"坐标回绕!!!TypesettingUnit: {unit}, ")
|
|
825
|
+
logger.warning(f"坐标回绕!!!TypesettingUnit: {unit.box}, ")
|
|
823
826
|
|
|
824
827
|
last_unit = relocated_unit
|
|
825
828
|
|
|
@@ -3,8 +3,13 @@ import functools
|
|
|
3
3
|
import re
|
|
4
4
|
import unicodedata
|
|
5
5
|
|
|
6
|
+
from babeldoc.format.pdf.document_il.il_version_1 import Box
|
|
6
7
|
from babeldoc.format.pdf.document_il.il_version_1 import Page
|
|
8
|
+
from babeldoc.format.pdf.document_il.il_version_1 import PdfFormula
|
|
7
9
|
from babeldoc.format.pdf.document_il.utils.fontmap import FontMapper
|
|
10
|
+
from babeldoc.format.pdf.document_il.utils.layout_helper import (
|
|
11
|
+
formular_height_ignore_char,
|
|
12
|
+
)
|
|
8
13
|
from babeldoc.format.pdf.translation_config import TranslationConfig
|
|
9
14
|
|
|
10
15
|
|
|
@@ -301,3 +306,29 @@ def is_formulas_font(font_name: str, formular_font_pattern: str | None) -> bool:
|
|
|
301
306
|
return True
|
|
302
307
|
|
|
303
308
|
return False
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
def update_formula_data(formula: PdfFormula):
|
|
312
|
+
min_x = min(char.visual_bbox.box.x for char in formula.pdf_character)
|
|
313
|
+
max_x = max(char.visual_bbox.box.x2 for char in formula.pdf_character)
|
|
314
|
+
if not all(map(formular_height_ignore_char, formula.pdf_character)):
|
|
315
|
+
min_y = min(
|
|
316
|
+
char.visual_bbox.box.y
|
|
317
|
+
for char in formula.pdf_character
|
|
318
|
+
if not formular_height_ignore_char(char)
|
|
319
|
+
)
|
|
320
|
+
max_y = max(
|
|
321
|
+
char.visual_bbox.box.y2
|
|
322
|
+
for char in formula.pdf_character
|
|
323
|
+
if not formular_height_ignore_char(char)
|
|
324
|
+
)
|
|
325
|
+
else:
|
|
326
|
+
min_y = min(char.visual_bbox.box.y for char in formula.pdf_character)
|
|
327
|
+
max_y = max(char.visual_bbox.box.y2 for char in formula.pdf_character)
|
|
328
|
+
formula.box = Box(min_x, min_y, max_x, max_y)
|
|
329
|
+
if not formula.y_offset:
|
|
330
|
+
formula.y_offset = 0
|
|
331
|
+
if not formula.x_offset:
|
|
332
|
+
formula.x_offset = 0
|
|
333
|
+
if not formula.x_advance:
|
|
334
|
+
formula.x_advance = 0
|
|
@@ -634,6 +634,7 @@ def get_character_layout(
|
|
|
634
634
|
"abstract",
|
|
635
635
|
"content",
|
|
636
636
|
"figure_title",
|
|
637
|
+
"chart_title",
|
|
637
638
|
"table_title",
|
|
638
639
|
"doc_title",
|
|
639
640
|
"footnote",
|
|
@@ -722,6 +723,7 @@ def is_text_layout(layout: Layout):
|
|
|
722
723
|
"footer",
|
|
723
724
|
"seal",
|
|
724
725
|
"text",
|
|
726
|
+
"chart_title",
|
|
725
727
|
]
|
|
726
728
|
|
|
727
729
|
|
|
@@ -640,7 +640,6 @@ def migrate_toc(
|
|
|
640
640
|
old_doc = Document(translation_config.input_file)
|
|
641
641
|
if not old_doc:
|
|
642
642
|
return
|
|
643
|
-
|
|
644
643
|
try:
|
|
645
644
|
fix_filter(old_doc)
|
|
646
645
|
fix_null_xref(old_doc)
|
|
@@ -653,6 +652,15 @@ def migrate_toc(
|
|
|
653
652
|
logger.info("No TOC found in the original PDF, skipping migration.")
|
|
654
653
|
return
|
|
655
654
|
|
|
655
|
+
if translation_config.only_include_translated_page:
|
|
656
|
+
total_page = set(range(0, len(old_doc)))
|
|
657
|
+
|
|
658
|
+
pages_to_translate = {
|
|
659
|
+
i for i in len(old_doc) if translation_config.should_translate_page(i + 1)
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
should_removed_page = list(total_page - pages_to_translate)
|
|
663
|
+
|
|
656
664
|
files = {
|
|
657
665
|
translate_result.dual_pdf_path,
|
|
658
666
|
# translate_result.mono_pdf_path,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "BabelDOC"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.3"
|
|
4
4
|
description = "Yet Another Document Translator"
|
|
5
5
|
license = "AGPL-3.0"
|
|
6
6
|
readme = "README.md"
|
|
@@ -157,7 +157,7 @@ pythonpath = [".", "src"]
|
|
|
157
157
|
testpaths = ["tests"]
|
|
158
158
|
|
|
159
159
|
[bumpver]
|
|
160
|
-
current_version = "0.4.
|
|
160
|
+
current_version = "0.4.3"
|
|
161
161
|
version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]"
|
|
162
162
|
|
|
163
163
|
[bumpver.file_patterns]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/add_debug_information.py
RENAMED
|
File without changes
|
{babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/automatic_term_extractor.py
RENAMED
|
File without changes
|
{babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/detect_scanned_file.py
RENAMED
|
File without changes
|
|
File without changes
|
{babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/il_translator_llm_only.py
RENAMED
|
File without changes
|
|
File without changes
|
{babeldoc-0.4.1 → babeldoc-0.4.3}/babeldoc/format/pdf/document_il/midend/paragraph_finder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|