Skip to main content

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:

  1. Create a file ocrd_models/ocrd_page_user_methods/get_FirstTextRegion.py
def get_FirstTextRegion(self):
  return self.get_TextRegion[0]
  1. Edit ocrd_models/ocrd_page_user_methods.py and append to the METHOD_SPECS list:
METHOD_SPECS = (
  # ...
  _add_method(r'^PageType$', 'get_FirstTextRegion')
  # ...
)

If the filename (sans the .py extension) does not match the method_name, you can provide an additional file_name attribute to _add_method:

METHOD_SPECS = (
  # ...
  _add_method(r'^PageType$', 'exportChildren', 'exportChildren_PageType')
  # ...
)

Would add the method exportChildren from a file exportChildren_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!

  1. 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.33.0.tar.gz (96.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ocrd_models-2.33.0-py3-none-any.whl (102.0 kB view details)

Uploaded Python 3

File details

Details for the file ocrd_models-2.33.0.tar.gz.

File metadata

  • Download URL: ocrd_models-2.33.0.tar.gz
  • Upload date:
  • Size: 96.9 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.1 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

Hashes for ocrd_models-2.33.0.tar.gz
Algorithm Hash digest
SHA256 ca5f76a2729d9237f17b6e3b03aa8f0cdfc16c11fbc1dfd8923c464154be96c8
MD5 d988b3d484aa2c16563ee58710dd2fee
BLAKE2b-256 b76a2c1dabb221d12a8b40ea4df2c007985413272eb96929b067dbff7d17853d

See more details on using hashes here.

File details

Details for the file ocrd_models-2.33.0-py3-none-any.whl.

File metadata

  • Download URL: ocrd_models-2.33.0-py3-none-any.whl
  • Upload date:
  • Size: 102.0 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.1 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

Hashes for ocrd_models-2.33.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f50c54fa7eaf52101bfeb57e3e2c777feb5a63e219452a6ada0caf1eb89ada1
MD5 f57e8c822bcece4a0b1d4590ce150d50
BLAKE2b-256 d8f1fdc79f943a949cedfc4bc533536165ec966825c46ca6c19af8a9a0dbaf51

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page