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.10.5.tar.gz (78.5 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.10.5-py3-none-any.whl (82.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ocrd_models-2.10.5.tar.gz
  • Upload date:
  • Size: 78.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9

File hashes

Hashes for ocrd_models-2.10.5.tar.gz
Algorithm Hash digest
SHA256 b290324a6c5c1d94a4b809bf87485c3b3e0b5e9a4968653f8ab60e3ce2c80a09
MD5 408bf2caf0ea2f9b90e860ba7f77fa80
BLAKE2b-256 02b793de6ed431767fa0ad463532fabad3fc30cb28170dcef8440c48a8457f5e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ocrd_models-2.10.5-py3-none-any.whl
  • Upload date:
  • Size: 82.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.1.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9

File hashes

Hashes for ocrd_models-2.10.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d559b2b67f0147403fd9fbeb073631cdedf419dfde78d2aba9b7e6c191924c
MD5 eba9565450ead4cf0813315ec5bb5d36
BLAKE2b-256 b7777ce5be9fd71649da9c48b9309d72e8bf92a1e1f3ab721bc4b3c30d57bc1a

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