roascan 2.0.1__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.
- roascan-2.0.1/LICENSE +201 -0
- roascan-2.0.1/MANIFEST.in +22 -0
- roascan-2.0.1/NOTICE +76 -0
- roascan-2.0.1/PKG-INFO +288 -0
- roascan-2.0.1/README.md +252 -0
- roascan-2.0.1/ROASCAN_ROADMAP_2026.md +39 -0
- roascan-2.0.1/SKILL.md +33 -0
- roascan-2.0.1/THIRD_PARTY_LICENSES.txt +695 -0
- roascan-2.0.1/dotnet/RoaScan.cs +517 -0
- roascan-2.0.1/examples/roascan_example.py +69 -0
- roascan-2.0.1/mcp_config.json +11 -0
- roascan-2.0.1/pyproject.toml +66 -0
- roascan-2.0.1/roascan/__init__.py +85 -0
- roascan-2.0.1/roascan/__main__.py +342 -0
- roascan-2.0.1/roascan/accent.py +143 -0
- roascan-2.0.1/roascan/api.py +223 -0
- roascan-2.0.1/roascan/desktop/__init__.py +60 -0
- roascan-2.0.1/roascan/desktop/__main__.py +9 -0
- roascan-2.0.1/roascan/desktop/capture.py +165 -0
- roascan-2.0.1/roascan/desktop/clipboard.py +136 -0
- roascan-2.0.1/roascan/desktop/config.py +174 -0
- roascan-2.0.1/roascan/desktop/config_cli.py +92 -0
- roascan-2.0.1/roascan/desktop/hotkey.py +97 -0
- roascan-2.0.1/roascan/desktop/i18n.py +123 -0
- roascan-2.0.1/roascan/desktop/result_panel.py +383 -0
- roascan-2.0.1/roascan/desktop/tray_app.py +364 -0
- roascan-2.0.1/roascan/docout.py +442 -0
- roascan-2.0.1/roascan/engine.py +1001 -0
- roascan-2.0.1/roascan/mcp_server.py +482 -0
- roascan-2.0.1/roascan/models/en_dict.txt +95 -0
- roascan-2.0.1/roascan/models/es_ES.dic +58222 -0
- roascan-2.0.1/roascan/models/ppocrv5_latin_dict.txt +502 -0
- roascan-2.0.1/roascan/models/roascan_rec_en.onnx +0 -0
- roascan-2.0.1/roascan/models/roascan_rec_latin_v5.onnx +0 -0
- roascan-2.0.1/roascan/native.py +196 -0
- roascan-2.0.1/roascan/prepro.py +77 -0
- roascan-2.0.1/roascan/recognizer.py +326 -0
- roascan-2.0.1/roascan/roascan_core.dll +0 -0
- roascan-2.0.1/roascan-native/CMakeLists.txt +42 -0
- roascan-2.0.1/roascan-native/README.md +99 -0
- roascan-2.0.1/roascan-native/ROASCAN_PIPELINE_SPEC.md +33 -0
- roascan-2.0.1/roascan-native/src/main.cpp +105 -0
- roascan-2.0.1/roascan-native/src/roascan_c_api.cpp +553 -0
- roascan-2.0.1/roascan-native/src/roascan_c_api.h +155 -0
- roascan-2.0.1/roascan-native/src/roascan_fontmetrics.cpp +60 -0
- roascan-2.0.1/roascan-native/src/roascan_fontmetrics.hpp +25 -0
- roascan-2.0.1/roascan-native/src/roascan_image.hpp +69 -0
- roascan-2.0.1/roascan-native/src/roascan_lexicon.cpp +154 -0
- roascan-2.0.1/roascan-native/src/roascan_lexicon.hpp +36 -0
- roascan-2.0.1/roascan-native/src/roascan_preprocess.cpp +626 -0
- roascan-2.0.1/roascan-native/src/roascan_preprocess.hpp +68 -0
- roascan-2.0.1/roascan-native/src/roascan_segmentation.cpp +295 -0
- roascan-2.0.1/roascan-native/src/roascan_segmentation.hpp +44 -0
- roascan-2.0.1/roascan-native/src/tools/roascan_tool_fontmetrics.cpp +39 -0
- roascan-2.0.1/roascan-native/src/tools/roascan_tool_lexicon.cpp +45 -0
- roascan-2.0.1/roascan-native/src/tools/roascan_tool_lut.cpp +40 -0
- roascan-2.0.1/roascan.egg-info/PKG-INFO +288 -0
- roascan-2.0.1/roascan.egg-info/SOURCES.txt +74 -0
- roascan-2.0.1/roascan.egg-info/dependency_links.txt +1 -0
- roascan-2.0.1/roascan.egg-info/entry_points.txt +5 -0
- roascan-2.0.1/roascan.egg-info/requires.txt +9 -0
- roascan-2.0.1/roascan.egg-info/top_level.txt +1 -0
- roascan-2.0.1/setup.cfg +4 -0
- roascan-2.0.1/setup.py +130 -0
- roascan-2.0.1/tests/assets/DejaVuSans.ttf +0 -0
- roascan-2.0.1/tests/assets/LICENSE_DEJAVU.txt +99 -0
- roascan-2.0.1/tests/assets/README.md +17 -0
- roascan-2.0.1/tests/test_config.py +103 -0
- roascan-2.0.1/tests/test_desktop_and_api.py +151 -0
- roascan-2.0.1/tests/test_document.png +0 -0
- roascan-2.0.1/tests/test_functional_ocr.py +568 -0
- roascan-2.0.1/tests/test_i18n.py +55 -0
- roascan-2.0.1/tests/test_p4_tray_and_hotkey.py +140 -0
- roascan-2.0.1/tests/test_p5_p6_tray_integration.py +118 -0
- roascan-2.0.1/tests/test_result_panel.py +126 -0
- roascan-2.0.1/tests/test_result_panel_runtime.py +110 -0
roascan-2.0.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Roa (RoaScan Project)
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include NOTICE
|
|
3
|
+
include THIRD_PARTY_LICENSES.txt
|
|
4
|
+
include README.md
|
|
5
|
+
include SKILL.md
|
|
6
|
+
include mcp_config.json
|
|
7
|
+
include ROASCAN_ROADMAP_2026.md
|
|
8
|
+
include pyproject.toml
|
|
9
|
+
include setup.py
|
|
10
|
+
|
|
11
|
+
recursive-include roascan *.py *.dll *.so *.dylib
|
|
12
|
+
recursive-include roascan/models *.onnx *.txt *.dic
|
|
13
|
+
recursive-include roascan-native CMakeLists.txt *.md *.cpp *.hpp *.h
|
|
14
|
+
recursive-include dotnet *.cs
|
|
15
|
+
recursive-include examples *.py
|
|
16
|
+
recursive-include tests *.py *.png
|
|
17
|
+
recursive-include tests/assets *.ttf *.txt *.md
|
|
18
|
+
|
|
19
|
+
prune roascan-native/build
|
|
20
|
+
prune build
|
|
21
|
+
prune dist
|
|
22
|
+
global-exclude __pycache__ *.py[cod] *.tmp *.log
|
roascan-2.0.1/NOTICE
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
RoaScan (roascan)
|
|
2
|
+
Copyright 2026 Roa (RoaScan Project)
|
|
3
|
+
|
|
4
|
+
This product includes software developed for the RoaScan project (https://github.com/edisonroaa-code/roascan),
|
|
5
|
+
licensed under the Apache License, Version 2.0 (see `LICENSE`).
|
|
6
|
+
|
|
7
|
+
================================================================================
|
|
8
|
+
THIRD-PARTY MODELS, LEXICONS, AND RUNTIME DEPENDENCIES PROVENANCE & LICENSES
|
|
9
|
+
================================================================================
|
|
10
|
+
|
|
11
|
+
1. Neural OCR Recognition Weights & Character Vocabularies (Bundled in `roascan/models/`):
|
|
12
|
+
- License: Apache License 2.0 (Permissive — PaddlePaddle Contributors)
|
|
13
|
+
- Upstream Repository: https://github.com/PaddlePaddle/PaddleOCR
|
|
14
|
+
- Exact Bundled Artifacts, Sizes & SHA-256 Checksums:
|
|
15
|
+
* `roascan/models/roascan_rec_latin_v5.onnx`
|
|
16
|
+
- Size: 7,904,513 bytes
|
|
17
|
+
- SHA-256: `b20bd37c168a570f583afbc8cd7925603890efbcdc000a59e22c269d160b5f5a`
|
|
18
|
+
- Upstream Model Origin: PaddleOCR Multilingual Latin SVTR/CRNN recognition inference graph
|
|
19
|
+
(`latin_PP-OCRv3_rec_infer` / PP-OCR Latin recognition architecture).
|
|
20
|
+
* `roascan/models/roascan_rec_en.onnx`
|
|
21
|
+
- Size: 8,967,018 bytes
|
|
22
|
+
- SHA-256: `ef7abd8bd3629ae57ea2c28b425c1bd258a871b93fd2fe7c433946ade9b5d9ea`
|
|
23
|
+
- Upstream Model Origin: PaddleOCR English SVTR/CRNN recognition inference graph
|
|
24
|
+
(`en_PP-OCRv4_rec_infer`).
|
|
25
|
+
* `roascan/models/ppocrv5_latin_dict.txt`
|
|
26
|
+
- Size: 1,634 bytes
|
|
27
|
+
- SHA-256: `3c0a8a79b612653c25f765271714f71281e4e955962c153e272b7b8c1d2b13ff`
|
|
28
|
+
- Upstream Origin: `ppocr/utils/dict/latin_dict.txt` (PaddleOCR Apache-2.0)
|
|
29
|
+
* `roascan/models/en_dict.txt`
|
|
30
|
+
- Size: 190 bytes
|
|
31
|
+
- SHA-256: `5662df9d2d03f0e8ca0d3b0649d6acbab904b6a14b3d3521463c71c37c668ce3`
|
|
32
|
+
- Upstream Origin: `ppocr/utils/en_dict.txt` (PaddleOCR Apache-2.0)
|
|
33
|
+
- Reproducible Export Procedure (Paddle Inference -> ONNX Runtime):
|
|
34
|
+
```bash
|
|
35
|
+
pip install paddle2onnx>=1.0.5 onnx>=1.14.0
|
|
36
|
+
paddle2onnx \
|
|
37
|
+
--model_dir ./inference_model_dir \
|
|
38
|
+
--model_filename inference.pdmodel \
|
|
39
|
+
--params_filename inference.pdiparams \
|
|
40
|
+
--save_file roascan_rec_model.onnx \
|
|
41
|
+
--opset_version 11 \
|
|
42
|
+
--enable_onnx_checker True
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
--------------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
2. Spanish Orthographic Lexicon (Bundled in `roascan/models/es_ES.dic`):
|
|
48
|
+
- File: `roascan/models/es_ES.dic`
|
|
49
|
+
- Size: 715,989 bytes
|
|
50
|
+
- SHA-256: `6975dddec3d5d2c676069537bc67b4b5f786c65c5d4cf6703a82acf779ac9ec1`
|
|
51
|
+
- Upstream Source: RLA-ES (Recursos Lingüísticos Abiertos del Español) v2.8
|
|
52
|
+
(https://github.com/sbosio/rla-es / https://github.com/sbosio/rla-es/blob/master/LICENSE.md)
|
|
53
|
+
- Original Authors: Santiago Bosio and RLA-ES contributors.
|
|
54
|
+
- Upstream License Options: Tri-licensed under GPLv3+ / LGPLv3+ / MPL-1.1+.
|
|
55
|
+
- Elected License for Redistribution in RoaScan: **Mozilla Public License Version 1.1 (MPL-1.1)**.
|
|
56
|
+
`roascan/models/es_ES.dic` is distributed as an unmodified standalone plain-text dictionary
|
|
57
|
+
file under the terms of the Mozilla Public License Version 1.1 (see `THIRD_PARTY_LICENSES.txt`).
|
|
58
|
+
Under MPL-1.1 Section 3.7 ("Larger Works"), the unmodified dictionary file is combined with
|
|
59
|
+
RoaScan's Apache-2.0 code as a separate data file read at runtime. Source availability for
|
|
60
|
+
`es_ES.dic` is satisfied both by its direct inclusion in plain text within `roascan/models/es_ES.dic`
|
|
61
|
+
and at https://github.com/sbosio/rla-es.
|
|
62
|
+
|
|
63
|
+
--------------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
3. External Python Runtime Dependencies (Not Bundled in Wheel/sdist; Installed via PyPI):
|
|
66
|
+
- `onnxruntime` — MIT License (Microsoft Corporation)
|
|
67
|
+
- `numpy` — BSD-3-Clause License (NumPy Developers)
|
|
68
|
+
- `Pillow` — MIT-CMU Permissive License (Jeffrey A. Clark & contributors)
|
|
69
|
+
- `PyMuPDF` (`fitz`) — GNU Affero General Public License v3.0 (AGPL-3.0) or Commercial
|
|
70
|
+
License from Artifex Software, Inc. (https://pymupdf.readthedocs.io/en/latest/about.html).
|
|
71
|
+
IMPORTANT COMPLIANCE NOTICE:
|
|
72
|
+
RoaScan does NOT bundle, copy, or redistribute `PyMuPDF` inside its source repository,
|
|
73
|
+
`sdist`, or `wheel`. RoaScan's own C++17 and Python code is licensed under Apache-2.0.
|
|
74
|
+
However, when `PyMuPDF` is installed from PyPI and imported at runtime for PDF ingestion
|
|
75
|
+
or searchable PDF generation, the resulting runtime environment is subject to `PyMuPDF`'s
|
|
76
|
+
AGPL-3.0 license terms unless the user holds a commercial license from Artifex Software, Inc.
|
roascan-2.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: roascan
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: RoaScan: Ultra-lightweight C++17 & ONNX multi-page OCR engine and MCP Server for AI Agents (Scanned PDF/TIFF -> Restored Searchable PDF & Structured Markdown).
|
|
5
|
+
Author: Roa
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/edisonroaa-code/roascan
|
|
8
|
+
Project-URL: Repository, https://github.com/edisonroaa-code/roascan
|
|
9
|
+
Project-URL: Issues, https://github.com/edisonroaa-code/roascan/issues
|
|
10
|
+
Keywords: ocr,roascan,mcp,model-context-protocol,ai-agent,pdf-to-markdown,searchable-pdf,document-restoration,onnxruntime,cpp17
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Programming Language :: C++
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
21
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
License-File: THIRD_PARTY_LICENSES.txt
|
|
27
|
+
Requires-Dist: numpy>=1.22.0
|
|
28
|
+
Requires-Dist: Pillow>=9.5.0
|
|
29
|
+
Requires-Dist: onnxruntime>=1.15.0
|
|
30
|
+
Requires-Dist: PyMuPDF>=1.22.0
|
|
31
|
+
Provides-Extra: desktop
|
|
32
|
+
Requires-Dist: pystray>=0.19.0; extra == "desktop"
|
|
33
|
+
Requires-Dist: pynput>=1.7.0; extra == "desktop"
|
|
34
|
+
Requires-Dist: platformdirs>=3.0.0; extra == "desktop"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# RoaScan (`roascan`) — C++17 & ONNX Multi-Page OCR + MCP Server for AI Agents
|
|
38
|
+
|
|
39
|
+
**RoaScan** (`roascan`) is a local, CPU-first multi-page OCR and optical document restoration engine powered by a clean-room **C++17 native core** (`roascan_core`) and **ONNX Runtime** (`PP-OCRv5 Latin` / `PP-OCRv4 English`).
|
|
40
|
+
|
|
41
|
+
Designed as an **Agent-First local OCR tool** (Antigravity, Claude Code, Claude Desktop, Cursor, Windsurf, OpenHands) and document restoration library that runs on CPU without requiring GPU hardware, Tesseract, or Ghostscript.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Key Capabilities & Architectural Scope
|
|
46
|
+
|
|
47
|
+
1. **Multi-Page Scanned Input (Lazy Streaming & Disk-Spooling)**:
|
|
48
|
+
- Native ingestion of multi-page `.pdf` (rasterized page-by-page on demand), `.tiff`/`.tif`, `.png`, `.jpg`, and `.bmp`.
|
|
49
|
+
- In Markdown/text mode (`set_retain_images(False)`), page bitmaps are discarded immediately after recognition (`0 bytes` retained in `engine._pages`).
|
|
50
|
+
- In Searchable PDF mode (`set_retain_images(True)`), restored page images are spooled as compressed PNGs to an exclusive temporary directory (`_spool_dir`) and automatically cleaned up on `engine.close()`, keeping **`0 bytes` of raw uncompressed bitmaps in `engine._pages` RAM**.
|
|
51
|
+
2. **Dual High-Value Output**:
|
|
52
|
+
- **Restored Searchable PDF (`.pdf`)**: Preserves physical page dimensions in PDF points (`72 pt/inch`, e.g. `595.28 x 841.89 pt` for A4) and document-level metadata (`title`, `author`), applies C++17 Sauvola 64-bit integral background whitening, 1px anti-aliased ink preservation, coarse-to-fine deskew (`0.1°` precision), and orthogonal `90° / 180° / 270°` orientation recovery with an invisible selectable text overlay (`Ctrl+F`).
|
|
53
|
+
- **Structured Semantic Markdown (`.md`)**: Automatic reconstruction of `#`/`##` titles via typographic font-height clustering, `**Key:** Value` pairs, multi-column reading order (`XY-Cut`), C++ morphological table grid-line removal, and GitHub-Flavored Markdown tables (`|---|---|`).
|
|
54
|
+
3. **Built-in Model Context Protocol (MCP) Server**: Ready-to-run stdio JSON-RPC 2.0 server (`roascan --mcp` or `roascan-mcp`) exposing 4 validated tools (`roascan_to_markdown`, `roascan_to_searchable_pdf`, `roascan_process_document`, `roascan_inspect_pdf`).
|
|
55
|
+
4. **Spanish & Latin Diacritic Restoration**: Built-in Hunspell lexicon with `/G` and `/S` affix expansion (`ELECTRONICA` -> `ELECTRÓNICA`, `REPUBLICA` -> `REPÚBLICA`, `Pena` -> `Peña`).
|
|
56
|
+
|
|
57
|
+
> [!IMPORTANT]
|
|
58
|
+
> **Scope of Optical PDF Restoration (`roascan_to_searchable_pdf` / `--pdf`):**
|
|
59
|
+
> The Searchable PDF pipeline is an **optical scan restorer**. It rasterizes each page, corrects orthogonal rotations (`90°/180°/270°`) and fine skew, whitens shadowed backgrounds, and reconstructs the page from the restored bitmap at exact physical dimensions (`72 pt/inch`) with an invisible selectable text layer (`render_mode=3`) and document metadata (`title`, `author`). Native vector objects, interactive hyperlinks, annotations, and AcroForm fields from digital-born PDFs are not preserved.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Measured Footprint & Reproducible Performance
|
|
64
|
+
|
|
65
|
+
| Metric | Measured Value (Intel Core i7-7700 4C/8T, Windows x64, Python 3.12) |
|
|
66
|
+
| :--- | :--- |
|
|
67
|
+
| **RoaScan Wheel Artifact Size** | `~15.0 MiB` compressed (`~17.0 MiB` unpacked, including C++ DLL + ONNX weights + Hunspell lexicon) |
|
|
68
|
+
| **Full Runtime Environment** | `~223 MiB` on disk when including `onnxruntime`, `numpy`, `Pillow`, and `PyMuPDF` in a clean virtual environment |
|
|
69
|
+
| **C++17 Coarse-to-Fine Deskew Kernel** | `~0.90–1.96 ms` (median `~1.03 ms`) on synthetic 300 DPI A4 binary page (`-15°..+15°` at `0.1°` step with spatial subsampling) |
|
|
70
|
+
| **End-to-End Single-Page OCR** | `~230–720 ms` in-process (`ocr_elapsed_ms` after ONNX session init; `~1.1 s` total cold CLI invocation including interpreter & session startup) |
|
|
71
|
+
| **30-Page A4 PDF Memory Profile** | `0 bytes` of raw page bitmaps retained in `engine.extract_pages()` in both Markdown and Searchable PDF modes |
|
|
72
|
+
|
|
73
|
+
### Platform Verification Status
|
|
74
|
+
- **Windows x64 (`win_amd64`)**: Precompiled `roascan_core.dll` bundled in wheel (`py3-none-win_amd64`); verified end-to-end. Requires standard Microsoft Visual C++ Redistributable (`MSVCP140.dll` / `VCRUNTIME140.dll`).
|
|
75
|
+
- **Linux & macOS (Experimental Source Build)**: Native compilation, functional OCR, MCP, and wheel builds pass GitHub Actions on both platforms. Desktop integration remains unverified there. `sdist` includes full C++17 sources and `CMakeLists.txt` (`roascan-native/`). Building a wheel from source (`pip install .` or `python -m build --wheel`) automatically invokes `cmake` via `setup.py` to compile `libroascan_core.so` / `libroascan_core.dylib` (requires `cmake >= 3.16` and a C++17 compiler).
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Repository Structure
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
├── pyproject.toml # PEP 621 package definition
|
|
83
|
+
├── setup.py # CMake native builder & platform-tagged wheel packager
|
|
84
|
+
├── MANIFEST.in # Complete source distribution (sdist) manifest
|
|
85
|
+
├── LICENSE # Full Apache-2.0 License
|
|
86
|
+
├── NOTICE # Provenance, SHA-256 hashes, and licensing notices
|
|
87
|
+
├── THIRD_PARTY_LICENSES.txt # Full license texts for bundled third-party resources (MPL-1.1 / Apache-2.0)
|
|
88
|
+
├── SKILL.md # AI Agent discovery & usage specification
|
|
89
|
+
├── mcp_config.json # Ready-to-use Model Context Protocol (MCP) config
|
|
90
|
+
├── roascan/ # Python SDK, CLI, MCP Server, bundled DLL & ONNX models
|
|
91
|
+
│ ├── api.py # Stable high-level API & Bridge Contract (`run_ocr`, `RoaScanResult`)
|
|
92
|
+
│ └── desktop/ # Desktop capture, interactive region crop & native clipboard
|
|
93
|
+
├── roascan-native/ # C++17 Native Core (`roascan_core`) & CMake build
|
|
94
|
+
├── dotnet/ # Experimental C# / .NET P/Invoke preprocessing bridge (`RoaScan.cs`)
|
|
95
|
+
├── examples/ # End-to-end Python usage examples
|
|
96
|
+
└── tests/ # Automated pytest suite (`test_functional_ocr.py`, `test_desktop_and_api.py`)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Installation (`pip install`)
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# 1. Core library + CLI + MCP Server:
|
|
105
|
+
pip install roascan
|
|
106
|
+
|
|
107
|
+
# 2. With desktop tray companion & global shortcut extra:
|
|
108
|
+
pip install "roascan[desktop]"
|
|
109
|
+
|
|
110
|
+
# Verify installation, native C++ core, and ONNX models:
|
|
111
|
+
roascan --doctor
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 1. Python API (`roascan.run_ocr`)
|
|
117
|
+
|
|
118
|
+
Stable bridge contract supporting file paths, PIL images, or raw image bytes without network dependencies:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import roascan
|
|
122
|
+
|
|
123
|
+
# Run local OCR with automatic language correction & Markdown reconstruction
|
|
124
|
+
result = roascan.run_ocr("factura.png", language="es")
|
|
125
|
+
|
|
126
|
+
# Standard bridge contract attributes:
|
|
127
|
+
print(result.text) # Reconstructed plain text
|
|
128
|
+
print(result.markdown) # Structured Markdown with tables & headings
|
|
129
|
+
print(len(result.words)) # Detected words with bboxes & confidences
|
|
130
|
+
print(result.confidences) # List of word confidence scores
|
|
131
|
+
|
|
132
|
+
# Copy recognized text directly to the Windows clipboard:
|
|
133
|
+
result.copy_to_clipboard()
|
|
134
|
+
|
|
135
|
+
# Save structured Markdown:
|
|
136
|
+
result.save_markdown("factura.md")
|
|
137
|
+
|
|
138
|
+
# Access as dictionary mapping:
|
|
139
|
+
data = result.to_dict()
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 2. CLI Usage (`roascan`)
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# 1. OCR a file and copy text directly to clipboard:
|
|
148
|
+
roascan ocr factura.png --out factura.md --copy
|
|
149
|
+
|
|
150
|
+
# 2. Interactive desktop region capture (Tkinter overlay -> OCR -> clipboard):
|
|
151
|
+
roascan clip
|
|
152
|
+
|
|
153
|
+
# 3. Capture specific coordinates without interactive prompt:
|
|
154
|
+
roascan clip --bbox 100,100,700,500 --out recorte.md
|
|
155
|
+
|
|
156
|
+
# 4. Convert a scanned multi-page PDF into both Searchable PDF and Markdown:
|
|
157
|
+
roascan scan.pdf --pdf limpio.pdf --md out.md --lang es
|
|
158
|
+
|
|
159
|
+
# 5. Output unified, versioned JSON (includes ocr_elapsed_ms and total elapsed_ms):
|
|
160
|
+
roascan factura.pdf --json
|
|
161
|
+
|
|
162
|
+
# 6. Run environment & model health check:
|
|
163
|
+
roascan --doctor
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 3. Desktop Screen Capture & Tray Companion (`roascan.desktop`)
|
|
169
|
+
|
|
170
|
+
RoaScan includes an offline desktop companion (clean-room design: zero cloud, zero accounts, zero telemetry):
|
|
171
|
+
|
|
172
|
+
### 3.1. System Tray Companion (`roascan tray` / `roascan-tray`)
|
|
173
|
+
Starts a lightweight background companion in the Windows notification area with a global shortcut:
|
|
174
|
+
- **Default Global Shortcut:** `Ctrl+Shift+O` (triggers interactive region crop -> OCR -> copies text to clipboard).
|
|
175
|
+
- **Tray Menu:** "OCR región" (triggers capture), "Salir" (clean shutdown).
|
|
176
|
+
- **Anti-Reentrancy Lock:** Prevents overlapping captures if the shortcut is pressed repeatedly.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Launch background system tray companion (default hotkey Ctrl+Shift+O):
|
|
180
|
+
roascan tray
|
|
181
|
+
# or
|
|
182
|
+
roascan-tray
|
|
183
|
+
# or
|
|
184
|
+
python -m roascan.desktop
|
|
185
|
+
|
|
186
|
+
# Custom hotkey or tray-only mode:
|
|
187
|
+
roascan tray --hotkey "Ctrl+Alt+O"
|
|
188
|
+
roascan tray --no-hotkey # tray menu only
|
|
189
|
+
roascan tray --ui-lang en # English interface
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
> **Windows Hotkey Note:** Global shortcuts registered via `pynput` run in normal user mode and do not require administrative privileges. However, when an elevated administrator window (UAC) has active focus, Windows restricts non-elevated global keyhooks. To change the shortcut permanently without CLI flags, use `roascan config set hotkey "Ctrl+Alt+O"` or set `ROASCAN_HOTKEY="Ctrl+Alt+O"`.
|
|
193
|
+
|
|
194
|
+
### 3.2. Result Inspection & Editing Panel (P5)
|
|
195
|
+
|
|
196
|
+
When a region or clip is recognized, RoaScan automatically opens a lightweight, non-blocking result window:
|
|
197
|
+
- **Editable Text Area**: Review, edit, or format the recognized text before saving or copying.
|
|
198
|
+
- **Copy**: Places the *currently edited* text onto the system clipboard.
|
|
199
|
+
- **Save**: Exports the text as structured Markdown (`.md`) or plain text (`.txt`) to the configured `save_dir` (default: `~/Documents/RoaScan`).
|
|
200
|
+
- **Close / Escape**: Dismisses the panel cleanly while keeping the background tray companion alive.
|
|
201
|
+
- **Single Instance**: Triggering another OCR updates the active panel and brings it to the front rather than stacking multiple windows.
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Open interactive result panel directly from CLI clip:
|
|
205
|
+
roascan clip --panel
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 3.3. User Preferences & Localization (P6)
|
|
209
|
+
|
|
210
|
+
RoaScan stores user preferences in standard platform directories (`%LOCALAPPDATA%/roascan/config.json` on Windows or `~/.config/roascan/config.json` on Linux/macOS via `platformdirs`).
|
|
211
|
+
|
|
212
|
+
#### CLI Configuration Management:
|
|
213
|
+
```bash
|
|
214
|
+
# View active configuration and defaults:
|
|
215
|
+
roascan config show
|
|
216
|
+
|
|
217
|
+
# Get the path to config.json:
|
|
218
|
+
roascan config path
|
|
219
|
+
|
|
220
|
+
# Change preferences:
|
|
221
|
+
roascan config set hotkey "Ctrl+Shift+O"
|
|
222
|
+
roascan config set ui_lang "en" # "es" or "en"
|
|
223
|
+
roascan config set ocr_lang "es" # "es", "en", "latin"
|
|
224
|
+
roascan config set show_result_panel true
|
|
225
|
+
roascan config set copy_on_success true
|
|
226
|
+
roascan config set save_dir "D:/MisDocumentos/OCR"
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### Precedence Order:
|
|
230
|
+
`CLI Flags > Environment Variables (e.g. ROASCAN_HOTKEY, ROASCAN_UI_LANG) > config.json > Default Values`.
|
|
231
|
+
|
|
232
|
+
### 3.4. Programmatic Desktop Capture, Panel & Clipboard API
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
from roascan.desktop import (
|
|
236
|
+
capture_region_and_ocr,
|
|
237
|
+
show_result_panel,
|
|
238
|
+
copy_to_clipboard,
|
|
239
|
+
get_clipboard_text,
|
|
240
|
+
load_config,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
# 1. Capture screen region -> local OCR -> show result editor:
|
|
244
|
+
result = capture_region_and_ocr(interactive=True, copy_clipboard=True, language="es")
|
|
245
|
+
if result and result.text:
|
|
246
|
+
show_result_panel(result.text, blocking=True)
|
|
247
|
+
|
|
248
|
+
# 2. Read or write native Windows clipboard without external dependencies:
|
|
249
|
+
copy_to_clipboard("Texto copiado desde RoaScan")
|
|
250
|
+
print("Clipboard actual:", get_clipboard_text())
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 4. Model Context Protocol (MCP) Server
|
|
256
|
+
|
|
257
|
+
Start the MCP server over `stdio`:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
roascan --mcp
|
|
261
|
+
# or
|
|
262
|
+
roascan-mcp
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Claude Desktop / Cursor / Antigravity `mcp_config.json`:
|
|
266
|
+
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"mcpServers": {
|
|
270
|
+
"roascan": {
|
|
271
|
+
"command": "roascan-mcp",
|
|
272
|
+
"args": [],
|
|
273
|
+
"env": {
|
|
274
|
+
"PYTHONIOENCODING": "utf-8"
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## 3. Licensing & Third-Party Notices
|
|
284
|
+
|
|
285
|
+
- **RoaScan Source Code (C++17 & Python)**: Licensed under the **Apache License 2.0** (see [`LICENSE`](https://github.com/edisonroaa-code/roascan/blob/main/LICENSE)).
|
|
286
|
+
- **Bundled Neural Models (`roascan/models/*.onnx`, `*_dict.txt`)**: Derived from PaddleOCR under **Apache License 2.0**. Exact bundled SHA-256 checksums and an example `paddle2onnx` export command are documented in [`NOTICE`](https://github.com/edisonroaa-code/roascan/blob/main/NOTICE).
|
|
287
|
+
- **Bundled Spanish Orthographic Dictionary (`roascan/models/es_ES.dic`)**: Unmodified plain-text dictionary from RLA-ES v2.8, distributed under the elected **Mozilla Public License Version 1.1 (`MPL-1.1`)** option (see [`NOTICE`](https://github.com/edisonroaa-code/roascan/blob/main/NOTICE) and [`THIRD_PARTY_LICENSES.txt`](https://github.com/edisonroaa-code/roascan/blob/main/THIRD_PARTY_LICENSES.txt)).
|
|
288
|
+
- **Runtime Dependency `PyMuPDF` (`fitz`)**: Not bundled or redistributed in RoaScan packages; installed from PyPI at runtime under **AGPL-3.0** (or commercial license from Artifex Software, Inc.). See [`NOTICE`](https://github.com/edisonroaa-code/roascan/blob/main/NOTICE) for compliance details.
|