SAA 2014 Pre-conference Workshop - OCRing with Open Source Tools

Matt Christy
Matt ChristyLead Software Applications Developer
USING OPEN SOURCE OCR
TOOLS FOR DIGITIZATION
PROJECTS
Matthew J. Christy
Intro – Me
• Matthew J. Christy
• Lead Software Applications Developer at the Initiative for Digital
Humanities, Media and Culture (IDHMC) at Texas A&M University
• @matt_christy
• idhmc.tamu.edu
• @idhmc_nexus
• Co-project manager of the Early Modern OCR Project (eMOP)
• emop.tamu.edu
• #emop
• Former Systems/Electronic Resources Librarian
Tuesday, August 12, 2014 Open Source OCR Tools 2
Intro – You
• Name & Institution
• Experience with OCR
• What’s your project or what are you bringing with you?
Tuesday, August 12, 2014 Open Source OCR Tools 3
Intro – Outline
• OCR & Open Source Engines
• Digitization vs OCR
• Tesseract
• OCROpus
• Gamera
• Setup
• Installing Tesseract
• Installing Aletheia
• Installing Franken+
• Installing ImageMacick / GIMP
• Running Tesseract (default)
• Identifying issues with your page
images
• What’s your font?
• Image quality problems
• Pre-processing
• Binarization
• Cropping
• “de”-ing (noise, skew, warp, etc.)
• Training Tesseract for your font
• Tesseract’s native training mechanism
• When more is needed
• Aletheia
• Franken+
• Word lists
• Common transformation errors
• Running Tesseract (your training)
• Your results
• Comparing OCR results to Groundtruth
• Creating Groundtruth
• Post-processing
• Hand correction
• Crowd-source correction
• eMOP tools
4Tuesday, August 12, 2014 Open Source OCR Tools
OCR & Open Source Engines
Digitization vs. OCR
• Digitization is the creation of a digital representation of an
object.
• In the print world, a digital image of a page: page image
• end product: image files (.tif .jpg .png .pdf)
• Optical Character Recognition (OCR) is the use of
software to recognize the characters on a page image
and turn that into text.
• text that is searchable, and editable
• end product: text files (.txt .rtf .doc .pdf)
Tuesday, August 12, 2014 Open Source OCR Tools 5
Tesseract
• Developed by Ray Smith at HP
• Taken up by Google
• Used in their Google Books mass-digitization & OCR
program
• Open Source: code.google.com/p/tesseract-ocr/
• version 3.02
• Windows, Mac and UNIX
• Documentation is not always helpful
• User group: groups.google.com/forum/ - !forum/tesseract-ocr
• Training for various scripts and languages available
• Lots of users, so Google it
Tuesday, August 12, 2014 Open Source OCR Tools 6
OCR Opus
• Developed by Thomas Breuel
• Originally used Tesseract for character recognition
• Was not under active development for a while, but a new
version is now available
• Open Source: code.google.com/p/ocropus/
• version 0.7
• Windows, Mac & UNIX
• User group: groups.google.com/forum/ - !forum/ocropus
Tuesday, August 12, 2014 Open Source OCR Tools 7
Gamera
• Developed by Ichiro Fujinaga (McGill University)
• Designed to OCR music
• It’s actually the Gamera OCR Toolkit that you want
• Open Source:
gamera.informatik.hsnr.de/addons/ocr4gamera/
• version 1.1.0 (Jun, 2014)
• Windows, Mac and UNIX
• User group: groups.yahoo.com/neo/groups/gamera-devel/info
• Training can take a while.
• emop.tamu.edu/Gamera-OCR
Tuesday, August 12, 2014 Open Source OCR Tools 8
Installing Tesseract
• Mac: emop.tamu.edu/Installing-Tesseract-Mac
• PC: emop.tamu.edu/Installing-Tesseract-PC
• code.google.com/p/tesseract-ocr/wiki/ReadMe
• Standard English-language training:
code.google.com/p/tesseract-ocr/downloads/list (tesseract-ocr-
3.02.eng.tar.gz)
> combine_tessdata -u eng.traineddata ../unpacked/eng
> dawg2wordlist eng.unicharset eng.word-dawg eng-word-
list.txt
Tuesday, August 12, 2014 Open Source OCR Tools 9
Installing Aletheia
• Windows only
• Download the zip file
• www.primaresearch.org/tools/Aletheia
• Click the Download the previous version button (v2.1)
• Run executable file
Tuesday, August 12, 2014 Open Source OCR Tools 10
Installing Franken+
• Windows only
• Download the zip file
• dh-emopweb.tamu.edu/Franken+/
• Install executable file
• Requirements:
• .NET Framework 4.5 (standard on Windows 8)
• a local MySQL server with root username
(MySQL Community Server 5.6)
• See emop.tamu.edu/Installing-FrankenPlus for more instructions
Tuesday, August 12, 2014 Open Source OCR Tools 11
Installing ImageMagick/GIMP
• Two good free image manipulation programs available for
Windows, Mac and Unix
• ImageMagick
• typically command-line but has a limited graphical interface
inWindows
• www.imagemagick.org/
• GIMP (GNU Image Manipulation Program)
• has a graphical user interface for all platforms
• www.gimp.org/
Tuesday, August 12, 2014 Open Source OCR Tools 12
Running Tesseract with default training
> tesseract <page image> <outfile> -l <lang> <config file>
• Where:
• <outfile> is the name of the of the .txt and .html files to be created
• <lang> is the “language name” you gave your training, i.e. what you
called your typeface training set
• <config file> is a file name containing some configuration information for
Tesseract
• “tessedit_create_hocr 1” produces hOCR (HTML) output
• Tesseract’s default output is text only
• Tesseract’s default <lang> in “eng” their standard english-language
training
Tuesday, August 12, 2014 Open Source OCR Tools 13
Identifying issues with your page images
What’s your font?
• OCR engines need to be trained on the typeface they will
be trying to recognize
• Modern fonts (fonts available via a word processor) make
it easy to train an OCR engine
• Other fonts (bus signs, secretary hand, early modern
fonts) require special training procedures
Tuesday, August 12, 2014 Open Source OCR Tools 14
WhatTheFont
• www.myfonts.com/WhatTheFont/
• crop your page image down to a section of 20 or so letters (<2 MB)
• try to find some distinctive characters
• submit, then help identify the characters found
Tuesday, August 12, 2014 Open Source OCR Tools 15
Image Quality Issues
• Small file size/resolution
(< 300 dpi)
• Noise
• Bleedthrough
• Over/under inking
• Skew
• Warp
Tuesday, August 12, 2014 Open Source OCR Tools 16
Pre-processing
• There are pre-processing algorithms available to fix most of
these issues
• Very useful if you have a small number of documents, or if you
know that all your documents have the same issues (need the
same pre-processing)
• Can dramatically improve OCR results
• Tools:
• GIMP: www.gimp.org/
• ImageMagick: www.imagemagick.org/
• (www.fmwconcepts.com/imagemagick)
Tuesday, August 12, 2014 Open Source OCR Tools 17
Binarization
• Converting to Black & White
• ImageMagick:
> convert <infile> -colorspace gray +dither -colors 2 -
normalize  <outfile>
• Fred’s scripts
> otsuthresh <in> <out>
> localthresh
• GIMP
• Image -> Mode -> Indexed ...
• Tools -> Color Tools… -> Threshold…
Tuesday, August 12, 2014 Open Source OCR Tools 18
Cropping
• Sometimes it helps to crop images to:
• remove noise
• remove unwanted elements (rulers, fingers, note cards, etc.)
• separate multi-page images
• It can also reduce the length of time needed to pre-
process
• Only feasible with a small number of documents
• Can use:
• GIMP
• Paint
• Preview
Tuesday, August 12, 2014 Open Source OCR Tools 19
Denoise
• or “Despeckle”
• Removes speckles from page image
• There’s a trade-off
• Being too aggressive can reduce the integrity of the glyphs
• ImageMagick:
> convert <infile> -noise 1 <outfile>
> convert <infile> -despeckle <outfule>
• GIMP:
• Filters -> Enhance -> Despeckle …
• Try it multiple times, but watch your glyph
integrity
Tuesday, August 12, 2014 Open Source OCR Tools 20
Deskew
• or “Rotate” or “Auto-straighten”
• ImageMagick:
• Fred’s scripts:
> sh ./skew.sh -a 2 -m degrees -d b2r
-v background <infile> <outfile>
• GIMP:
• There’s a plugin, but I couldn’t get it
installed
• registry.gimp.org/node/2958
Tuesday, August 12, 2014 Open Source OCR Tools 21
Dewarp
• Dealing with warping (for example, when a page bends
due to a tight or think spine) is much trickier.
Tuesday, August 12, 2014 Open Source OCR Tools 22
Training Tesseract for your font
• The difference between Training and OCRing
• You may end up using some of the documents you want to OCR to
create the training.
Tuesday, August 12, 2014 Open Source OCR Tools 23
• Training:
• Binarize
• Clean
• Aletheia: Find glyphs
(unicode values and
coordinates on page)
• Franken+: choose best
exemplars of glyphs
• Add word lists (optional)
• Process to create Tesseract
training data
• OCRing:
• Binarize
• Clean (if possible)
• OCR with Tesseract
Training Tesseract for your font
Tuesday, August 12, 2014 Open Source OCR Tools 24
code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3
When more is needed
Tuesday, August 12, 2014 Open Source OCR Tools 25
Aletheia: PRImA Research Labs
www.primaresearch.org/
tools/Aletheia
Franken+
dh-
emopweb.tamu.edu/Fra
nken+/
See: Aletheia/Franken+ Quick Start Guide for
more information
Aletheia
Open Source OCR Tools
26
www.primaresearch.org/tools.p
hp
Available for free but requires
registration.
• Created by PRImA Research Labs,
University of Salford, UK.
• Windows based tool.
• Developed as a groundtruth
creation tool
• Used by eMOP undergraduate
student workers to create training of
desired typeface for Tesseract.
• Can identify glyphs on a page image
with page coordinates and Unicode
values.
Tuesday, August 12, 2014 Open Source OCR Tools
Aletheia:Workflow
Open Source OCR Tools
27
• Binarization and Denoise are native Aletheia functions
• A team of Undergraduate student workers refines and corrects glyph
boxes and unicode values, where needed.
• Output: A set of PAGE XML files with page coordinates and unicode
values for every identified glyph on each processed TIFF image.
Tuesday, August 12,
2014
Open Source OCR ToolsTuesday, August 12, 2014
Aletheia: Glyph Recognition
Open Source OCR Tools
28
Uses Tesseract to find glyphs
Tuesday, August 12, 2014 Open Source OCR Tools
Aletheia: I/O
Open Source OCR Tools
29
We then convert PAGE XML
file to Tesseract Box file using
XSLT
Tuesday, August 12, 2014 Open Source OCR Tools
Tesseract Training
Open Source OCR Tools
30Tuesday, August 12, 2014 Open Source OCR Tools
Franken+
1. Windows based tool that uses a
MySQL DB.
2. Developed for eMOP by IDHMC
Graduate student worker Bryan
Tarpley.
3. Designed to be easily used by eMOP
Undergraduate student workers
4. Takes Aletheia's output files as input.
5. Outputs the same box files and TIFF
images that Tesseract's first stage of
native training.
• Available open-source at:
github.com/idhmc-tamu/FrankenPlus
Open Source OCR Tools
31Tuesday, August 12, 2014 Open Source OCR Tools
Franken+Workflow
Open Source OCR Tools
32
1. Groups all glyphs with the
same Unicode values into
one window for
comparison.
2. Uses all selected glyphs
to create a Franken-page
image (TIFF) using a
selected text as a base.
3. Outputs the same box
files and TIFF images
that Tesseract's first stage
of native training.
Tuesday, August 12,
2014
Open Source OCR ToolsTuesday, August 12, 2014
Franken+ Ingestion
Open Source OCR Tools
33Tuesday, August 12, 2014 Open Source OCR Tools
Franken+
Open Source OCR Tools
34
• All exemplars of the
same glyph are
displayed together.
• Users can quickly
identify and deselect:
• Incorrectly labeled
glyphs
• Incomplete glyphs
• Unrepresentative
exemplars
• Different sized glyphs
Tuesday, August 12, 2014 Open Source OCR Tools
Open Source OCR Tools
35
Franken+
Tuesday, August 12, 2014 Open Source OCR Tools
TrainingTesseract
Open Source OCR Tools
36
Thiſ great conſumption to a fever turn'd,
And ſo the oꝗld had fitſ; it joy'd, it mourn'd;
And, aſ men thinke, that Agueſ phy ck are,
And th'Ague being ſpent, give over care.
Žo thou cke World, mꝗꝗak'ꝗ thy ſelże to bee
Well, when ãlaſ, thou'rt in a Lethargie.
Her death did wound and tame thee than, and than
Thou might'ꝗ ha e better ſpar'd the Sunne, or man.
That wound waſ deep, but 'tiſ more miżery,
That thou haꝗ loꝗ thy ſenſe and memor .
'Twaſ heavy then to heare thy voyce of mone,
But thiſ iſ worſe, that thou art ſpeechle e growne.
Thou haꝗ forgot thy name thou hadꝗ; thou waꝗ
Nothing but ee, and her thou haꝗ o'rpaꝗ.
For aſ a child kept from the Fount, untill
Ä prince, expe ed long, come to fulfill
The ceremonieſ, thou unnam'd had'ꝗ laid,
Had not her comming, thee her palace made:
Her name defin'd thee, gave thee forme, and frame,
And thou forgett'ꝗ to celebrate th n me.
Some monethſ e hath beene dead (but beìng dead,
Meaſureſ of timeſ are all determined)
But long e'ath beene away, long, long, et none
Offerſ to tell uſ who it iſ that'ſ gone.
But aſ in ꝗateſ doubtfull of future heireſ,
When ckne e without remedie empaireſ
The preſent Prince, they're loth it ould be ſaid,
The Prince doth langui , or the Prince iſ dead:
So mankinde feeling no a generall tha ,
Tuesday, August 12, 2014 Open Source OCR Tools
F+TraininigText.txt
When more is needed
Tuesday, August 12, 2014 Open Source OCR Tools 37
Tesseract – Word Lists
• Tesseract has the ability to use word lists or dictionaries to look up
words while scanning.
• Word lists help Tesseract decide what a word is when it’s not sure.
• Takes advantage of the character confidence score that Tesseract computes
while scanning.
• This character confidence info is lost when the hOCR output is created.
• DAWG (Directed Acyclic Word Graph) files (8)
• word-dawg: A dawg made from dictionary words from the language.
• freq-dawg: A dawg made from the most frequent words which would have
gone into word-dawg.
• punc-dawg: A dawg made from punctuation patterns found around words.
The "word" part is replaced by a single space.
• number-dawg: A dawg made from tokens which originally contained digits.
Each digit is replaced by a space character.
Tuesday, August 12, 2014 Open Source OCR Tools 38
Tesseract – Word Lists
• Collect a word list
• spellcheckers (ispell, aspell, hunspell) – check the license
• period specific works will require period specific word lists
• dh-emopweb.tamu.edu/eebo-word-freq.php
• emop.tamu.edu/Early-Modern-Word-List
• You can also take Google’s eng.traineddata file apart and use their
word list. (combine_tessdata –u, dawg2wordlist)
• Format: one word per line, no other info, UTF-8.
• If you have a word count associated with your list then split it into
two lists: frequent and other.
• Apply wordlist2dawg application to create dawg files.
Tuesday, August 12, 2014 Open Source OCR Tools 39
Tesseract – Ambiguity and Transformation
Errors
• Tesseract, like all OCR engines, can make consistent
transformation errors across pages, documents and
collections.
• m  rn
• ri  n
• 1)  D
• Tesseract’s ambiguous characters file to helps it to correct
some of these errors while it’s OCRing
• Can also be used to force substitutions
• st  st
• ſ  s
• The name of the file is <lang>.unicharambigs
Tuesday, August 12, 2014 Open Source OCR Tools 40
tesseract-ocr.googlecode.com/svn-history/r683/trunk/doc/unicharambigs
Tesseract – .unicharambigs file
• Type Indicator:
0: Substitute B for A if doing
so produces a word in the
dictionary.
1: Always substitute B for A.
• This really only works for
substitutions where at least
one side is multiple
characters.
The .unicharambigs file
must end with a blank line
(/n) at the bottom of the file.
Tuesday, August 12, 2014 Open Source OCR Tools 41
Running Tesseract with your training
> tesseract <page image> <outfile> -l <lang> <config file>
• on my computer:
• go to: C:Program Files (x86)Tesseract-OCR
• > tesseract C:UsersIDHMCDesktopocr-test-
files2633700005.000.001.tif C:UsersIDHMCocr-test-
files26337eebo32989-out-test-1 -l <lang> tess_cfg.txt
Tuesday, August 12, 2014 Open Source OCR Tools 42
Tesseract – Results
• hOCR file
• XML-like .html file & .txt file (tessedit_create_hocr option)
• creates blocks for page, areas, paragraphs, lines, and words
• each block contains page coordinates
• words contain confidence values (version 3.02.03)
Tuesday, August 12, 2014 Open Source OCR Tools 43
Comparing OCR text to Groundtruth
• Juxta-cl (command line)
• created for eMOP
• based on JuxtaCommons tool (juxtacommons.org/)
• several different comparison algorithms to choose from and other
options
• open-source: github.com/performant-software/juxta-cl
• java-based tool run from command line
• Download: emop.tamu.edu/Installing-JuxtaCL
• ocrevalUAtion
• created for Succeed (www.succeed-project.eu/)
• java-based tool
• open-source: sites.google.com/site/textdigitisation/ocrevaluation
Tuesday, August 12, 2014 Open Source OCR Tools 44
Creating Groundtruth
• Aletheia was developed as a groundtruth creation tool for
Succeed.
• Use it to process some of your page images to quickly produce
corrected full-text.
• Worth the effort if you have a large collection
Tuesday, August 12, 2014 Open Source OCR Tools 45
Post Processing
• No OCR is perfect. It will need to be corrected.
• Hand Correction
• The most thorough way, but time consuming.
• Proofread Page: A media wiki extension
(www.mediawiki.org/wiki/Extension:Proofread_Page)
• Crowdsourced Correction
• Give it to the c(l/r)owd
• Tools:
• Online collaborative manuscript transcription tools
• FromThePage: beta.fromthepage.com/ (github.com/benwbrum/fromthepage/wiki)
• T-Pen: t-pen.org
• Scripto: scripto.org
Tuesday, August 12, 2014 Open Source OCR Tools 46
eMOP Post Processing
• Open source tools for:
• scoring OCR results without groundtruth
• estimating the correctability of a page
• removing noise (i.e. junk that Tesseract identifies as words)
• correcting OCR results using dictionaries and google 3-grams
• gitlab.tamu.edu/groups/emop
• Other tools:
• succeed-project.eu/publications/available-tools/index-succeed
Tuesday, August 12, 2014 Open Source OCR Tools 47
The end
mchristy@tamu.edu
48Tuesday, August 12, 2014 Open Source OCR Tools
1 of 48

Recommended

Dh2014 e mopcobre-complete by
Dh2014 e mopcobre-completeDh2014 e mopcobre-complete
Dh2014 e mopcobre-completeLaura Mandell
2.9K views45 slides
Navigating the Storm: eMOP, Big DH Projects, and Agile Steering Standards by
Navigating the Storm: eMOP, Big DH Projects, and Agile Steering StandardsNavigating the Storm: eMOP, Big DH Projects, and Agile Steering Standards
Navigating the Storm: eMOP, Big DH Projects, and Agile Steering StandardsLiz Grumbach
2.1K views27 slides
Digital Frontiers 2015: eMOP's Imprint (Printer's and Publisher's) DB by
Digital Frontiers 2015: eMOP's Imprint (Printer's and Publisher's) DBDigital Frontiers 2015: eMOP's Imprint (Printer's and Publisher's) DB
Digital Frontiers 2015: eMOP's Imprint (Printer's and Publisher's) DBMatt Christy
1.2K views12 slides
DLF Forum 2015: Beyond eMOP by
DLF Forum 2015: Beyond eMOPDLF Forum 2015: Beyond eMOP
DLF Forum 2015: Beyond eMOPMatt Christy
1.4K views28 slides
mchristy-DH2014-emop-bookhistory-tools by
mchristy-DH2014-emop-bookhistory-toolsmchristy-DH2014-emop-bookhistory-tools
mchristy-DH2014-emop-bookhistory-toolsMatt Christy
2.8K views21 slides
TCDL15 Beyond eMOP by
TCDL15 Beyond eMOPTCDL15 Beyond eMOP
TCDL15 Beyond eMOPMatt Christy
1.3K views31 slides

More Related Content

What's hot

mchristy-Dh2014- emop-postOCR-triage by
mchristy-Dh2014- emop-postOCR-triagemchristy-Dh2014- emop-postOCR-triage
mchristy-Dh2014- emop-postOCR-triageMatt Christy
1.6K views21 slides
HotSoS16 Tutorial "Text Analytics for Security" by Tao Xie and William Enck by
HotSoS16 Tutorial "Text Analytics for Security" by Tao Xie and William EnckHotSoS16 Tutorial "Text Analytics for Security" by Tao Xie and William Enck
HotSoS16 Tutorial "Text Analytics for Security" by Tao Xie and William EnckTao Xie
1.2K views78 slides
Incorporating Chinese Radicals Into Neural Machine Translation: Deeper Than C... by
Incorporating Chinese Radicals Into Neural Machine Translation: Deeper Than C...Incorporating Chinese Radicals Into Neural Machine Translation: Deeper Than C...
Incorporating Chinese Radicals Into Neural Machine Translation: Deeper Than C...Lifeng (Aaron) Han
119 views21 slides
Apply chinese radicals into neural machine translation: deeper than character... by
Apply chinese radicals into neural machine translation: deeper than character...Apply chinese radicals into neural machine translation: deeper than character...
Apply chinese radicals into neural machine translation: deeper than character...Lifeng (Aaron) Han
87 views22 slides
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing. by
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.Lifeng (Aaron) Han
86 views124 slides
Introducción a NLP (Natural Language Processing) en Azure by
Introducción a NLP (Natural Language Processing) en AzureIntroducción a NLP (Natural Language Processing) en Azure
Introducción a NLP (Natural Language Processing) en AzurePlain Concepts
304 views58 slides

What's hot(17)

mchristy-Dh2014- emop-postOCR-triage by Matt Christy
mchristy-Dh2014- emop-postOCR-triagemchristy-Dh2014- emop-postOCR-triage
mchristy-Dh2014- emop-postOCR-triage
Matt Christy1.6K views
HotSoS16 Tutorial "Text Analytics for Security" by Tao Xie and William Enck by Tao Xie
HotSoS16 Tutorial "Text Analytics for Security" by Tao Xie and William EnckHotSoS16 Tutorial "Text Analytics for Security" by Tao Xie and William Enck
HotSoS16 Tutorial "Text Analytics for Security" by Tao Xie and William Enck
Tao Xie1.2K views
Incorporating Chinese Radicals Into Neural Machine Translation: Deeper Than C... by Lifeng (Aaron) Han
Incorporating Chinese Radicals Into Neural Machine Translation: Deeper Than C...Incorporating Chinese Radicals Into Neural Machine Translation: Deeper Than C...
Incorporating Chinese Radicals Into Neural Machine Translation: Deeper Than C...
Lifeng (Aaron) Han119 views
Apply chinese radicals into neural machine translation: deeper than character... by Lifeng (Aaron) Han
Apply chinese radicals into neural machine translation: deeper than character...Apply chinese radicals into neural machine translation: deeper than character...
Apply chinese radicals into neural machine translation: deeper than character...
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing. by Lifeng (Aaron) Han
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.
ADAPT Centre and My NLP journey: MT, MTE, QE, MWE, NER, Treebanks, Parsing.
Introducción a NLP (Natural Language Processing) en Azure by Plain Concepts
Introducción a NLP (Natural Language Processing) en AzureIntroducción a NLP (Natural Language Processing) en Azure
Introducción a NLP (Natural Language Processing) en Azure
Plain Concepts304 views
DMDS Winter 2015 Workshop 1 slides by Paige Morgan
DMDS Winter 2015 Workshop 1 slidesDMDS Winter 2015 Workshop 1 slides
DMDS Winter 2015 Workshop 1 slides
Paige Morgan835 views
ISEC'18 Tutorial: Research Methodology on Pursuing Impact-Driven Research by Tao Xie
ISEC'18 Tutorial: Research Methodology on Pursuing Impact-Driven ResearchISEC'18 Tutorial: Research Methodology on Pursuing Impact-Driven Research
ISEC'18 Tutorial: Research Methodology on Pursuing Impact-Driven Research
Tao Xie1.8K views
Software Analytics - Achievements and Challenges by Tao Xie
Software Analytics - Achievements and ChallengesSoftware Analytics - Achievements and Challenges
Software Analytics - Achievements and Challenges
Tao Xie1.8K views
Searching for the Best Machine Translation Combination by Matīss
Searching for the Best Machine Translation CombinationSearching for the Best Machine Translation Combination
Searching for the Best Machine Translation Combination
Matīss 210 views
Data Science Reinvents Learning? by Paco Nathan
Data Science Reinvents Learning?Data Science Reinvents Learning?
Data Science Reinvents Learning?
Paco Nathan6.1K views
Demo the reactive jargons by Thoughtworks
Demo the reactive jargonsDemo the reactive jargons
Demo the reactive jargons
Thoughtworks954 views
Visualising the world of competitive programming with Python (Codeforces) by Anuj Menta
Visualising the world of competitive programming with Python (Codeforces)Visualising the world of competitive programming with Python (Codeforces)
Visualising the world of competitive programming with Python (Codeforces)
Anuj Menta233 views
Math-Bridge Authoring by mathgear
Math-Bridge AuthoringMath-Bridge Authoring
Math-Bridge Authoring
mathgear109 views

Similar to SAA 2014 Pre-conference Workshop - OCRing with Open Source Tools

Open Source Tools and the Software Engineering Process by
Open Source Tools and the Software Engineering ProcessOpen Source Tools and the Software Engineering Process
Open Source Tools and the Software Engineering ProcessSteve Arnold
1.2K views10 slides
Doug McCune - Using Open Source Flex and ActionScript Projects by
Doug McCune - Using Open Source Flex and ActionScript ProjectsDoug McCune - Using Open Source Flex and ActionScript Projects
Doug McCune - Using Open Source Flex and ActionScript ProjectsDoug McCune
972 views29 slides
Curating activism workshop 1 by
Curating activism workshop 1Curating activism workshop 1
Curating activism workshop 1Rodric Yates
247 views15 slides
Open source softrware, group 5 final by
Open source softrware, group 5 finalOpen source softrware, group 5 final
Open source softrware, group 5 finalbigrouge
149 views21 slides
Sound soft hackday-100905 by
Sound soft hackday-100905Sound soft hackday-100905
Sound soft hackday-100905SoundSoftware ac.uk
863 views15 slides

Similar to SAA 2014 Pre-conference Workshop - OCRing with Open Source Tools(20)

Open Source Tools and the Software Engineering Process by Steve Arnold
Open Source Tools and the Software Engineering ProcessOpen Source Tools and the Software Engineering Process
Open Source Tools and the Software Engineering Process
Steve Arnold1.2K views
Doug McCune - Using Open Source Flex and ActionScript Projects by Doug McCune
Doug McCune - Using Open Source Flex and ActionScript ProjectsDoug McCune - Using Open Source Flex and ActionScript Projects
Doug McCune - Using Open Source Flex and ActionScript Projects
Doug McCune972 views
Curating activism workshop 1 by Rodric Yates
Curating activism workshop 1Curating activism workshop 1
Curating activism workshop 1
Rodric Yates247 views
Open source softrware, group 5 final by bigrouge
Open source softrware, group 5 finalOpen source softrware, group 5 final
Open source softrware, group 5 final
bigrouge149 views
Autopsy 3: Free Open Source End-to-End Windows-based Digital Forensics Platform by Basis Technology
Autopsy 3: Free Open Source End-to-End Windows-based Digital Forensics PlatformAutopsy 3: Free Open Source End-to-End Windows-based Digital Forensics Platform
Autopsy 3: Free Open Source End-to-End Windows-based Digital Forensics Platform
Basis Technology5.3K views
Autopsy 3: Free Open Source End-to-End Windows-based Digital Forensics Platform by Jason Letourneau
Autopsy 3: Free Open Source End-to-End Windows-based Digital Forensics PlatformAutopsy 3: Free Open Source End-to-End Windows-based Digital Forensics Platform
Autopsy 3: Free Open Source End-to-End Windows-based Digital Forensics Platform
Jason Letourneau1.8K views
Coursera data science specialization by Mengshu Liu
Coursera data science specializationCoursera data science specialization
Coursera data science specialization
Mengshu Liu281 views
Cool Tools for Technical Writers by Jeff Haas
Cool Tools for Technical WritersCool Tools for Technical Writers
Cool Tools for Technical Writers
Jeff Haas10.4K views
Part A--Scanners, Conversion by gollanmel
Part A--Scanners, ConversionPart A--Scanners, Conversion
Part A--Scanners, Conversion
gollanmel254 views
Infrastructure crossroads... and the way we walked them in DKPro by openminted_eu
Infrastructure crossroads... and the way we walked them in DKProInfrastructure crossroads... and the way we walked them in DKPro
Infrastructure crossroads... and the way we walked them in DKPro
openminted_eu505 views
Malicious File for Exploiting Forensic Software by Takahiro Haruyama
Malicious File for Exploiting Forensic SoftwareMalicious File for Exploiting Forensic Software
Malicious File for Exploiting Forensic Software
Takahiro Haruyama15.5K views
Know thy logos by Vishal V
Know thy logosKnow thy logos
Know thy logos
Vishal V62 views
Metadata & Interoperability: Free Tools by Mike Jennings
Metadata & Interoperability: Free ToolsMetadata & Interoperability: Free Tools
Metadata & Interoperability: Free Tools
Mike Jennings208 views
Introduction to r by gslicraf
Introduction to rIntroduction to r
Introduction to r
gslicraf1.7K views
IT Systems for Knowledge Management used in Software Engineering (2010) by Peter Kofler
IT Systems for Knowledge Management used in Software Engineering (2010)IT Systems for Knowledge Management used in Software Engineering (2010)
IT Systems for Knowledge Management used in Software Engineering (2010)
Peter Kofler1.3K views

Recently uploaded

discussion post.pdf by
discussion post.pdfdiscussion post.pdf
discussion post.pdfjessemercerail
106 views1 slide
Nico Baumbach IMR Media Component by
Nico Baumbach IMR Media ComponentNico Baumbach IMR Media Component
Nico Baumbach IMR Media ComponentInMediaRes1
425 views2 slides
Classification of crude drugs.pptx by
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptxGayatriPatra14
65 views13 slides
Ch. 7 Political Participation and Elections.pptx by
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptxRommel Regala
69 views11 slides
Material del tarjetero LEES Travesías.docx by
Material del tarjetero LEES Travesías.docxMaterial del tarjetero LEES Travesías.docx
Material del tarjetero LEES Travesías.docxNorberto Millán Muñoz
68 views9 slides
ANATOMY AND PHYSIOLOGY UNIT 1 { PART-1} by
ANATOMY AND PHYSIOLOGY UNIT 1 { PART-1}ANATOMY AND PHYSIOLOGY UNIT 1 { PART-1}
ANATOMY AND PHYSIOLOGY UNIT 1 { PART-1}DR .PALLAVI PATHANIA
234 views195 slides

Recently uploaded(20)

Nico Baumbach IMR Media Component by InMediaRes1
Nico Baumbach IMR Media ComponentNico Baumbach IMR Media Component
Nico Baumbach IMR Media Component
InMediaRes1425 views
Classification of crude drugs.pptx by GayatriPatra14
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptx
GayatriPatra1465 views
Ch. 7 Political Participation and Elections.pptx by Rommel Regala
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptx
Rommel Regala69 views
Structure and Functions of Cell.pdf by Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan317 views
Education and Diversity.pptx by DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar107 views
American Psychological Association 7th Edition.pptx by SamiullahAfridi4
American Psychological Association  7th Edition.pptxAmerican Psychological Association  7th Edition.pptx
American Psychological Association 7th Edition.pptx
SamiullahAfridi474 views
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx by ISSIP
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptxEIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
EIT-Digital_Spohrer_AI_Intro 20231128 v1.pptx
ISSIP256 views
Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation) by AnshulDewangan3
 Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation) Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation)
Compare the flora and fauna of Kerala and Chhattisgarh ( Charttabulation)
AnshulDewangan3275 views
Class 10 English lesson plans by TARIQ KHAN
Class 10 English  lesson plansClass 10 English  lesson plans
Class 10 English lesson plans
TARIQ KHAN239 views
UWP OA Week Presentation (1).pptx by Jisc
UWP OA Week Presentation (1).pptxUWP OA Week Presentation (1).pptx
UWP OA Week Presentation (1).pptx
Jisc68 views
Class 10 English notes 23-24.pptx by TARIQ KHAN
Class 10 English notes 23-24.pptxClass 10 English notes 23-24.pptx
Class 10 English notes 23-24.pptx
TARIQ KHAN95 views
The basics - information, data, technology and systems.pdf by JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena177 views
11.28.23 Social Capital and Social Exclusion.pptx by mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239112 views

SAA 2014 Pre-conference Workshop - OCRing with Open Source Tools

  • 1. USING OPEN SOURCE OCR TOOLS FOR DIGITIZATION PROJECTS Matthew J. Christy
  • 2. Intro – Me • Matthew J. Christy • Lead Software Applications Developer at the Initiative for Digital Humanities, Media and Culture (IDHMC) at Texas A&M University • @matt_christy • idhmc.tamu.edu • @idhmc_nexus • Co-project manager of the Early Modern OCR Project (eMOP) • emop.tamu.edu • #emop • Former Systems/Electronic Resources Librarian Tuesday, August 12, 2014 Open Source OCR Tools 2
  • 3. Intro – You • Name & Institution • Experience with OCR • What’s your project or what are you bringing with you? Tuesday, August 12, 2014 Open Source OCR Tools 3
  • 4. Intro – Outline • OCR & Open Source Engines • Digitization vs OCR • Tesseract • OCROpus • Gamera • Setup • Installing Tesseract • Installing Aletheia • Installing Franken+ • Installing ImageMacick / GIMP • Running Tesseract (default) • Identifying issues with your page images • What’s your font? • Image quality problems • Pre-processing • Binarization • Cropping • “de”-ing (noise, skew, warp, etc.) • Training Tesseract for your font • Tesseract’s native training mechanism • When more is needed • Aletheia • Franken+ • Word lists • Common transformation errors • Running Tesseract (your training) • Your results • Comparing OCR results to Groundtruth • Creating Groundtruth • Post-processing • Hand correction • Crowd-source correction • eMOP tools 4Tuesday, August 12, 2014 Open Source OCR Tools
  • 5. OCR & Open Source Engines Digitization vs. OCR • Digitization is the creation of a digital representation of an object. • In the print world, a digital image of a page: page image • end product: image files (.tif .jpg .png .pdf) • Optical Character Recognition (OCR) is the use of software to recognize the characters on a page image and turn that into text. • text that is searchable, and editable • end product: text files (.txt .rtf .doc .pdf) Tuesday, August 12, 2014 Open Source OCR Tools 5
  • 6. Tesseract • Developed by Ray Smith at HP • Taken up by Google • Used in their Google Books mass-digitization & OCR program • Open Source: code.google.com/p/tesseract-ocr/ • version 3.02 • Windows, Mac and UNIX • Documentation is not always helpful • User group: groups.google.com/forum/ - !forum/tesseract-ocr • Training for various scripts and languages available • Lots of users, so Google it Tuesday, August 12, 2014 Open Source OCR Tools 6
  • 7. OCR Opus • Developed by Thomas Breuel • Originally used Tesseract for character recognition • Was not under active development for a while, but a new version is now available • Open Source: code.google.com/p/ocropus/ • version 0.7 • Windows, Mac & UNIX • User group: groups.google.com/forum/ - !forum/ocropus Tuesday, August 12, 2014 Open Source OCR Tools 7
  • 8. Gamera • Developed by Ichiro Fujinaga (McGill University) • Designed to OCR music • It’s actually the Gamera OCR Toolkit that you want • Open Source: gamera.informatik.hsnr.de/addons/ocr4gamera/ • version 1.1.0 (Jun, 2014) • Windows, Mac and UNIX • User group: groups.yahoo.com/neo/groups/gamera-devel/info • Training can take a while. • emop.tamu.edu/Gamera-OCR Tuesday, August 12, 2014 Open Source OCR Tools 8
  • 9. Installing Tesseract • Mac: emop.tamu.edu/Installing-Tesseract-Mac • PC: emop.tamu.edu/Installing-Tesseract-PC • code.google.com/p/tesseract-ocr/wiki/ReadMe • Standard English-language training: code.google.com/p/tesseract-ocr/downloads/list (tesseract-ocr- 3.02.eng.tar.gz) > combine_tessdata -u eng.traineddata ../unpacked/eng > dawg2wordlist eng.unicharset eng.word-dawg eng-word- list.txt Tuesday, August 12, 2014 Open Source OCR Tools 9
  • 10. Installing Aletheia • Windows only • Download the zip file • www.primaresearch.org/tools/Aletheia • Click the Download the previous version button (v2.1) • Run executable file Tuesday, August 12, 2014 Open Source OCR Tools 10
  • 11. Installing Franken+ • Windows only • Download the zip file • dh-emopweb.tamu.edu/Franken+/ • Install executable file • Requirements: • .NET Framework 4.5 (standard on Windows 8) • a local MySQL server with root username (MySQL Community Server 5.6) • See emop.tamu.edu/Installing-FrankenPlus for more instructions Tuesday, August 12, 2014 Open Source OCR Tools 11
  • 12. Installing ImageMagick/GIMP • Two good free image manipulation programs available for Windows, Mac and Unix • ImageMagick • typically command-line but has a limited graphical interface inWindows • www.imagemagick.org/ • GIMP (GNU Image Manipulation Program) • has a graphical user interface for all platforms • www.gimp.org/ Tuesday, August 12, 2014 Open Source OCR Tools 12
  • 13. Running Tesseract with default training > tesseract <page image> <outfile> -l <lang> <config file> • Where: • <outfile> is the name of the of the .txt and .html files to be created • <lang> is the “language name” you gave your training, i.e. what you called your typeface training set • <config file> is a file name containing some configuration information for Tesseract • “tessedit_create_hocr 1” produces hOCR (HTML) output • Tesseract’s default output is text only • Tesseract’s default <lang> in “eng” their standard english-language training Tuesday, August 12, 2014 Open Source OCR Tools 13
  • 14. Identifying issues with your page images What’s your font? • OCR engines need to be trained on the typeface they will be trying to recognize • Modern fonts (fonts available via a word processor) make it easy to train an OCR engine • Other fonts (bus signs, secretary hand, early modern fonts) require special training procedures Tuesday, August 12, 2014 Open Source OCR Tools 14
  • 15. WhatTheFont • www.myfonts.com/WhatTheFont/ • crop your page image down to a section of 20 or so letters (<2 MB) • try to find some distinctive characters • submit, then help identify the characters found Tuesday, August 12, 2014 Open Source OCR Tools 15
  • 16. Image Quality Issues • Small file size/resolution (< 300 dpi) • Noise • Bleedthrough • Over/under inking • Skew • Warp Tuesday, August 12, 2014 Open Source OCR Tools 16
  • 17. Pre-processing • There are pre-processing algorithms available to fix most of these issues • Very useful if you have a small number of documents, or if you know that all your documents have the same issues (need the same pre-processing) • Can dramatically improve OCR results • Tools: • GIMP: www.gimp.org/ • ImageMagick: www.imagemagick.org/ • (www.fmwconcepts.com/imagemagick) Tuesday, August 12, 2014 Open Source OCR Tools 17
  • 18. Binarization • Converting to Black & White • ImageMagick: > convert <infile> -colorspace gray +dither -colors 2 - normalize <outfile> • Fred’s scripts > otsuthresh <in> <out> > localthresh • GIMP • Image -> Mode -> Indexed ... • Tools -> Color Tools… -> Threshold… Tuesday, August 12, 2014 Open Source OCR Tools 18
  • 19. Cropping • Sometimes it helps to crop images to: • remove noise • remove unwanted elements (rulers, fingers, note cards, etc.) • separate multi-page images • It can also reduce the length of time needed to pre- process • Only feasible with a small number of documents • Can use: • GIMP • Paint • Preview Tuesday, August 12, 2014 Open Source OCR Tools 19
  • 20. Denoise • or “Despeckle” • Removes speckles from page image • There’s a trade-off • Being too aggressive can reduce the integrity of the glyphs • ImageMagick: > convert <infile> -noise 1 <outfile> > convert <infile> -despeckle <outfule> • GIMP: • Filters -> Enhance -> Despeckle … • Try it multiple times, but watch your glyph integrity Tuesday, August 12, 2014 Open Source OCR Tools 20
  • 21. Deskew • or “Rotate” or “Auto-straighten” • ImageMagick: • Fred’s scripts: > sh ./skew.sh -a 2 -m degrees -d b2r -v background <infile> <outfile> • GIMP: • There’s a plugin, but I couldn’t get it installed • registry.gimp.org/node/2958 Tuesday, August 12, 2014 Open Source OCR Tools 21
  • 22. Dewarp • Dealing with warping (for example, when a page bends due to a tight or think spine) is much trickier. Tuesday, August 12, 2014 Open Source OCR Tools 22
  • 23. Training Tesseract for your font • The difference between Training and OCRing • You may end up using some of the documents you want to OCR to create the training. Tuesday, August 12, 2014 Open Source OCR Tools 23 • Training: • Binarize • Clean • Aletheia: Find glyphs (unicode values and coordinates on page) • Franken+: choose best exemplars of glyphs • Add word lists (optional) • Process to create Tesseract training data • OCRing: • Binarize • Clean (if possible) • OCR with Tesseract
  • 24. Training Tesseract for your font Tuesday, August 12, 2014 Open Source OCR Tools 24 code.google.com/p/tesseract-ocr/wiki/TrainingTesseract3
  • 25. When more is needed Tuesday, August 12, 2014 Open Source OCR Tools 25 Aletheia: PRImA Research Labs www.primaresearch.org/ tools/Aletheia Franken+ dh- emopweb.tamu.edu/Fra nken+/ See: Aletheia/Franken+ Quick Start Guide for more information
  • 26. Aletheia Open Source OCR Tools 26 www.primaresearch.org/tools.p hp Available for free but requires registration. • Created by PRImA Research Labs, University of Salford, UK. • Windows based tool. • Developed as a groundtruth creation tool • Used by eMOP undergraduate student workers to create training of desired typeface for Tesseract. • Can identify glyphs on a page image with page coordinates and Unicode values. Tuesday, August 12, 2014 Open Source OCR Tools
  • 27. Aletheia:Workflow Open Source OCR Tools 27 • Binarization and Denoise are native Aletheia functions • A team of Undergraduate student workers refines and corrects glyph boxes and unicode values, where needed. • Output: A set of PAGE XML files with page coordinates and unicode values for every identified glyph on each processed TIFF image. Tuesday, August 12, 2014 Open Source OCR ToolsTuesday, August 12, 2014
  • 28. Aletheia: Glyph Recognition Open Source OCR Tools 28 Uses Tesseract to find glyphs Tuesday, August 12, 2014 Open Source OCR Tools
  • 29. Aletheia: I/O Open Source OCR Tools 29 We then convert PAGE XML file to Tesseract Box file using XSLT Tuesday, August 12, 2014 Open Source OCR Tools
  • 30. Tesseract Training Open Source OCR Tools 30Tuesday, August 12, 2014 Open Source OCR Tools
  • 31. Franken+ 1. Windows based tool that uses a MySQL DB. 2. Developed for eMOP by IDHMC Graduate student worker Bryan Tarpley. 3. Designed to be easily used by eMOP Undergraduate student workers 4. Takes Aletheia's output files as input. 5. Outputs the same box files and TIFF images that Tesseract's first stage of native training. • Available open-source at: github.com/idhmc-tamu/FrankenPlus Open Source OCR Tools 31Tuesday, August 12, 2014 Open Source OCR Tools
  • 32. Franken+Workflow Open Source OCR Tools 32 1. Groups all glyphs with the same Unicode values into one window for comparison. 2. Uses all selected glyphs to create a Franken-page image (TIFF) using a selected text as a base. 3. Outputs the same box files and TIFF images that Tesseract's first stage of native training. Tuesday, August 12, 2014 Open Source OCR ToolsTuesday, August 12, 2014
  • 33. Franken+ Ingestion Open Source OCR Tools 33Tuesday, August 12, 2014 Open Source OCR Tools
  • 34. Franken+ Open Source OCR Tools 34 • All exemplars of the same glyph are displayed together. • Users can quickly identify and deselect: • Incorrectly labeled glyphs • Incomplete glyphs • Unrepresentative exemplars • Different sized glyphs Tuesday, August 12, 2014 Open Source OCR Tools
  • 35. Open Source OCR Tools 35 Franken+ Tuesday, August 12, 2014 Open Source OCR Tools
  • 36. TrainingTesseract Open Source OCR Tools 36 Thiſ great conſumption to a fever turn'd, And ſo the oꝗld had fitſ; it joy'd, it mourn'd; And, aſ men thinke, that Agueſ phy ck are, And th'Ague being ſpent, give over care. Žo thou cke World, mꝗꝗak'ꝗ thy ſelże to bee Well, when ãlaſ, thou'rt in a Lethargie. Her death did wound and tame thee than, and than Thou might'ꝗ ha e better ſpar'd the Sunne, or man. That wound waſ deep, but 'tiſ more miżery, That thou haꝗ loꝗ thy ſenſe and memor . 'Twaſ heavy then to heare thy voyce of mone, But thiſ iſ worſe, that thou art ſpeechle e growne. Thou haꝗ forgot thy name thou hadꝗ; thou waꝗ Nothing but ee, and her thou haꝗ o'rpaꝗ. For aſ a child kept from the Fount, untill Ä prince, expe ed long, come to fulfill The ceremonieſ, thou unnam'd had'ꝗ laid, Had not her comming, thee her palace made: Her name defin'd thee, gave thee forme, and frame, And thou forgett'ꝗ to celebrate th n me. Some monethſ e hath beene dead (but beìng dead, Meaſureſ of timeſ are all determined) But long e'ath beene away, long, long, et none Offerſ to tell uſ who it iſ that'ſ gone. But aſ in ꝗateſ doubtfull of future heireſ, When ckne e without remedie empaireſ The preſent Prince, they're loth it ould be ſaid, The Prince doth langui , or the Prince iſ dead: So mankinde feeling no a generall tha , Tuesday, August 12, 2014 Open Source OCR Tools F+TraininigText.txt
  • 37. When more is needed Tuesday, August 12, 2014 Open Source OCR Tools 37
  • 38. Tesseract – Word Lists • Tesseract has the ability to use word lists or dictionaries to look up words while scanning. • Word lists help Tesseract decide what a word is when it’s not sure. • Takes advantage of the character confidence score that Tesseract computes while scanning. • This character confidence info is lost when the hOCR output is created. • DAWG (Directed Acyclic Word Graph) files (8) • word-dawg: A dawg made from dictionary words from the language. • freq-dawg: A dawg made from the most frequent words which would have gone into word-dawg. • punc-dawg: A dawg made from punctuation patterns found around words. The "word" part is replaced by a single space. • number-dawg: A dawg made from tokens which originally contained digits. Each digit is replaced by a space character. Tuesday, August 12, 2014 Open Source OCR Tools 38
  • 39. Tesseract – Word Lists • Collect a word list • spellcheckers (ispell, aspell, hunspell) – check the license • period specific works will require period specific word lists • dh-emopweb.tamu.edu/eebo-word-freq.php • emop.tamu.edu/Early-Modern-Word-List • You can also take Google’s eng.traineddata file apart and use their word list. (combine_tessdata –u, dawg2wordlist) • Format: one word per line, no other info, UTF-8. • If you have a word count associated with your list then split it into two lists: frequent and other. • Apply wordlist2dawg application to create dawg files. Tuesday, August 12, 2014 Open Source OCR Tools 39
  • 40. Tesseract – Ambiguity and Transformation Errors • Tesseract, like all OCR engines, can make consistent transformation errors across pages, documents and collections. • m  rn • ri  n • 1)  D • Tesseract’s ambiguous characters file to helps it to correct some of these errors while it’s OCRing • Can also be used to force substitutions • st  st • ſ  s • The name of the file is <lang>.unicharambigs Tuesday, August 12, 2014 Open Source OCR Tools 40 tesseract-ocr.googlecode.com/svn-history/r683/trunk/doc/unicharambigs
  • 41. Tesseract – .unicharambigs file • Type Indicator: 0: Substitute B for A if doing so produces a word in the dictionary. 1: Always substitute B for A. • This really only works for substitutions where at least one side is multiple characters. The .unicharambigs file must end with a blank line (/n) at the bottom of the file. Tuesday, August 12, 2014 Open Source OCR Tools 41
  • 42. Running Tesseract with your training > tesseract <page image> <outfile> -l <lang> <config file> • on my computer: • go to: C:Program Files (x86)Tesseract-OCR • > tesseract C:UsersIDHMCDesktopocr-test- files2633700005.000.001.tif C:UsersIDHMCocr-test- files26337eebo32989-out-test-1 -l <lang> tess_cfg.txt Tuesday, August 12, 2014 Open Source OCR Tools 42
  • 43. Tesseract – Results • hOCR file • XML-like .html file & .txt file (tessedit_create_hocr option) • creates blocks for page, areas, paragraphs, lines, and words • each block contains page coordinates • words contain confidence values (version 3.02.03) Tuesday, August 12, 2014 Open Source OCR Tools 43
  • 44. Comparing OCR text to Groundtruth • Juxta-cl (command line) • created for eMOP • based on JuxtaCommons tool (juxtacommons.org/) • several different comparison algorithms to choose from and other options • open-source: github.com/performant-software/juxta-cl • java-based tool run from command line • Download: emop.tamu.edu/Installing-JuxtaCL • ocrevalUAtion • created for Succeed (www.succeed-project.eu/) • java-based tool • open-source: sites.google.com/site/textdigitisation/ocrevaluation Tuesday, August 12, 2014 Open Source OCR Tools 44
  • 45. Creating Groundtruth • Aletheia was developed as a groundtruth creation tool for Succeed. • Use it to process some of your page images to quickly produce corrected full-text. • Worth the effort if you have a large collection Tuesday, August 12, 2014 Open Source OCR Tools 45
  • 46. Post Processing • No OCR is perfect. It will need to be corrected. • Hand Correction • The most thorough way, but time consuming. • Proofread Page: A media wiki extension (www.mediawiki.org/wiki/Extension:Proofread_Page) • Crowdsourced Correction • Give it to the c(l/r)owd • Tools: • Online collaborative manuscript transcription tools • FromThePage: beta.fromthepage.com/ (github.com/benwbrum/fromthepage/wiki) • T-Pen: t-pen.org • Scripto: scripto.org Tuesday, August 12, 2014 Open Source OCR Tools 46
  • 47. eMOP Post Processing • Open source tools for: • scoring OCR results without groundtruth • estimating the correctability of a page • removing noise (i.e. junk that Tesseract identifies as words) • correcting OCR results using dictionaries and google 3-grams • gitlab.tamu.edu/groups/emop • Other tools: • succeed-project.eu/publications/available-tools/index-succeed Tuesday, August 12, 2014 Open Source OCR Tools 47
  • 48. The end mchristy@tamu.edu 48Tuesday, August 12, 2014 Open Source OCR Tools

Editor's Notes

  1. This is something I think a lot of users don’t really understand. PDF’s have really confused the issue.
  2. There is a new version of Aletheia which changed the output format. Franken+ is currently being updated to handle this new output. In the meantime…
  3. GNU Image Manipulation Program
  4. Aletheia: Created by PRImA Research Labs at the University of Salford, as a groundtruth creation tool. A team of undergraduates uses Aletheia to identify each glyph on the page images, and ensure that the correct Unicode value is assigned to each. Aletheia outputs an XML file containing all identified glyphs on a page with their corresponding coordinates and Unicode values.
  5. This document had 3 distinct point sizes, but Franken+ revealed there were more like 5 or 6. In this case it probably doesn’t matter, but it points out the possibilities