Skip to main content

OCR-D framework - file format APIs and schemas

Project description

ocrd_models

OCR-D framework - file format APIs and schemas

Adding user methods to the generated OcrdPage 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]
    
  2. 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!

  3. Regenerate the PAGE API:

    make generate-page
    

See also: https://github.com/OCR-D/core

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.42.0.tar.gz (99.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.42.0-py3-none-any.whl (104.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ocrd_models-2.42.0.tar.gz
  • Upload date:
  • Size: 99.6 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.42.0.tar.gz
Algorithm Hash digest
SHA256 2c6f7d5617ba436e608f9704f3ae6bc5dcc84bec24527cf94ca8c8e76ffd81b8
MD5 052b400a570c568f35f320127331ca57
BLAKE2b-256 4a5253dae3da0b99badcbb9a380e16dbb06abc60e9eee8ec09e3f88228fef051

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ocrd_models-2.42.0-py3-none-any.whl
  • Upload date:
  • Size: 104.7 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.42.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da5cb594157529f8c92286195ed85196e0737b754cc09bc258655aba9bb8e94e
MD5 5a27823e94de71f21d1c94e98f966c7c
BLAKE2b-256 879a8fa5fcb61ee1a483be93eda77d36bb7eca6ee38e11b51c2e3ca45fc9363e

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