BabelDOC 0.5.14__tar.gz → 0.5.16__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 (314) hide show
  1. {babeldoc-0.5.14 → babeldoc-0.5.16}/PKG-INFO +1 -1
  2. babeldoc-0.5.16/babeldoc/__init__.py +1 -0
  3. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/const.py +1 -1
  4. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/rpc_doclayout6.py +15 -15
  5. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/automatic_term_extractor.py +16 -5
  6. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/detect_scanned_file.py +1 -0
  7. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/il_translator.py +32 -33
  8. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/il_translator_llm_only.py +63 -63
  9. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/high_level.py +16 -20
  10. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/translation_config.py +7 -0
  11. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/main.py +12 -3
  12. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/translator/translator.py +5 -0
  13. babeldoc-0.5.16/babeldoc/utils/memory.py +251 -0
  14. {babeldoc-0.5.14 → babeldoc-0.5.16}/pyproject.toml +2 -2
  15. babeldoc-0.5.14/babeldoc/__init__.py +0 -1
  16. {babeldoc-0.5.14 → babeldoc-0.5.16}/.cursorignore +0 -0
  17. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -0
  18. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -0
  19. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/PULL_REQUEST_TEMPLATE/pr_form.yml +0 -0
  20. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  21. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/dependabot.yml +0 -0
  22. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/labels.yml +0 -0
  23. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/release-drafter.yml +0 -0
  24. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/workflows/codeql.yml +0 -0
  25. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/workflows/docs.yml +0 -0
  26. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/workflows/labeler.yml +0 -0
  27. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/workflows/lint.yml +0 -0
  28. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/workflows/pr-lint.yml +0 -0
  29. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/workflows/publish-to-pypi.yml +0 -0
  30. {babeldoc-0.5.14 → babeldoc-0.5.16}/.github/workflows/test.yml +0 -0
  31. {babeldoc-0.5.14 → babeldoc-0.5.16}/.gitignore +0 -0
  32. {babeldoc-0.5.14 → babeldoc-0.5.16}/.pre-commit-config.yaml +0 -0
  33. {babeldoc-0.5.14 → babeldoc-0.5.16}/LICENSE +0 -0
  34. {babeldoc-0.5.14 → babeldoc-0.5.16}/README.md +0 -0
  35. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/assets/assets.py +0 -0
  36. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/assets/embedding_assets_metadata.py +0 -0
  37. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/asynchronize/__init__.py +0 -0
  38. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/babeldoc_exception/BabelDOCException.py +0 -0
  39. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/babeldoc_exception/__init__.py +0 -0
  40. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/README.md +0 -0
  41. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/__init__.py +0 -0
  42. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/base_doclayout.py +0 -0
  43. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/doclayout.py +0 -0
  44. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/rpc_doclayout.py +0 -0
  45. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/rpc_doclayout2.py +0 -0
  46. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/rpc_doclayout3.py +0 -0
  47. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/rpc_doclayout4.py +0 -0
  48. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/rpc_doclayout5.py +0 -0
  49. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/rpc_doclayout7.py +0 -0
  50. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/docvision/table_detection/rapidocr.py +0 -0
  51. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/__init__.py +0 -0
  52. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/__init__.py +0 -0
  53. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/babelpdf/base14.py +0 -0
  54. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/babelpdf/cidfont.py +0 -0
  55. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/babelpdf/encoding.py +0 -0
  56. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/babelpdf/utils.py +0 -0
  57. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/babelpdf/win_core.py +0 -0
  58. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/converter.py +0 -0
  59. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/__init__.py +0 -0
  60. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/backend/__init__.py +0 -0
  61. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/backend/pdf_creater.py +0 -0
  62. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/frontend/__init__.py +0 -0
  63. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/frontend/il_creater.py +0 -0
  64. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/il_version_1.py +0 -0
  65. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/il_version_1.rnc +0 -0
  66. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/il_version_1.rng +0 -0
  67. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/il_version_1.xsd +0 -0
  68. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/__init__.py +0 -0
  69. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/add_debug_information.py +0 -0
  70. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/layout_parser.py +0 -0
  71. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/paragraph_finder.py +0 -0
  72. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/remove_descent.py +0 -0
  73. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/styles_and_formulas.py +0 -0
  74. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/table_parser.py +0 -0
  75. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/midend/typesetting.py +0 -0
  76. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/__init__.py +0 -0
  77. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/extract_char.py +0 -0
  78. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/fontmap.py +0 -0
  79. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/formular_helper.py +0 -0
  80. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/layout_helper.py +1 -1
  81. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/matrix_helper.py +0 -0
  82. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/mupdf_helper.py +0 -0
  83. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/paragraph_helper.py +0 -0
  84. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/spatial_analyzer.py +0 -0
  85. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/style_helper.py +0 -0
  86. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/utils/zstd_helper.py +0 -0
  87. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/document_il/xml_converter.py +0 -0
  88. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/pdfinterp.py +0 -0
  89. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/result_merger.py +0 -0
  90. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/format/pdf/split_manager.py +0 -0
  91. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/glossary.py +0 -0
  92. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/LICENSE +0 -0
  93. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/__init__.py +0 -0
  94. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/_saslprep.py +0 -0
  95. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/arcfour.py +0 -0
  96. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/ascii85.py +0 -0
  97. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/casting.py +0 -0
  98. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/ccitt.py +0 -0
  99. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/78-EUC-H.pickle.gz +0 -0
  100. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/78-EUC-V.pickle.gz +0 -0
  101. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/78-H.pickle.gz +0 -0
  102. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/78-RKSJ-H.pickle.gz +0 -0
  103. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/78-RKSJ-V.pickle.gz +0 -0
  104. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/78-V.pickle.gz +0 -0
  105. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/78ms-RKSJ-H.pickle.gz +0 -0
  106. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/78ms-RKSJ-V.pickle.gz +0 -0
  107. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/83pv-RKSJ-H.pickle.gz +0 -0
  108. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/83pv-RKSJ-V.pickle.gz +0 -0
  109. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/90ms-RKSJ-H.pickle.gz +0 -0
  110. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/90ms-RKSJ-V.pickle.gz +0 -0
  111. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/90msp-RKSJ-H.pickle.gz +0 -0
  112. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/90msp-RKSJ-V.pickle.gz +0 -0
  113. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/90pv-RKSJ-H.pickle.gz +0 -0
  114. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/90pv-RKSJ-V.pickle.gz +0 -0
  115. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Add-H.pickle.gz +0 -0
  116. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Add-RKSJ-H.pickle.gz +0 -0
  117. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Add-RKSJ-V.pickle.gz +0 -0
  118. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Add-V.pickle.gz +0 -0
  119. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/B5-H.pickle.gz +0 -0
  120. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/B5-V.pickle.gz +0 -0
  121. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/B5pc-H.pickle.gz +0 -0
  122. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/B5pc-V.pickle.gz +0 -0
  123. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/CNS-EUC-H.pickle.gz +0 -0
  124. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/CNS-EUC-V.pickle.gz +0 -0
  125. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/CNS1-H.pickle.gz +0 -0
  126. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/CNS1-V.pickle.gz +0 -0
  127. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/CNS2-H.pickle.gz +0 -0
  128. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/CNS2-V.pickle.gz +0 -0
  129. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/ETHK-B5-H.pickle.gz +0 -0
  130. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/ETHK-B5-V.pickle.gz +0 -0
  131. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/ETen-B5-H.pickle.gz +0 -0
  132. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/ETen-B5-V.pickle.gz +0 -0
  133. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/ETenms-B5-H.pickle.gz +0 -0
  134. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/ETenms-B5-V.pickle.gz +0 -0
  135. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/EUC-H.pickle.gz +0 -0
  136. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/EUC-V.pickle.gz +0 -0
  137. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Ext-H.pickle.gz +0 -0
  138. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Ext-RKSJ-H.pickle.gz +0 -0
  139. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Ext-RKSJ-V.pickle.gz +0 -0
  140. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Ext-V.pickle.gz +0 -0
  141. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GB-EUC-H.pickle.gz +0 -0
  142. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GB-EUC-V.pickle.gz +0 -0
  143. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GB-H.pickle.gz +0 -0
  144. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GB-V.pickle.gz +0 -0
  145. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBK-EUC-H.pickle.gz +0 -0
  146. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBK-EUC-V.pickle.gz +0 -0
  147. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBK2K-H.pickle.gz +0 -0
  148. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBK2K-V.pickle.gz +0 -0
  149. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBKp-EUC-H.pickle.gz +0 -0
  150. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBKp-EUC-V.pickle.gz +0 -0
  151. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBT-EUC-H.pickle.gz +0 -0
  152. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBT-EUC-V.pickle.gz +0 -0
  153. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBT-H.pickle.gz +0 -0
  154. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBT-V.pickle.gz +0 -0
  155. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBTpc-EUC-H.pickle.gz +0 -0
  156. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBTpc-EUC-V.pickle.gz +0 -0
  157. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBpc-EUC-H.pickle.gz +0 -0
  158. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/GBpc-EUC-V.pickle.gz +0 -0
  159. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/H.pickle.gz +0 -0
  160. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKdla-B5-H.pickle.gz +0 -0
  161. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKdla-B5-V.pickle.gz +0 -0
  162. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKdlb-B5-H.pickle.gz +0 -0
  163. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKdlb-B5-V.pickle.gz +0 -0
  164. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKgccs-B5-H.pickle.gz +0 -0
  165. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKgccs-B5-V.pickle.gz +0 -0
  166. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKm314-B5-H.pickle.gz +0 -0
  167. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKm314-B5-V.pickle.gz +0 -0
  168. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKm471-B5-H.pickle.gz +0 -0
  169. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKm471-B5-V.pickle.gz +0 -0
  170. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKscs-B5-H.pickle.gz +0 -0
  171. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/HKscs-B5-V.pickle.gz +0 -0
  172. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Hankaku-H.pickle.gz +0 -0
  173. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Hankaku-V.pickle.gz +0 -0
  174. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Hiragana-H.pickle.gz +0 -0
  175. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Hiragana-V.pickle.gz +0 -0
  176. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSC-EUC-H.pickle.gz +0 -0
  177. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSC-EUC-V.pickle.gz +0 -0
  178. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSC-H.pickle.gz +0 -0
  179. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSC-Johab-H.pickle.gz +0 -0
  180. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSC-Johab-V.pickle.gz +0 -0
  181. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSC-V.pickle.gz +0 -0
  182. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSCms-UHC-H.pickle.gz +0 -0
  183. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-H.pickle.gz +0 -0
  184. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSCms-UHC-HW-V.pickle.gz +0 -0
  185. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSCms-UHC-V.pickle.gz +0 -0
  186. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSCpc-EUC-H.pickle.gz +0 -0
  187. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/KSCpc-EUC-V.pickle.gz +0 -0
  188. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Katakana-H.pickle.gz +0 -0
  189. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Katakana-V.pickle.gz +0 -0
  190. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/NWP-H.pickle.gz +0 -0
  191. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/NWP-V.pickle.gz +0 -0
  192. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/README.txt +0 -0
  193. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/RKSJ-H.pickle.gz +0 -0
  194. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/RKSJ-V.pickle.gz +0 -0
  195. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Roman-H.pickle.gz +0 -0
  196. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/Roman-V.pickle.gz +0 -0
  197. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniCNS-UCS2-H.pickle.gz +0 -0
  198. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniCNS-UCS2-V.pickle.gz +0 -0
  199. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniCNS-UTF16-H.pickle.gz +0 -0
  200. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniCNS-UTF16-V.pickle.gz +0 -0
  201. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniCNS-UTF32-H.pickle.gz +0 -0
  202. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniCNS-UTF32-V.pickle.gz +0 -0
  203. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniCNS-UTF8-H.pickle.gz +0 -0
  204. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniCNS-UTF8-V.pickle.gz +0 -0
  205. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniGB-UCS2-H.pickle.gz +0 -0
  206. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniGB-UCS2-V.pickle.gz +0 -0
  207. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniGB-UTF16-H.pickle.gz +0 -0
  208. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniGB-UTF16-V.pickle.gz +0 -0
  209. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniGB-UTF32-H.pickle.gz +0 -0
  210. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniGB-UTF32-V.pickle.gz +0 -0
  211. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniGB-UTF8-H.pickle.gz +0 -0
  212. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniGB-UTF8-V.pickle.gz +0 -0
  213. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UCS2-H.pickle.gz +0 -0
  214. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-H.pickle.gz +0 -0
  215. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UCS2-HW-V.pickle.gz +0 -0
  216. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UCS2-V.pickle.gz +0 -0
  217. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UTF16-H.pickle.gz +0 -0
  218. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UTF16-V.pickle.gz +0 -0
  219. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UTF32-H.pickle.gz +0 -0
  220. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UTF32-V.pickle.gz +0 -0
  221. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UTF8-H.pickle.gz +0 -0
  222. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS-UTF8-V.pickle.gz +0 -0
  223. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-H.pickle.gz +0 -0
  224. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS2004-UTF16-V.pickle.gz +0 -0
  225. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-H.pickle.gz +0 -0
  226. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS2004-UTF32-V.pickle.gz +0 -0
  227. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-H.pickle.gz +0 -0
  228. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJIS2004-UTF8-V.pickle.gz +0 -0
  229. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-H.pickle.gz +0 -0
  230. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJISX0213-UTF32-V.pickle.gz +0 -0
  231. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-H.pickle.gz +0 -0
  232. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniJISX02132004-UTF32-V.pickle.gz +0 -0
  233. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniKS-UCS2-H.pickle.gz +0 -0
  234. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniKS-UCS2-V.pickle.gz +0 -0
  235. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniKS-UTF16-H.pickle.gz +0 -0
  236. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniKS-UTF16-V.pickle.gz +0 -0
  237. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniKS-UTF32-H.pickle.gz +0 -0
  238. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniKS-UTF32-V.pickle.gz +0 -0
  239. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniKS-UTF8-H.pickle.gz +0 -0
  240. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/UniKS-UTF8-V.pickle.gz +0 -0
  241. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/V.pickle.gz +0 -0
  242. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/WP-Symbol-H.pickle.gz +0 -0
  243. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/WP-Symbol-V.pickle.gz +0 -0
  244. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/to-unicode-Adobe-CNS1.pickle.gz +0 -0
  245. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/to-unicode-Adobe-GB1.pickle.gz +0 -0
  246. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Japan1.pickle.gz +0 -0
  247. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmap/to-unicode-Adobe-Korea1.pickle.gz +0 -0
  248. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/cmapdb.py +0 -0
  249. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/converter.py +0 -0
  250. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/data_structures.py +0 -0
  251. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/encodingdb.py +0 -0
  252. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/fontmetrics.py +0 -0
  253. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/glyphlist.py +0 -0
  254. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/high_level.py +0 -0
  255. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/image.py +0 -0
  256. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/jbig2.py +0 -0
  257. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/latin_enc.py +0 -0
  258. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/layout.py +0 -0
  259. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/lzw.py +0 -0
  260. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdfcolor.py +0 -0
  261. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdfdevice.py +0 -0
  262. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdfdocument.py +0 -0
  263. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdfexceptions.py +0 -0
  264. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdffont.py +0 -0
  265. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdfinterp.py +0 -0
  266. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdfpage.py +0 -0
  267. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdfparser.py +0 -0
  268. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/pdftypes.py +0 -0
  269. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/psexceptions.py +0 -0
  270. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/psparser.py +0 -0
  271. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/py.typed +0 -0
  272. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/runlength.py +0 -0
  273. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/settings.py +0 -0
  274. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/pdfminer/utils.py +0 -0
  275. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/progress_monitor.py +0 -0
  276. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/tools/generate_font_metadata.py +0 -0
  277. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/tools/italic_assistance.py +0 -0
  278. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/tools/italic_recognize_tool.py +0 -0
  279. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/translator/__init__.py +0 -0
  280. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/translator/cache.py +0 -0
  281. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/utils/__init__.py +0 -0
  282. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/utils/atomic_integer.py +0 -0
  283. {babeldoc-0.5.14 → babeldoc-0.5.16}/babeldoc/utils/priority_thread_pool_executor.py +0 -0
  284. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/CODE_OF_CONDUCT.md +0 -0
  285. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/CONTRIBUTING.md +0 -0
  286. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/CONTRIBUTOR_REWARD.md +0 -0
  287. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/ImplementationDetails/AsyncTranslate/AsyncTranslate.md +0 -0
  288. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/ImplementationDetails/ILTranslator/ILTranslator.md +0 -0
  289. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/ImplementationDetails/PDFCreation/PDFCreation.md +0 -0
  290. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/ImplementationDetails/PDFParsing/PDFParsing.md +0 -0
  291. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/ImplementationDetails/ParagraphFinding/ParagraphFinding.md +0 -0
  292. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/ImplementationDetails/README.md +0 -0
  293. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/ImplementationDetails/StylesAndFormulas/StylesAndFormulas.md +0 -0
  294. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/ImplementationDetails/Typesetting/Typesetting.md +0 -0
  295. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/README.md +0 -0
  296. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/deploy.sh +0 -0
  297. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/example/demo_glossary.csv +0 -0
  298. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-banner.png +0 -0
  299. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.png +0 -0
  300. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.svg +0 -0
  301. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-big-logo-with-transparent-background.png +0 -0
  302. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-big-logo-with-transparent-background.svg +0 -0
  303. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-big-logo.png +0 -0
  304. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-contributor_reward_example.png +0 -0
  305. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-preview.gif +0 -0
  306. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-small-logo-with-transparent-background.png +0 -0
  307. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-small-logo-with-transparent-background.svg +0 -0
  308. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/images/babeldoc-small-logo.png +0 -0
  309. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/index.md +0 -0
  310. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/intro-to-pdf-object.md +0 -0
  311. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/requirements.txt +0 -0
  312. {babeldoc-0.5.14 → babeldoc-0.5.16}/docs/supported_languages.md +0 -0
  313. {babeldoc-0.5.14 → babeldoc-0.5.16}/mkdocs.yml +0 -0
  314. {babeldoc-0.5.14 → babeldoc-0.5.16}/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.14
3
+ Version: 0.5.16
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.16"
@@ -6,7 +6,7 @@ import subprocess
6
6
  import threading
7
7
  from pathlib import Path
8
8
 
9
- __version__ = "0.5.14"
9
+ __version__ = "0.5.16"
10
10
 
11
11
  CACHE_FOLDER = Path.home() / ".cache" / "babeldoc"
12
12
 
@@ -58,17 +58,6 @@ def encode_image(image) -> bytes:
58
58
  return encoded
59
59
 
60
60
 
61
- @retry(
62
- stop=stop_after_attempt(3), # 最多重试 3 次
63
- wait=wait_exponential(
64
- multiplier=1, min=1, max=10
65
- ), # 指数退避策略,初始 1 秒,最大 10 秒
66
- retry=retry_if_exception_type((httpx.HTTPError, Exception)), # 针对哪些异常重试
67
- before_sleep=lambda retry_state: logger.warning(
68
- f"Request failed, retrying in {getattr(retry_state.next_action, 'sleep', 'unknown')} seconds... "
69
- f"(Attempt {retry_state.attempt_number}/3)"
70
- ),
71
- )
72
61
  def clip_num(num: float, min_value: float, max_value: float) -> float:
73
62
  """Clip a number to a specified range."""
74
63
  if num < min_value:
@@ -78,6 +67,17 @@ def clip_num(num: float, min_value: float, max_value: float) -> float:
78
67
  return num
79
68
 
80
69
 
70
+ @retry(
71
+ stop=stop_after_attempt(5), # 最多重试 3 次
72
+ wait=wait_exponential(
73
+ multiplier=1, min=1, max=10
74
+ ), # 指数退避策略,初始 1 秒,最大 10 秒
75
+ retry=retry_if_exception_type((httpx.HTTPError, Exception)), # 针对哪些异常重试
76
+ before_sleep=lambda retry_state: logger.warning(
77
+ f"Request failed VLM, retrying in {getattr(retry_state.next_action, 'sleep', 'unknown')} seconds... "
78
+ f"(Attempt {retry_state.attempt_number}/5)"
79
+ ),
80
+ )
81
81
  def predict_layout(
82
82
  image,
83
83
  host: str = "http://localhost:8000",
@@ -186,14 +186,14 @@ def predict_layout(
186
186
 
187
187
 
188
188
  @retry(
189
- stop=stop_after_attempt(3), # 最多重试 3 次
189
+ stop=stop_after_attempt(5), # 最多重试 3 次
190
190
  wait=wait_exponential(
191
191
  multiplier=1, min=1, max=10
192
192
  ), # 指数退避策略,初始 1 秒,最大 10 秒
193
193
  retry=retry_if_exception_type((httpx.HTTPError, Exception)), # 针对哪些异常重试
194
194
  before_sleep=lambda retry_state: logger.warning(
195
- f"Request failed, retrying in {getattr(retry_state.next_action, 'sleep', 'unknown')} seconds... "
196
- f"(Attempt {retry_state.attempt_number}/3)"
195
+ f"Request failed PADDLE, retrying in {getattr(retry_state.next_action, 'sleep', 'unknown')} seconds... "
196
+ f"(Attempt {retry_state.attempt_number}/5)"
197
197
  ),
198
198
  )
199
199
  def predict_layout2(
@@ -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=8) as executor:
602
+ with ThreadPoolExecutor(max_workers=32) as executor:
603
603
  yield from executor.map(
604
604
  self.predict_page,
605
605
  pages,
@@ -138,18 +138,24 @@ class AutomaticTermExtractor:
138
138
  except Exception:
139
139
  return 0
140
140
 
141
- def _snapshot_token_usage(self) -> tuple[int, int, int]:
141
+ def _snapshot_token_usage(self) -> tuple[int, int, int, int]:
142
142
  if not self.translate_engine:
143
- return 0, 0, 0
143
+ return 0, 0, 0, 0
144
144
  token_counter = getattr(self.translate_engine, "token_count", None)
145
145
  prompt_counter = getattr(self.translate_engine, "prompt_token_count", None)
146
146
  completion_counter = getattr(
147
147
  self.translate_engine, "completion_token_count", None
148
148
  )
149
+ cache_hit_prompt_counter = getattr(
150
+ self.translate_engine, "cache_hit_prompt_token_count", None
151
+ )
149
152
  total_tokens = token_counter.value if token_counter else 0
150
153
  prompt_tokens = prompt_counter.value if prompt_counter else 0
151
154
  completion_tokens = completion_counter.value if completion_counter else 0
152
- return total_tokens, prompt_tokens, completion_tokens
155
+ cache_hit_prompt_tokens = (
156
+ cache_hit_prompt_counter.value if cache_hit_prompt_counter else 0
157
+ )
158
+ return total_tokens, prompt_tokens, completion_tokens, cache_hit_prompt_tokens
153
159
 
154
160
  def _clean_json_output(self, llm_output: str) -> str:
155
161
  llm_output = llm_output.strip()
@@ -327,7 +333,9 @@ class AutomaticTermExtractor:
327
333
 
328
334
  def procress(self, doc_il: ILDocument):
329
335
  logger.info(f"{self.stage_name}: Starting term extraction for document.")
330
- start_total, start_prompt, start_completion = self._snapshot_token_usage()
336
+ start_total, start_prompt, start_completion, start_cache_hit_prompt = (
337
+ self._snapshot_token_usage()
338
+ )
331
339
  tracker = DocumentTermExtractTracker()
332
340
  total = sum(len(page.pdf_paragraph) for page in doc_il.page)
333
341
  with self.translation_config.progress_monitor.stage_start(
@@ -341,11 +349,14 @@ class AutomaticTermExtractor:
341
349
  self.process_page(page, executor, pbar, tracker.new_page())
342
350
 
343
351
  self.shared_context.finalize_auto_extracted_glossary()
344
- end_total, end_prompt, end_completion = self._snapshot_token_usage()
352
+ end_total, end_prompt, end_completion, end_cache_hit_prompt = (
353
+ self._snapshot_token_usage()
354
+ )
345
355
  self.translation_config.record_term_extraction_usage(
346
356
  end_total - start_total,
347
357
  end_prompt - start_prompt,
348
358
  end_completion - start_completion,
359
+ end_cache_hit_prompt - start_cache_hit_prompt,
349
360
  )
350
361
 
351
362
  if self.translation_config.debug:
@@ -131,6 +131,7 @@ class DetectScannedFile:
131
131
  self.translation_config.shared_context_cross_split_part.auto_enabled_ocr_workaround = True
132
132
  self.translation_config.ocr_workaround = True
133
133
  self.translation_config.skip_scanned_detection = True
134
+ self.translation_config.disable_rich_text_translate = True
134
135
  self.clean_render_order_for_chars(docs)
135
136
  self.translation_config.remove_non_formula_lines = False
136
137
  else:
@@ -890,6 +890,38 @@ class ILTranslator:
890
890
  f"You are a professional and reliable machine translation engine responsible for translating the input text into {self.translation_config.lang_out}."
891
891
  ]
892
892
 
893
+ llm_input.append("When translating, please follow the following rules:")
894
+
895
+ rich_text_left_placeholder = (
896
+ self.translate_engine.get_rich_text_left_placeholder(1)
897
+ )
898
+ if isinstance(rich_text_left_placeholder, tuple):
899
+ rich_text_left_placeholder = rich_text_left_placeholder[0]
900
+ rich_text_right_placeholder = (
901
+ self.translate_engine.get_rich_text_right_placeholder(2)
902
+ )
903
+ if isinstance(rich_text_right_placeholder, tuple):
904
+ rich_text_right_placeholder = rich_text_right_placeholder[0]
905
+
906
+ # Create a structured prompt template for LLM translation
907
+ llm_input.append(
908
+ f'1. Do not translate style tags, such as "{rich_text_left_placeholder}xxx{rich_text_right_placeholder}"!'
909
+ )
910
+
911
+ formula_placeholder = self.translate_engine.get_formular_placeholder(3)
912
+ if isinstance(formula_placeholder, tuple):
913
+ formula_placeholder = formula_placeholder[0]
914
+
915
+ llm_input.append(
916
+ f'2. Do not translate formula placeholders, such as "{formula_placeholder}". The system will automatically replace the placeholders with the corresponding formulas.'
917
+ )
918
+ llm_input.append(
919
+ "3. If there is no need to translate (such as proper nouns, codes, etc.), then return the original text."
920
+ )
921
+ llm_input.append(
922
+ f"4. Only output the translation result in {self.translation_config.lang_out} without explanations and annotations."
923
+ )
924
+
893
925
  llm_context_hints = []
894
926
 
895
927
  if title_paragraph:
@@ -952,41 +984,8 @@ class ILTranslator:
952
984
  for md_block in active_glossary_markdown_blocks:
953
985
  llm_input.append(f"\n{md_block}\n")
954
986
 
955
- llm_input.append("When translating, please follow the following rules:")
956
-
957
- rich_text_left_placeholder = (
958
- self.translate_engine.get_rich_text_left_placeholder(1)
959
- )
960
- if isinstance(rich_text_left_placeholder, tuple):
961
- rich_text_left_placeholder = rich_text_left_placeholder[0]
962
- rich_text_right_placeholder = (
963
- self.translate_engine.get_rich_text_right_placeholder(2)
964
- )
965
- if isinstance(rich_text_right_placeholder, tuple):
966
- rich_text_right_placeholder = rich_text_right_placeholder[0]
967
-
968
- # Create a structured prompt template for LLM translation
969
- llm_input.append(
970
- f'1. Do not translate style tags, such as "{rich_text_left_placeholder}xxx{rich_text_right_placeholder}"!'
971
- )
972
-
973
- formula_placeholder = self.translate_engine.get_formular_placeholder(3)
974
- if isinstance(formula_placeholder, tuple):
975
- formula_placeholder = formula_placeholder[0]
976
-
977
- llm_input.append(
978
- f'2. Do not translate formula placeholders, such as "{formula_placeholder}". The system will automatically replace the placeholders with the corresponding formulas.'
979
- )
980
- llm_input.append(
981
- "3. If there is no need to translate (such as proper nouns, codes, etc.), then return the original text."
982
- )
983
- llm_input.append(
984
- f"4. Only output the translation result in {self.translation_config.lang_out} without explanations and annotations."
985
- )
986
- llm_input.append(f"5. Translate text into {self.translation_config.lang_out}.")
987
987
  prompt_template = f"""
988
988
  Now, please carefully read the following text to be translated and directly output your translation.\n\n{text}
989
-
990
989
  """
991
990
  llm_input.append(prompt_template)
992
991
 
@@ -643,69 +643,6 @@ class ILTranslatorLLMOnly:
643
643
  "When translating, strictly follow the instructions below to ensure translation quality and preserve all formatting, tags, and placeholders:\n"
644
644
  )
645
645
 
646
- # 2. ##Contextual Hints for Better Translation
647
- contextual_hints_section: list[str] = []
648
- hint_idx = 1
649
- if title_paragraph:
650
- contextual_hints_section.append(
651
- f"{hint_idx}. First title in full text: {title_paragraph.unicode}"
652
- )
653
- hint_idx += 1
654
-
655
- if local_title_paragraph:
656
- is_different_from_global = True
657
- if title_paragraph:
658
- if local_title_paragraph.debug_id == title_paragraph.debug_id:
659
- is_different_from_global = False
660
-
661
- if is_different_from_global:
662
- contextual_hints_section.append(
663
- f"{hint_idx}. Most similar section title: {local_title_paragraph.unicode}"
664
- )
665
- hint_idx += 1
666
-
667
- # --- ADD GLOSSARY HINTS ---
668
- batch_text_for_glossary_matching = "\n".join(
669
- item.get("input", "") for item in json_format_input
670
- )
671
-
672
- active_glossary_markdown_blocks: list[str] = []
673
- # Use cached glossaries
674
- if self._cached_glossaries:
675
- for glossary in self._cached_glossaries:
676
- # Get active entries for the current batch_text_for_glossary_matching
677
- active_entries = glossary.get_active_entries_for_text(
678
- batch_text_for_glossary_matching
679
- )
680
-
681
- if active_entries:
682
- current_glossary_md_entries: list[str] = []
683
- for original_source, target_text in sorted(active_entries):
684
- current_glossary_md_entries.append(
685
- f"| {original_source} | {target_text} |"
686
- )
687
-
688
- if current_glossary_md_entries:
689
- glossary_table_md = (
690
- f"### Glossary: {glossary.name}\n\n"
691
- "| Source Term | Target Term |\n"
692
- "|-------------|-------------|\n"
693
- + "\n".join(current_glossary_md_entries)
694
- )
695
- active_glossary_markdown_blocks.append(glossary_table_md)
696
-
697
- if contextual_hints_section or active_glossary_markdown_blocks:
698
- llm_prompt_parts.append("\n## Contextual Hints for Better Translation")
699
- llm_prompt_parts.extend(contextual_hints_section)
700
-
701
- if active_glossary_markdown_blocks:
702
- llm_prompt_parts.append(
703
- f"{hint_idx}. You MUST strictly adhere to the following glossaries. auto_extracted_glossary has a lower priority; please give preference to other glossaries. If a source term from a table appears in the text, use the corresponding target term in your translation:"
704
- )
705
- # hint_idx += 1 # No need to increment if tables are part of this point
706
- for md_block in active_glossary_markdown_blocks:
707
- llm_prompt_parts.append(f"\n{md_block}\n")
708
-
709
646
  # 3. ## Strict Rules:
710
647
  llm_prompt_parts.append("\n## Strict Rules:")
711
648
  llm_prompt_parts.append(
@@ -771,6 +708,69 @@ class ILTranslatorLLMOnly:
771
708
  llm_prompt_parts.append("```")
772
709
  llm_prompt_parts.append("</example>")
773
710
 
711
+ # 2. ##Contextual Hints for Better Translation
712
+ contextual_hints_section: list[str] = []
713
+ hint_idx = 1
714
+ if title_paragraph:
715
+ contextual_hints_section.append(
716
+ f"{hint_idx}. First title in full text: {title_paragraph.unicode}"
717
+ )
718
+ hint_idx += 1
719
+
720
+ if local_title_paragraph:
721
+ is_different_from_global = True
722
+ if title_paragraph:
723
+ if local_title_paragraph.debug_id == title_paragraph.debug_id:
724
+ is_different_from_global = False
725
+
726
+ if is_different_from_global:
727
+ contextual_hints_section.append(
728
+ f"{hint_idx}. The most recent title is: {local_title_paragraph.unicode}"
729
+ )
730
+ hint_idx += 1
731
+
732
+ # --- ADD GLOSSARY HINTS ---
733
+ batch_text_for_glossary_matching = "\n".join(
734
+ item.get("input", "") for item in json_format_input
735
+ )
736
+
737
+ active_glossary_markdown_blocks: list[str] = []
738
+ # Use cached glossaries
739
+ if self._cached_glossaries:
740
+ for glossary in self._cached_glossaries:
741
+ # Get active entries for the current batch_text_for_glossary_matching
742
+ active_entries = glossary.get_active_entries_for_text(
743
+ batch_text_for_glossary_matching
744
+ )
745
+
746
+ if active_entries:
747
+ current_glossary_md_entries: list[str] = []
748
+ for original_source, target_text in sorted(active_entries):
749
+ current_glossary_md_entries.append(
750
+ f"| {original_source} | {target_text} |"
751
+ )
752
+
753
+ if current_glossary_md_entries:
754
+ glossary_table_md = (
755
+ f"### Glossary: {glossary.name}\n\n"
756
+ "| Source Term | Target Term |\n"
757
+ "|-------------|-------------|\n"
758
+ + "\n".join(current_glossary_md_entries)
759
+ )
760
+ active_glossary_markdown_blocks.append(glossary_table_md)
761
+
762
+ if contextual_hints_section or active_glossary_markdown_blocks:
763
+ llm_prompt_parts.append("\n## Contextual Hints for Better Translation")
764
+ llm_prompt_parts.extend(contextual_hints_section)
765
+
766
+ if active_glossary_markdown_blocks:
767
+ llm_prompt_parts.append(
768
+ f"{hint_idx}. You MUST strictly adhere to the following glossaries. please give preference to other glossaries. If a source term from a table appears in the text, use the corresponding target term in your translation:"
769
+ )
770
+ # hint_idx += 1 # No need to increment if tables are part of this point
771
+ for md_block in active_glossary_markdown_blocks:
772
+ llm_prompt_parts.append(f"\n{md_block}\n")
773
+
774
774
  # 6. ## Here is the input:
775
775
  llm_prompt_parts.append("\n## Here is the input:")
776
776
 
@@ -62,6 +62,7 @@ from babeldoc.pdfminer.pdfinterp import PDFResourceManager
62
62
  from babeldoc.pdfminer.pdfpage import PDFPage
63
63
  from babeldoc.pdfminer.pdfparser import PDFParser
64
64
  from babeldoc.progress_monitor import ProgressMonitor
65
+ from babeldoc.utils import memory
65
66
 
66
67
  logger = logging.getLogger(__name__)
67
68
 
@@ -455,20 +456,10 @@ class MemoryMonitor:
455
456
  self.peak_memory_usage = 0
456
457
  self.monitor_thread = None
457
458
  self.stop_event = None
458
-
459
- try:
460
- import psutil
461
-
462
- self.psutil = psutil
463
- except ImportError:
464
- logger.warning("psutil not installed, memory monitoring disabled")
465
- self.psutil = None
459
+ self.last_pss_check_time = None
466
460
 
467
461
  def __enter__(self):
468
462
  """Start memory monitoring."""
469
- if not self.psutil:
470
- return self
471
-
472
463
  self.stop_event = threading.Event()
473
464
  self.monitor_thread = threading.Thread(
474
465
  target=self._monitor_memory_usage, daemon=True
@@ -479,7 +470,7 @@ class MemoryMonitor:
479
470
 
480
471
  def __exit__(self, exc_type, exc_val, exc_tb):
481
472
  """Stop monitoring and log peak memory usage."""
482
- if not self.psutil or not self.monitor_thread:
473
+ if not self.monitor_thread:
483
474
  return
484
475
 
485
476
  self.stop_event.set()
@@ -490,14 +481,15 @@ class MemoryMonitor:
490
481
  """Background thread that periodically checks memory usage."""
491
482
  while not self.stop_event.is_set():
492
483
  try:
493
- current_process = self.psutil.Process()
494
- # Get memory usage of current process and all children
495
- total_memory = current_process.memory_info().rss
496
- for child in current_process.children(recursive=True):
497
- try:
498
- total_memory += child.memory_info().rss
499
- except (self.psutil.NoSuchProcess, self.psutil.AccessDenied):
500
- pass
484
+ # Use throttled memory check with 2-second PSS throttle
485
+ total_memory, self.last_pss_check_time = (
486
+ memory.get_memory_usage_with_throttle(
487
+ include_children=True,
488
+ prefer_pss=True,
489
+ last_pss_check_time=self.last_pss_check_time,
490
+ pss_throttle_seconds=2.0,
491
+ )
492
+ )
501
493
 
502
494
  # Convert to MB for better readability
503
495
  total_memory_mb = total_memory / (1024 * 1024)
@@ -508,6 +500,10 @@ class MemoryMonitor:
508
500
 
509
501
  time.sleep(self.interval)
510
502
 
503
+ def get_peek_memory_psutil(self):
504
+ """Get peak memory usage using psutil (for backwards compatibility)."""
505
+ return memory.get_memory_usage_bytes(include_children=True, prefer_pss=True)
506
+
511
507
 
512
508
  def fix_null_page_content(doc: Document) -> list[int]:
513
509
  invalid_page = []
@@ -227,6 +227,7 @@ class TranslationConfig:
227
227
 
228
228
  if self.ocr_workaround:
229
229
  self.skip_scanned_detection = True
230
+ self.disable_rich_text_translate = True
230
231
 
231
232
  # for backward compatibility
232
233
  if use_side_by_side_dual is False and use_alternating_pages_dual is False:
@@ -321,6 +322,7 @@ class TranslationConfig:
321
322
  "total_tokens": 0,
322
323
  "prompt_tokens": 0,
323
324
  "completion_tokens": 0,
325
+ "cache_hit_prompt_tokens": 0,
324
326
  }
325
327
 
326
328
  if self.ocr_workaround:
@@ -437,6 +439,7 @@ class TranslationConfig:
437
439
  total_tokens: int,
438
440
  prompt_tokens: int,
439
441
  completion_tokens: int,
442
+ cache_hit_prompt_tokens: int,
440
443
  ) -> None:
441
444
  """Accumulate token usage for automatic term extraction."""
442
445
  if total_tokens > 0:
@@ -445,6 +448,10 @@ class TranslationConfig:
445
448
  self.term_extraction_token_usage["prompt_tokens"] += prompt_tokens
446
449
  if completion_tokens > 0:
447
450
  self.term_extraction_token_usage["completion_tokens"] += completion_tokens
451
+ if cache_hit_prompt_tokens > 0:
452
+ self.term_extraction_token_usage["cache_hit_prompt_tokens"] += (
453
+ cache_hit_prompt_tokens
454
+ )
448
455
 
449
456
 
450
457
  class TranslateResult:
@@ -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.14"
29
+ __version__ = "0.5.16"
30
30
 
31
31
 
32
32
  def create_parser():
@@ -636,6 +636,7 @@ async def main():
636
636
  total_term_extraction_total_tokens = 0
637
637
  total_term_extraction_prompt_tokens = 0
638
638
  total_term_extraction_completion_tokens = 0
639
+ total_term_extraction_cache_hit_prompt_tokens = 0
639
640
 
640
641
  for file in pending_files:
641
642
  # 清理文件路径,去除两端的引号
@@ -721,21 +722,29 @@ async def main():
721
722
  total_term_extraction_total_tokens += usage["total_tokens"]
722
723
  total_term_extraction_prompt_tokens += usage["prompt_tokens"]
723
724
  total_term_extraction_completion_tokens += usage["completion_tokens"]
725
+ total_term_extraction_cache_hit_prompt_tokens += usage[
726
+ "cache_hit_prompt_tokens"
727
+ ]
724
728
  logger.info(f"Total tokens: {translator.token_count.value}")
725
729
  logger.info(f"Prompt tokens: {translator.prompt_token_count.value}")
726
730
  logger.info(f"Completion tokens: {translator.completion_token_count.value}")
727
731
  logger.info(
728
- "Term extraction tokens: total=%s prompt=%s completion=%s",
732
+ f"Cache hit prompt tokens: {translator.cache_hit_prompt_token_count.value}"
733
+ )
734
+ logger.info(
735
+ "Term extraction tokens: total=%s prompt=%s completion=%s cache_hit_prompt=%s",
729
736
  total_term_extraction_total_tokens,
730
737
  total_term_extraction_prompt_tokens,
731
738
  total_term_extraction_completion_tokens,
739
+ total_term_extraction_cache_hit_prompt_tokens,
732
740
  )
733
741
  if term_extraction_translator is not translator:
734
742
  logger.info(
735
- "Term extraction translator raw tokens: total=%s prompt=%s completion=%s",
743
+ "Term extraction translator raw tokens: total=%s prompt=%s completion=%s cache_hit_prompt=%s",
736
744
  term_extraction_translator.token_count.value,
737
745
  term_extraction_translator.prompt_token_count.value,
738
746
  term_extraction_translator.completion_token_count.value,
747
+ term_extraction_translator.cache_hit_prompt_token_count.value,
739
748
  )
740
749
 
741
750
 
@@ -249,6 +249,7 @@ class OpenAITranslator(BaseTranslator):
249
249
  self.token_count = AtomicInteger()
250
250
  self.prompt_token_count = AtomicInteger()
251
251
  self.completion_token_count = AtomicInteger()
252
+ self.cache_hit_prompt_token_count = AtomicInteger()
252
253
 
253
254
  @retry(
254
255
  retry=retry_if_exception_type(openai.RateLimitError),
@@ -338,6 +339,10 @@ class OpenAITranslator(BaseTranslator):
338
339
  self.prompt_token_count.inc(response.usage.prompt_tokens)
339
340
  if response.usage and response.usage.completion_tokens:
340
341
  self.completion_token_count.inc(response.usage.completion_tokens)
342
+ if response.usage and (
343
+ hit_count := getattr(response.usage, "prompt_cache_hit_tokens", 0)
344
+ ):
345
+ self.cache_hit_prompt_token_count.inc(hit_count)
341
346
  except Exception as e:
342
347
  logger.exception("Error updating token count")
343
348