NoisOCR
Tools to simulate post-OCR noisy texts.
Features:
- Sliding window;
- Sliding window with hyphenation;
- Simulate text errors;
- Simulate text annotations.
Install
pip install noisocr
Sliding window:
import noisocr
text = "Lorem Ipsum is simply dummy...type specimen book."
max_window_size = 50
windows = noisocr.sliding_window(text, max_window_size)
# Output:
# [
# 'Lorem Ipsum is simply dummy text of the printing',
# ...
# 'type and scrambled it to make a type specimen',
# 'book.'
# ]
Sliding window with hyphenation:
- See the package https://pypi.org/project/PyHyphen to see all supported languages.
import noisocr
text = "Lorem Ipsum is simply dummy...type specimen book."
max_window_size = 50
windows = noisocr.sliding_window(text, max_window_size)
# Output:
# [
# 'Lorem Ipsum is simply dummy text of the printing ',
# 'typesetting industry. Lorem Ipsum has been the in-',
# ...
# 'scrambled it to make a type specimen book.'
# ]
Simulate text errors:
- See the package https://pypi.org/project/typo to see all possible error types.
import noisocr
text = "Hello world."
text_with_errors = noisocr.simulate_errors(text, interactions=1)
# Output: Hello, wotrld!
text_with_errors = noisocr.simulate_errors(text, 2)
# Output: Hsllo,wlorld!
text_with_errors = noisocr.simulate_errors(text, 5)
# Output: fllo,w0rlr!
Simulate text annotations:
- By default, the annotations found in the BRESSAY dataset were used. But you can define which types of annotations you want to simulate. For annotations with internal text, use the pattern
##--text--##.
import noisocr
text = "Hello world."
text_with_annotation = noisocr.simulate_annotation(text, probability=0.5)
# Output: Hello, $$--xxx--$$
text_with_annotation = noisocr.simulate_annotation(text, probability=0.5)
# Output: Hello, ##--world!--##
text_with_annotation = noisocr.simulate_annotation(text, 0.01)
# Output: Hello world.
Metadata
Release files for noisocr 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| noisocr-0.2.tar.gz | 3.5 kB | Without provenance | Details for noisocr-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| noisocr-0.2-py3-none-any.whl | Python 3 | none | any | Details for noisocr-0.2-py3-none-any.whl |
Total release size: 7.3 kB
Release files / noisocr-0.2.tar.gz
| Download URL | noisocr-0.2.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
879410c6e670d27c80d31e9966dee77cd3d8d48e20d451160309cfaab602eecd
|
|
BLAKE2b-256 checksum How to use checksums |
5de4f64a436144a0a1bfba8b8f80715550e4b7140e29074b8b74d45e1f69df12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / noisocr-0.2-py3-none-any.whl
| Download URL | noisocr-0.2-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48fdd99e492695db1f0fb6d58a3405af5fb9d693f651ccd9fef0772b6636151a
|
|
BLAKE2b-256 checksum How to use checksums |
32ae5d6c16528943a2f97ce45f738a23775b88b1c5ff4b9265cb3b7b43531ed2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Security for noisocr 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.