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.30.0.tar.gz (96.6 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.30.0-py3-none-any.whl (101.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ocrd_models-2.30.0.tar.gz
  • Upload date:
  • Size: 96.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.9

File hashes

Hashes for ocrd_models-2.30.0.tar.gz
Algorithm Hash digest
SHA256 086ac6fa3cd79a333cb633b0c8dc85261aa4c52e0f1d9f29459cb9ef6bb6c699
MD5 c484f9a29db320258e7c71b34532d58f
BLAKE2b-256 6c4053bb31234ccd7179b0b4e792f8cfa085807ff8d08630327b8345cee1d24b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ocrd_models-2.30.0-py3-none-any.whl
  • Upload date:
  • Size: 101.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.6.9

File hashes

Hashes for ocrd_models-2.30.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0991d641f16de320d14994fb270f4b879cd2ecf89041a38fc0de7a62fe188867
MD5 8fe471aab852482675967cab568da463
BLAKE2b-256 e4c762cb804f2e6b2ce1550fb142afc3ed61454d78fbc56e0f69365611fa7204

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