OCR-D framework - file format APIs and schemas
Project description
ocrd_models
OCR-D framework - file format APIs and schemas
See https://github.com/OCR-D/core
Adding user methods to the generated PAGE 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.py
def get_FirstTextRegion(self):
return self.get_TextRegion[0]
NOTE The method name and file name must be identical.
NOTE Do not use Python's %
string interpolation operator, it will break generateDS. Use "".format(...)
instead.
- Edit
ocrd_models/ocrd_page_user_methods.py
and append to theMETHOD_SPECS
list:
METHOD_SPECS = (
# ...
_add_method(r'^PageType$', 'get_FirstTextRegion')
# ...
)
- Regenerate the PAGE API:
make generate-page
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
ocrd_models-2.8.1.tar.gz
(77.2 kB
view hashes)
Built Distribution
Close
Hashes for ocrd_models-2.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57f49792e95391dbc6f190aed932e242a15da8e19ac7907b36d63df49fa43269 |
|
MD5 | 449dfc340ee5a34ede53a1aaa2263895 |
|
BLAKE2b-256 | fff5136a857216cc5033acf9bc6889f5ab4dd6cb82d84f9a2b9657eb1aaf184a |