yomitoku 0.9.2__tar.gz → 0.9.4__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 (183) hide show
  1. {yomitoku-0.9.2 → yomitoku-0.9.4}/PKG-INFO +2 -3
  2. {yomitoku-0.9.2 → yomitoku-0.9.4}/README.md +1 -2
  3. {yomitoku-0.9.2 → yomitoku-0.9.4}/README_EN.md +1 -2
  4. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/cli.en.md +4 -10
  5. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/cli.ja.md +4 -9
  6. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/cli/main.py +41 -15
  7. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/constants.py +1 -1
  8. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/export/export_csv.py +17 -0
  9. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/utils/searchable_pdf.py +6 -5
  10. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/test_cli.py +25 -0
  11. {yomitoku-0.9.2 → yomitoku-0.9.4}/.github/FUNDING.yml +0 -0
  12. {yomitoku-0.9.2 → yomitoku-0.9.4}/.github/release-drafter.yml +0 -0
  13. {yomitoku-0.9.2 → yomitoku-0.9.4}/.github/workflows/build-and-publish-docs.yaml +0 -0
  14. {yomitoku-0.9.2 → yomitoku-0.9.4}/.github/workflows/build-and-publish.yml +0 -0
  15. {yomitoku-0.9.2 → yomitoku-0.9.4}/.github/workflows/create-release.yml +0 -0
  16. {yomitoku-0.9.2 → yomitoku-0.9.4}/.github/workflows/lint-and-test.yml +0 -0
  17. {yomitoku-0.9.2 → yomitoku-0.9.4}/.gitignore +0 -0
  18. {yomitoku-0.9.2 → yomitoku-0.9.4}/.pre-commit-config.yaml +0 -0
  19. {yomitoku-0.9.2 → yomitoku-0.9.4}/.python-version +0 -0
  20. {yomitoku-0.9.2 → yomitoku-0.9.4}/configs/yomitoku-layout-parser-rtdtrv2-open-beta.yaml +0 -0
  21. {yomitoku-0.9.2 → yomitoku-0.9.4}/configs/yomitoku-table-structure-recognizer-rtdtrv2-open-beta.yaml +0 -0
  22. {yomitoku-0.9.2 → yomitoku-0.9.4}/configs/yomitoku-text-detector-dbnet-open-beta.yaml +0 -0
  23. {yomitoku-0.9.2 → yomitoku-0.9.4}/configs/yomitoku-text-recognizer-parseq-open-beta.yaml +0 -0
  24. {yomitoku-0.9.2 → yomitoku-0.9.4}/configs/yomitoku-text-recognizer-parseq-small-open-beta.yaml +0 -0
  25. {yomitoku-0.9.2 → yomitoku-0.9.4}/demo/sample.pdf +0 -0
  26. {yomitoku-0.9.2 → yomitoku-0.9.4}/demo/setting_document_anaysis.py +0 -0
  27. {yomitoku-0.9.2 → yomitoku-0.9.4}/demo/simple_document_analysis.py +0 -0
  28. {yomitoku-0.9.2 → yomitoku-0.9.4}/demo/simple_layout.py +0 -0
  29. {yomitoku-0.9.2 → yomitoku-0.9.4}/demo/simple_ocr.py +0 -0
  30. {yomitoku-0.9.2 → yomitoku-0.9.4}/demo/text_detector.yaml +0 -0
  31. {yomitoku-0.9.2 → yomitoku-0.9.4}/dockerfile +0 -0
  32. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/assets/logo.svg +0 -0
  33. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/configuration.en.md +0 -0
  34. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/configuration.ja.md +0 -0
  35. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/index.en.md +0 -0
  36. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/index.ja.md +0 -0
  37. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/installation.en.md +0 -0
  38. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/installation.ja.md +0 -0
  39. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/mcp.en.md +0 -0
  40. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/mcp.ja.md +0 -0
  41. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/module.en.md +0 -0
  42. {yomitoku-0.9.2 → yomitoku-0.9.4}/docs/module.ja.md +0 -0
  43. {yomitoku-0.9.2 → yomitoku-0.9.4}/gallery.md +0 -0
  44. {yomitoku-0.9.2 → yomitoku-0.9.4}/mkdocs.yml +0 -0
  45. {yomitoku-0.9.2 → yomitoku-0.9.4}/pyproject.toml +0 -0
  46. {yomitoku-0.9.2 → yomitoku-0.9.4}/pytest.ini +0 -0
  47. {yomitoku-0.9.2 → yomitoku-0.9.4}/scripts/register_hugging_face_hub.py +0 -0
  48. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/__init__.py +0 -0
  49. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/base.py +0 -0
  50. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/cli/__init__.py +0 -0
  51. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/cli/mcp_server.py +0 -0
  52. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/__init__.py +0 -0
  53. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/cfg_layout_parser_rtdtrv2.py +0 -0
  54. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/cfg_layout_parser_rtdtrv2_v2.py +0 -0
  55. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/cfg_table_structure_recognizer_rtdtrv2.py +0 -0
  56. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/cfg_text_detector_dbnet.py +0 -0
  57. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/cfg_text_detector_dbnet_v2.py +0 -0
  58. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/cfg_text_recognizer_parseq.py +0 -0
  59. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/cfg_text_recognizer_parseq_small.py +0 -0
  60. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/configs/cfg_text_recognizer_parseq_v2.py +0 -0
  61. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/data/__init__.py +0 -0
  62. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/data/dataset.py +0 -0
  63. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/data/functions.py +0 -0
  64. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/document_analyzer.py +0 -0
  65. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/export/__init__.py +0 -0
  66. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/export/export_html.py +0 -0
  67. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/export/export_json.py +0 -0
  68. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/export/export_markdown.py +0 -0
  69. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/layout_analyzer.py +0 -0
  70. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/layout_parser.py +0 -0
  71. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/__init__.py +0 -0
  72. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/dbnet_plus.py +0 -0
  73. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/layers/__init__.py +0 -0
  74. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/layers/activate.py +0 -0
  75. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/layers/dbnet_feature_attention.py +0 -0
  76. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/layers/parseq_transformer.py +0 -0
  77. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/layers/rtdetr_backbone.py +0 -0
  78. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/layers/rtdetr_hybrid_encoder.py +0 -0
  79. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/layers/rtdetrv2_decoder.py +0 -0
  80. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/parseq.py +0 -0
  81. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/models/rtdetr.py +0 -0
  82. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/ocr.py +0 -0
  83. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/onnx/.gitkeep +0 -0
  84. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/postprocessor/__init__.py +0 -0
  85. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/postprocessor/dbnet_postporcessor.py +0 -0
  86. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/postprocessor/parseq_tokenizer.py +0 -0
  87. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/postprocessor/rtdetr_postprocessor.py +0 -0
  88. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/reading_order.py +0 -0
  89. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/resource/MPLUS1p-Medium.ttf +0 -0
  90. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/resource/charset.txt +0 -0
  91. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/table_structure_recognizer.py +0 -0
  92. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/text_detector.py +0 -0
  93. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/text_recognizer.py +0 -0
  94. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/utils/__init__.py +0 -0
  95. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/utils/graph.py +0 -0
  96. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/utils/logger.py +0 -0
  97. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/utils/misc.py +0 -0
  98. {yomitoku-0.9.2 → yomitoku-0.9.4}/src/yomitoku/utils/visualizer.py +0 -0
  99. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/in/demo.jpg +0 -0
  100. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/in/gallery1.jpg +0 -0
  101. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/in/gallery2.jpg +0 -0
  102. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/in/gallery3.jpg +0 -0
  103. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/in/gallery4.jpg +0 -0
  104. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/in/gallery5.jpg +0 -0
  105. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/in/gallery6.jpg +0 -0
  106. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/in/gallery7.jpeg +0 -0
  107. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/logo/horizontal.png +0 -0
  108. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/demo_html.png +0 -0
  109. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_demo_p1_figure_0.png +0 -0
  110. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_0.png +0 -0
  111. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_1.png +0 -0
  112. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_10.png +0 -0
  113. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_2.png +0 -0
  114. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_3.png +0 -0
  115. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_4.png +0 -0
  116. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_5.png +0 -0
  117. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_6.png +0 -0
  118. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_7.png +0 -0
  119. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_8.png +0 -0
  120. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery1_p1_figure_9.png +0 -0
  121. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery3_p1_figure_0.png +0 -0
  122. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery3_p1_figure_1.png +0 -0
  123. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery5_p1_figure_0.png +0 -0
  124. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery5_p1_figure_1.png +0 -0
  125. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery6_p1_figure_0.png +0 -0
  126. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery6_p1_figure_1.png +0 -0
  127. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/figures/in_gallery7_p1_figure_0.png +0 -0
  128. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_demo_p1.html +0 -0
  129. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_demo_p1.md +0 -0
  130. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_demo_p1_layout.jpg +0 -0
  131. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_demo_p1_ocr.jpg +0 -0
  132. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery1_p1.html +0 -0
  133. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery1_p1.md +0 -0
  134. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery1_p1_layout.jpg +0 -0
  135. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery1_p1_ocr.jpg +0 -0
  136. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery2_p1.html +0 -0
  137. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery2_p1.md +0 -0
  138. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery2_p1_layout.jpg +0 -0
  139. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery2_p1_ocr.jpg +0 -0
  140. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery3_p1.html +0 -0
  141. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery3_p1.md +0 -0
  142. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery3_p1_layout.jpg +0 -0
  143. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery3_p1_ocr.jpg +0 -0
  144. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery4_p1.html +0 -0
  145. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery4_p1.md +0 -0
  146. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery4_p1_layout.jpg +0 -0
  147. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery4_p1_ocr.jpg +0 -0
  148. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery5_p1.html +0 -0
  149. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery5_p1.md +0 -0
  150. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery5_p1_layout.jpg +0 -0
  151. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery5_p1_ocr.jpg +0 -0
  152. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery6_p1.html +0 -0
  153. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery6_p1.md +0 -0
  154. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery6_p1_layout.jpg +0 -0
  155. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery6_p1_ocr.jpg +0 -0
  156. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery7_p1.html +0 -0
  157. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery7_p1.md +0 -0
  158. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery7_p1_layout.jpg +0 -0
  159. {yomitoku-0.9.2 → yomitoku-0.9.4}/static/out/in_gallery7_p1_ocr.jpg +0 -0
  160. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/invalid.jpg +0 -0
  161. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/invalid.pdf +0 -0
  162. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/rgba.png +0 -0
  163. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/sampldoc.tif +0 -0
  164. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/small.jpg +0 -0
  165. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/subdir/test.jpg +0 -0
  166. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/test.bmp +0 -0
  167. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/test.jpg +0 -0
  168. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/test.pdf +0 -0
  169. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/test.png +0 -0
  170. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/test.tiff +0 -0
  171. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/test.txt +0 -0
  172. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/data/test_gray.jpg +0 -0
  173. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/test_base.py +0 -0
  174. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/test_data.py +0 -0
  175. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/test_document_analyzer.py +0 -0
  176. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/test_export.py +0 -0
  177. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/test_layout_analyzer.py +0 -0
  178. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/test_ocr.py +0 -0
  179. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/yaml/layout_parser.yaml +0 -0
  180. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/yaml/table_structure_recognizer.yaml +0 -0
  181. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/yaml/text_detector.yaml +0 -0
  182. {yomitoku-0.9.2 → yomitoku-0.9.4}/tests/yaml/text_recognizer.yaml +0 -0
  183. {yomitoku-0.9.2 → yomitoku-0.9.4}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yomitoku
3
- Version: 0.9.2
3
+ Version: 0.9.4
4
4
  Summary: Yomitoku is an AI-powered document image analysis package designed specifically for the Japanese language.
5
5
  Author-email: Kotaro Kinoshita <kotaro.kinoshita@mlism.com>
6
6
  License: CC BY-NC-SA 4.0
@@ -87,7 +87,7 @@ yomitoku ${path_data} -f md -o results -v --figure --lite
87
87
  ```
88
88
 
89
89
  - `${path_data}` 解析対象の画像が含まれたディレクトリか画像ファイルのパスを直接して指定してください。ディレクトリを対象とした場合はディレクトリのサブディレクトリ内の画像も含めて処理を実行します。
90
- - `-f`, `--format` 出力形式のファイルフォーマットを指定します。(json, csv, html, md をサポート)
90
+ - `-f`, `--format` 出力形式のファイルフォーマットを指定します。(json, csv, html, md, pdf(searchable-pdf) をサポート)
91
91
  - `-o`, `--outdir` 出力先のディレクトリ名を指定します。存在しない場合は新規で作成されます。
92
92
  - `-v`, `--vis` を指定すると解析結果を可視化した画像を出力します。
93
93
  - `-l`, `--lite` を指定すると軽量モデルで推論を実行します。通常より高速に推論できますが、若干、精度が低下する可能性があります。
@@ -98,7 +98,6 @@ yomitoku ${path_data} -f md -o results -v --figure --lite
98
98
  - `--encoding` エクスポートする出力ファイルの文字エンコーディングを指定します。サポートされていない文字コードが含まれる場合は、その文字を無視します。(utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
99
99
  - `--combine` PDFを入力に与えたときに、複数ページが含まれる場合に、それらの予測結果を一つのファイルに統合してエクスポートします。
100
100
  - `--ignore_meta` 文章のheater, fotterなどの文字情報を出力ファイルに含めません。
101
- - `--searchable_pdf` 読み取った文字情報をPDFに埋め込み全文検索可能なPDFを出力します。
102
101
 
103
102
  その他のオプションに関しては、ヘルプを参照
104
103
 
@@ -60,7 +60,7 @@ yomitoku ${path_data} -f md -o results -v --figure --lite
60
60
  ```
61
61
 
62
62
  - `${path_data}` 解析対象の画像が含まれたディレクトリか画像ファイルのパスを直接して指定してください。ディレクトリを対象とした場合はディレクトリのサブディレクトリ内の画像も含めて処理を実行します。
63
- - `-f`, `--format` 出力形式のファイルフォーマットを指定します。(json, csv, html, md をサポート)
63
+ - `-f`, `--format` 出力形式のファイルフォーマットを指定します。(json, csv, html, md, pdf(searchable-pdf) をサポート)
64
64
  - `-o`, `--outdir` 出力先のディレクトリ名を指定します。存在しない場合は新規で作成されます。
65
65
  - `-v`, `--vis` を指定すると解析結果を可視化した画像を出力します。
66
66
  - `-l`, `--lite` を指定すると軽量モデルで推論を実行します。通常より高速に推論できますが、若干、精度が低下する可能性があります。
@@ -71,7 +71,6 @@ yomitoku ${path_data} -f md -o results -v --figure --lite
71
71
  - `--encoding` エクスポートする出力ファイルの文字エンコーディングを指定します。サポートされていない文字コードが含まれる場合は、その文字を無視します。(utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
72
72
  - `--combine` PDFを入力に与えたときに、複数ページが含まれる場合に、それらの予測結果を一つのファイルに統合してエクスポートします。
73
73
  - `--ignore_meta` 文章のheater, fotterなどの文字情報を出力ファイルに含めません。
74
- - `--searchable_pdf` 読み取った文字情報をPDFに埋め込み全文検索可能なPDFを出力します。
75
74
 
76
75
  その他のオプションに関しては、ヘルプを参照
77
76
 
@@ -59,7 +59,7 @@ yomitoku ${path_data} -f md -o results -v --figure --lite
59
59
  ```
60
60
 
61
61
  - `${path_data}`: Specify the path to a directory containing images to be analyzed or directly provide the path to an image file. If a directory is specified, images in its subdirectories will also be processed.
62
- - `-f`, `--format`: Specify the output file format. Supported formats are json, csv, html, and md.
62
+ - `-f`, `--format`: Specify the output file format. Supported formats are json, csv, html, md , and pdf(searchable-pdf).
63
63
  - `-o`, `--outdir`: Specify the name of the output directory. If it does not exist, it will be created.
64
64
  - `-v`, `--vis`: If specified, outputs visualized images of the analysis results.
65
65
  - `-l`, `--lite`: inference is performed using a lightweight model. This enables fast inference even on a CPU.
@@ -70,7 +70,6 @@ yomitoku ${path_data} -f md -o results -v --figure --lite
70
70
  - `--encoding` Specifies the character encoding for the output file to be exported. If unsupported characters are included, they will be ignored. (utf-8, utf-8-sig, shift-jis, enc-jp, cp932)
71
71
  - `--combine` When a PDF is provided as input and contains multiple pages, this option combines their prediction results into a single file for export.
72
72
  - `--ignore_meta` Excludes text information such as headers and footers from the output file.
73
- - `--searchable_pdf` Embeds the recognized text into the PDF and outputs a fully searchable PDF.
74
73
 
75
74
  For other options, please refer to the help documentation.
76
75
 
@@ -7,7 +7,7 @@ yomitoku ${path_data} -v -o results
7
7
  ```
8
8
 
9
9
  - `${path_data}`: Specify the path to a directory containing images to be analyzed or directly provide the path to an image file. If a directory is specified, images in its subdirectories will also be processed.
10
- - `-f`, `--format`: Specify the output file format. Supported formats are json, csv, html, and md.
10
+ - `-f`, `--format`: Specify the output file format. Supported formats are json, csv, html, md , and pdf(searchable-pdf).
11
11
  - `-o`, `--outdir`: Specify the name of the output directory. If it does not exist, it will be created.
12
12
  - `-v`, `--vis`: If specified, outputs visualized images of the analysis results.
13
13
 
@@ -41,6 +41,8 @@ You can specify the output format of the analysis results using the --format or
41
41
  yomitoku ${path_data} -f md
42
42
  ```
43
43
 
44
+ - `pdf`: Detect the text in the image and embed it into the PDF as invisible text, converting the file into a searchable PDF.
45
+
44
46
  ## Specifying the Output Device
45
47
 
46
48
  You can specify the device for running the model using the -d or --device option. Supported options are cuda, cpu, and mps. If a GPU is not available, inference will be performed on the CPU. (Default: cuda)
@@ -121,12 +123,4 @@ yomitoku ${path_data} --reading_order left2right
121
123
 
122
124
  * `left2right`: Prioritizes reading from left to right. Suitable for layouts like receipts or health insurance cards, where key-value text pairs are arranged in columns.
123
125
 
124
- * `right2left`: Prioritizes reading from right to left. Effective for vertically written documents.
125
-
126
- ## Create a searchable PDF
127
-
128
- Detect the text in the image and embed it into the PDF as invisible text, converting the file into a searchable PDF.
129
-
130
- ```
131
- yomitoku ${path_data} --searchable_pdf
132
- ```
126
+ * `right2left`: Prioritizes reading from right to left. Effective for vertically written documents.
@@ -31,12 +31,14 @@ yomitoku ${path_data} --lite -v
31
31
 
32
32
  ## 出力フォーマットの指定
33
33
 
34
- `--format`, `-f` オプションを使用することで解析結果の出力形式のフォーマットを指定できます。出力フォーマットの種類は json, csv, html, md(markdown)をサポートしています。
34
+ - `-f`, `--format` 出力形式のファイルフォーマットを指定します。(json, csv, html, md, pdf(searchable-pdf) をサポート)
35
35
 
36
36
  ```
37
37
  yomitoku ${path_data} -f md
38
38
  ```
39
39
 
40
+ - pdf: 画像内の文字情報を認識し、文字情報を透明テキストとして、PDFに埋め込むことで、サーチャブルPDFに変換します。
41
+
40
42
  ## 出力デバイスの指定
41
43
 
42
44
  - `-d`, `--device` オプションを使用することで、モデルを実行するためのデバイスを指定します。(cuda | cpu | mps)。gpu が利用できない場合は cpu で推論が実行されます。(デフォルト: cuda)
@@ -117,11 +119,4 @@ yomitoku ${path_data} --reading_order left2right
117
119
 
118
120
  - `left2right`: 左から右方向に優先的に読み取り順を推定します。レシートや保険証などキーに対して、値を示すテキストが段組みになっているようなレイアウトに有効です。
119
121
 
120
- - `right2left:` 右から左方向に優先的に読み取り順を推定します。縦書きのドキュメントに対して有効です。
121
-
122
- ## 検索可能なPDFを作成する
123
- 画像内の文字情報を認識し、文字情報を透明テキストとして、PDFに埋め込むことで、サーチャブルPDFに変換します。
124
-
125
- ```
126
- yomitoku ${path_data} --searchable_pdf
127
- ```
122
+ - `right2left:` 右から左方向に優先的に読み取り順を推定します。縦書きのドキュメントに対して有効です。
@@ -49,10 +49,15 @@ def merge_all_pages(results):
49
49
  else:
50
50
  out += "\n" + data
51
51
 
52
+ elif format == "pdf":
53
+ if out is None:
54
+ out = [data]
55
+ else:
56
+ out.append(data)
52
57
  return out
53
58
 
54
59
 
55
- def save_merged_file(out_path, args, out):
60
+ def save_merged_file(out_path, args, out, imgs):
56
61
  if args.format == "json":
57
62
  save_json(out, out_path, args.encoding)
58
63
  elif args.format == "csv":
@@ -61,6 +66,13 @@ def save_merged_file(out_path, args, out):
61
66
  save_html(out, out_path, args.encoding)
62
67
  elif args.format == "md":
63
68
  save_markdown(out, out_path, args.encoding)
69
+ elif args.format == "pdf":
70
+ create_searchable_pdf(
71
+ imgs,
72
+ out,
73
+ output_path=out_path,
74
+ font_path=args.font_path,
75
+ )
64
76
 
65
77
 
66
78
  def validate_encoding(encoding):
@@ -82,12 +94,10 @@ def process_single_file(args, analyzer, path, format):
82
94
  imgs = load_image(path)
83
95
 
84
96
  format_results = []
85
- results = []
86
97
  for page, img in enumerate(imgs):
87
98
  result, ocr, layout = analyzer(img)
88
99
  dirname = path.parent.name
89
100
  filename = path.stem
90
- results.append(result)
91
101
 
92
102
  # cv2.imwrite(
93
103
  # os.path.join(args.outdir, f"{dirname}_{filename}_p{page+1}.jpg"), img
@@ -148,6 +158,7 @@ def process_single_file(args, analyzer, path, format):
148
158
  args.ignore_line_break,
149
159
  img,
150
160
  args.figure,
161
+ args.figure_letter,
151
162
  args.figure_dir,
152
163
  )
153
164
  else:
@@ -157,6 +168,7 @@ def process_single_file(args, analyzer, path, format):
157
168
  encoding=args.encoding,
158
169
  img=img,
159
170
  export_figure=args.figure,
171
+ export_figure_letter=args.figure_letter,
160
172
  figure_dir=args.figure_dir,
161
173
  )
162
174
 
@@ -228,6 +240,21 @@ def process_single_file(args, analyzer, path, format):
228
240
  "data": md,
229
241
  }
230
242
  )
243
+ elif format == "pdf":
244
+ if not args.combine:
245
+ create_searchable_pdf(
246
+ [img],
247
+ [result],
248
+ output_path=out_path,
249
+ font_path=args.font_path,
250
+ )
251
+
252
+ format_results.append(
253
+ {
254
+ "format": format,
255
+ "data": result,
256
+ }
257
+ )
231
258
 
232
259
  out = merge_all_pages(format_results)
233
260
  if args.combine:
@@ -236,16 +263,8 @@ def process_single_file(args, analyzer, path, format):
236
263
  out_path,
237
264
  args,
238
265
  out,
239
- )
240
-
241
- if args.searchable_pdf:
242
- pdf_path = os.path.join(args.outdir, f"{filename}.pdf")
243
- create_searchable_pdf(
244
266
  imgs,
245
- results,
246
- output_path=pdf_path,
247
267
  )
248
- logger.info(f"Output SearchablePDF: {pdf_path}")
249
268
 
250
269
 
251
270
  def main():
@@ -362,11 +381,11 @@ def main():
362
381
  choices=["auto", "left2right", "top2bottom", "right2left"],
363
382
  )
364
383
  parser.add_argument(
365
- "--searchable_pdf",
366
- action="store_true",
367
- help="if set, create searchable PDF",
384
+ "--font_path",
385
+ default=None,
386
+ type=str,
387
+ help="Path to the font file(.ttf) for PDF output",
368
388
  )
369
-
370
389
  args = parser.parse_args()
371
390
 
372
391
  path = Path(args.arg1)
@@ -379,6 +398,13 @@ def main():
379
398
  f"Invalid output format: {args.format}. Supported formats are {SUPPORT_OUTPUT_FORMAT}"
380
399
  )
381
400
 
401
+ if (
402
+ args.font_path is not None
403
+ and not os.path.exists(args.font_path)
404
+ and format == "pdf"
405
+ ):
406
+ raise FileNotFoundError(f"Font file not found: {args.font_path}")
407
+
382
408
  validate_encoding(args.encoding)
383
409
 
384
410
  if format == "markdown":
@@ -1,7 +1,7 @@
1
1
  import os
2
2
 
3
3
  ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
4
- SUPPORT_OUTPUT_FORMAT = ["json", "csv", "html", "markdown", "md"]
4
+ SUPPORT_OUTPUT_FORMAT = ["json", "csv", "html", "markdown", "md", "pdf"]
5
5
  SUPPORT_INPUT_FORMAT = ["jpg", "jpeg", "png", "bmp", "tiff", "tif", "pdf"]
6
6
  MIN_IMAGE_SIZE = 32
7
7
  WARNING_IMAGE_SIZE = 720
@@ -63,6 +63,7 @@ def convert_csv(
63
63
  ignore_line_break,
64
64
  img=None,
65
65
  export_figure: bool = True,
66
+ export_figure_letter: bool = False,
66
67
  figure_dir="figures",
67
68
  ):
68
69
  elements = []
@@ -89,6 +90,20 @@ def convert_csv(
89
90
  }
90
91
  )
91
92
 
93
+ if export_figure_letter:
94
+ for figure in inputs.figures:
95
+ paragraphs = sorted(figure.paragraphs, key=lambda x: x.order)
96
+ for paragraph in paragraphs:
97
+ contents = paragraph_to_csv(paragraph, ignore_line_break)
98
+ elements.append(
99
+ {
100
+ "type": "paragraph",
101
+ "box": paragraph.box,
102
+ "element": contents,
103
+ "order": figure.order,
104
+ }
105
+ )
106
+
92
107
  elements = sorted(elements, key=lambda x: x["order"])
93
108
 
94
109
  if export_figure:
@@ -109,6 +124,7 @@ def export_csv(
109
124
  encoding: str = "utf-8",
110
125
  img=None,
111
126
  export_figure: bool = True,
127
+ export_figure_letter: bool = False,
112
128
  figure_dir="figures",
113
129
  ):
114
130
  elements = convert_csv(
@@ -117,6 +133,7 @@ def export_csv(
117
133
  ignore_line_break,
118
134
  img,
119
135
  export_figure,
136
+ export_figure_letter,
120
137
  figure_dir,
121
138
  )
122
139
 
@@ -14,7 +14,6 @@ import jaconv
14
14
  from ..constants import ROOT_DIR
15
15
 
16
16
  FONT_PATH = ROOT_DIR + "/resource/MPLUS1p-Medium.ttf"
17
- pdfmetrics.registerFont(TTFont("MPLUS1p-Medium", FONT_PATH))
18
17
 
19
18
 
20
19
  def _poly2rect(points):
@@ -62,14 +61,17 @@ def to_full_width(text):
62
61
  return jaconv_text
63
62
 
64
63
 
65
- def create_searchable_pdf(images, ocr_results, output_path):
64
+ def create_searchable_pdf(images, ocr_results, output_path, font_path=None):
65
+ if font_path is None:
66
+ font_path = FONT_PATH
67
+
68
+ pdfmetrics.registerFont(TTFont("MPLUS1p-Medium", font_path))
69
+
66
70
  packet = BytesIO()
67
71
  c = canvas.Canvas(packet)
68
72
 
69
73
  for i, (image, ocr_result) in enumerate(zip(images, ocr_results)):
70
74
  image = Image.fromarray(image[:, :, ::-1]) # Convert BGR to RGB
71
- pdfmetrics.registerFont(TTFont("MPLUS1p-Medium", FONT_PATH))
72
-
73
75
  image_path = f"tmp_{i}.png"
74
76
  image.save(image_path)
75
77
  w, h = image.size
@@ -97,7 +99,6 @@ def create_searchable_pdf(images, ocr_results, output_path):
97
99
 
98
100
  c.setFont("MPLUS1p-Medium", font_size)
99
101
  c.setFillColorRGB(1, 1, 1, alpha=0) # 透明
100
- # c.setFillColorRGB(0, 0, 0)
101
102
  if direction == "vertical":
102
103
  base_y = h - y2 + (bbox_height - font_size)
103
104
  for j, ch in enumerate(text):
@@ -152,6 +152,31 @@ def test_run_tiff_csv(monkeypatch, tmp_path):
152
152
  assert os.path.exists(out_path)
153
153
 
154
154
 
155
+ def test_run_tiff_pdf(monkeypatch, tmp_path):
156
+ path_img = "tests/data/test.tiff"
157
+ monkeypatch.setattr(
158
+ "sys.argv",
159
+ [
160
+ "main.py",
161
+ path_img,
162
+ "-o",
163
+ str(tmp_path),
164
+ "-f",
165
+ "pdf",
166
+ "--tsr_cfg",
167
+ "tests/yaml/table_structure_recognizer.yaml",
168
+ "--lite",
169
+ "--figure",
170
+ ],
171
+ )
172
+ main.main()
173
+ path = Path(path_img)
174
+ dirname = path.parent.name
175
+ filename = path.stem
176
+ out_path = os.path.join(str(tmp_path), f"{dirname}_{filename}_p1.pdf")
177
+ assert os.path.exists(out_path)
178
+
179
+
155
180
  def test_run_pdf_md(monkeypatch, tmp_path):
156
181
  path_img = "tests/data/test.pdf"
157
182
  monkeypatch.setattr(
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes