OCR-D framework - file format APIs and schemas
Project description
ocrd_models
OCR-D framework - file format APIs and schemas
Adding user methods to the generated OcrdPage API
Let's say you want to add a method get_FirstTextRegion on the pc:Page element:
-
Create a file
ocrd_models/ocrd_page_user_methods/get_FirstTextRegion.pydef get_FirstTextRegion(self): return self.get_TextRegion[0]
-
Edit
ocrd_models/ocrd_page_user_methods.pyand append to theMETHOD_SPECSlist:METHOD_SPECS = ( # ... _add_method(r'^PageType$', 'get_FirstTextRegion') # ... )
If the filename (sans the
.pyextension) does not match the method_name, you can provide an additionalfile_nameattribute to_add_method:METHOD_SPECS = ( # ... _add_method(r'^PageType$', 'exportChildren', 'exportChildren_PageType') # ... )
Would add the method
exportChildrenfrom a fileexportChildren_PageType.py.Note: The method name in the file must match the method name passed to
_add_method. This is not checked automatically, so double-check manually! -
Regenerate the PAGE API:
make generate-page
See also: https://github.com/OCR-D/core
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ocrd_models-2.42.0.tar.gz.
File metadata
- Download URL: ocrd_models-2.42.0.tar.gz
- Upload date:
- Size: 99.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c6f7d5617ba436e608f9704f3ae6bc5dcc84bec24527cf94ca8c8e76ffd81b8
|
|
| MD5 |
052b400a570c568f35f320127331ca57
|
|
| BLAKE2b-256 |
4a5253dae3da0b99badcbb9a380e16dbb06abc60e9eee8ec09e3f88228fef051
|
File details
Details for the file ocrd_models-2.42.0-py3-none-any.whl.
File metadata
- Download URL: ocrd_models-2.42.0-py3-none-any.whl
- Upload date:
- Size: 104.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.0 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da5cb594157529f8c92286195ed85196e0737b754cc09bc258655aba9bb8e94e
|
|
| MD5 |
5a27823e94de71f21d1c94e98f966c7c
|
|
| BLAKE2b-256 |
879a8fa5fcb61ee1a483be93eda77d36bb7eca6ee38e11b51c2e3ca45fc9363e
|