Validate and transform various OCR file formats (hOCR, ALTO, PAGE, FineReader)

Overview

ocr-fileformat

Codacy Badge Build Status GitHub release ocr-fileformat Docker build

Validate and transform between OCR file formats (hOCR, ALTO, PAGE, FineReader)

Screenshot GUI

Installation

Docker

You can run the command line scripts and web interface as a Docker container, you only need Docker installed.

To start the web interface on http://localhost:8080:

docker run --rm -it -p 8080:8080 ubma/ocr-fileformat

To run the command line scripts, mount the directory containing your input files into the container's /data directory:

docker run --rm -it -v "$PWD":/data ubma/ocr-fileformat ocr-transform alto2.0 hocr somefile.alto

System-wide

To install system-wide to /usr/local:

sudo make install

To install without sudo to your home directory:

make install PREFIX=$HOME/.local

If $HOME/.local/bin is not in your PATH, add this to your shell startup file (e.g. ~/.bashrc or ~/.zshrc):

export PATH="$HOME/.local/bin $PATH"

The web application has a PHP backed. You can deploy it on any PHP-capable server by copying the web folder somewhere below the document root of your server, e.g. /var/www/html for Apache on Debian/Ubuntu:

sudo -u www-data cp -r web /var/www/html/ocr-fileformat

In this example the GUI would be available under http://localhost/ocr-fileformat/.

Usage

The project offers two functionalities, which can be accessd via a command line script (CLI), using a web interface (GUI) or in you own tools (API)

CLI

  • ocr-transform: Transformation of OCR output between OCR formats
  • ocr-validate: Validation of OCR output against OCR format schemas

GUI

The web interface is for testing validation and transformations. You can upload a file or select an input file by URL.

API

Transformation

Transformation CLI

Usage: ocr-transform [-dl] <input-fmt> <output-fmt> [<input> [<output>]] [-- <saxon_opts>]

For example, you can transform an ALTO XML to a hOCR file with:

ocr-transform alto hocr sample.xml sample.hocr

Or convert from ALTO XML (version 2.1) to hOCR with:

ocr-transform alto2.1 hocr sample.alto sample.hocr

You can also pass arguments directly to the Saxon CLI by passing them after a double dash (--). For example, to set the foo parameter to bar:

ocr-transform alto hocr sample.xml sample.hocr -- foo=bar

Try ocr-transform -h to get an overview:

Usage: ocr-transform [-dhLv]   [ []] [-- ]

    Options:
        --help    -h     Show this help
        --version -v     Show version
        --debug   -d     Increase debug level by 1, can be repeated
        --list    -L     List transformations

    Transformations:
        abbyy hocr
        abbyy page
        alto2.0 alto3.0
        alto2.0 alto3.1
        alto2.0 hocr
        alto2.1 alto3.0
        alto2.1 alto3.1
        alto2.1 hocr
        alto page
        alto text
        gcv hocr
        gcv page
        hocr alto2.0
        hocr alto2.1
        hocr page
        hocr text
        page alto
        page hocr
        page page2019
        page text
        tei hocr

    Saxon options:
        Usage: see http://www.saxonica.com/documentation/index.html#!using-xsl/commandline
        Options available: -? -a -catalog -config -cr -diag -dtd -ea -expand -explain -export -ext -im -init -it -jit -l -lib -license -m -nogo -now -o -opt -or -outval -p -quit -r -relocate -repeat -s -sa -scmin -strip -t -T -target -threads -TJ -Tlevel -Tout -TP -traceout -tree -u -val -versionmsg -warnings -x -xi -xmlversion -xsd -xsdversion -xsiloc -xsl -y
        Use -XYZ:? for details of option XYZ
        Params:
          param=value           Set stylesheet string parameter
          +param=filename       Set stylesheet document parameter
          ?param=expression     Set stylesheet parameter using XPath
          !param=value          Set serialization parameter

Transformation GUI

Select the Transform menu option. Choose a URL, an input and an output format. Click Transform.

Transformation API

The stylesheets are installed in $PREFIX/share/ocr-fileformat/xslt and can be used directly in your scripts and software. You will need to use an XSLT 2.0 capable stylesheet transformer.

Supported Transformations

From ╲ To hOCR ALTO PAGEXML
hOCR =
ALTO =
PAGEXML =
FineReader -
Google Cloud Vision -
TEI - -

Validation

Usage: ocr-validate [-dhL]   []

    Options:
        --help    -h     Show this help
        --version -v     Show version
        --debug   -d     Increase debug level by 1, can be repeated
        --list    -L     List available schemas

    Schemas:
        hocr
        alto-1-0 alto-1-1 alto-1-2 alto-1-3 alto-1-4 alto-2-0 alto-2-1 alto-2-2-draft alto-3-0 alto-3-1 alto-3-2-draft alto-4-0 alto-4-1
        abbyy-6-schema-v1 abbyy-8-schema-v2 abbyy-9-schema-v1 abbyy-10-schema-v1
        page-2009-03-16 page-2010-01-12 page-2010-03-19 page-2013-07-15 page-2016-07-15 page-2017-07-15 page-2018-07-15 page-2019-07-15

Validation CLI

For example, to validate an XML file againt the ALTO 3.1 schema:

ocr-validate alto-3-1 myFile.alto

Validation GUI

Select the Validate menu option. Choose a URL and an schema. Click Validate.

Validation API

The XSD files are installed under $PREFIX/share/ocr-fileformat/xsd

Supported Validation Formats

hOCR ALTO PAGEXML FineReader Google Cloud Vision
Validation -

License

This is free software. You may use it under the terms of the MIT License.

During the installation process several projects are included (in ./vendor). These projects have different licenses:

Comments
  • Converting hOCR to Alto

    Converting hOCR to Alto

    Hi, first thanks for making this tool.

    I have questions using the GUI to convert hOCR to Alto XML.

    My hOCR file looks as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="unknown" lang="unknown">
      <head>
        <title>None</title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <meta name='ocr-system' content='gcv2hocr.py' />
        <meta name='ocr-langs' content='unknown' />
        <meta name='ocr-number-of-pages' content='1' />
        <meta name='ocr-capabilities' content='ocr_page ocr_carea ocr_line ocrx_word ocrp_lang'/>
      </head>
      <body>
        <div class='ocr_page' lang='unknown' title='bbox 0 0 1420 2068'>
            <div class='ocr_carea' lang='unknown' title='bbox 176 121 1420 2068'>
                <span class='ocr_line' id='line_0' title='bbox 678 121 747 168; baseline 0 -5'>
                    <span class='ocrx_word' id='word_0_0' title='bbox 678 121 747 168'>2T</span>
                </span>
                <span class='ocr_line' id='line_1' title='bbox 383 184 572 218; baseline 0 -5'>
                    <span class='ocrx_word' id='word_1_0' title='bbox 383 184 572 218'>Especially</span>
                </span>
                <span class='ocr_line' id='line_2' title='bbox 583 184 697 218; baseline 0 -5'>
                    <span class='ocrx_word' id='word_2_0' title='bbox 583 184 697 218'>during</span>
                </span>
                <span class='ocr_line' id='line_3' title='bbox 722 188 775 215; baseline 0 -5'>
                    <span class='ocrx_word' id='word_3_0' title='bbox 722 188 775 215'>the</span>
                </span>
                <span class='ocr_line' id='line_4' title='bbox 796 186 888 218; baseline 0 -5'>
                    <span class='ocrx_word' id='word_4_0' title='bbox 796 186 888 218'>years</span>
                </span>
                <span class='ocr_line' id='line_5' title='bbox 904 184 977 218; baseline 0 -5'>
                    <span class='ocrx_word' id='word_5_0' title='bbox 904 184 977 218'>1933</span>
                </span>
                <span class='ocr_line' id='line_6' title='bbox 1040 187 1110 218; baseline 0 -5'>
                    <span class='ocrx_word' id='word_6_0' title='bbox 1040 187 1110 218'>1938</span>
                </span>
    

    But the ALTO output from the GUI gives me two xml files, which look like this:

    <alto xmlns="http://www.loc.gov/standards/alto/ns-v2#"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.loc.gov/standards/alto/ns-v2# http://www.loc.gov/standards/alto/v2/alto-2-0.xsd">
       <Description>
          <MeasurementUnit>pixel</MeasurementUnit>
          <sourceImageInformation>
             <fileName/>
          </sourceImageInformation>
          <OCRProcessing ID="IdOcr">
             <ocrProcessingStep>
                <processingSoftware>
                   <softwareName>gcv2hocr.py</softwareName>
                   <softwareVersion>gcv2hocr.py</softwareVersion>
                </processingSoftware>
             </ocrProcessingStep>
          </OCRProcessing>
       </Description>
       <Layout>
          <Page ID="" PHYSICAL_IMG_NR="1" HEIGHT="" WIDTH="">
             <PrintSpace HEIGHT="" WIDTH="" VPOS="0" HPOS="0">
                <ComposedBlock ID="" HEIGHT="1947" WIDTH="1244" VPOS="121" HPOS="176"/>
             </PrintSpace>
          </Page>
       </Layout>
    </alto>
    

    and

    <?xml version="1.0" encoding="utf-8"?>
    <alto xmlns="http://www.loc.gov/standards/alto/ns-v2#"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.loc.gov/standards/alto/ns-v2# http://www.loc.gov/standards/alto/alto.xsd">None2TEspeciallyduringtheyears19331938theGermanun-employmentwasfullyremoved.LikemanyothershealsothoughtthatNationlasocialismvouldcauseaneconomicrisejoiningtheSAinApril1937Inforeigncountriestoo,Nationalsocialismwasnotrecognizedinitslasterfectsinthosedays.Imayremindyouofthefactthate.g.LordRothermeredevotedaspecialcopyofthe"DailyMailtotheNSDAPandaman1iaeMrWinstonChurchillwritesinhisreminiscences:"AtthattimeIhadnonationalprejudicesagainstHitler.Iknewbut1ittleofhisopinionoflifeandpastandhisoharacter.TomymindHitlerwasrighttobeaGerman1ovinghiscountry"Nodoubt,thatevenmoresuchorsimilarutterancesofstatesmenareknown.Atthattimemyhusbandcouldnotforeseethatbyhisjoininghewouldpromoteorsupportacriminalaffair.In1937hewasbusyasanassistantfortheknow-ledgeofkinsattheAnthropologicInstituteoftheUnivezaityofVienna.InSept.1937hepassedtothegeneralSS,becausehecouldbebusyasanivestigatorofkins.WaenAustriauasannexed,hecouldjointheGermanPolice.Afberyearsoftroublesanddistressnowhegotasafepoşitionasanofficial.Whenhewascalledouttothefrontier-guard(controlofpassports)onApril1st,1938hismembershiptothegeneralSSwasextinguished.HislatertransfertotheSDandtotheWafen-SS"wasnotvoluntary.DhusmyhusbanddoesnotbelongtotheciroleofthosemembersoftheSSwhomustbecosideredasCriminalsaccordingtothejudgementsofuremberg,becauseonlythosecounttothemwhoweremembersofthe3SstillfterSept.1st,1939.ThelatercompulsoryassimilationofranksintheSDandthe"Waffen-s"isotconsideredasamembershipothe3Saspertherulingpracticeofall"SpruchkammerInthecourseofageneraltraining-planinin1944myhusbandcametotheKRIPOforthreemonthstobeemployedthereforinformetionpurposes.ThenBourmonthsfollowedat.theSIAPOtobetrained1ateroninother1inesotheGeImanPolice.AstherewasalackofmenattheSTAPO,theycausedthepro-longationofhiscommendandinFebr.1945histransfertotheSTAPO.MyhusbandhasseveraltimestriedtoleavetheSTAFOandf1nallyappliedforbeingemployedasavoluateeratthefront.A1lhisapplicationswererefused.FurthertrialsWouldbeperhapspunishedasadenialofobedienceoradecompo-sitionof,themilitgry.ref.3)InFebr.andMarcha945asamemberoftheArmedForoesofthethenGermanymyhusbandshotdownanalliedterror-flyereachi.e.anenemyeirforce-manwhohadfiredabwomenandchildrenatBensheim/Germanyinalowflight,andthisonaccouatofadirectmilitaryandthereforebindingorderofhisdirectsuperior.Hewasorderedtodosobytheleaderofhisunit,SS-SourmbannführerandcouscillortothegovernmentGIRKEorbyhesdeputySS-sturmbannführerandcouncillortotheKRIPOHELLENBROICHresp.InFébr.1945Girkeaskedbyphonethecom-petentCommanderoftheSIPOSS-OberführerTRUMMLER,whethertheorderissuedfromBerlinbesti1lvalidbywhichterror-flyersweretobelki1led.TrummleransweredintheaffirmativeandP.t.o.</alto>
    

    I've not worked with ALTO formats before, but I'm thinking it shouldn't look like this? Please let me know what you think, any help would be greatly appreciated!

    opened by asor12 21
  • Release v0.2.0?

    Release v0.2.0?

    I think we should create a new release. I started to draft one in GitHub, see https://github.com/UB-Mannheim/ocr-fileformat/releases . However, I am not sure, what has to been done with the release option in the Makefile. Is it enough to increase the version counter? Do you agree that we are now at v0.2.0?

    opened by zuphilip 13
  • Fix conversion from ALTO to PAGE and vice versa

    Fix conversion from ALTO to PAGE and vice versa

    • Fix order of arguments passed
    • Remove shell debugging (-x)
    • Handle input from STDIN
    • Add -convert-to ALTO argument needed for conversion from PAGE to ALTO
    opened by stweil 11
  • Support for google cloud vision 2 hocr by @dinosauria123

    Support for google cloud vision 2 hocr by @dinosauria123

    Works, but ideally:

    • [x] use upstream repo
    • [x] delete temporary files
    • [ ] fall back to max x/y if width height unspecified
    • [ ] maybe port to more flexible language, e.g. python
    opened by kba 11
  • Integrate PRIMA Labs PageConverter

    Integrate PRIMA Labs PageConverter

    Integrates https://github.com/PRImA-Research-Lab/prima-page-converter. Currently supports ALTO -> PAGE conversion but could be extended (also accepts Google Cloud Vision, hocr, older PAGE versions and FRXML).

    @wrznr @maxnth @chreul

    opened by kba 10
  • installation problem under macOS 10.13.6

    installation problem under macOS 10.13.6

    Thanks for the great tool.

    Right now when I run sudo make install I get the following output:

    (base) MacBook-Pro:ocr-fileformat$ sudo make install
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -C vendor check
    # download the dependencies
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -C vendor all
    mkdir -p xsd
    # copy Alto XSD
    cd xsd && ln -sf ../vendor/alto-schema/*/*.xsd . && \
    		for xsd in *.xsd;do \
    			target_xsd=`echo $xsd|sed 's/.//g'|sed 's/-/./'`; \
    			if [ ! -e $target_xsd ];then \
    				mv -f $xsd $target_xsd; \
    			fi; done
    # copy PAGE XSD
    # copy ABBYY XSD
    cd xsd && ln -sf ../vendor/abbyy-schema/*.xsd .
    mkdir -p xslt
    # symlink hocr<->alto as well as the language codes lookup xml
    cd xslt && ln -sf ../vendor/hOCR-to-ALTO/hocr2alto2.0.xsl hocr__alto2.0.xsl
    cd xslt && ln -sf ../vendor/hOCR-to-ALTO/hocr2alto2.1.xsl hocr__alto2.1.xsl
    cd xslt && ln -sf ../vendor/hOCR-to-ALTO/alto2hocr.xsl alto2.0__hocr.xsl
    cd xslt && ln -sf ../vendor/hOCR-to-ALTO/alto2hocr.xsl alto2.1__hocr.xsl
    cd xslt && ln -sf ../vendor/hOCR-to-ALTO/hocr2text.xsl hocr__text.xsl
    cd xslt && ln -sf ../vendor/hOCR-to-ALTO/alto2text.xsl alto__text.xsl
    cd xslt && ln -sf ../vendor/hOCR-to-ALTO/codes_lookup.xml codes_lookup.xml
    cd xslt && ln -sf ../vendor/format-converters/page2hocr.xsl page__hocr.xsl
    cd xslt && ln -sf alto2.0__alto3.0.xsl alto2.0__alto3.1.xsl
    cd xslt && ln -sf alto2.0__alto3.0.xsl alto2.1__alto3.0.xsl
    cd xslt && ln -sf alto2.0__alto3.0.xsl alto2.1__alto3.1.xsl
    mkdir -p /usr/local/share/ocr-fileformat
    cp -r script xsd xslt vendor lib.sh /usr/local/share/ocr-fileformat
    mkdir -p /usr/local/bin
    sed '/^SHAREDIR=/c SHAREDIR="/usr/local/share/ocr-fileformat"' bin/ocr-transform.sh > /usr/local/bin/ocr-transform
    sed: 1: "/^SHAREDIR=/c SHAREDIR= ...": command c expects \ followed by text
    make: *** [install] Error 1
    

    The Docker image runs fine however.

    What am I doing wrong?

    Thanks again

    opened by jtlz2 9
  • Convert Google Cloud Vision OCR output to hocr.

    Convert Google Cloud Vision OCR output to hocr.

    I have a question.

    I try to use Google Cloud Vision API to OCR.

    https://cloud.google.com/vision/

    The output of the OCR results including the position of the texts.

    I want to convert Google OCR output to hocr format, do you have any ideas ?

    I already talked this subject here. Please check our previous discussions.

    https://github.com/tmbdev/hocr-tools/issues/26

    opened by dinosauria123 9
  • New Saxon version 10.2 is out

    New Saxon version 10.2 is out

    We can update to the new Saxon version 9.9.1.7 which is out since some days:

    https://sourceforge.net/projects/saxon/files/Saxon-HE/9.9/

    https://sourceforge.net/projects/saxon/files/Saxon-HE/9.9/SaxonHE9-9-1-7J.zip/download

    In principle this only means a similar commit like in https://github.com/UB-Mannheim/ocr-fileformat/commit/4faff379843f4923960cbba6cbbd0a741fb4ffe6 but this should be tested then also.

    opened by zuphilip 8
  • Proxy support

    Proxy support

    When a HTTP proxy is needed, conversion from PAGE to ALTO is failing:

    # ocrd-fileformat-transform -I OCR-D-GT-PAGE -O ALTO
    14:36:13.086 INFO ocrd-fileformat-transform - page --> alto: input file OCR-D-GT-PAGE_00000024 (PHYS_0024)
    java.net.ConnectException: Connection timed out (Connection timed out)
            at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
            at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
            at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
            at java.base/java.net.Socket.connect(Socket.java:609)
            at java.base/java.net.Socket.connect(Socket.java:558)
            at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
            at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
            at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
            at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
            at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
            at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
            at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253)
            at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
            at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
            at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
            at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
            at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
            at java.base/java.net.URL.openStream(URL.java:1140)
            at org.primaresearch.io.xml.XmlValidator.getSchema(XmlValidator.java:53)
            at org.primaresearch.dla.page.io.xml.XmlPageWriter_Alto.run(XmlPageWriter_Alto.java:200)
            at org.primaresearch.dla.page.io.xml.XmlPageWriter_Alto.write(XmlPageWriter_Alto.java:115)
            at org.primaresearch.dla.page.converter.PageConverter.run(PageConverter.java:282)
            at org.primaresearch.dla.page.converter.PageConverter.main(PageConverter.java:161)
    Could not initialise ALTO XML writer
    java.lang.NullPointerException
            at org.primaresearch.dla.page.io.xml.XmlPageWriter_Alto.run(XmlPageWriter_Alto.java:200)
            at org.primaresearch.dla.page.io.xml.XmlPageWriter_Alto.write(XmlPageWriter_Alto.java:115)
            at org.primaresearch.dla.page.converter.PageConverter.run(PageConverter.java:282)
            at org.primaresearch.dla.page.converter.PageConverter.main(PageConverter.java:161)
    14:38:23.306 ERROR ocrd-fileformat-transform - Transformation exited with return value 0 but no file was written.
    

    Unfortunately with the network setup here, this also is a long wait for a connection error because packets are simply dropped...

    The preferred solution for me would be that ocr-fileformat would parse the somewhat standard http_proxy environment variable and passes the correct parameter to java:

    java -Dhttp.proxyHost=http-proxy.sbb.spk-berlin.de -Dhttp.proxyPort=3128 [...other parameters...]
    
    opened by mikegerber 7
  • alto to text: too many spaces

    alto to text: too many spaces

    Example alto excerpt:

    <TextLine><String CONTENT="Wappen:"/><SP/><String CONTENT="Heimstatt;"/><SP/><String CONTENT="Heimstatt,">... ...
    

    converts to text

    Wappen:␣␣Heimstatt;␣␣Heimstatt,␣␣Neipperg,␣␣Gemmingen ... ...
    
    opened by jbarth-ubhd 7
  • :arrow_up: Upgrade to new version of hOCR-to-ALTO

    :arrow_up: Upgrade to new version of hOCR-to-ALTO

    This solves #95 and #81 also no special features of ALTO 3.0 or ALTO 4.0 are considered in the transformations, but this would be anyways something for upstream.

    opened by zuphilip 6
  • Feature request: Page concatenation during conversion

    Feature request: Page concatenation during conversion

    Transkribus (https://readcoop.eu/transkribus/?sc=Transkribus), which just reached 100 000 users, export PAGE and ALTO as a single file for every page and the actual page numbers are not stored in the files. In my workflow ALTO -> hOCR-> dsed I have to edit the page numbers in *.dsed files before using them as a valid djvused input (to use the transcription as the hidden text layer in a DjVu document). It would be nice to solve the problem in a general and elegant way.

    opened by jsbien 0
  • [feature request] Support MacOS

    [feature request] Support MacOS

    The current bash scripts contain code which does not work on MacOS out of the box (incompatible usage of sed, associative arrays, maybe more). Users are forced to install newer versions of bash and sed (which might be undesired) to run it.

    Perhaps all bash scripts should be replaced by Python3 scripts. python3 is already used in the code, and using it everywhere might even simplify the code. At least it would be portable. It would even be possible to provide ocr-fileformat in the Python Package Index PyPI.

    enhancement 
    opened by stweil 0
  • page__text.xsl is not honoring the reading order

    page__text.xsl is not honoring the reading order

    page__text.xsl is not honoring the reading order in the PAGE-XML (pc:ReadingOrder), which gives completely false results. For this page, I get this text (shortened):

    % docker run --rm -it -v "$PWD":/data ubma/ocr-fileformat ocr-transform page text OCR-D-GT-PAGE/OCR-D-GT-PAGE_00000024.xml | head
                   
    20
    Die
    [22.]
    [22.]
    ein gleies vorgegeben, und ſo gar ſehr viele mahle gegen ae menſlie Mglikeit mit Gewalt for-
    ciret worden zu ſeyn, behaupten wi, mithin neb dem Bredekaw, weler (§. 28. 29.)  in aen ſeinen
    Auagen wiederſproen, mit der Pœna fal um do gewier zu belegen i, da
    ſecund. Farin. Tit. 9. qu. 66. p. m. 320.
    die Klage ſo wohl als das Zeugnß vor falſ und erditet mßen gehalten werden.
    §. 35) So viel die von der Inquitin
    write /dev/stdout: broken pipe
    

    For comparison, dinglehopper-extract gives the correct text:

    % dinglehopper-extract OCR-D-GT-PAGE/OCR-D-GT-PAGE_00000024.xml| head
    20
    rath mit einer Pœna fiſcali angeſehen worden, und ſolche durch des Hrn. Graffen von Königsfeld Vor-
    ſpruch, nur aus Gnaden nachgelaſſen erhalten.
    Sondern man hat auch dieſen 4. Wochen lang alle Abend bey der Inquiſitin gantz allein gelaſſen.
    Binnen welcher gantzer Zeit der Schreiber Bredekaw beſtändig bey Ihme geweſen, und ſich in
    der am 13 ten Octobr. a.c. in Judicio gegen ſeinen geweſenen Hrn. introducirter Appellation deſſen Bey-
    raths bedienet hat;
    §. 33) Dabenebenſt iſt der Schreiber binnen dieſer gantzen Zeit auf freyem Fuß geblieben, und
    hat nicht nur durch ſeinen Conſulenten, ſondern auch, weilen der Inquiſitin ſelbſten in Ihrem Gefängnüß
    ſo viele Freyheit gelaſſen worden, daß ſie frembden Beſuch von Ihren Anverwandten ohngehindert em-
    

    Image from the ZIP (converted to JPEG), for easier understanding:

    OCR-D-IMG_00000024

    bug enhancement 
    opened by mikegerber 6
  • Web interface in Docker container/ Error when uploading document:

    Web interface in Docker container/ Error when uploading document: "Must be either POST with the field 'file'...."

    I am running the Web service in a Docker container. When trying to upload and process a file, I am getting the following Error: Must be either POST with file field 'file' or GET with param 'url'.

    Bildschirmfoto 2021-05-13 um 12 37 58

    Environment:

    • MacOS 11.3.1
    • Docker Engine v20.10.0
    • ocr-transform v0.4.0
    opened by cboulanger 2
  • Google Cloud Vision to PAGE-XML

    Google Cloud Vision to PAGE-XML

    It was mentioned before but @cneud just reminded me of https://github.com/PRImA-Research-Lab/cloud-vision-ocr-to-page . Should not be too hard to integrate and would allow using GCV results in OCR-D/Transkribus/OCR4all.

    BTW: Has anyone experience with the Azure Computer Vision API in the context of OCR? As a sign of goodwill in times of Covid-19, they are currently offering a generous free tier including access to the vision API. Would be interesting to compare.

    opened by kba 5
Releases(v0.5.0)
  • v0.5.0(Nov 8, 2022)

    What's Changed

    • ⬆️ Update JPageConverter to 1.5.05 by @mikegerber in https://github.com/UB-Mannheim/ocr-fileformat/pull/131
    • update hocr2alto to include filak/hOCR-to-ALTO#23 by @kba in https://github.com/UB-Mannheim/ocr-fileformat/pull/130
    • page schemas: use github not primaresearch.org by @kba in https://github.com/UB-Mannheim/ocr-fileformat/pull/132
    • Page to alto python by @kba in https://github.com/UB-Mannheim/ocr-fileformat/pull/134
    • [doc][fix] clear README cli links by @M3ssman in https://github.com/UB-Mannheim/ocr-fileformat/pull/141
    • Add ImageWare MyBib to ALTO conversion by karkraeg, fix #139 by @kba in https://github.com/UB-Mannheim/ocr-fileformat/pull/140
    • page__alto: process all arguments by @bertsky in https://github.com/UB-Mannheim/ocr-fileformat/pull/142
    • when converting to PAGE, always use latest schema by @bertsky in https://github.com/UB-Mannheim/ocr-fileformat/pull/146
    • docker: unlimit POST upload size, #136 by @kba in https://github.com/UB-Mannheim/ocr-fileformat/pull/137
    • Update Saxon-HE by @stweil in https://github.com/UB-Mannheim/ocr-fileformat/pull/144
    • Use git submodules by @stweil in https://github.com/UB-Mannheim/ocr-fileformat/pull/148
    • update page-to-alto by @bertsky in https://github.com/UB-Mannheim/ocr-fileformat/pull/152
    • page to text: rewrite by @bertsky in https://github.com/UB-Mannheim/ocr-fileformat/pull/151
    • Update SaxonHE to version 11.2 by @stweil in https://github.com/UB-Mannheim/ocr-fileformat/pull/149
    • vendor/Makefile: page-to-alto is phony by @bertsky in https://github.com/UB-Mannheim/ocr-fileformat/pull/154

    New Contributors

    • @mikegerber made their first contribution in https://github.com/UB-Mannheim/ocr-fileformat/pull/131
    • @M3ssman made their first contribution in https://github.com/UB-Mannheim/ocr-fileformat/pull/141
    • @bertsky made their first contribution in https://github.com/UB-Mannheim/ocr-fileformat/pull/142

    Full Changelog: https://github.com/UB-Mannheim/ocr-fileformat/compare/v0.4.0...v0.5.0

    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Sep 18, 2020)

  • v0.3.2(Jul 9, 2020)

  • v0.3.1(Jun 25, 2020)

  • v0.3.0(Jan 9, 2020)

  • v0.2.3(Dec 11, 2017)

  • v0.2.2(Dec 10, 2017)

  • v0.2.1(Feb 27, 2017)

    • Docker fixes (busybox/alpine incompatibilities + allow overriding web config) and add documentation for Docker https://github.com/UB-Mannheim/ocr-fileformat/pull/33, https://github.com/UB-Mannheim/ocr-fileformat/pull/45, https://github.com/UB-Mannheim/ocr-fileformat/pull/53
    • Update URLs to ABBYY schemas, add new PAGE format 2016-07-15 https://github.com/UB-Mannheim/ocr-fileformat/commit/fded289165d557ba016fc83f5fbbf034295313eb
    • Switch to official filak/hOCR-to-ALTO repo, linking language codes lookup xml https://github.com/UB-Mannheim/ocr-fileformat/pull/48, https://github.com/UB-Mannheim/ocr-fileformat/issues/46, https://github.com/UB-Mannheim/ocr-fileformat/pull/52
    Source code(tar.gz)
    Source code(zip)
    ocr-fileformat_0.2.1.tar.gz(4.48 MB)
    ocr-fileformat_0.2.1.zip(4.54 MB)
  • v0.2.0(Sep 13, 2016)

    • Add option to run arbitrary scripts: In addition to XSD/XSLT, arbitrary executable scripts can be placed in ./script/validate and ./script/transform/, written in Python, bash or compiled C code.
    • Validation: hocr against hocr-check from tmbdev/hocr-tools
    • Web interface: Download button for transformation results
    • Web interface: Support file uploads for transformation and validation
    • Enable ALTO/hocr to plain text transformations
    • Code cleanup of the shared shell script library

    More details: https://github.com/UB-Mannheim/ocr-fileformat/compare/v0.1.0...v0.2.0

    Source code(tar.gz)
    Source code(zip)
    ocr-fileformat_0.2.0.tar.gz(4.48 MB)
    ocr-fileformat_0.2.0.zip(4.53 MB)
  • v0.0.2(Sep 12, 2016)

    • Add transformation from alto2 to alto3: alto2.0__alto3.0.xsl. Thanks to @cneud !
    • Normalize project name and fix some links
    • Makefile: release goal

    More details: https://github.com/UB-Mannheim/ocr-fileformat/compare/v0.0.1...v0.0.2

    Source code(tar.gz)
    Source code(zip)
  • v0.0.1(May 18, 2016)

Owner
Universitätsbibliothek Mannheim
Mannheim University Library
Universitätsbibliothek Mannheim
Tools for manipulating and evaluating the hOCR format for representing multi-lingual OCR results by embedding them into HTML.

hocr-tools About About the code Installation System-wide with pip System-wide from source virtualenv Available Programs hocr-check -- check the hOCR f

OCRopus 285 Dec 8, 2022
PAGE XML format collection for document image page content and more

PAGE-XML PAGE XML format collection for document image page content and more For an introduction, please see the following publication: http://www.pri

PRImA Research Lab 46 Nov 14, 2022
Page to PAGE Layout Analysis Tool

P2PaLA Page to PAGE Layout Analysis (P2PaLA) is a toolkit for Document Layout Analysis based on Neural Networks. ?? Try our new DEMO for online baseli

Lorenzo Quirós Díaz 180 Nov 24, 2022
Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)

English | 简体中文 Introduction PaddleOCR aims to create multilingual, awesome, leading, and practical OCR tools that help users train better models and a

null 27.5k Jan 8, 2023
OCR-D-compliant page segmentation

ocrd_segment This repository aims to provide a number of OCR-D-compliant processors for layout analysis and evaluation. Installation In your virtual e

OCR-D 59 Sep 10, 2022
It is a image ocr tool using the Tesseract-OCR engine with the pytesseract package and has a GUI.

OCR-Tool It is a image ocr tool made in Python using the Tesseract-OCR engine with the pytesseract package and has a GUI. This is my second ever pytho

Khant Htet Aung 4 Jul 11, 2022
Indonesian ID Card OCR using tesseract OCR

KTP OCR Indonesian ID Card OCR using tesseract OCR KTP OCR is python-flask with tesseract web application to convert Indonesian ID Card to text / JSON

Revan Muhammad Dafa 5 Dec 6, 2021
This is a passport scanning web service to help you scan, identify and validate your passport created with a simple and flexible design and ready to be integrated right into your system!

Passport-Recogniton-System This is a passport scanning web service to help you scan, identify and validate your passport created with a simple and fle

Mo'men Ashraf Muhamed 7 Jan 4, 2023
Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.

Deskew by Marek Mauder https://galfar.vevb.net/deskew https://github.com/galfar/deskew v1.30 2019-06-07 Overview Deskew is a command line tool for des

Marek Mauder 127 Dec 3, 2022
Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.

EasyOCR Ready-to-use OCR with 80+ languages supported including Chinese, Japanese, Korean and Thai. What's new 1 February 2021 - Version 1.2.3 Add set

Jaided AI 16.7k Jan 3, 2023
Text page dewarping using a "cubic sheet" model

page_dewarp Page dewarping and thresholding using a "cubic sheet" model - see full writeup at https://mzucker.github.io/2016/08/15/page-dewarping.html

Matt Zucker 1.2k Dec 29, 2022
Deep learning based page layout analysis

Deep Learning Based Page Layout Analyze This is a Python implementaion of page layout analyze tool. The goal of page layout analyze is to segment page

null 186 Dec 29, 2022
ocroseg - This is a deep learning model for page layout analysis / segmentation.

ocroseg This is a deep learning model for page layout analysis / segmentation. There are many different ways in which you can train and run it, but by

NVIDIA Research Projects 71 Dec 6, 2022
a deep learning model for page layout analysis / segmentation.

OCR Segmentation a deep learning model for page layout analysis / segmentation. dependencies tensorflow1.8 python3 dataset: uw3-framed-lines-degraded-

null 99 Dec 12, 2022
This repository lets you train neural networks models for performing end-to-end full-page handwriting recognition using the Apache MXNet deep learning frameworks on the IAM Dataset.

Handwritten Text Recognition (OCR) with MXNet Gluon These notebooks have been created by Jonathan Chung, as part of his internship as Applied Scientis

Amazon Web Services - Labs 422 Jan 3, 2023
Simple app for visual editing of Page XML files

Name nw-page-editor - Simple app for visual editing of Page XML files. Version: 2021.02.22 Description nw-page-editor is an application for viewing/ed

Mauricio Villegas 27 Jun 20, 2022
~1000 book pages + OpenCV + python = page regions identified as paragraphs, lines, images, captions, etc.

cosc428-structor I had an open-ended Computer Vision assignment to complete, and an out-of-copyright book that I wanted to turn into an ebook. Convent

Chad Oliver 45 Dec 6, 2022
Turn images of tables into CSV data. Detect tables from images and run OCR on the cells.

Table of Contents Overview Requirements Demo Modules Overview This python package contains modules to help with finding and extracting tabular data fr

Eric Ihli 311 Dec 24, 2022