BabelDOC 0.3.60__tar.gz → 0.3.62__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.3.60 → babeldoc-0.3.62}/PKG-INFO +3 -2
- babeldoc-0.3.62/babeldoc/__init__.py +1 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/const.py +1 -1
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/converter.py +18 -18
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/frontend/il_creater.py +33 -33
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/automatic_term_extractor.py +1 -1
- babeldoc-0.3.62/babeldoc/docvision/base_doclayout.py +79 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/docvision/doclayout.py +2 -71
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/docvision/rpc_doclayout.py +3 -3
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/docvision/table_detection/rapidocr.py +2 -2
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/high_level.py +55 -17
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/main.py +7 -5
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/pdfinterp.py +34 -34
- babeldoc-0.3.62/babeldoc/pdfminer/LICENSE +22 -0
- babeldoc-0.3.62/babeldoc/pdfminer/__init__.py +11 -0
- babeldoc-0.3.62/babeldoc/pdfminer/_saslprep.py +101 -0
- babeldoc-0.3.62/babeldoc/pdfminer/arcfour.py +35 -0
- babeldoc-0.3.62/babeldoc/pdfminer/ascii85.py +48 -0
- babeldoc-0.3.62/babeldoc/pdfminer/casting.py +92 -0
- babeldoc-0.3.62/babeldoc/pdfminer/ccitt.py +609 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/78-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/78-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/78-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/78-RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/78-RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/78-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/78ms-RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/78ms-RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/83pv-RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/83pv-RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/90ms-RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/90ms-RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/90msp-RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/90msp-RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/90pv-RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/90pv-RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Add-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Add-RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Add-RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Add-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/B5pc-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/B5pc-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/CNS-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/CNS-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/CNS1-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/CNS1-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/CNS2-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/CNS2-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/ETHK-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/ETHK-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/ETen-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/ETen-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/ETenms-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/ETenms-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Ext-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Ext-RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Ext-RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Ext-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GB-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GB-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GB-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GB-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBK-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBK-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBK2K-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBK2K-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBKp-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBKp-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBT-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBT-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBT-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBT-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBTpc-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBTpc-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBpc-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/GBpc-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKdla-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKdla-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKdlb-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKdlb-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKgccs-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKgccs-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKm314-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKm314-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKm471-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKm471-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKscs-B5-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/HKscs-B5-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Hankaku-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Hankaku-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Hiragana-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Hiragana-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSC-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSC-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSC-Johab-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSC-Johab-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSCms-UHC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSCms-UHC-HW-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSCms-UHC-HW-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSCms-UHC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSCpc-EUC-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/KSCpc-EUC-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Katakana-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Katakana-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/NWP-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/NWP-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/README.txt +79 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/RKSJ-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/RKSJ-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Roman-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/Roman-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniCNS-UCS2-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniCNS-UCS2-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniCNS-UTF16-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniCNS-UTF16-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniCNS-UTF32-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniCNS-UTF32-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniCNS-UTF8-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniCNS-UTF8-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniGB-UCS2-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniGB-UCS2-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniGB-UTF16-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniGB-UTF16-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniGB-UTF32-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniGB-UTF32-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniGB-UTF8-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniGB-UTF8-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UCS2-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UCS2-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UTF16-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UTF16-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UTF32-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UTF32-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UTF8-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS-UTF8-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniKS-UCS2-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniKS-UCS2-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniKS-UTF16-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniKS-UTF16-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniKS-UTF32-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniKS-UTF32-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniKS-UTF8-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/UniKS-UTF8-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/WP-Symbol-H.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/WP-Symbol-V.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/to-unicode-Adobe-CNS1.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/to-unicode-Adobe-GB1.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/to-unicode-Adobe-Japan1.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmap/to-unicode-Adobe-Korea1.pickle.gz +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/cmapdb.py +472 -0
- babeldoc-0.3.62/babeldoc/pdfminer/converter.py +1033 -0
- babeldoc-0.3.62/babeldoc/pdfminer/data_structures.py +55 -0
- babeldoc-0.3.62/babeldoc/pdfminer/encodingdb.py +127 -0
- babeldoc-0.3.62/babeldoc/pdfminer/fontmetrics.py +4464 -0
- babeldoc-0.3.62/babeldoc/pdfminer/glyphlist.py +4365 -0
- babeldoc-0.3.62/babeldoc/pdfminer/high_level.py +233 -0
- babeldoc-0.3.62/babeldoc/pdfminer/image.py +288 -0
- babeldoc-0.3.62/babeldoc/pdfminer/jbig2.py +377 -0
- babeldoc-0.3.62/babeldoc/pdfminer/latin_enc.py +244 -0
- babeldoc-0.3.62/babeldoc/pdfminer/layout.py +978 -0
- babeldoc-0.3.62/babeldoc/pdfminer/lzw.py +108 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdfcolor.py +36 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdfdevice.py +325 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdfdocument.py +1072 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdfexceptions.py +33 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdffont.py +1215 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdfinterp.py +1275 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdfpage.py +229 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdfparser.py +173 -0
- babeldoc-0.3.62/babeldoc/pdfminer/pdftypes.py +394 -0
- babeldoc-0.3.62/babeldoc/pdfminer/psexceptions.py +18 -0
- babeldoc-0.3.62/babeldoc/pdfminer/psparser.py +659 -0
- babeldoc-0.3.62/babeldoc/pdfminer/py.typed +0 -0
- babeldoc-0.3.62/babeldoc/pdfminer/runlength.py +36 -0
- babeldoc-0.3.62/babeldoc/pdfminer/settings.py +1 -0
- babeldoc-0.3.62/babeldoc/pdfminer/utils.py +799 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/translation_config.py +3 -2
- {babeldoc-0.3.60 → babeldoc-0.3.62}/pyproject.toml +6 -3
- {babeldoc-0.3.60 → babeldoc-0.3.62}/uv.lock +5 -16
- babeldoc-0.3.60/babeldoc/__init__.py +0 -1
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.cursorignore +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/PULL_REQUEST_TEMPLATE/pr_form.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/dependabot.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/labels.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/release-drafter.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/workflows/codeql.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/workflows/docs.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/workflows/labeler.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/workflows/lint.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/workflows/pr-lint.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/workflows/publish-to-pypi.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.github/workflows/test.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.gitignore +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/.pre-commit-config.yaml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/LICENSE +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/README.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/assets/assets.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/assets/embedding_assets_metadata.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/asynchronize/__init__.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/__init__.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/babeldoc_exception/BabelDOCException.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/backend/__init__.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/backend/pdf_creater.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/frontend/__init__.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/il_version_1.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/il_version_1.rnc +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/il_version_1.rng +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/il_version_1.xsd +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/__init__.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/add_debug_information.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/detect_scanned_file.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/il_translator.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/il_translator_llm_only.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/layout_parser.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/paragraph_finder.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/remove_descent.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/styles_and_formulas.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/table_parser.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/midend/typesetting.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/translator/__init__.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/translator/cache.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/translator/translator.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/utils/atomic_integer.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/utils/fontmap.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/utils/layout_helper.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/utils/mupdf_helper.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/utils/paragraph_helper.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/utils/priority_thread_pool_executor.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/utils/style_helper.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/utils/zstd_helper.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/document_il/xml_converter.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/docvision/README.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/docvision/__init__.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/format/office/__init__.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/glossary.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/progress_monitor.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/result_merger.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/split_manager.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/tools/generate_font_metadata.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/tools/italic_assistance.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/babeldoc/tools/italic_recognize_tool.py +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/CODE_OF_CONDUCT.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/CONTRIBUTING.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/CONTRIBUTOR_REWARD.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/ImplementationDetails/AsyncTranslate/AsyncTranslate.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/ImplementationDetails/ILTranslator/ILTranslator.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/ImplementationDetails/PDFCreation/PDFCreation.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/ImplementationDetails/PDFParsing/PDFParsing.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/ImplementationDetails/ParagraphFinding/ParagraphFinding.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/ImplementationDetails/README.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/ImplementationDetails/StylesAndFormulas/StylesAndFormulas.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/ImplementationDetails/Typesetting/Typesetting.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/README.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/deploy.sh +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/example/demo_glossary.csv +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-banner.png +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.png +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.svg +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-big-logo-with-transparent-background.png +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-big-logo-with-transparent-background.svg +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-big-logo.png +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-contributor_reward_example.png +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-preview.gif +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-small-logo-with-transparent-background.png +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-small-logo-with-transparent-background.svg +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/images/babeldoc-small-logo.png +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/index.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/intro-to-pdf-object.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/requirements.txt +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/docs/supported_languages.md +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/mkdocs.yml +0 -0
- {babeldoc-0.3.60 → babeldoc-0.3.62}/tests/test_translation_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: BabelDOC
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.62
|
|
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
|
|
@@ -13,7 +13,9 @@ Classifier: Operating System :: OS Independent
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Requires-Python: <3.14,>=3.10
|
|
15
15
|
Requires-Dist: bitstring>=4.3.0
|
|
16
|
+
Requires-Dist: charset-normalizer>=2.0.0
|
|
16
17
|
Requires-Dist: configargparse>=1.7
|
|
18
|
+
Requires-Dist: cryptography>=36.0.0
|
|
17
19
|
Requires-Dist: freetype-py>=2.5.1
|
|
18
20
|
Requires-Dist: httpx[socks]>=0.27.0
|
|
19
21
|
Requires-Dist: huggingface-hub>=0.27.0
|
|
@@ -25,7 +27,6 @@ Requires-Dist: onnxruntime>=1.16.1
|
|
|
25
27
|
Requires-Dist: openai>=1.59.3
|
|
26
28
|
Requires-Dist: opencv-python-headless>=4.10.0.84
|
|
27
29
|
Requires-Dist: orjson>=3.10.14
|
|
28
|
-
Requires-Dist: pdfminer-six==20250416
|
|
29
30
|
Requires-Dist: peewee>=3.17.8
|
|
30
31
|
Requires-Dist: psutil>=7.0.0
|
|
31
32
|
Requires-Dist: pydantic>=2.10.6
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.62"
|
|
@@ -3,27 +3,27 @@ import re
|
|
|
3
3
|
import unicodedata
|
|
4
4
|
|
|
5
5
|
import numpy as np
|
|
6
|
-
from pdfminer.converter import PDFConverter
|
|
7
|
-
from pdfminer.layout import LTChar
|
|
8
|
-
from pdfminer.layout import LTComponent
|
|
9
|
-
from pdfminer.layout import LTFigure
|
|
10
|
-
from pdfminer.layout import LTLine
|
|
11
|
-
from pdfminer.layout import LTPage
|
|
12
|
-
from pdfminer.layout import LTText
|
|
13
|
-
from pdfminer.pdfcolor import PDFColorSpace
|
|
14
|
-
from pdfminer.pdffont import PDFCIDFont
|
|
15
|
-
from pdfminer.pdffont import PDFFont
|
|
16
|
-
from pdfminer.pdffont import PDFUnicodeNotDefined
|
|
17
|
-
from pdfminer.pdfinterp import PDFGraphicState
|
|
18
|
-
from pdfminer.pdfinterp import PDFResourceManager
|
|
19
|
-
from pdfminer.utils import Matrix
|
|
20
|
-
from pdfminer.utils import apply_matrix_pt
|
|
21
|
-
from pdfminer.utils import bbox2str
|
|
22
|
-
from pdfminer.utils import matrix2str
|
|
23
|
-
from pdfminer.utils import mult_matrix
|
|
24
6
|
from pymupdf import Font
|
|
25
7
|
|
|
26
8
|
from babeldoc.document_il.frontend.il_creater import ILCreater
|
|
9
|
+
from babeldoc.pdfminer.converter import PDFConverter
|
|
10
|
+
from babeldoc.pdfminer.layout import LTChar
|
|
11
|
+
from babeldoc.pdfminer.layout import LTComponent
|
|
12
|
+
from babeldoc.pdfminer.layout import LTFigure
|
|
13
|
+
from babeldoc.pdfminer.layout import LTLine
|
|
14
|
+
from babeldoc.pdfminer.layout import LTPage
|
|
15
|
+
from babeldoc.pdfminer.layout import LTText
|
|
16
|
+
from babeldoc.pdfminer.pdfcolor import PDFColorSpace
|
|
17
|
+
from babeldoc.pdfminer.pdffont import PDFCIDFont
|
|
18
|
+
from babeldoc.pdfminer.pdffont import PDFFont
|
|
19
|
+
from babeldoc.pdfminer.pdffont import PDFUnicodeNotDefined
|
|
20
|
+
from babeldoc.pdfminer.pdfinterp import PDFGraphicState
|
|
21
|
+
from babeldoc.pdfminer.pdfinterp import PDFResourceManager
|
|
22
|
+
from babeldoc.pdfminer.utils import Matrix
|
|
23
|
+
from babeldoc.pdfminer.utils import apply_matrix_pt
|
|
24
|
+
from babeldoc.pdfminer.utils import bbox2str
|
|
25
|
+
from babeldoc.pdfminer.utils import matrix2str
|
|
26
|
+
from babeldoc.pdfminer.utils import mult_matrix
|
|
27
27
|
|
|
28
28
|
log = logging.getLogger(__name__)
|
|
29
29
|
|
|
@@ -2,26 +2,26 @@ import base64
|
|
|
2
2
|
import functools
|
|
3
3
|
import logging
|
|
4
4
|
import re
|
|
5
|
-
from functools import wraps
|
|
6
5
|
from io import BytesIO
|
|
7
6
|
from itertools import islice
|
|
8
7
|
|
|
9
8
|
import freetype
|
|
10
|
-
import pdfminer.pdfinterp
|
|
11
9
|
import pymupdf
|
|
12
|
-
from pdfminer.layout import LTChar
|
|
13
|
-
from pdfminer.layout import LTFigure
|
|
14
|
-
from pdfminer.pdffont import PDFCIDFont
|
|
15
|
-
from pdfminer.pdffont import PDFFont
|
|
16
|
-
from pdfminer.pdfpage import PDFPage as PDFMinerPDFPage
|
|
17
|
-
from pdfminer.pdftypes import PDFObjRef as PDFMinerPDFObjRef
|
|
18
|
-
from pdfminer.pdftypes import resolve1 as pdftypes_resolve1
|
|
19
|
-
from pdfminer.psparser import PSLiteral
|
|
20
10
|
|
|
11
|
+
import babeldoc.pdfminer.pdfinterp
|
|
21
12
|
from babeldoc.document_il import il_version_1
|
|
22
13
|
from babeldoc.document_il.utils import zstd_helper
|
|
23
14
|
from babeldoc.document_il.utils.style_helper import BLACK
|
|
24
15
|
from babeldoc.document_il.utils.style_helper import YELLOW
|
|
16
|
+
from babeldoc.pdfminer.layout import LTChar
|
|
17
|
+
from babeldoc.pdfminer.layout import LTFigure
|
|
18
|
+
from babeldoc.pdfminer.pdffont import PDFCIDFont
|
|
19
|
+
from babeldoc.pdfminer.pdffont import PDFFont
|
|
20
|
+
|
|
21
|
+
# from babeldoc.pdfminer.pdfpage import PDFPage as PDFMinerPDFPage
|
|
22
|
+
# from babeldoc.pdfminer.pdftypes import PDFObjRef as PDFMinerPDFObjRef
|
|
23
|
+
# from babeldoc.pdfminer.pdftypes import resolve1 as pdftypes_resolve1
|
|
24
|
+
from babeldoc.pdfminer.psparser import PSLiteral
|
|
25
25
|
from babeldoc.translation_config import TranslationConfig
|
|
26
26
|
|
|
27
27
|
|
|
@@ -38,28 +38,28 @@ def batched(iterable, n, *, strict=False):
|
|
|
38
38
|
|
|
39
39
|
logger = logging.getLogger(__name__)
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
def create_hook(func, hook):
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def hook_pdfminer_pdf_page_init(*args):
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
PDFMinerPDFPage.__init__ = create_hook(
|
|
61
|
-
|
|
62
|
-
)
|
|
41
|
+
#
|
|
42
|
+
# def create_hook(func, hook):
|
|
43
|
+
# @wraps(func)
|
|
44
|
+
# def wrapper(*args, **kwargs):
|
|
45
|
+
# hook(*args, **kwargs)
|
|
46
|
+
# return func(*args, **kwargs)
|
|
47
|
+
#
|
|
48
|
+
# return wrapper
|
|
49
|
+
#
|
|
50
|
+
#
|
|
51
|
+
# def hook_pdfminer_pdf_page_init(*args):
|
|
52
|
+
# attrs = args[3]
|
|
53
|
+
# try:
|
|
54
|
+
# while isinstance(attrs["MediaBox"], PDFMinerPDFObjRef):
|
|
55
|
+
# attrs["MediaBox"] = pdftypes_resolve1(attrs["MediaBox"])
|
|
56
|
+
# except Exception:
|
|
57
|
+
# logger.exception(f"try to fix mediabox failed: {attrs}")
|
|
58
|
+
#
|
|
59
|
+
#
|
|
60
|
+
# PDFMinerPDFPage.__init__ = create_hook(
|
|
61
|
+
# PDFMinerPDFPage.__init__, hook_pdfminer_pdf_page_init
|
|
62
|
+
# )
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
def indirect(obj):
|
|
@@ -781,7 +781,7 @@ class ILCreater:
|
|
|
781
781
|
cmap = parse_cmap(self.mupdf.xref_stream(to_unicode_idx).decode("U8"))
|
|
782
782
|
return bbox_list, cmap
|
|
783
783
|
|
|
784
|
-
def create_graphic_state(self, gs: pdfminer.pdfinterp.PDFGraphicState):
|
|
784
|
+
def create_graphic_state(self, gs: babeldoc.pdfminer.pdfinterp.PDFGraphicState):
|
|
785
785
|
graphic_state = il_version_1.GraphicState()
|
|
786
786
|
for k, v in gs.__dict__.items():
|
|
787
787
|
if v is None:
|
|
@@ -195,7 +195,7 @@ class AutomaticTermExtractor:
|
|
|
195
195
|
continue
|
|
196
196
|
total_token_count += self.calc_token_count(paragraph.unicode)
|
|
197
197
|
paragraphs.append(paragraph)
|
|
198
|
-
if total_token_count >
|
|
198
|
+
if total_token_count > 600 or len(paragraphs) > 12:
|
|
199
199
|
executor.submit(
|
|
200
200
|
self.extract_terms_from_paragraphs,
|
|
201
201
|
BatchParagraph(paragraphs, tracker),
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
import logging
|
|
3
|
+
from collections.abc import Generator
|
|
4
|
+
|
|
5
|
+
import pymupdf
|
|
6
|
+
|
|
7
|
+
from babeldoc.document_il.il_version_1 import Page
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class YoloResult:
|
|
13
|
+
"""Helper class to store detection results from ONNX model."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, names, boxes=None, boxes_data=None):
|
|
16
|
+
if boxes is not None:
|
|
17
|
+
self.boxes = boxes
|
|
18
|
+
else:
|
|
19
|
+
assert boxes_data is not None
|
|
20
|
+
self.boxes = [YoloBox(data=d) for d in boxes_data]
|
|
21
|
+
self.boxes.sort(key=lambda x: x.conf, reverse=True)
|
|
22
|
+
self.names = names
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class YoloBox:
|
|
26
|
+
"""Helper class to store detection results from ONNX model."""
|
|
27
|
+
|
|
28
|
+
def __init__(self, data=None, xyxy=None, conf=None, cls=None):
|
|
29
|
+
if data is not None:
|
|
30
|
+
self.xyxy = data[:4]
|
|
31
|
+
self.conf = data[-2]
|
|
32
|
+
self.cls = data[-1]
|
|
33
|
+
return
|
|
34
|
+
assert xyxy is not None and conf is not None and cls is not None
|
|
35
|
+
self.xyxy = xyxy
|
|
36
|
+
self.conf = conf
|
|
37
|
+
self.cls = cls
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class DocLayoutModel(abc.ABC):
|
|
41
|
+
@staticmethod
|
|
42
|
+
def load_onnx():
|
|
43
|
+
logger.info("Loading ONNX model...")
|
|
44
|
+
from babeldoc.docvision.doclayout import OnnxModel
|
|
45
|
+
|
|
46
|
+
model = OnnxModel.from_pretrained()
|
|
47
|
+
return model
|
|
48
|
+
|
|
49
|
+
@staticmethod
|
|
50
|
+
def load_available():
|
|
51
|
+
return DocLayoutModel.load_onnx()
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
@abc.abstractmethod
|
|
55
|
+
def stride(self) -> int:
|
|
56
|
+
"""Stride of the model input."""
|
|
57
|
+
|
|
58
|
+
@abc.abstractmethod
|
|
59
|
+
def predict(self, image: bytes, imgsz: int = 1024, **kwargs) -> list[int]:
|
|
60
|
+
"""
|
|
61
|
+
Predict the layout of a document page.
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
image: The image of the document page.
|
|
65
|
+
imgsz: Resize the image to this size. Must be a multiple of the stride.
|
|
66
|
+
**kwargs: Additional arguments.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
@abc.abstractmethod
|
|
70
|
+
def handle_document(
|
|
71
|
+
self,
|
|
72
|
+
pages: list[Page],
|
|
73
|
+
mupdf_doc: pymupdf.Document,
|
|
74
|
+
translate_config,
|
|
75
|
+
save_debug_image,
|
|
76
|
+
) -> Generator[tuple[Page, YoloResult], None, None]:
|
|
77
|
+
"""
|
|
78
|
+
Handle a document.
|
|
79
|
+
"""
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import abc
|
|
2
1
|
import ast
|
|
3
2
|
import logging
|
|
4
3
|
import platform
|
|
@@ -10,6 +9,8 @@ import cv2
|
|
|
10
9
|
import numpy as np
|
|
11
10
|
|
|
12
11
|
from babeldoc.document_il.utils.mupdf_helper import get_no_rotation_img
|
|
12
|
+
from babeldoc.docvision.base_doclayout import DocLayoutModel
|
|
13
|
+
from babeldoc.docvision.base_doclayout import YoloResult
|
|
13
14
|
|
|
14
15
|
try:
|
|
15
16
|
import onnx
|
|
@@ -31,76 +32,6 @@ from babeldoc.assets.assets import get_doclayout_onnx_model_path
|
|
|
31
32
|
logger = logging.getLogger(__name__)
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
class YoloResult:
|
|
35
|
-
"""Helper class to store detection results from ONNX model."""
|
|
36
|
-
|
|
37
|
-
def __init__(self, names, boxes=None, boxes_data=None):
|
|
38
|
-
if boxes is not None:
|
|
39
|
-
self.boxes = boxes
|
|
40
|
-
else:
|
|
41
|
-
assert boxes_data is not None
|
|
42
|
-
self.boxes = [YoloBox(data=d) for d in boxes_data]
|
|
43
|
-
self.boxes.sort(key=lambda x: x.conf, reverse=True)
|
|
44
|
-
self.names = names
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class DocLayoutModel(abc.ABC):
|
|
48
|
-
@staticmethod
|
|
49
|
-
def load_onnx():
|
|
50
|
-
logger.info("Loading ONNX model...")
|
|
51
|
-
model = OnnxModel.from_pretrained()
|
|
52
|
-
return model
|
|
53
|
-
|
|
54
|
-
@staticmethod
|
|
55
|
-
def load_available():
|
|
56
|
-
return DocLayoutModel.load_onnx()
|
|
57
|
-
|
|
58
|
-
@property
|
|
59
|
-
@abc.abstractmethod
|
|
60
|
-
def stride(self) -> int:
|
|
61
|
-
"""Stride of the model input."""
|
|
62
|
-
|
|
63
|
-
@abc.abstractmethod
|
|
64
|
-
def predict(self, image: bytes, imgsz: int = 1024, **kwargs) -> list[int]:
|
|
65
|
-
"""
|
|
66
|
-
Predict the layout of a document page.
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
image: The image of the document page.
|
|
70
|
-
imgsz: Resize the image to this size. Must be a multiple of the stride.
|
|
71
|
-
**kwargs: Additional arguments.
|
|
72
|
-
"""
|
|
73
|
-
|
|
74
|
-
@abc.abstractmethod
|
|
75
|
-
def handle_document(
|
|
76
|
-
self,
|
|
77
|
-
pages: list[babeldoc.document_il.il_version_1.Page],
|
|
78
|
-
mupdf_doc: pymupdf.Document,
|
|
79
|
-
translate_config,
|
|
80
|
-
save_debug_image,
|
|
81
|
-
) -> Generator[
|
|
82
|
-
tuple[babeldoc.document_il.il_version_1.Page, YoloResult], None, None
|
|
83
|
-
]:
|
|
84
|
-
"""
|
|
85
|
-
Handle a document.
|
|
86
|
-
"""
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
class YoloBox:
|
|
90
|
-
"""Helper class to store detection results from ONNX model."""
|
|
91
|
-
|
|
92
|
-
def __init__(self, data=None, xyxy=None, conf=None, cls=None):
|
|
93
|
-
if data is not None:
|
|
94
|
-
self.xyxy = data[:4]
|
|
95
|
-
self.conf = data[-2]
|
|
96
|
-
self.cls = data[-1]
|
|
97
|
-
return
|
|
98
|
-
assert xyxy is not None and conf is not None and cls is not None
|
|
99
|
-
self.xyxy = xyxy
|
|
100
|
-
self.conf = conf
|
|
101
|
-
self.cls = cls
|
|
102
|
-
|
|
103
|
-
|
|
104
35
|
# 检测操作系统类型
|
|
105
36
|
os_name = platform.system()
|
|
106
37
|
|
|
@@ -15,9 +15,9 @@ from tenacity import wait_exponential
|
|
|
15
15
|
|
|
16
16
|
import babeldoc
|
|
17
17
|
from babeldoc.document_il.utils.mupdf_helper import get_no_rotation_img
|
|
18
|
-
from babeldoc.docvision.
|
|
19
|
-
from babeldoc.docvision.
|
|
20
|
-
from babeldoc.docvision.
|
|
18
|
+
from babeldoc.docvision.base_doclayout import DocLayoutModel
|
|
19
|
+
from babeldoc.docvision.base_doclayout import YoloBox
|
|
20
|
+
from babeldoc.docvision.base_doclayout import YoloResult
|
|
21
21
|
|
|
22
22
|
logger = logging.getLogger(__name__)
|
|
23
23
|
|
|
@@ -7,8 +7,8 @@ import cv2
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
from babeldoc.assets.assets import get_table_detection_rapidocr_model_path
|
|
9
9
|
from babeldoc.document_il.utils.mupdf_helper import get_no_rotation_img
|
|
10
|
-
from babeldoc.docvision.
|
|
11
|
-
from babeldoc.docvision.
|
|
10
|
+
from babeldoc.docvision.base_doclayout import YoloBox
|
|
11
|
+
from babeldoc.docvision.base_doclayout import YoloResult
|
|
12
12
|
from rapidocr_onnxruntime import RapidOCR
|
|
13
13
|
|
|
14
14
|
try:
|
|
@@ -5,7 +5,6 @@ import io
|
|
|
5
5
|
import logging
|
|
6
6
|
import pathlib
|
|
7
7
|
import shutil
|
|
8
|
-
import struct
|
|
9
8
|
import threading
|
|
10
9
|
import time
|
|
11
10
|
from asyncio import CancelledError
|
|
@@ -14,11 +13,6 @@ from typing import Any
|
|
|
14
13
|
from typing import BinaryIO
|
|
15
14
|
|
|
16
15
|
import pymupdf
|
|
17
|
-
from pdfminer.cmapdb import IdentityCMap
|
|
18
|
-
from pdfminer.pdfdocument import PDFDocument
|
|
19
|
-
from pdfminer.pdfinterp import PDFResourceManager
|
|
20
|
-
from pdfminer.pdfpage import PDFPage
|
|
21
|
-
from pdfminer.pdfparser import PDFParser
|
|
22
16
|
from pymupdf import Document
|
|
23
17
|
from pymupdf import Font
|
|
24
18
|
|
|
@@ -45,6 +39,10 @@ from babeldoc.document_il.midend.typesetting import Typesetting
|
|
|
45
39
|
from babeldoc.document_il.utils.fontmap import FontMapper
|
|
46
40
|
from babeldoc.document_il.xml_converter import XMLConverter
|
|
47
41
|
from babeldoc.pdfinterp import PDFPageInterpreterEx
|
|
42
|
+
from babeldoc.pdfminer.pdfdocument import PDFDocument
|
|
43
|
+
from babeldoc.pdfminer.pdfinterp import PDFResourceManager
|
|
44
|
+
from babeldoc.pdfminer.pdfpage import PDFPage
|
|
45
|
+
from babeldoc.pdfminer.pdfparser import PDFParser
|
|
48
46
|
from babeldoc.progress_monitor import ProgressMonitor
|
|
49
47
|
from babeldoc.result_merger import ResultMerger
|
|
50
48
|
from babeldoc.split_manager import SplitManager
|
|
@@ -52,17 +50,6 @@ from babeldoc.translation_config import TranslateResult
|
|
|
52
50
|
from babeldoc.translation_config import TranslationConfig
|
|
53
51
|
from babeldoc.translation_config import WatermarkOutputMode
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
def decode(_, code: bytes) -> tuple[int, ...]:
|
|
57
|
-
n = len(code) // 2
|
|
58
|
-
if n:
|
|
59
|
-
return struct.unpack_from(f">{n}H", code)
|
|
60
|
-
else:
|
|
61
|
-
return ()
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
IdentityCMap.decode = decode
|
|
65
|
-
|
|
66
53
|
logger = logging.getLogger(__name__)
|
|
67
54
|
|
|
68
55
|
TRANSLATE_STAGES = [
|
|
@@ -608,6 +595,12 @@ def do_translate(
|
|
|
608
595
|
# not being able to copy translated text can be fixed,
|
|
609
596
|
# the macOS preview is broken
|
|
610
597
|
# fix_cmap(result, translation_config)
|
|
598
|
+
try:
|
|
599
|
+
migrate_toc(translation_config, result)
|
|
600
|
+
except Exception as e:
|
|
601
|
+
logger.error(
|
|
602
|
+
f"Failed to migrate TOC from {translation_config.input_file}: {e}"
|
|
603
|
+
)
|
|
611
604
|
pm.translate_done(result)
|
|
612
605
|
return result
|
|
613
606
|
|
|
@@ -625,6 +618,51 @@ def do_translate(
|
|
|
625
618
|
translation_config.cleanup_temp_files()
|
|
626
619
|
|
|
627
620
|
|
|
621
|
+
def migrate_toc(
|
|
622
|
+
translation_config: TranslationConfig, translate_result: TranslateResult
|
|
623
|
+
):
|
|
624
|
+
old_doc = Document(translation_config.input_file)
|
|
625
|
+
if not old_doc:
|
|
626
|
+
return
|
|
627
|
+
|
|
628
|
+
try:
|
|
629
|
+
fix_filter(old_doc)
|
|
630
|
+
fix_null_xref(old_doc)
|
|
631
|
+
except Exception:
|
|
632
|
+
logger.exception("auto fix failed, please check the pdf file")
|
|
633
|
+
|
|
634
|
+
toc_data = old_doc.get_toc()
|
|
635
|
+
|
|
636
|
+
if not toc_data:
|
|
637
|
+
logger.info("No TOC found in the original PDF, skipping migration.")
|
|
638
|
+
return
|
|
639
|
+
|
|
640
|
+
files = {
|
|
641
|
+
translate_result.dual_pdf_path,
|
|
642
|
+
# translate_result.mono_pdf_path,
|
|
643
|
+
translate_result.no_watermark_dual_pdf_path,
|
|
644
|
+
# translate_result.no_watermark_mono_pdf_path
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
for f in files:
|
|
648
|
+
mig_toc_temp_input = translation_config.get_working_file_path(
|
|
649
|
+
"mig_toc_temp.pdf"
|
|
650
|
+
)
|
|
651
|
+
shutil.copy(f, mig_toc_temp_input)
|
|
652
|
+
new_doc = Document(mig_toc_temp_input.as_posix())
|
|
653
|
+
if not new_doc:
|
|
654
|
+
continue
|
|
655
|
+
|
|
656
|
+
new_doc.set_toc(toc_data)
|
|
657
|
+
PDFCreater.save_pdf_with_timeout(
|
|
658
|
+
new_doc,
|
|
659
|
+
f.as_posix(),
|
|
660
|
+
translation_config=translation_config,
|
|
661
|
+
clean=not translation_config.skip_clean,
|
|
662
|
+
tag="mig_toc",
|
|
663
|
+
)
|
|
664
|
+
|
|
665
|
+
|
|
628
666
|
def fix_media_box(doc: Document) -> None:
|
|
629
667
|
mediabox_data = {}
|
|
630
668
|
for x in range(1, doc.xref_length()):
|
|
@@ -16,15 +16,12 @@ import babeldoc.assets.assets
|
|
|
16
16
|
import babeldoc.high_level
|
|
17
17
|
from babeldoc.document_il.translator.translator import OpenAITranslator
|
|
18
18
|
from babeldoc.document_il.translator.translator import set_translate_rate_limiter
|
|
19
|
-
from babeldoc.docvision.doclayout import DocLayoutModel
|
|
20
|
-
from babeldoc.docvision.rpc_doclayout import RpcDocLayoutModel
|
|
21
|
-
from babeldoc.docvision.table_detection.rapidocr import RapidOCRModel
|
|
22
19
|
from babeldoc.glossary import Glossary
|
|
23
20
|
from babeldoc.translation_config import TranslationConfig
|
|
24
21
|
from babeldoc.translation_config import WatermarkOutputMode
|
|
25
22
|
|
|
26
23
|
logger = logging.getLogger(__name__)
|
|
27
|
-
__version__ = "0.3.
|
|
24
|
+
__version__ = "0.3.62"
|
|
28
25
|
|
|
29
26
|
|
|
30
27
|
def create_parser():
|
|
@@ -329,14 +326,19 @@ async def main():
|
|
|
329
326
|
|
|
330
327
|
# 设置翻译速率限制
|
|
331
328
|
set_translate_rate_limiter(args.qps)
|
|
332
|
-
|
|
333
329
|
# 初始化文档布局模型
|
|
334
330
|
if args.rpc_doclayout:
|
|
331
|
+
from babeldoc.docvision.rpc_doclayout import RpcDocLayoutModel
|
|
332
|
+
|
|
335
333
|
doc_layout_model = RpcDocLayoutModel(host=args.rpc_doclayout)
|
|
336
334
|
else:
|
|
335
|
+
from babeldoc.docvision.doclayout import DocLayoutModel
|
|
336
|
+
|
|
337
337
|
doc_layout_model = DocLayoutModel.load_onnx()
|
|
338
338
|
|
|
339
339
|
if args.translate_table_text:
|
|
340
|
+
from babeldoc.docvision.table_detection.rapidocr import RapidOCRModel
|
|
341
|
+
|
|
340
342
|
table_model = RapidOCRModel()
|
|
341
343
|
else:
|
|
342
344
|
table_model = None
|
|
@@ -4,42 +4,42 @@ from typing import Any
|
|
|
4
4
|
from typing import cast
|
|
5
5
|
|
|
6
6
|
import numpy as np
|
|
7
|
-
from pdfminer import settings
|
|
8
|
-
from pdfminer.pdfcolor import PREDEFINED_COLORSPACE
|
|
9
|
-
from pdfminer.pdfcolor import PDFColorSpace
|
|
10
|
-
from pdfminer.pdfdevice import PDFDevice
|
|
11
|
-
from pdfminer.pdfdevice import PDFTextSeq
|
|
12
|
-
from pdfminer.pdffont import PDFFont
|
|
13
|
-
from pdfminer.pdfinterp import LITERAL_FORM
|
|
14
|
-
from pdfminer.pdfinterp import LITERAL_IMAGE
|
|
15
|
-
from pdfminer.pdfinterp import Color
|
|
16
|
-
from pdfminer.pdfinterp import PDFContentParser
|
|
17
|
-
from pdfminer.pdfinterp import PDFInterpreterError
|
|
18
|
-
from pdfminer.pdfinterp import PDFPageInterpreter
|
|
19
|
-
from pdfminer.pdfinterp import PDFResourceManager
|
|
20
|
-
from pdfminer.pdfinterp import PDFStackT
|
|
21
|
-
from pdfminer.pdfpage import PDFPage
|
|
22
|
-
from pdfminer.pdftypes import LITERALS_ASCII85_DECODE
|
|
23
|
-
from pdfminer.pdftypes import PDFObjRef
|
|
24
|
-
from pdfminer.pdftypes import PDFStream
|
|
25
|
-
from pdfminer.pdftypes import dict_value
|
|
26
|
-
from pdfminer.pdftypes import list_value
|
|
27
|
-
from pdfminer.pdftypes import resolve1
|
|
28
|
-
from pdfminer.pdftypes import stream_value
|
|
29
|
-
from pdfminer.psexceptions import PSEOF
|
|
30
|
-
from pdfminer.psexceptions import PSTypeError
|
|
31
|
-
from pdfminer.psparser import PSKeyword
|
|
32
|
-
from pdfminer.psparser import PSLiteral
|
|
33
|
-
from pdfminer.psparser import keyword_name
|
|
34
|
-
from pdfminer.psparser import literal_name
|
|
35
|
-
from pdfminer.utils import MATRIX_IDENTITY
|
|
36
|
-
from pdfminer.utils import Matrix
|
|
37
|
-
from pdfminer.utils import Rect
|
|
38
|
-
from pdfminer.utils import apply_matrix_pt
|
|
39
|
-
from pdfminer.utils import choplist
|
|
40
|
-
from pdfminer.utils import mult_matrix
|
|
41
7
|
|
|
42
8
|
from babeldoc.document_il.frontend.il_creater import ILCreater
|
|
9
|
+
from babeldoc.pdfminer import settings
|
|
10
|
+
from babeldoc.pdfminer.pdfcolor import PREDEFINED_COLORSPACE
|
|
11
|
+
from babeldoc.pdfminer.pdfcolor import PDFColorSpace
|
|
12
|
+
from babeldoc.pdfminer.pdfdevice import PDFDevice
|
|
13
|
+
from babeldoc.pdfminer.pdfdevice import PDFTextSeq
|
|
14
|
+
from babeldoc.pdfminer.pdffont import PDFFont
|
|
15
|
+
from babeldoc.pdfminer.pdfinterp import LITERAL_FORM
|
|
16
|
+
from babeldoc.pdfminer.pdfinterp import LITERAL_IMAGE
|
|
17
|
+
from babeldoc.pdfminer.pdfinterp import Color
|
|
18
|
+
from babeldoc.pdfminer.pdfinterp import PDFContentParser
|
|
19
|
+
from babeldoc.pdfminer.pdfinterp import PDFInterpreterError
|
|
20
|
+
from babeldoc.pdfminer.pdfinterp import PDFPageInterpreter
|
|
21
|
+
from babeldoc.pdfminer.pdfinterp import PDFResourceManager
|
|
22
|
+
from babeldoc.pdfminer.pdfinterp import PDFStackT
|
|
23
|
+
from babeldoc.pdfminer.pdfpage import PDFPage
|
|
24
|
+
from babeldoc.pdfminer.pdftypes import LITERALS_ASCII85_DECODE
|
|
25
|
+
from babeldoc.pdfminer.pdftypes import PDFObjRef
|
|
26
|
+
from babeldoc.pdfminer.pdftypes import PDFStream
|
|
27
|
+
from babeldoc.pdfminer.pdftypes import dict_value
|
|
28
|
+
from babeldoc.pdfminer.pdftypes import list_value
|
|
29
|
+
from babeldoc.pdfminer.pdftypes import resolve1
|
|
30
|
+
from babeldoc.pdfminer.pdftypes import stream_value
|
|
31
|
+
from babeldoc.pdfminer.psexceptions import PSEOF
|
|
32
|
+
from babeldoc.pdfminer.psexceptions import PSTypeError
|
|
33
|
+
from babeldoc.pdfminer.psparser import PSKeyword
|
|
34
|
+
from babeldoc.pdfminer.psparser import PSLiteral
|
|
35
|
+
from babeldoc.pdfminer.psparser import keyword_name
|
|
36
|
+
from babeldoc.pdfminer.psparser import literal_name
|
|
37
|
+
from babeldoc.pdfminer.utils import MATRIX_IDENTITY
|
|
38
|
+
from babeldoc.pdfminer.utils import Matrix
|
|
39
|
+
from babeldoc.pdfminer.utils import Rect
|
|
40
|
+
from babeldoc.pdfminer.utils import apply_matrix_pt
|
|
41
|
+
from babeldoc.pdfminer.utils import choplist
|
|
42
|
+
from babeldoc.pdfminer.utils import mult_matrix
|
|
43
43
|
|
|
44
44
|
log = logging.getLogger(__name__)
|
|
45
45
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2004-2016 Yusuke Shinyama <yusuke at shinyama dot jp>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
|
4
|
+
obtaining a copy of this software and associated documentation
|
|
5
|
+
files (the "Software"), to deal in the Software without
|
|
6
|
+
restriction, including without limitation the rights to use,
|
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or
|
|
8
|
+
sell copies of the Software, and to permit persons to whom the
|
|
9
|
+
Software is furnished to do so, subject to the following
|
|
10
|
+
conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be
|
|
13
|
+
included in all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
|
16
|
+
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
17
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
18
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
19
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
21
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from importlib.metadata import PackageNotFoundError
|
|
2
|
+
from importlib.metadata import version
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
__version__ = version("pdfminer.six")
|
|
6
|
+
except PackageNotFoundError:
|
|
7
|
+
# package is not installed, return default
|
|
8
|
+
__version__ = "0.0"
|
|
9
|
+
|
|
10
|
+
if __name__ == "__main__":
|
|
11
|
+
print(__version__)
|