BabelDOC 0.5.12__tar.gz → 0.5.14__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.
Files changed (313) hide show
  1. {babeldoc-0.5.12 → babeldoc-0.5.14}/PKG-INFO +1 -1
  2. babeldoc-0.5.14/babeldoc/__init__.py +1 -0
  3. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/babeldoc_exception/BabelDOCException.py +6 -0
  4. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/const.py +12 -1
  5. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/rpc_doclayout6.py +1 -1
  6. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/frontend/il_creater.py +1 -1
  7. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/il_translator.py +62 -0
  8. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/il_translator_llm_only.py +13 -4
  9. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/style_helper.py +4 -0
  10. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/high_level.py +8 -0
  11. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/main.py +1 -1
  12. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdfinterp.py +1 -0
  13. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/translator/translator.py +31 -17
  14. {babeldoc-0.5.12 → babeldoc-0.5.14}/pyproject.toml +2 -2
  15. babeldoc-0.5.12/babeldoc/__init__.py +0 -1
  16. {babeldoc-0.5.12 → babeldoc-0.5.14}/.cursorignore +0 -0
  17. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -0
  18. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -0
  19. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/PULL_REQUEST_TEMPLATE/pr_form.yml +0 -0
  20. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  21. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/dependabot.yml +0 -0
  22. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/labels.yml +0 -0
  23. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/release-drafter.yml +0 -0
  24. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/workflows/codeql.yml +0 -0
  25. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/workflows/docs.yml +0 -0
  26. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/workflows/labeler.yml +0 -0
  27. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/workflows/lint.yml +0 -0
  28. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/workflows/pr-lint.yml +0 -0
  29. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/workflows/publish-to-pypi.yml +0 -0
  30. {babeldoc-0.5.12 → babeldoc-0.5.14}/.github/workflows/test.yml +0 -0
  31. {babeldoc-0.5.12 → babeldoc-0.5.14}/.gitignore +0 -0
  32. {babeldoc-0.5.12 → babeldoc-0.5.14}/.pre-commit-config.yaml +0 -0
  33. {babeldoc-0.5.12 → babeldoc-0.5.14}/LICENSE +0 -0
  34. {babeldoc-0.5.12 → babeldoc-0.5.14}/README.md +0 -0
  35. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/assets/assets.py +0 -0
  36. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/assets/embedding_assets_metadata.py +0 -0
  37. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/asynchronize/__init__.py +0 -0
  38. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/babeldoc_exception/__init__.py +0 -0
  39. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/README.md +0 -0
  40. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/__init__.py +0 -0
  41. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/base_doclayout.py +0 -0
  42. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/doclayout.py +0 -0
  43. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/rpc_doclayout.py +0 -0
  44. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/rpc_doclayout2.py +0 -0
  45. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/rpc_doclayout3.py +0 -0
  46. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/rpc_doclayout4.py +0 -0
  47. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/rpc_doclayout5.py +0 -0
  48. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/rpc_doclayout7.py +0 -0
  49. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/docvision/table_detection/rapidocr.py +0 -0
  50. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/__init__.py +0 -0
  51. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/__init__.py +0 -0
  52. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/babelpdf/base14.py +0 -0
  53. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/babelpdf/cidfont.py +0 -0
  54. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/babelpdf/encoding.py +0 -0
  55. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/babelpdf/utils.py +0 -0
  56. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/babelpdf/win_core.py +0 -0
  57. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/converter.py +0 -0
  58. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/__init__.py +0 -0
  59. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/backend/__init__.py +0 -0
  60. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/backend/pdf_creater.py +0 -0
  61. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/frontend/__init__.py +0 -0
  62. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/il_version_1.py +0 -0
  63. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/il_version_1.rnc +0 -0
  64. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/il_version_1.rng +0 -0
  65. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/il_version_1.xsd +0 -0
  66. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/__init__.py +0 -0
  67. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/add_debug_information.py +0 -0
  68. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/automatic_term_extractor.py +0 -0
  69. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/detect_scanned_file.py +0 -0
  70. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/layout_parser.py +0 -0
  71. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/paragraph_finder.py +0 -0
  72. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/remove_descent.py +0 -0
  73. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/styles_and_formulas.py +0 -0
  74. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/table_parser.py +0 -0
  75. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/midend/typesetting.py +0 -0
  76. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/__init__.py +0 -0
  77. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/extract_char.py +0 -0
  78. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/fontmap.py +0 -0
  79. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/formular_helper.py +0 -0
  80. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/layout_helper.py +0 -0
  81. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/matrix_helper.py +0 -0
  82. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/mupdf_helper.py +0 -0
  83. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/paragraph_helper.py +0 -0
  84. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/spatial_analyzer.py +0 -0
  85. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/utils/zstd_helper.py +0 -0
  86. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/document_il/xml_converter.py +0 -0
  87. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/pdfinterp.py +0 -0
  88. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/result_merger.py +0 -0
  89. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/split_manager.py +0 -0
  90. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/format/pdf/translation_config.py +0 -0
  91. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/glossary.py +0 -0
  92. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/LICENSE +0 -0
  93. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/__init__.py +0 -0
  94. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/_saslprep.py +0 -0
  95. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/arcfour.py +0 -0
  96. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/ascii85.py +0 -0
  97. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/casting.py +0 -0
  98. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/ccitt.py +0 -0
  99. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/78-EUC-H.pickle.gz +0 -0
  100. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/78-EUC-V.pickle.gz +0 -0
  101. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/78-H.pickle.gz +0 -0
  102. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/78-RKSJ-H.pickle.gz +0 -0
  103. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/78-RKSJ-V.pickle.gz +0 -0
  104. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/78-V.pickle.gz +0 -0
  105. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/78ms-RKSJ-H.pickle.gz +0 -0
  106. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/78ms-RKSJ-V.pickle.gz +0 -0
  107. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/83pv-RKSJ-H.pickle.gz +0 -0
  108. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/83pv-RKSJ-V.pickle.gz +0 -0
  109. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/90ms-RKSJ-H.pickle.gz +0 -0
  110. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/90ms-RKSJ-V.pickle.gz +0 -0
  111. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/90msp-RKSJ-H.pickle.gz +0 -0
  112. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/90msp-RKSJ-V.pickle.gz +0 -0
  113. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/90pv-RKSJ-H.pickle.gz +0 -0
  114. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/90pv-RKSJ-V.pickle.gz +0 -0
  115. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Add-H.pickle.gz +0 -0
  116. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Add-RKSJ-H.pickle.gz +0 -0
  117. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Add-RKSJ-V.pickle.gz +0 -0
  118. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Add-V.pickle.gz +0 -0
  119. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/B5-H.pickle.gz +0 -0
  120. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/B5-V.pickle.gz +0 -0
  121. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/B5pc-H.pickle.gz +0 -0
  122. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/B5pc-V.pickle.gz +0 -0
  123. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/CNS-EUC-H.pickle.gz +0 -0
  124. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/CNS-EUC-V.pickle.gz +0 -0
  125. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/CNS1-H.pickle.gz +0 -0
  126. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/CNS1-V.pickle.gz +0 -0
  127. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/CNS2-H.pickle.gz +0 -0
  128. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/CNS2-V.pickle.gz +0 -0
  129. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/ETHK-B5-H.pickle.gz +0 -0
  130. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/ETHK-B5-V.pickle.gz +0 -0
  131. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/ETen-B5-H.pickle.gz +0 -0
  132. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/ETen-B5-V.pickle.gz +0 -0
  133. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/ETenms-B5-H.pickle.gz +0 -0
  134. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/ETenms-B5-V.pickle.gz +0 -0
  135. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/EUC-H.pickle.gz +0 -0
  136. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/EUC-V.pickle.gz +0 -0
  137. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Ext-H.pickle.gz +0 -0
  138. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Ext-RKSJ-H.pickle.gz +0 -0
  139. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Ext-RKSJ-V.pickle.gz +0 -0
  140. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Ext-V.pickle.gz +0 -0
  141. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GB-EUC-H.pickle.gz +0 -0
  142. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GB-EUC-V.pickle.gz +0 -0
  143. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GB-H.pickle.gz +0 -0
  144. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GB-V.pickle.gz +0 -0
  145. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBK-EUC-H.pickle.gz +0 -0
  146. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBK-EUC-V.pickle.gz +0 -0
  147. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBK2K-H.pickle.gz +0 -0
  148. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBK2K-V.pickle.gz +0 -0
  149. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBKp-EUC-H.pickle.gz +0 -0
  150. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBKp-EUC-V.pickle.gz +0 -0
  151. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBT-EUC-H.pickle.gz +0 -0
  152. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBT-EUC-V.pickle.gz +0 -0
  153. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBT-H.pickle.gz +0 -0
  154. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBT-V.pickle.gz +0 -0
  155. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBTpc-EUC-H.pickle.gz +0 -0
  156. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBTpc-EUC-V.pickle.gz +0 -0
  157. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBpc-EUC-H.pickle.gz +0 -0
  158. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/GBpc-EUC-V.pickle.gz +0 -0
  159. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/H.pickle.gz +0 -0
  160. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKdla-B5-H.pickle.gz +0 -0
  161. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKdla-B5-V.pickle.gz +0 -0
  162. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKdlb-B5-H.pickle.gz +0 -0
  163. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKdlb-B5-V.pickle.gz +0 -0
  164. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKgccs-B5-H.pickle.gz +0 -0
  165. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKgccs-B5-V.pickle.gz +0 -0
  166. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKm314-B5-H.pickle.gz +0 -0
  167. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKm314-B5-V.pickle.gz +0 -0
  168. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKm471-B5-H.pickle.gz +0 -0
  169. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKm471-B5-V.pickle.gz +0 -0
  170. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKscs-B5-H.pickle.gz +0 -0
  171. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/HKscs-B5-V.pickle.gz +0 -0
  172. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Hankaku-H.pickle.gz +0 -0
  173. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Hankaku-V.pickle.gz +0 -0
  174. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Hiragana-H.pickle.gz +0 -0
  175. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Hiragana-V.pickle.gz +0 -0
  176. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSC-EUC-H.pickle.gz +0 -0
  177. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSC-EUC-V.pickle.gz +0 -0
  178. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSC-H.pickle.gz +0 -0
  179. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSC-Johab-H.pickle.gz +0 -0
  180. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSC-Johab-V.pickle.gz +0 -0
  181. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSC-V.pickle.gz +0 -0
  182. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSCms-UHC-H.pickle.gz +0 -0
  183. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-H.pickle.gz +0 -0
  184. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-V.pickle.gz +0 -0
  185. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSCms-UHC-V.pickle.gz +0 -0
  186. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSCpc-EUC-H.pickle.gz +0 -0
  187. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/KSCpc-EUC-V.pickle.gz +0 -0
  188. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Katakana-H.pickle.gz +0 -0
  189. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Katakana-V.pickle.gz +0 -0
  190. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/NWP-H.pickle.gz +0 -0
  191. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/NWP-V.pickle.gz +0 -0
  192. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/README.txt +0 -0
  193. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/RKSJ-H.pickle.gz +0 -0
  194. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/RKSJ-V.pickle.gz +0 -0
  195. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Roman-H.pickle.gz +0 -0
  196. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/Roman-V.pickle.gz +0 -0
  197. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniCNS-UCS2-H.pickle.gz +0 -0
  198. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniCNS-UCS2-V.pickle.gz +0 -0
  199. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniCNS-UTF16-H.pickle.gz +0 -0
  200. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniCNS-UTF16-V.pickle.gz +0 -0
  201. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniCNS-UTF32-H.pickle.gz +0 -0
  202. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniCNS-UTF32-V.pickle.gz +0 -0
  203. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniCNS-UTF8-H.pickle.gz +0 -0
  204. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniCNS-UTF8-V.pickle.gz +0 -0
  205. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniGB-UCS2-H.pickle.gz +0 -0
  206. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniGB-UCS2-V.pickle.gz +0 -0
  207. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniGB-UTF16-H.pickle.gz +0 -0
  208. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniGB-UTF16-V.pickle.gz +0 -0
  209. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniGB-UTF32-H.pickle.gz +0 -0
  210. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniGB-UTF32-V.pickle.gz +0 -0
  211. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniGB-UTF8-H.pickle.gz +0 -0
  212. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniGB-UTF8-V.pickle.gz +0 -0
  213. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UCS2-H.pickle.gz +0 -0
  214. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-H.pickle.gz +0 -0
  215. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-V.pickle.gz +0 -0
  216. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UCS2-V.pickle.gz +0 -0
  217. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UTF16-H.pickle.gz +0 -0
  218. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UTF16-V.pickle.gz +0 -0
  219. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UTF32-H.pickle.gz +0 -0
  220. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UTF32-V.pickle.gz +0 -0
  221. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UTF8-H.pickle.gz +0 -0
  222. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS-UTF8-V.pickle.gz +0 -0
  223. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-H.pickle.gz +0 -0
  224. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-V.pickle.gz +0 -0
  225. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-H.pickle.gz +0 -0
  226. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-V.pickle.gz +0 -0
  227. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-H.pickle.gz +0 -0
  228. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-V.pickle.gz +0 -0
  229. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-H.pickle.gz +0 -0
  230. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-V.pickle.gz +0 -0
  231. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-H.pickle.gz +0 -0
  232. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-V.pickle.gz +0 -0
  233. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniKS-UCS2-H.pickle.gz +0 -0
  234. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniKS-UCS2-V.pickle.gz +0 -0
  235. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniKS-UTF16-H.pickle.gz +0 -0
  236. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniKS-UTF16-V.pickle.gz +0 -0
  237. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniKS-UTF32-H.pickle.gz +0 -0
  238. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniKS-UTF32-V.pickle.gz +0 -0
  239. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniKS-UTF8-H.pickle.gz +0 -0
  240. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/UniKS-UTF8-V.pickle.gz +0 -0
  241. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/V.pickle.gz +0 -0
  242. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/WP-Symbol-H.pickle.gz +0 -0
  243. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/WP-Symbol-V.pickle.gz +0 -0
  244. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/to-unicode-Adobe-CNS1.pickle.gz +0 -0
  245. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/to-unicode-Adobe-GB1.pickle.gz +0 -0
  246. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Japan1.pickle.gz +0 -0
  247. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Korea1.pickle.gz +0 -0
  248. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/cmapdb.py +0 -0
  249. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/converter.py +0 -0
  250. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/data_structures.py +0 -0
  251. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/encodingdb.py +0 -0
  252. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/fontmetrics.py +0 -0
  253. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/glyphlist.py +0 -0
  254. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/high_level.py +0 -0
  255. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/image.py +0 -0
  256. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/jbig2.py +0 -0
  257. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/latin_enc.py +0 -0
  258. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/layout.py +0 -0
  259. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/lzw.py +0 -0
  260. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdfcolor.py +0 -0
  261. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdfdevice.py +0 -0
  262. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdfdocument.py +0 -0
  263. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdfexceptions.py +0 -0
  264. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdffont.py +0 -0
  265. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdfpage.py +0 -0
  266. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdfparser.py +0 -0
  267. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/pdftypes.py +0 -0
  268. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/psexceptions.py +0 -0
  269. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/psparser.py +0 -0
  270. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/py.typed +0 -0
  271. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/runlength.py +0 -0
  272. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/settings.py +0 -0
  273. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/pdfminer/utils.py +0 -0
  274. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/progress_monitor.py +0 -0
  275. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/tools/generate_font_metadata.py +0 -0
  276. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/tools/italic_assistance.py +0 -0
  277. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/tools/italic_recognize_tool.py +0 -0
  278. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/translator/__init__.py +0 -0
  279. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/translator/cache.py +0 -0
  280. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/utils/__init__.py +0 -0
  281. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/utils/atomic_integer.py +0 -0
  282. {babeldoc-0.5.12 → babeldoc-0.5.14}/babeldoc/utils/priority_thread_pool_executor.py +0 -0
  283. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/CODE_OF_CONDUCT.md +0 -0
  284. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/CONTRIBUTING.md +0 -0
  285. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/CONTRIBUTOR_REWARD.md +0 -0
  286. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/ImplementationDetails/AsyncTranslate/AsyncTranslate.md +0 -0
  287. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/ImplementationDetails/ILTranslator/ILTranslator.md +0 -0
  288. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/ImplementationDetails/PDFCreation/PDFCreation.md +0 -0
  289. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/ImplementationDetails/PDFParsing/PDFParsing.md +0 -0
  290. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/ImplementationDetails/ParagraphFinding/ParagraphFinding.md +0 -0
  291. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/ImplementationDetails/README.md +0 -0
  292. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/ImplementationDetails/StylesAndFormulas/StylesAndFormulas.md +0 -0
  293. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/ImplementationDetails/Typesetting/Typesetting.md +0 -0
  294. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/README.md +0 -0
  295. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/deploy.sh +0 -0
  296. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/example/demo_glossary.csv +0 -0
  297. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-banner.png +0 -0
  298. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.png +0 -0
  299. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.svg +0 -0
  300. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-big-logo-with-transparent-background.png +0 -0
  301. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-big-logo-with-transparent-background.svg +0 -0
  302. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-big-logo.png +0 -0
  303. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-contributor_reward_example.png +0 -0
  304. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-preview.gif +0 -0
  305. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-small-logo-with-transparent-background.png +0 -0
  306. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-small-logo-with-transparent-background.svg +0 -0
  307. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/images/babeldoc-small-logo.png +0 -0
  308. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/index.md +0 -0
  309. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/intro-to-pdf-object.md +0 -0
  310. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/requirements.txt +0 -0
  311. {babeldoc-0.5.12 → babeldoc-0.5.14}/docs/supported_languages.md +0 -0
  312. {babeldoc-0.5.12 → babeldoc-0.5.14}/mkdocs.yml +0 -0
  313. {babeldoc-0.5.12 → babeldoc-0.5.14}/tests/test_translation_cache_cleanup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: BabelDOC
3
- Version: 0.5.12
3
+ Version: 0.5.14
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
@@ -0,0 +1 @@
1
+ __version__ = "0.5.14"
@@ -11,3 +11,9 @@ class ExtractTextError(Exception):
11
11
  class InputFileGeneratedByBabelDOCError(Exception):
12
12
  def __init__(self, message):
13
13
  super().__init__(message)
14
+
15
+
16
+ class ContentFilterError(Exception):
17
+ def __init__(self, message):
18
+ super().__init__(message)
19
+ self.message = message
@@ -6,7 +6,7 @@ import subprocess
6
6
  import threading
7
7
  from pathlib import Path
8
8
 
9
- __version__ = "0.5.12"
9
+ __version__ = "0.5.14"
10
10
 
11
11
  CACHE_FOLDER = Path.home() / ".cache" / "babeldoc"
12
12
 
@@ -73,6 +73,17 @@ def get_process_pool():
73
73
  return _process_pool
74
74
 
75
75
 
76
+ def close_process_pool():
77
+ if not _ENABLE_PROCESS_POOL:
78
+ return None
79
+ global _process_pool
80
+ with _process_pool_lock:
81
+ if _process_pool:
82
+ _process_pool.close()
83
+ _process_pool.join()
84
+ _process_pool = None
85
+
86
+
76
87
  def batched(iterable, n, *, strict=False):
77
88
  # batched('ABCDEFG', 3) → ABC DEF G
78
89
  if n < 1:
@@ -599,7 +599,7 @@ class RpcDocLayoutModel(DocLayoutModel):
599
599
  ):
600
600
  layout_temp_path = translate_config.get_working_file_path("layout.temp.pdf")
601
601
  mupdf_doc.save(layout_temp_path.as_posix())
602
- with ThreadPoolExecutor(max_workers=32) as executor:
602
+ with ThreadPoolExecutor(max_workers=8) as executor:
603
603
  yield from executor.map(
604
604
  self.predict_page,
605
605
  pages,
@@ -955,7 +955,7 @@ class ILCreater:
955
955
  )
956
956
  return
957
957
 
958
- if char_bounding_box:
958
+ if char_bounding_box and len(char_bounding_box) == 4:
959
959
  x_min, y_min, x_max, y_max = char_bounding_box
960
960
  factor = 1 / 1000 * pdf_style.font_size
961
961
  x_min = x_min * factor
@@ -4,12 +4,16 @@ import copy
4
4
  import json
5
5
  import logging
6
6
  import re
7
+ import threading
7
8
  from pathlib import Path
8
9
 
9
10
  import tiktoken
10
11
  from tqdm import tqdm
11
12
 
13
+ import babeldoc.format.pdf.document_il.il_version_1 as il_version_1
14
+ from babeldoc.babeldoc_exception.BabelDOCException import ContentFilterError
12
15
  from babeldoc.format.pdf.document_il import Document
16
+ from babeldoc.format.pdf.document_il import GraphicState
13
17
  from babeldoc.format.pdf.document_il import Page
14
18
  from babeldoc.format.pdf.document_il import PdfFont
15
19
  from babeldoc.format.pdf.document_il import PdfFormula
@@ -34,6 +38,7 @@ from babeldoc.format.pdf.document_il.utils.paragraph_helper import (
34
38
  from babeldoc.format.pdf.document_il.utils.paragraph_helper import (
35
39
  is_pure_numeric_paragraph,
36
40
  )
41
+ from babeldoc.format.pdf.document_il.utils.style_helper import GRAY80
37
42
  from babeldoc.format.pdf.translation_config import TranslationConfig
38
43
  from babeldoc.translator.translator import BaseTranslator
39
44
  from babeldoc.utils.priority_thread_pool_executor import PriorityThreadPoolExecutor
@@ -307,6 +312,8 @@ class ILTranslator:
307
312
  self.support_llm_translate = False
308
313
 
309
314
  self.use_as_fallback = False
315
+ self.add_content_filter_hint_lock = threading.Lock()
316
+ self.docs = None
310
317
 
311
318
  def calc_token_count(self, text: str) -> int:
312
319
  try:
@@ -315,6 +322,7 @@ class ILTranslator:
315
322
  return 0
316
323
 
317
324
  def translate(self, docs: Document):
325
+ self.docs = docs
318
326
  tracker = DocumentTranslateTracker()
319
327
 
320
328
  if not self.translation_config.shared_context_cross_split_part.first_paragraph:
@@ -390,6 +398,7 @@ class ILTranslator:
390
398
  executor.submit(
391
399
  self.translate_paragraph,
392
400
  paragraph,
401
+ page,
393
402
  pbar,
394
403
  tracker.new_paragraph(),
395
404
  page_font_map,
@@ -985,9 +994,58 @@ Now, please carefully read the following text to be translated and directly outp
985
994
 
986
995
  return final_input
987
996
 
997
+ def add_content_filter_hint(self, page: Page, paragraph: PdfParagraph):
998
+ with self.add_content_filter_hint_lock:
999
+ new_box = il_version_1.Box(
1000
+ x=paragraph.box.x,
1001
+ y=paragraph.box.y2,
1002
+ x2=paragraph.box.x2,
1003
+ y2=paragraph.box.y2 + 1.1,
1004
+ )
1005
+ page.pdf_paragraph.append(
1006
+ self._create_text(
1007
+ "翻译服务检测到内容可能包含不安全或敏感内容,请您避免翻译敏感内容,感谢您的配合。",
1008
+ GRAY80,
1009
+ new_box,
1010
+ 1,
1011
+ )
1012
+ )
1013
+ logger.info("success add content filter hint")
1014
+
1015
+ def _create_text(
1016
+ self,
1017
+ text: str,
1018
+ color: GraphicState,
1019
+ box: il_version_1.Box,
1020
+ font_size: float = 4,
1021
+ ):
1022
+ style = il_version_1.PdfStyle(
1023
+ font_id="base",
1024
+ font_size=font_size,
1025
+ graphic_state=color,
1026
+ )
1027
+ return il_version_1.PdfParagraph(
1028
+ first_line_indent=False,
1029
+ box=box,
1030
+ vertical=False,
1031
+ pdf_style=style,
1032
+ unicode=text,
1033
+ pdf_paragraph_composition=[
1034
+ il_version_1.PdfParagraphComposition(
1035
+ pdf_same_style_unicode_characters=il_version_1.PdfSameStyleUnicodeCharacters(
1036
+ unicode=text,
1037
+ pdf_style=style,
1038
+ debug_info=True,
1039
+ ),
1040
+ ),
1041
+ ],
1042
+ xobj_id=-1,
1043
+ )
1044
+
988
1045
  def translate_paragraph(
989
1046
  self,
990
1047
  paragraph: PdfParagraph,
1048
+ page: Page,
991
1049
  pbar: tqdm | None = None,
992
1050
  tracker: ParagraphTranslateTracker = None,
993
1051
  page_font_map: dict[str, PdfFont] = None,
@@ -1039,6 +1097,10 @@ Now, please carefully read the following text to be translated and directly outp
1039
1097
  self.post_translate_paragraph(
1040
1098
  paragraph, tracker, translate_input, translated_text
1041
1099
  )
1100
+ except ContentFilterError as e:
1101
+ logger.warning(f"ContentFilterError: {e.message}")
1102
+ self.add_content_filter_hint(page, paragraph)
1103
+ return
1042
1104
  except Exception as e:
1043
1105
  logger.exception(
1044
1106
  f"Error translating paragraph. Paragraph: {paragraph.debug_id} ({paragraph.unicode}). Error: {e}. ",
@@ -40,9 +40,11 @@ class BatchParagraph:
40
40
  def __init__(
41
41
  self,
42
42
  paragraphs: list[PdfParagraph],
43
+ pages: list[Page],
43
44
  page_tracker: PageTranslateTracker,
44
45
  ):
45
46
  self.paragraphs = paragraphs
47
+ self.pages = pages
46
48
  self.trackers = [page_tracker.new_paragraph() for _ in paragraphs]
47
49
 
48
50
 
@@ -112,6 +114,7 @@ class ILTranslatorLLMOnly:
112
114
  return None
113
115
 
114
116
  def translate(self, docs: Document) -> None:
117
+ self.il_translator.docs = docs
115
118
  tracker = DocumentTranslateTracker()
116
119
  self.mid = 0
117
120
 
@@ -361,8 +364,9 @@ class ILTranslatorLLMOnly:
361
364
 
362
365
  # Create batch with both paragraphs
363
366
  cross_page_paragraphs = [last_curr_paragraph, first_next_paragraph]
367
+ cross_page_pages = [page_curr, page_next]
364
368
  batch_paragraph = BatchParagraph(
365
- cross_page_paragraphs, tracker.new_cross_page()
369
+ cross_page_paragraphs, cross_page_pages, tracker.new_cross_page()
366
370
  )
367
371
 
368
372
  self.mid += 1
@@ -438,7 +442,7 @@ class ILTranslatorLLMOnly:
438
442
  p1.unicode
439
443
  ) + self.calc_token_count(p2.unicode)
440
444
 
441
- batch = BatchParagraph([p1, p2], tracker.new_cross_column())
445
+ batch = BatchParagraph([p1, p2], [page, page], tracker.new_cross_column())
442
446
  self.mid += 1
443
447
  executor.submit(
444
448
  self.translate_paragraph,
@@ -523,7 +527,7 @@ class ILTranslatorLLMOnly:
523
527
  self.mid += 1
524
528
  executor.submit(
525
529
  self.translate_paragraph,
526
- BatchParagraph(paragraphs, tracker),
530
+ BatchParagraph(paragraphs, [page] * len(paragraphs), tracker),
527
531
  pbar,
528
532
  page_font_map,
529
533
  page_xobj_font_map,
@@ -541,7 +545,7 @@ class ILTranslatorLLMOnly:
541
545
  self.mid += 1
542
546
  executor.submit(
543
547
  self.translate_paragraph,
544
- BatchParagraph(paragraphs, tracker),
548
+ BatchParagraph(paragraphs, [page] * len(paragraphs), tracker),
545
549
  pbar,
546
550
  page_font_map,
547
551
  page_xobj_font_map,
@@ -630,6 +634,9 @@ class ILTranslatorLLMOnly:
630
634
  llm_prompt_parts.append("#role")
631
635
  if self.translation_config.custom_system_prompt:
632
636
  llm_prompt_parts.append(self.translation_config.custom_system_prompt)
637
+ llm_prompt_parts.append(
638
+ "When translating, strictly follow the instructions below to ensure translation quality and preserve all formatting, tags, and placeholders:\n"
639
+ )
633
640
  else:
634
641
  llm_prompt_parts.append(
635
642
  f"You are a professional and reliable machine translation engine responsible for translating the input text into {self.translation_config.lang_out}.\n"
@@ -894,6 +901,7 @@ class ILTranslatorLLMOnly:
894
901
  executor.submit(
895
902
  self.il_translator.translate_paragraph,
896
903
  inputs[id_][2],
904
+ batch_paragraph.pages[id_],
897
905
  pbar,
898
906
  inputs[id_][3],
899
907
  page_font_map,
@@ -929,6 +937,7 @@ class ILTranslatorLLMOnly:
929
937
  executor.submit(
930
938
  self.il_translator.translate_paragraph,
931
939
  paragraph,
940
+ batch_paragraph.pages[i],
932
941
  pbar,
933
942
  tracker,
934
943
  page_font_map,
@@ -29,6 +29,10 @@ BLACK = il_version_1.GraphicState(passthrough_per_char_instruction="0 g 0 G")
29
29
 
30
30
  WHITE = il_version_1.GraphicState(passthrough_per_char_instruction="1 g 1 G")
31
31
 
32
+ GRAY80 = il_version_1.GraphicState(passthrough_per_char_instruction="0.80 g 0.80 G")
33
+ GRAY67 = il_version_1.GraphicState(passthrough_per_char_instruction="0.67 g 0.67 G")
34
+ GRAY33 = il_version_1.GraphicState(passthrough_per_char_instruction="0.33 g 0.33 G")
35
+
32
36
  # Generate all color styles
33
37
  RED = il_version_1.GraphicState(
34
38
  passthrough_per_char_instruction="1.0000000000 0.2313725490 0.1882352941 rg "
@@ -25,6 +25,7 @@ from babeldoc.babeldoc_exception.BabelDOCException import (
25
25
  )
26
26
  from babeldoc.const import CACHE_FOLDER
27
27
  from babeldoc.const import WATERMARK_VERSION
28
+ from babeldoc.const import close_process_pool
28
29
  from babeldoc.format.pdf.converter import TranslateConverter
29
30
  from babeldoc.format.pdf.document_il import il_version_1
30
31
  from babeldoc.format.pdf.document_il.backend.pdf_creater import SAVE_PDF_STAGE_NAME
@@ -149,6 +150,12 @@ def add_metadata(
149
150
  translated_by += f"_{translate_config.metadata_extra_data}"
150
151
  meta["producer"] = translated_by
151
152
  meta["creator"] = creator
153
+
154
+ for k, v in meta.items():
155
+ if v:
156
+ # 使用正则替换掉 surrogate 范围内的字符
157
+ meta[k] = re.sub(r"[\uD800-\uDFFF]", "", v)
158
+
152
159
  pdf.set_metadata(meta)
153
160
  safe_save(pdf, temp_path)
154
161
  shutil.move(temp_path, path)
@@ -1005,6 +1012,7 @@ def _do_translate_single(
1005
1012
  logger.debug("start generating layouts")
1006
1013
  docs = LayoutParser(translation_config).process(docs, doc_pdf2zh)
1007
1014
  logger.debug("finish generating layouts")
1015
+ close_process_pool()
1008
1016
  if translation_config.debug:
1009
1017
  xml_converter.write_json(
1010
1018
  docs,
@@ -26,7 +26,7 @@ from babeldoc.translator.translator import OpenAITranslator
26
26
  from babeldoc.translator.translator import set_translate_rate_limiter
27
27
 
28
28
  logger = logging.getLogger(__name__)
29
- __version__ = "0.5.12"
29
+ __version__ = "0.5.14"
30
30
 
31
31
 
32
32
  def create_parser():
@@ -119,6 +119,7 @@ class PDFTextState:
119
119
  obj.rise = self.rise
120
120
  obj.matrix = self.matrix
121
121
  obj.linematrix = self.linematrix
122
+ obj.font_id = getattr(self, "font_id", None)
122
123
  return obj
123
124
 
124
125
  def reset(self) -> None:
@@ -14,6 +14,7 @@ from tenacity import retry_if_exception_type
14
14
  from tenacity import stop_after_attempt
15
15
  from tenacity import wait_exponential
16
16
 
17
+ from babeldoc.babeldoc_exception.BabelDOCException import ContentFilterError
17
18
  from babeldoc.translator.cache import TranslationCache
18
19
  from babeldoc.utils.atomic_integer import AtomicInteger
19
20
 
@@ -155,7 +156,12 @@ class BaseTranslator(ABC):
155
156
  _translate_rate_limiter.wait()
156
157
  translation = self.do_llm_translate(text, rate_limit_params)
157
158
  if not (self.ignore_cache or ignore_cache):
158
- self.cache.set(text, translation)
159
+ try:
160
+ self.cache.set(text, translation)
161
+ except Exception as e:
162
+ logger.debug(
163
+ f"try set cache failed, ignore it: {e}, text: {text}, translation: {translation}"
164
+ )
159
165
  return translation
160
166
 
161
167
  @abstractmethod
@@ -299,22 +305,30 @@ class OpenAITranslator(BaseTranslator):
299
305
  extra_headers["X-DashScope-DataInspection"] = (
300
306
  '{"input": "disable", "output": "disable"}'
301
307
  )
302
-
303
- response = self.client.chat.completions.create(
304
- model=self.model,
305
- **options,
306
- max_tokens=2048,
307
- messages=[
308
- {
309
- "role": "user",
310
- "content": text,
311
- },
312
- ],
313
- extra_headers=extra_headers,
314
- extra_body=self.extra_body,
315
- )
316
- self.update_token_count(response)
317
- return response.choices[0].message.content.strip()
308
+ try:
309
+ response = self.client.chat.completions.create(
310
+ model=self.model,
311
+ **options,
312
+ max_tokens=2048,
313
+ messages=[
314
+ {
315
+ "role": "user",
316
+ "content": text,
317
+ },
318
+ ],
319
+ extra_headers=extra_headers,
320
+ extra_body=self.extra_body,
321
+ )
322
+ self.update_token_count(response)
323
+ return response.choices[0].message.content.strip()
324
+ except openai.BadRequestError as e:
325
+ if (
326
+ "系统检测到输入或生成内容可能包含不安全或敏感内容,请您避免输入易产生敏感内容的提示语,感谢您的配合。"
327
+ in e.message
328
+ ):
329
+ raise ContentFilterError(e.message) from e
330
+ else:
331
+ raise
318
332
 
319
333
  def update_token_count(self, response):
320
334
  try:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "BabelDOC"
3
- version = "0.5.12"
3
+ version = "0.5.14"
4
4
  description = "Yet Another Document Translator"
5
5
  license = "AGPL-3.0"
6
6
  readme = "README.md"
@@ -162,7 +162,7 @@ pythonpath = [".", "src"]
162
162
  testpaths = ["tests"]
163
163
 
164
164
  [bumpver]
165
- current_version = "0.5.12"
165
+ current_version = "0.5.14"
166
166
  version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]"
167
167
 
168
168
  [bumpver.file_patterns]
@@ -1 +0,0 @@
1
- __version__ = "0.5.12"
File without changes
File without changes
File without changes
File without changes
File without changes