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.39.0.tar.gz (97.2 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.39.0-py3-none-any.whl (102.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ocrd_models-2.39.0.tar.gz
  • Upload date:
  • Size: 97.2 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

Hashes for ocrd_models-2.39.0.tar.gz
Algorithm Hash digest
SHA256 b91a338616bc49636c4972a840ed319f89336f1e45be17004645e0c1e381554f
MD5 8e9f7a860b2d83ff5cea2637a36915f5
BLAKE2b-256 0b226b841c5fd84ab9d6ec4b30efd92c9beefe0287cb07dd7301a5aaea3778e8

See more details on using hashes here.

File details

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

File metadata

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

Hashes for ocrd_models-2.39.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a825e278f40910e39d25f939fbffea3e3beacce7eda17aa80631a62dd57e6039
MD5 576d105d507f1855c7f055e38fb20a22
BLAKE2b-256 37b6a9b56237ad1edc0ac05c1336fbb5f4e8fff98741e2c3fdee1b8b26af2d95

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