tesseract_bin 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +23 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/ext/tesseract_bin/extconf.rb +17 -0
- data/lib/tesseract_bin.rb +12 -0
- data/tesseract_bin.gemspec +660 -0
- data/test/helper.rb +18 -0
- data/test/test_tesseract_bin.rb +7 -0
- data/vendor/tesseract-2.04/AUTHORS +8 -0
- data/vendor/tesseract-2.04/COPYING +23 -0
- data/vendor/tesseract-2.04/ChangeLog +71 -0
- data/vendor/tesseract-2.04/INSTALL +229 -0
- data/vendor/tesseract-2.04/Makefile.am +20 -0
- data/vendor/tesseract-2.04/Makefile.in +641 -0
- data/vendor/tesseract-2.04/NEWS +1 -0
- data/vendor/tesseract-2.04/README +138 -0
- data/vendor/tesseract-2.04/ReleaseNotes +213 -0
- data/vendor/tesseract-2.04/StdAfx.cpp +8 -0
- data/vendor/tesseract-2.04/StdAfx.h +24 -0
- data/vendor/tesseract-2.04/ccmain/Makefile.am +63 -0
- data/vendor/tesseract-2.04/ccmain/Makefile.in +735 -0
- data/vendor/tesseract-2.04/ccmain/adaptions.cpp +1082 -0
- data/vendor/tesseract-2.04/ccmain/adaptions.h +109 -0
- data/vendor/tesseract-2.04/ccmain/applybox.cpp +891 -0
- data/vendor/tesseract-2.04/ccmain/applybox.h +73 -0
- data/vendor/tesseract-2.04/ccmain/baseapi.cpp +1105 -0
- data/vendor/tesseract-2.04/ccmain/baseapi.h +256 -0
- data/vendor/tesseract-2.04/ccmain/blobcmp.cpp +76 -0
- data/vendor/tesseract-2.04/ccmain/blobcmp.h +29 -0
- data/vendor/tesseract-2.04/ccmain/callnet.cpp +93 -0
- data/vendor/tesseract-2.04/ccmain/callnet.h +32 -0
- data/vendor/tesseract-2.04/ccmain/charcut.cpp +704 -0
- data/vendor/tesseract-2.04/ccmain/charcut.h +120 -0
- data/vendor/tesseract-2.04/ccmain/charsample.cpp +699 -0
- data/vendor/tesseract-2.04/ccmain/control.cpp +1842 -0
- data/vendor/tesseract-2.04/ccmain/control.h +198 -0
- data/vendor/tesseract-2.04/ccmain/docqual.cpp +1481 -0
- data/vendor/tesseract-2.04/ccmain/docqual.h +155 -0
- data/vendor/tesseract-2.04/ccmain/expandblob.cpp +82 -0
- data/vendor/tesseract-2.04/ccmain/expandblob.h +13 -0
- data/vendor/tesseract-2.04/ccmain/fixspace.cpp +989 -0
- data/vendor/tesseract-2.04/ccmain/fixspace.h +72 -0
- data/vendor/tesseract-2.04/ccmain/fixxht.cpp +825 -0
- data/vendor/tesseract-2.04/ccmain/fixxht.h +93 -0
- data/vendor/tesseract-2.04/ccmain/imgscale.cpp +154 -0
- data/vendor/tesseract-2.04/ccmain/imgscale.h +32 -0
- data/vendor/tesseract-2.04/ccmain/matmatch.cpp +391 -0
- data/vendor/tesseract-2.04/ccmain/matmatch.h +48 -0
- data/vendor/tesseract-2.04/ccmain/output.cpp +1273 -0
- data/vendor/tesseract-2.04/ccmain/output.h +116 -0
- data/vendor/tesseract-2.04/ccmain/pagewalk.cpp +666 -0
- data/vendor/tesseract-2.04/ccmain/pagewalk.h +155 -0
- data/vendor/tesseract-2.04/ccmain/paircmp.cpp +107 -0
- data/vendor/tesseract-2.04/ccmain/paircmp.h +43 -0
- data/vendor/tesseract-2.04/ccmain/pgedit.cpp +1867 -0
- data/vendor/tesseract-2.04/ccmain/pgedit.h +181 -0
- data/vendor/tesseract-2.04/ccmain/reject.cpp +1775 -0
- data/vendor/tesseract-2.04/ccmain/reject.h +181 -0
- data/vendor/tesseract-2.04/ccmain/scaleimg.cpp +366 -0
- data/vendor/tesseract-2.04/ccmain/scaleimg.h +35 -0
- data/vendor/tesseract-2.04/ccmain/tessbox.cpp +375 -0
- data/vendor/tesseract-2.04/ccmain/tessbox.h +110 -0
- data/vendor/tesseract-2.04/ccmain/tessedit.cpp +278 -0
- data/vendor/tesseract-2.04/ccmain/tessedit.h +49 -0
- data/vendor/tesseract-2.04/ccmain/tessembedded.cpp +110 -0
- data/vendor/tesseract-2.04/ccmain/tessembedded.h +38 -0
- data/vendor/tesseract-2.04/ccmain/tesseractfull.cc +37 -0
- data/vendor/tesseract-2.04/ccmain/tesseractmain.cpp +387 -0
- data/vendor/tesseract-2.04/ccmain/tesseractmain.h +58 -0
- data/vendor/tesseract-2.04/ccmain/tessio.h +110 -0
- data/vendor/tesseract-2.04/ccmain/tessvars.cpp +38 -0
- data/vendor/tesseract-2.04/ccmain/tessvars.h +48 -0
- data/vendor/tesseract-2.04/ccmain/tfacep.h +62 -0
- data/vendor/tesseract-2.04/ccmain/tfacepp.cpp +443 -0
- data/vendor/tesseract-2.04/ccmain/tfacepp.h +85 -0
- data/vendor/tesseract-2.04/ccmain/tstruct.cpp +549 -0
- data/vendor/tesseract-2.04/ccmain/tstruct.h +108 -0
- data/vendor/tesseract-2.04/ccmain/varabled.cpp +346 -0
- data/vendor/tesseract-2.04/ccmain/varabled.h +125 -0
- data/vendor/tesseract-2.04/ccmain/werdit.cpp +193 -0
- data/vendor/tesseract-2.04/ccmain/werdit.h +67 -0
- data/vendor/tesseract-2.04/ccstruct/Makefile.am +25 -0
- data/vendor/tesseract-2.04/ccstruct/Makefile.in +650 -0
- data/vendor/tesseract-2.04/ccstruct/blckerr.h +29 -0
- data/vendor/tesseract-2.04/ccstruct/blobbox.cpp +778 -0
- data/vendor/tesseract-2.04/ccstruct/blobbox.h +381 -0
- data/vendor/tesseract-2.04/ccstruct/blobs.cpp +247 -0
- data/vendor/tesseract-2.04/ccstruct/blobs.h +119 -0
- data/vendor/tesseract-2.04/ccstruct/blread.cpp +537 -0
- data/vendor/tesseract-2.04/ccstruct/blread.h +63 -0
- data/vendor/tesseract-2.04/ccstruct/callcpp.cpp +252 -0
- data/vendor/tesseract-2.04/ccstruct/coutln.cpp +650 -0
- data/vendor/tesseract-2.04/ccstruct/coutln.h +186 -0
- data/vendor/tesseract-2.04/ccstruct/crakedge.h +39 -0
- data/vendor/tesseract-2.04/ccstruct/genblob.cpp +133 -0
- data/vendor/tesseract-2.04/ccstruct/genblob.h +52 -0
- data/vendor/tesseract-2.04/ccstruct/hpddef.h +39 -0
- data/vendor/tesseract-2.04/ccstruct/hpdsizes.h +8 -0
- data/vendor/tesseract-2.04/ccstruct/ipoints.h +479 -0
- data/vendor/tesseract-2.04/ccstruct/labls.cpp +188 -0
- data/vendor/tesseract-2.04/ccstruct/labls.h +38 -0
- data/vendor/tesseract-2.04/ccstruct/linlsq.cpp +249 -0
- data/vendor/tesseract-2.04/ccstruct/linlsq.h +102 -0
- data/vendor/tesseract-2.04/ccstruct/lmedsq.cpp +453 -0
- data/vendor/tesseract-2.04/ccstruct/lmedsq.h +84 -0
- data/vendor/tesseract-2.04/ccstruct/mod128.cpp +100 -0
- data/vendor/tesseract-2.04/ccstruct/mod128.h +85 -0
- data/vendor/tesseract-2.04/ccstruct/normalis.cpp +176 -0
- data/vendor/tesseract-2.04/ccstruct/normalis.h +108 -0
- data/vendor/tesseract-2.04/ccstruct/ocrblock.cpp +369 -0
- data/vendor/tesseract-2.04/ccstruct/ocrblock.h +235 -0
- data/vendor/tesseract-2.04/ccstruct/ocrrow.cpp +216 -0
- data/vendor/tesseract-2.04/ccstruct/ocrrow.h +133 -0
- data/vendor/tesseract-2.04/ccstruct/pageblk.cpp +879 -0
- data/vendor/tesseract-2.04/ccstruct/pageblk.h +318 -0
- data/vendor/tesseract-2.04/ccstruct/pageres.cpp +330 -0
- data/vendor/tesseract-2.04/ccstruct/pageres.h +313 -0
- data/vendor/tesseract-2.04/ccstruct/pdblock.cpp +361 -0
- data/vendor/tesseract-2.04/ccstruct/pdblock.h +181 -0
- data/vendor/tesseract-2.04/ccstruct/pdclass.h +54 -0
- data/vendor/tesseract-2.04/ccstruct/points.cpp +102 -0
- data/vendor/tesseract-2.04/ccstruct/points.h +299 -0
- data/vendor/tesseract-2.04/ccstruct/polyaprx.cpp +588 -0
- data/vendor/tesseract-2.04/ccstruct/polyaprx.h +51 -0
- data/vendor/tesseract-2.04/ccstruct/polyblk.cpp +398 -0
- data/vendor/tesseract-2.04/ccstruct/polyblk.h +122 -0
- data/vendor/tesseract-2.04/ccstruct/polyblob.cpp +357 -0
- data/vendor/tesseract-2.04/ccstruct/polyblob.h +102 -0
- data/vendor/tesseract-2.04/ccstruct/polyvert.cpp +23 -0
- data/vendor/tesseract-2.04/ccstruct/polyvert.h +58 -0
- data/vendor/tesseract-2.04/ccstruct/poutline.cpp +441 -0
- data/vendor/tesseract-2.04/ccstruct/poutline.h +125 -0
- data/vendor/tesseract-2.04/ccstruct/quadlsq.cpp +147 -0
- data/vendor/tesseract-2.04/ccstruct/quadlsq.h +67 -0
- data/vendor/tesseract-2.04/ccstruct/quadratc.cpp +21 -0
- data/vendor/tesseract-2.04/ccstruct/quadratc.h +63 -0
- data/vendor/tesseract-2.04/ccstruct/quspline.cpp +382 -0
- data/vendor/tesseract-2.04/ccstruct/quspline.h +113 -0
- data/vendor/tesseract-2.04/ccstruct/ratngs.cpp +372 -0
- data/vendor/tesseract-2.04/ccstruct/ratngs.h +198 -0
- data/vendor/tesseract-2.04/ccstruct/rect.cpp +229 -0
- data/vendor/tesseract-2.04/ccstruct/rect.h +320 -0
- data/vendor/tesseract-2.04/ccstruct/rejctmap.cpp +545 -0
- data/vendor/tesseract-2.04/ccstruct/rejctmap.h +284 -0
- data/vendor/tesseract-2.04/ccstruct/rwpoly.cpp +89 -0
- data/vendor/tesseract-2.04/ccstruct/rwpoly.h +45 -0
- data/vendor/tesseract-2.04/ccstruct/statistc.cpp +905 -0
- data/vendor/tesseract-2.04/ccstruct/statistc.h +135 -0
- data/vendor/tesseract-2.04/ccstruct/stepblob.cpp +296 -0
- data/vendor/tesseract-2.04/ccstruct/stepblob.h +88 -0
- data/vendor/tesseract-2.04/ccstruct/txtregn.cpp +230 -0
- data/vendor/tesseract-2.04/ccstruct/txtregn.h +155 -0
- data/vendor/tesseract-2.04/ccstruct/vecfuncs.cpp +63 -0
- data/vendor/tesseract-2.04/ccstruct/vecfuncs.h +91 -0
- data/vendor/tesseract-2.04/ccstruct/werd.cpp +967 -0
- data/vendor/tesseract-2.04/ccstruct/werd.h +277 -0
- data/vendor/tesseract-2.04/ccutil/Makefile.am +19 -0
- data/vendor/tesseract-2.04/ccutil/Makefile.in +626 -0
- data/vendor/tesseract-2.04/ccutil/basedir.cpp +118 -0
- data/vendor/tesseract-2.04/ccutil/basedir.h +32 -0
- data/vendor/tesseract-2.04/ccutil/bits16.cpp +30 -0
- data/vendor/tesseract-2.04/ccutil/bits16.h +61 -0
- data/vendor/tesseract-2.04/ccutil/boxread.cpp +105 -0
- data/vendor/tesseract-2.04/ccutil/boxread.h +44 -0
- data/vendor/tesseract-2.04/ccutil/clst.cpp +626 -0
- data/vendor/tesseract-2.04/ccutil/clst.h +1085 -0
- data/vendor/tesseract-2.04/ccutil/debugwin.cpp +500 -0
- data/vendor/tesseract-2.04/ccutil/debugwin.h +103 -0
- data/vendor/tesseract-2.04/ccutil/elst.cpp +593 -0
- data/vendor/tesseract-2.04/ccutil/elst.h +1125 -0
- data/vendor/tesseract-2.04/ccutil/elst2.cpp +606 -0
- data/vendor/tesseract-2.04/ccutil/elst2.h +1121 -0
- data/vendor/tesseract-2.04/ccutil/errcode.cpp +104 -0
- data/vendor/tesseract-2.04/ccutil/errcode.h +104 -0
- data/vendor/tesseract-2.04/ccutil/fileerr.h +34 -0
- data/vendor/tesseract-2.04/ccutil/globaloc.cpp +115 -0
- data/vendor/tesseract-2.04/ccutil/globaloc.h +40 -0
- data/vendor/tesseract-2.04/ccutil/hashfn.cpp +57 -0
- data/vendor/tesseract-2.04/ccutil/hashfn.h +30 -0
- data/vendor/tesseract-2.04/ccutil/host.h +180 -0
- data/vendor/tesseract-2.04/ccutil/hosthplb.h +1 -0
- data/vendor/tesseract-2.04/ccutil/lsterr.h +43 -0
- data/vendor/tesseract-2.04/ccutil/mainblk.cpp +126 -0
- data/vendor/tesseract-2.04/ccutil/mainblk.h +39 -0
- data/vendor/tesseract-2.04/ccutil/memblk.cpp +1106 -0
- data/vendor/tesseract-2.04/ccutil/memblk.h +189 -0
- data/vendor/tesseract-2.04/ccutil/memry.cpp +532 -0
- data/vendor/tesseract-2.04/ccutil/memry.h +192 -0
- data/vendor/tesseract-2.04/ccutil/memryerr.h +38 -0
- data/vendor/tesseract-2.04/ccutil/mfcpch.cpp +5 -0
- data/vendor/tesseract-2.04/ccutil/mfcpch.h +37 -0
- data/vendor/tesseract-2.04/ccutil/ndminx.h +31 -0
- data/vendor/tesseract-2.04/ccutil/notdll.h +28 -0
- data/vendor/tesseract-2.04/ccutil/nwmain.h +176 -0
- data/vendor/tesseract-2.04/ccutil/ocrclass.h +345 -0
- data/vendor/tesseract-2.04/ccutil/ocrshell.cpp +772 -0
- data/vendor/tesseract-2.04/ccutil/ocrshell.h +191 -0
- data/vendor/tesseract-2.04/ccutil/platform.h +18 -0
- data/vendor/tesseract-2.04/ccutil/scanutils.cpp +543 -0
- data/vendor/tesseract-2.04/ccutil/scanutils.h +55 -0
- data/vendor/tesseract-2.04/ccutil/secname.h +9 -0
- data/vendor/tesseract-2.04/ccutil/serialis.cpp +117 -0
- data/vendor/tesseract-2.04/ccutil/serialis.h +93 -0
- data/vendor/tesseract-2.04/ccutil/stderr.h +26 -0
- data/vendor/tesseract-2.04/ccutil/strngs.cpp +495 -0
- data/vendor/tesseract-2.04/ccutil/strngs.h +138 -0
- data/vendor/tesseract-2.04/ccutil/tessclas.h +135 -0
- data/vendor/tesseract-2.04/ccutil/tessopt.cpp +61 -0
- data/vendor/tesseract-2.04/ccutil/tessopt.h +30 -0
- data/vendor/tesseract-2.04/ccutil/tprintf.cpp +122 -0
- data/vendor/tesseract-2.04/ccutil/tprintf.h +35 -0
- data/vendor/tesseract-2.04/ccutil/unichar.cpp +144 -0
- data/vendor/tesseract-2.04/ccutil/unichar.h +84 -0
- data/vendor/tesseract-2.04/ccutil/unicharmap.cpp +172 -0
- data/vendor/tesseract-2.04/ccutil/unicharmap.h +82 -0
- data/vendor/tesseract-2.04/ccutil/unicharset.cpp +307 -0
- data/vendor/tesseract-2.04/ccutil/unicharset.h +267 -0
- data/vendor/tesseract-2.04/ccutil/varable.cpp +672 -0
- data/vendor/tesseract-2.04/ccutil/varable.h +419 -0
- data/vendor/tesseract-2.04/classify/Makefile.am +24 -0
- data/vendor/tesseract-2.04/classify/Makefile.in +647 -0
- data/vendor/tesseract-2.04/classify/adaptive.cpp +535 -0
- data/vendor/tesseract-2.04/classify/adaptive.h +199 -0
- data/vendor/tesseract-2.04/classify/adaptmatch.cpp +2958 -0
- data/vendor/tesseract-2.04/classify/adaptmatch.h +86 -0
- data/vendor/tesseract-2.04/classify/baseline.cpp +58 -0
- data/vendor/tesseract-2.04/classify/baseline.h +91 -0
- data/vendor/tesseract-2.04/classify/blobclass.cpp +123 -0
- data/vendor/tesseract-2.04/classify/blobclass.h +49 -0
- data/vendor/tesseract-2.04/classify/chartoname.cpp +74 -0
- data/vendor/tesseract-2.04/classify/chartoname.h +21 -0
- data/vendor/tesseract-2.04/classify/cluster.cpp +2834 -0
- data/vendor/tesseract-2.04/classify/cluster.h +158 -0
- data/vendor/tesseract-2.04/classify/clusttool.cpp +507 -0
- data/vendor/tesseract-2.04/classify/clusttool.h +70 -0
- data/vendor/tesseract-2.04/classify/cutoffs.cpp +73 -0
- data/vendor/tesseract-2.04/classify/cutoffs.h +49 -0
- data/vendor/tesseract-2.04/classify/extern.h +32 -0
- data/vendor/tesseract-2.04/classify/extract.cpp +100 -0
- data/vendor/tesseract-2.04/classify/extract.h +36 -0
- data/vendor/tesseract-2.04/classify/featdefs.cpp +244 -0
- data/vendor/tesseract-2.04/classify/featdefs.h +71 -0
- data/vendor/tesseract-2.04/classify/flexfx.cpp +87 -0
- data/vendor/tesseract-2.04/classify/flexfx.h +34 -0
- data/vendor/tesseract-2.04/classify/float2int.cpp +126 -0
- data/vendor/tesseract-2.04/classify/float2int.h +65 -0
- data/vendor/tesseract-2.04/classify/fpoint.cpp +73 -0
- data/vendor/tesseract-2.04/classify/fpoint.h +63 -0
- data/vendor/tesseract-2.04/classify/fxdefs.cpp +74 -0
- data/vendor/tesseract-2.04/classify/fxdefs.h +93 -0
- data/vendor/tesseract-2.04/classify/fxid.h +69 -0
- data/vendor/tesseract-2.04/classify/hideedge.cpp +35 -0
- data/vendor/tesseract-2.04/classify/hideedge.h +76 -0
- data/vendor/tesseract-2.04/classify/intfx.cpp +608 -0
- data/vendor/tesseract-2.04/classify/intfx.h +63 -0
- data/vendor/tesseract-2.04/classify/intmatcher.cpp +1524 -0
- data/vendor/tesseract-2.04/classify/intmatcher.h +199 -0
- data/vendor/tesseract-2.04/classify/intproto.cpp +1823 -0
- data/vendor/tesseract-2.04/classify/intproto.h +320 -0
- data/vendor/tesseract-2.04/classify/kdtree.cpp +884 -0
- data/vendor/tesseract-2.04/classify/kdtree.h +118 -0
- data/vendor/tesseract-2.04/classify/mf.cpp +106 -0
- data/vendor/tesseract-2.04/classify/mf.h +43 -0
- data/vendor/tesseract-2.04/classify/mfdefs.cpp +58 -0
- data/vendor/tesseract-2.04/classify/mfdefs.h +60 -0
- data/vendor/tesseract-2.04/classify/mfoutline.cpp +1087 -0
- data/vendor/tesseract-2.04/classify/mfoutline.h +277 -0
- data/vendor/tesseract-2.04/classify/mfx.cpp +436 -0
- data/vendor/tesseract-2.04/classify/mfx.h +52 -0
- data/vendor/tesseract-2.04/classify/normfeat.cpp +132 -0
- data/vendor/tesseract-2.04/classify/normfeat.h +63 -0
- data/vendor/tesseract-2.04/classify/normmatch.cpp +305 -0
- data/vendor/tesseract-2.04/classify/normmatch.h +38 -0
- data/vendor/tesseract-2.04/classify/ocrfeatures.cpp +310 -0
- data/vendor/tesseract-2.04/classify/ocrfeatures.h +148 -0
- data/vendor/tesseract-2.04/classify/outfeat.cpp +262 -0
- data/vendor/tesseract-2.04/classify/outfeat.h +76 -0
- data/vendor/tesseract-2.04/classify/picofeat.cpp +297 -0
- data/vendor/tesseract-2.04/classify/picofeat.h +65 -0
- data/vendor/tesseract-2.04/classify/protos.cpp +472 -0
- data/vendor/tesseract-2.04/classify/protos.h +258 -0
- data/vendor/tesseract-2.04/classify/sigmenu.cpp +225 -0
- data/vendor/tesseract-2.04/classify/sigmenu.h +39 -0
- data/vendor/tesseract-2.04/classify/speckle.cpp +127 -0
- data/vendor/tesseract-2.04/classify/speckle.h +69 -0
- data/vendor/tesseract-2.04/classify/xform2d.cpp +120 -0
- data/vendor/tesseract-2.04/classify/xform2d.h +60 -0
- data/vendor/tesseract-2.04/config/config.guess +1466 -0
- data/vendor/tesseract-2.04/config/config.h.in +188 -0
- data/vendor/tesseract-2.04/config/config.sub +1579 -0
- data/vendor/tesseract-2.04/config/depcomp +530 -0
- data/vendor/tesseract-2.04/config/install-sh +269 -0
- data/vendor/tesseract-2.04/config/missing +198 -0
- data/vendor/tesseract-2.04/config/mkinstalldirs +40 -0
- data/vendor/tesseract-2.04/config/stamp-h.in +0 -0
- data/vendor/tesseract-2.04/configure +10424 -0
- data/vendor/tesseract-2.04/cutil/Makefile.am +14 -0
- data/vendor/tesseract-2.04/cutil/Makefile.in +612 -0
- data/vendor/tesseract-2.04/cutil/bitvec.cpp +115 -0
- data/vendor/tesseract-2.04/cutil/bitvec.h +100 -0
- data/vendor/tesseract-2.04/cutil/callcpp.h +190 -0
- data/vendor/tesseract-2.04/cutil/const.h +108 -0
- data/vendor/tesseract-2.04/cutil/cutil.cpp +92 -0
- data/vendor/tesseract-2.04/cutil/cutil.h +159 -0
- data/vendor/tesseract-2.04/cutil/danerror.cpp +144 -0
- data/vendor/tesseract-2.04/cutil/danerror.h +41 -0
- data/vendor/tesseract-2.04/cutil/debug.cpp +97 -0
- data/vendor/tesseract-2.04/cutil/debug.h +348 -0
- data/vendor/tesseract-2.04/cutil/efio.cpp +62 -0
- data/vendor/tesseract-2.04/cutil/efio.h +32 -0
- data/vendor/tesseract-2.04/cutil/emalloc.cpp +91 -0
- data/vendor/tesseract-2.04/cutil/emalloc.h +44 -0
- data/vendor/tesseract-2.04/cutil/freelist.cpp +75 -0
- data/vendor/tesseract-2.04/cutil/freelist.h +45 -0
- data/vendor/tesseract-2.04/cutil/funcdefs.h +35 -0
- data/vendor/tesseract-2.04/cutil/general.h +33 -0
- data/vendor/tesseract-2.04/cutil/globals.cpp +69 -0
- data/vendor/tesseract-2.04/cutil/globals.h +70 -0
- data/vendor/tesseract-2.04/cutil/listio.cpp +68 -0
- data/vendor/tesseract-2.04/cutil/listio.h +43 -0
- data/vendor/tesseract-2.04/cutil/minmax.h +40 -0
- data/vendor/tesseract-2.04/cutil/oldheap.cpp +337 -0
- data/vendor/tesseract-2.04/cutil/oldheap.h +126 -0
- data/vendor/tesseract-2.04/cutil/oldlist.cpp +393 -0
- data/vendor/tesseract-2.04/cutil/oldlist.h +350 -0
- data/vendor/tesseract-2.04/cutil/structures.cpp +66 -0
- data/vendor/tesseract-2.04/cutil/structures.h +112 -0
- data/vendor/tesseract-2.04/cutil/tessarray.cpp +115 -0
- data/vendor/tesseract-2.04/cutil/tessarray.h +166 -0
- data/vendor/tesseract-2.04/cutil/tordvars.cpp +95 -0
- data/vendor/tesseract-2.04/cutil/tordvars.h +61 -0
- data/vendor/tesseract-2.04/cutil/variables.cpp +317 -0
- data/vendor/tesseract-2.04/cutil/variables.h +170 -0
- data/vendor/tesseract-2.04/dict/Makefile.am +13 -0
- data/vendor/tesseract-2.04/dict/Makefile.in +609 -0
- data/vendor/tesseract-2.04/dict/choicearr.h +96 -0
- data/vendor/tesseract-2.04/dict/choices.cpp +210 -0
- data/vendor/tesseract-2.04/dict/choices.h +241 -0
- data/vendor/tesseract-2.04/dict/context.cpp +270 -0
- data/vendor/tesseract-2.04/dict/context.h +82 -0
- data/vendor/tesseract-2.04/dict/dawg.cpp +363 -0
- data/vendor/tesseract-2.04/dict/dawg.h +394 -0
- data/vendor/tesseract-2.04/dict/hyphen.cpp +84 -0
- data/vendor/tesseract-2.04/dict/hyphen.h +125 -0
- data/vendor/tesseract-2.04/dict/lookdawg.cpp +228 -0
- data/vendor/tesseract-2.04/dict/lookdawg.h +76 -0
- data/vendor/tesseract-2.04/dict/makedawg.cpp +449 -0
- data/vendor/tesseract-2.04/dict/makedawg.h +83 -0
- data/vendor/tesseract-2.04/dict/matchdefs.h +145 -0
- data/vendor/tesseract-2.04/dict/permdawg.cpp +415 -0
- data/vendor/tesseract-2.04/dict/permdawg.h +98 -0
- data/vendor/tesseract-2.04/dict/permngram.cpp +358 -0
- data/vendor/tesseract-2.04/dict/permngram.h +33 -0
- data/vendor/tesseract-2.04/dict/permnum.cpp +522 -0
- data/vendor/tesseract-2.04/dict/permnum.h +83 -0
- data/vendor/tesseract-2.04/dict/permute.cpp +1704 -0
- data/vendor/tesseract-2.04/dict/permute.h +93 -0
- data/vendor/tesseract-2.04/dict/reduce.cpp +424 -0
- data/vendor/tesseract-2.04/dict/reduce.h +112 -0
- data/vendor/tesseract-2.04/dict/states.cpp +382 -0
- data/vendor/tesseract-2.04/dict/states.h +111 -0
- data/vendor/tesseract-2.04/dict/stopper.cpp +1458 -0
- data/vendor/tesseract-2.04/dict/stopper.h +103 -0
- data/vendor/tesseract-2.04/dict/trie.cpp +683 -0
- data/vendor/tesseract-2.04/dict/trie.h +190 -0
- data/vendor/tesseract-2.04/dlltest/Makefile.am +2 -0
- data/vendor/tesseract-2.04/dlltest/Makefile.in +388 -0
- data/vendor/tesseract-2.04/dlltest/dlltest.cpp +163 -0
- data/vendor/tesseract-2.04/dlltest/dlltest.dsp +186 -0
- data/vendor/tesseract-2.04/dlltest/dlltest.vcproj +637 -0
- data/vendor/tesseract-2.04/eurotext.tif +0 -0
- data/vendor/tesseract-2.04/image/Makefile.am +10 -0
- data/vendor/tesseract-2.04/image/Makefile.in +596 -0
- data/vendor/tesseract-2.04/image/bitstrm.cpp +157 -0
- data/vendor/tesseract-2.04/image/bitstrm.h +73 -0
- data/vendor/tesseract-2.04/image/img.h +336 -0
- data/vendor/tesseract-2.04/image/imgbmp.cpp +223 -0
- data/vendor/tesseract-2.04/image/imgbmp.h +50 -0
- data/vendor/tesseract-2.04/image/imgerrs.h +35 -0
- data/vendor/tesseract-2.04/image/imgio.cpp +321 -0
- data/vendor/tesseract-2.04/image/imgio.h +22 -0
- data/vendor/tesseract-2.04/image/imgs.cpp +1764 -0
- data/vendor/tesseract-2.04/image/imgs.h +102 -0
- data/vendor/tesseract-2.04/image/imgtiff.cpp +723 -0
- data/vendor/tesseract-2.04/image/imgtiff.h +89 -0
- data/vendor/tesseract-2.04/image/imgunpk.h +1377 -0
- data/vendor/tesseract-2.04/image/svshowim.cpp +40 -0
- data/vendor/tesseract-2.04/image/svshowim.h +25 -0
- data/vendor/tesseract-2.04/java/Makefile.am +4 -0
- data/vendor/tesseract-2.04/java/Makefile.in +473 -0
- data/vendor/tesseract-2.04/java/com/Makefile.am +1 -0
- data/vendor/tesseract-2.04/java/com/Makefile.in +470 -0
- data/vendor/tesseract-2.04/java/com/google/Makefile.am +1 -0
- data/vendor/tesseract-2.04/java/com/google/Makefile.in +470 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/Makefile.am +4 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/Makefile.in +473 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ScrollView.java +421 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/events/Makefile.am +5 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/events/Makefile.in +474 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/events/SVEvent.java +87 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/events/SVEventHandler.java +296 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/events/SVEventType.java +31 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/Makefile.am +7 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/Makefile.in +476 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVAbstractMenuItem.java +58 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVCheckboxMenuItem.java +60 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVEmptyMenuItem.java +48 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVImageHandler.java +228 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVMenuBar.java +130 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVMenuItem.java +61 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVPopupMenu.java +142 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVSubMenuItem.java +41 -0
- data/vendor/tesseract-2.04/java/com/google/scrollview/ui/SVWindow.java +643 -0
- data/vendor/tesseract-2.04/java/makefile +55 -0
- data/vendor/tesseract-2.04/pageseg/Makefile.am +13 -0
- data/vendor/tesseract-2.04/pageseg/Makefile.in +596 -0
- data/vendor/tesseract-2.04/pageseg/leptonica_pageseg.cpp +363 -0
- data/vendor/tesseract-2.04/pageseg/leptonica_pageseg.h +90 -0
- data/vendor/tesseract-2.04/pageseg/leptonica_pageseg_interface.cpp +82 -0
- data/vendor/tesseract-2.04/pageseg/leptonica_pageseg_interface.h +30 -0
- data/vendor/tesseract-2.04/pageseg/pageseg.cpp +170 -0
- data/vendor/tesseract-2.04/pageseg/pageseg.h +29 -0
- data/vendor/tesseract-2.04/phototest.tif +0 -0
- data/vendor/tesseract-2.04/tessdata/Makefile.am +31 -0
- data/vendor/tesseract-2.04/tessdata/Makefile.in +529 -0
- data/vendor/tesseract-2.04/tessdata/configs/Makefile.am +3 -0
- data/vendor/tesseract-2.04/tessdata/configs/Makefile.in +344 -0
- data/vendor/tesseract-2.04/tessdata/configs/api_config +1 -0
- data/vendor/tesseract-2.04/tessdata/configs/box.train +19 -0
- data/vendor/tesseract-2.04/tessdata/configs/box.train.stderr +18 -0
- data/vendor/tesseract-2.04/tessdata/configs/inter +4 -0
- data/vendor/tesseract-2.04/tessdata/configs/kannada +4 -0
- data/vendor/tesseract-2.04/tessdata/configs/makebox +1 -0
- data/vendor/tesseract-2.04/tessdata/configs/unlv +3 -0
- data/vendor/tesseract-2.04/tessdata/confsets +3 -0
- data/vendor/tesseract-2.04/tessdata/eng.DangAmbigs +39 -0
- data/vendor/tesseract-2.04/tessdata/eng.freq-dawg +0 -0
- data/vendor/tesseract-2.04/tessdata/eng.inttemp +0 -0
- data/vendor/tesseract-2.04/tessdata/eng.normproto +1247 -0
- data/vendor/tesseract-2.04/tessdata/eng.pffmtable +111 -0
- data/vendor/tesseract-2.04/tessdata/eng.unicharset +113 -0
- data/vendor/tesseract-2.04/tessdata/eng.user-words +921 -0
- data/vendor/tesseract-2.04/tessdata/eng.word-dawg +0 -0
- data/vendor/tesseract-2.04/tessdata/makedummies +8 -0
- data/vendor/tesseract-2.04/tessdata/tessconfigs/Makefile.am +3 -0
- data/vendor/tesseract-2.04/tessdata/tessconfigs/Makefile.in +344 -0
- data/vendor/tesseract-2.04/tessdata/tessconfigs/batch +2 -0
- data/vendor/tesseract-2.04/tessdata/tessconfigs/batch.nochop +2 -0
- data/vendor/tesseract-2.04/tessdata/tessconfigs/matdemo +7 -0
- data/vendor/tesseract-2.04/tessdata/tessconfigs/msdemo +13 -0
- data/vendor/tesseract-2.04/tessdata/tessconfigs/nobatch +2 -0
- data/vendor/tesseract-2.04/tessdata/tessconfigs/segdemo +9 -0
- data/vendor/tesseract-2.04/tessdll.cpp +351 -0
- data/vendor/tesseract-2.04/tessdll.dsp +2050 -0
- data/vendor/tesseract-2.04/tessdll.h +143 -0
- data/vendor/tesseract-2.04/tessdll.vcproj +5495 -0
- data/vendor/tesseract-2.04/tesseract.dsp +2124 -0
- data/vendor/tesseract-2.04/tesseract.dsw +116 -0
- data/vendor/tesseract-2.04/tesseract.sln +59 -0
- data/vendor/tesseract-2.04/tesseract.spec +188 -0
- data/vendor/tesseract-2.04/tesseract.vcproj +5859 -0
- data/vendor/tesseract-2.04/testing/Makefile.am +2 -0
- data/vendor/tesseract-2.04/testing/Makefile.in +312 -0
- data/vendor/tesseract-2.04/testing/README +43 -0
- data/vendor/tesseract-2.04/testing/counttestset.sh +61 -0
- data/vendor/tesseract-2.04/testing/reorgdata.sh +44 -0
- data/vendor/tesseract-2.04/testing/reports/1995.bus.3B.sum +1 -0
- data/vendor/tesseract-2.04/testing/reports/1995.doe3.3B.sum +1 -0
- data/vendor/tesseract-2.04/testing/reports/1995.mag.3B.sum +1 -0
- data/vendor/tesseract-2.04/testing/reports/1995.news.3B.sum +1 -0
- data/vendor/tesseract-2.04/testing/reports/2.03.summary +9 -0
- data/vendor/tesseract-2.04/testing/reports/2.04.summary +9 -0
- data/vendor/tesseract-2.04/testing/runalltests.sh +110 -0
- data/vendor/tesseract-2.04/testing/runtestset.sh +61 -0
- data/vendor/tesseract-2.04/textord/Makefile.am +20 -0
- data/vendor/tesseract-2.04/textord/Makefile.in +624 -0
- data/vendor/tesseract-2.04/textord/blkocc.cpp +809 -0
- data/vendor/tesseract-2.04/textord/blkocc.h +327 -0
- data/vendor/tesseract-2.04/textord/blobcmpl.h +31 -0
- data/vendor/tesseract-2.04/textord/drawedg.cpp +77 -0
- data/vendor/tesseract-2.04/textord/drawedg.h +34 -0
- data/vendor/tesseract-2.04/textord/drawtord.cpp +469 -0
- data/vendor/tesseract-2.04/textord/drawtord.h +107 -0
- data/vendor/tesseract-2.04/textord/edgblob.cpp +412 -0
- data/vendor/tesseract-2.04/textord/edgblob.h +100 -0
- data/vendor/tesseract-2.04/textord/edgloop.cpp +211 -0
- data/vendor/tesseract-2.04/textord/edgloop.h +66 -0
- data/vendor/tesseract-2.04/textord/fpchop.cpp +1641 -0
- data/vendor/tesseract-2.04/textord/fpchop.h +238 -0
- data/vendor/tesseract-2.04/textord/gap_map.cpp +166 -0
- data/vendor/tesseract-2.04/textord/gap_map.h +40 -0
- data/vendor/tesseract-2.04/textord/makerow.cpp +2628 -0
- data/vendor/tesseract-2.04/textord/makerow.h +295 -0
- data/vendor/tesseract-2.04/textord/oldbasel.cpp +1761 -0
- data/vendor/tesseract-2.04/textord/oldbasel.h +195 -0
- data/vendor/tesseract-2.04/textord/pithsync.cpp +696 -0
- data/vendor/tesseract-2.04/textord/pithsync.h +134 -0
- data/vendor/tesseract-2.04/textord/pitsync1.cpp +425 -0
- data/vendor/tesseract-2.04/textord/pitsync1.h +135 -0
- data/vendor/tesseract-2.04/textord/scanedg.cpp +452 -0
- data/vendor/tesseract-2.04/textord/scanedg.h +74 -0
- data/vendor/tesseract-2.04/textord/sortflts.cpp +80 -0
- data/vendor/tesseract-2.04/textord/sortflts.h +64 -0
- data/vendor/tesseract-2.04/textord/tessout.h +76 -0
- data/vendor/tesseract-2.04/textord/topitch.cpp +2019 -0
- data/vendor/tesseract-2.04/textord/topitch.h +195 -0
- data/vendor/tesseract-2.04/textord/tordmain.cpp +907 -0
- data/vendor/tesseract-2.04/textord/tordmain.h +132 -0
- data/vendor/tesseract-2.04/textord/tospace.cpp +1939 -0
- data/vendor/tesseract-2.04/textord/tospace.h +193 -0
- data/vendor/tesseract-2.04/textord/tovars.cpp +87 -0
- data/vendor/tesseract-2.04/textord/tovars.h +94 -0
- data/vendor/tesseract-2.04/textord/underlin.cpp +312 -0
- data/vendor/tesseract-2.04/textord/underlin.h +53 -0
- data/vendor/tesseract-2.04/textord/wordseg.cpp +620 -0
- data/vendor/tesseract-2.04/textord/wordseg.h +70 -0
- data/vendor/tesseract-2.04/training/Makefile.am +54 -0
- data/vendor/tesseract-2.04/training/Makefile.in +720 -0
- data/vendor/tesseract-2.04/training/cnTraining.cpp +855 -0
- data/vendor/tesseract-2.04/training/cntraining.dsp +243 -0
- data/vendor/tesseract-2.04/training/cntraining.vcproj +950 -0
- data/vendor/tesseract-2.04/training/mergenf.cpp +451 -0
- data/vendor/tesseract-2.04/training/mergenf.h +106 -0
- data/vendor/tesseract-2.04/training/mfTraining.cpp +1341 -0
- data/vendor/tesseract-2.04/training/mftraining.dsp +285 -0
- data/vendor/tesseract-2.04/training/mftraining.vcproj +1055 -0
- data/vendor/tesseract-2.04/training/name2char.cpp +166 -0
- data/vendor/tesseract-2.04/training/name2char.h +38 -0
- data/vendor/tesseract-2.04/training/training.cpp +190 -0
- data/vendor/tesseract-2.04/training/training.h +130 -0
- data/vendor/tesseract-2.04/training/unicharset_extractor.cpp +140 -0
- data/vendor/tesseract-2.04/training/unicharset_extractor.dsp +335 -0
- data/vendor/tesseract-2.04/training/unicharset_extractor.vcproj +769 -0
- data/vendor/tesseract-2.04/training/wordlist2dawg.cpp +69 -0
- data/vendor/tesseract-2.04/training/wordlist2dawg.dsp +319 -0
- data/vendor/tesseract-2.04/training/wordlist2dawg.vcproj +1113 -0
- data/vendor/tesseract-2.04/viewer/Makefile.am +9 -0
- data/vendor/tesseract-2.04/viewer/Makefile.in +591 -0
- data/vendor/tesseract-2.04/viewer/scrollview.cpp +825 -0
- data/vendor/tesseract-2.04/viewer/scrollview.h +414 -0
- data/vendor/tesseract-2.04/viewer/svmnode.cpp +140 -0
- data/vendor/tesseract-2.04/viewer/svmnode.h +94 -0
- data/vendor/tesseract-2.04/viewer/svpaint.cpp +220 -0
- data/vendor/tesseract-2.04/viewer/svutil.cpp +347 -0
- data/vendor/tesseract-2.04/viewer/svutil.h +138 -0
- data/vendor/tesseract-2.04/wordrec/Makefile.am +23 -0
- data/vendor/tesseract-2.04/wordrec/Makefile.in +641 -0
- data/vendor/tesseract-2.04/wordrec/associate.cpp +62 -0
- data/vendor/tesseract-2.04/wordrec/associate.h +93 -0
- data/vendor/tesseract-2.04/wordrec/badwords.cpp +106 -0
- data/vendor/tesseract-2.04/wordrec/badwords.h +51 -0
- data/vendor/tesseract-2.04/wordrec/bestfirst.cpp +526 -0
- data/vendor/tesseract-2.04/wordrec/bestfirst.h +203 -0
- data/vendor/tesseract-2.04/wordrec/charsample.h +208 -0
- data/vendor/tesseract-2.04/wordrec/chop.cpp +458 -0
- data/vendor/tesseract-2.04/wordrec/chop.h +153 -0
- data/vendor/tesseract-2.04/wordrec/chopper.cpp +750 -0
- data/vendor/tesseract-2.04/wordrec/chopper.h +104 -0
- data/vendor/tesseract-2.04/wordrec/closed.cpp +136 -0
- data/vendor/tesseract-2.04/wordrec/closed.h +65 -0
- data/vendor/tesseract-2.04/wordrec/djmenus.cpp +118 -0
- data/vendor/tesseract-2.04/wordrec/djmenus.h +33 -0
- data/vendor/tesseract-2.04/wordrec/drawfx.cpp +92 -0
- data/vendor/tesseract-2.04/wordrec/drawfx.h +33 -0
- data/vendor/tesseract-2.04/wordrec/findseam.cpp +566 -0
- data/vendor/tesseract-2.04/wordrec/findseam.h +69 -0
- data/vendor/tesseract-2.04/wordrec/gradechop.cpp +226 -0
- data/vendor/tesseract-2.04/wordrec/gradechop.h +91 -0
- data/vendor/tesseract-2.04/wordrec/heuristic.cpp +194 -0
- data/vendor/tesseract-2.04/wordrec/heuristic.h +120 -0
- data/vendor/tesseract-2.04/wordrec/makechop.cpp +281 -0
- data/vendor/tesseract-2.04/wordrec/makechop.h +69 -0
- data/vendor/tesseract-2.04/wordrec/matchtab.cpp +191 -0
- data/vendor/tesseract-2.04/wordrec/matchtab.h +45 -0
- data/vendor/tesseract-2.04/wordrec/matrix.cpp +118 -0
- data/vendor/tesseract-2.04/wordrec/matrix.h +104 -0
- data/vendor/tesseract-2.04/wordrec/measure.h +135 -0
- data/vendor/tesseract-2.04/wordrec/metrics.cpp +363 -0
- data/vendor/tesseract-2.04/wordrec/metrics.h +130 -0
- data/vendor/tesseract-2.04/wordrec/mfvars.cpp +51 -0
- data/vendor/tesseract-2.04/wordrec/mfvars.h +27 -0
- data/vendor/tesseract-2.04/wordrec/msmenus.cpp +110 -0
- data/vendor/tesseract-2.04/wordrec/msmenus.h +45 -0
- data/vendor/tesseract-2.04/wordrec/olutil.cpp +153 -0
- data/vendor/tesseract-2.04/wordrec/olutil.h +128 -0
- data/vendor/tesseract-2.04/wordrec/outlines.cpp +172 -0
- data/vendor/tesseract-2.04/wordrec/outlines.h +148 -0
- data/vendor/tesseract-2.04/wordrec/pieces.cpp +410 -0
- data/vendor/tesseract-2.04/wordrec/pieces.h +154 -0
- data/vendor/tesseract-2.04/wordrec/plotedges.cpp +134 -0
- data/vendor/tesseract-2.04/wordrec/plotedges.h +71 -0
- data/vendor/tesseract-2.04/wordrec/plotseg.cpp +116 -0
- data/vendor/tesseract-2.04/wordrec/plotseg.h +73 -0
- data/vendor/tesseract-2.04/wordrec/render.cpp +152 -0
- data/vendor/tesseract-2.04/wordrec/render.h +58 -0
- data/vendor/tesseract-2.04/wordrec/seam.cpp +482 -0
- data/vendor/tesseract-2.04/wordrec/seam.h +136 -0
- data/vendor/tesseract-2.04/wordrec/split.cpp +182 -0
- data/vendor/tesseract-2.04/wordrec/split.h +115 -0
- data/vendor/tesseract-2.04/wordrec/tally.cpp +68 -0
- data/vendor/tesseract-2.04/wordrec/tally.h +94 -0
- data/vendor/tesseract-2.04/wordrec/tessinit.cpp +108 -0
- data/vendor/tesseract-2.04/wordrec/tessinit.h +46 -0
- data/vendor/tesseract-2.04/wordrec/tface.cpp +272 -0
- data/vendor/tesseract-2.04/wordrec/tface.h +35 -0
- data/vendor/tesseract-2.04/wordrec/wordclass.cpp +284 -0
- data/vendor/tesseract-2.04/wordrec/wordclass.h +64 -0
- metadata +708 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
* File: underlin.h (Formerly undrline.h)
|
3
|
+
* Description: Code to chop blobs apart from underlines.
|
4
|
+
* Author: Ray Smith
|
5
|
+
* Created: Mon Aug 8 11:14:00 BST 1994
|
6
|
+
*
|
7
|
+
* (C) Copyright 1994, Hewlett-Packard Ltd.
|
8
|
+
** Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
** you may not use this file except in compliance with the License.
|
10
|
+
** You may obtain a copy of the License at
|
11
|
+
** http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
** Unless required by applicable law or agreed to in writing, software
|
13
|
+
** distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
** See the License for the specific language governing permissions and
|
16
|
+
** limitations under the License.
|
17
|
+
*
|
18
|
+
**********************************************************************/
|
19
|
+
|
20
|
+
#ifndef UNDERLIN_H
|
21
|
+
#define UNDERLIN_H
|
22
|
+
|
23
|
+
#include "fpchop.h"
|
24
|
+
#include "notdll.h"
|
25
|
+
|
26
|
+
extern double_VAR_H (textord_underline_offset, 0.1,
|
27
|
+
"Fraction of x to ignore");
|
28
|
+
extern BOOL_VAR_H (textord_restore_underlines, FALSE,
|
29
|
+
"Chop underlines & put back");
|
30
|
+
void restore_underlined_blobs( //get chop points
|
31
|
+
TO_BLOCK *block //block to do
|
32
|
+
);
|
33
|
+
TO_ROW *most_overlapping_row( //find best row
|
34
|
+
TO_ROW_LIST *rows, //list of rows
|
35
|
+
BLOBNBOX *blob //blob to place
|
36
|
+
);
|
37
|
+
void find_underlined_blobs( //get chop points
|
38
|
+
BLOBNBOX *u_line, //underlined unit
|
39
|
+
QSPLINE *baseline, //actual baseline
|
40
|
+
float xheight, //height of line
|
41
|
+
float baseline_offset, //amount to shrinke it
|
42
|
+
ICOORDELT_LIST *chop_cells //places to chop
|
43
|
+
);
|
44
|
+
void vertical_cunderline_projection( //project outlines
|
45
|
+
C_OUTLINE *outline, //outline to project
|
46
|
+
QSPLINE *baseline, //actual baseline
|
47
|
+
float xheight, //height of line
|
48
|
+
float baseline_offset, //amount to shrinke it
|
49
|
+
STATS *lower_proj, //below baseline
|
50
|
+
STATS *middle_proj, //centre region
|
51
|
+
STATS *upper_proj //top region
|
52
|
+
);
|
53
|
+
#endif
|
@@ -0,0 +1,620 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
* File: wordseg.cpp (Formerly wspace.c)
|
3
|
+
* Description: Code to segment the blobs into words.
|
4
|
+
* Author: Ray Smith
|
5
|
+
* Created: Fri Oct 16 11:32:28 BST 1992
|
6
|
+
*
|
7
|
+
* (C) Copyright 1992, Hewlett-Packard Ltd.
|
8
|
+
** Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
** you may not use this file except in compliance with the License.
|
10
|
+
** You may obtain a copy of the License at
|
11
|
+
** http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
** Unless required by applicable law or agreed to in writing, software
|
13
|
+
** distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
** See the License for the specific language governing permissions and
|
16
|
+
** limitations under the License.
|
17
|
+
*
|
18
|
+
**********************************************************************/
|
19
|
+
|
20
|
+
#include "mfcpch.h"
|
21
|
+
#ifdef __UNIX__
|
22
|
+
#include <assert.h>
|
23
|
+
#endif
|
24
|
+
#include "stderr.h"
|
25
|
+
#include "blobbox.h"
|
26
|
+
#include "ocrclass.h"
|
27
|
+
#include "lmedsq.h"
|
28
|
+
#include "statistc.h"
|
29
|
+
#include "drawtord.h"
|
30
|
+
#include "makerow.h"
|
31
|
+
#include "pitsync1.h"
|
32
|
+
#include "blobcmpl.h"
|
33
|
+
#include "tovars.h"
|
34
|
+
#include "topitch.h"
|
35
|
+
#include "tospace.h"
|
36
|
+
#include "fpchop.h"
|
37
|
+
#include "wordseg.h"
|
38
|
+
|
39
|
+
#define EXTERN
|
40
|
+
|
41
|
+
EXTERN BOOL_VAR (textord_fp_chopping, TRUE, "Do fixed pitch chopping");
|
42
|
+
extern /*"C" */ ETEXT_DESC *global_monitor; //progress monitor
|
43
|
+
|
44
|
+
#define FIXED_WIDTH_MULTIPLE 5
|
45
|
+
#define BLOCK_STATS_CLUSTERS 10
|
46
|
+
|
47
|
+
/**********************************************************************
|
48
|
+
* make_words
|
49
|
+
*
|
50
|
+
* Arrange the blobs into words.
|
51
|
+
**********************************************************************/
|
52
|
+
|
53
|
+
void make_words( //make words
|
54
|
+
ICOORD page_tr, //top right
|
55
|
+
float gradient, //page skew
|
56
|
+
BLOCK_LIST *blocks, //block list
|
57
|
+
TO_BLOCK_LIST *land_blocks, //rotated for landscape
|
58
|
+
TO_BLOCK_LIST *port_blocks //output list
|
59
|
+
) {
|
60
|
+
TO_BLOCK_IT block_it; //iterator
|
61
|
+
TO_BLOCK *block; //current block;
|
62
|
+
|
63
|
+
compute_fixed_pitch (page_tr, port_blocks, gradient, FCOORD (0.0f, -1.0f),
|
64
|
+
!(BOOL8) textord_test_landscape);
|
65
|
+
if (global_monitor != NULL) {
|
66
|
+
global_monitor->ocr_alive = TRUE;
|
67
|
+
global_monitor->progress = 25;
|
68
|
+
}
|
69
|
+
to_spacing(page_tr, port_blocks);
|
70
|
+
block_it.set_to_list (port_blocks);
|
71
|
+
for (block_it.mark_cycle_pt (); !block_it.cycled_list ();
|
72
|
+
block_it.forward ()) {
|
73
|
+
block = block_it.data ();
|
74
|
+
// set_row_spaces(block,FCOORD(1,0),!(BOOL8)textord_test_landscape);
|
75
|
+
//make proper classes
|
76
|
+
make_real_words (block, FCOORD (1.0f, 0.0f));
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
|
81
|
+
/**********************************************************************
|
82
|
+
* set_row_spaces
|
83
|
+
*
|
84
|
+
* Set the min_space and max_nonspace members of the row so that
|
85
|
+
* the blobs can be arranged into words.
|
86
|
+
**********************************************************************/
|
87
|
+
|
88
|
+
void set_row_spaces( //find space sizes
|
89
|
+
TO_BLOCK *block, //block to do
|
90
|
+
FCOORD rotation, //for drawing
|
91
|
+
BOOL8 testing_on //correct orientation
|
92
|
+
) {
|
93
|
+
inT32 maxwidth; //of widest space
|
94
|
+
TO_ROW *row; //current row
|
95
|
+
TO_ROW_IT row_it = block->get_rows ();
|
96
|
+
|
97
|
+
if (row_it.empty ())
|
98
|
+
return; //empty block
|
99
|
+
maxwidth = (inT32) ceil (block->xheight * textord_words_maxspace);
|
100
|
+
for (row_it.mark_cycle_pt (); !row_it.cycled_list (); row_it.forward ()) {
|
101
|
+
row = row_it.data ();
|
102
|
+
if (row->fixed_pitch == 0) {
|
103
|
+
// if (!textord_test_mode
|
104
|
+
// && row_words(block,row,maxwidth,rotation,testing_on)==0
|
105
|
+
// || textord_test_mode
|
106
|
+
// && row_words2(block,row,maxwidth,rotation,testing_on)==0)
|
107
|
+
// {
|
108
|
+
row->min_space =
|
109
|
+
(inT32) ceil (row->pr_space -
|
110
|
+
(row->pr_space -
|
111
|
+
row->pr_nonsp) * textord_words_definite_spread);
|
112
|
+
row->max_nonspace =
|
113
|
+
(inT32) floor (row->pr_nonsp +
|
114
|
+
(row->pr_space -
|
115
|
+
row->pr_nonsp) * textord_words_definite_spread);
|
116
|
+
if (testing_on && textord_show_initial_words) {
|
117
|
+
tprintf ("Assigning defaults %d non, %d space to row at %g\n",
|
118
|
+
row->max_nonspace, row->min_space, row->intercept ());
|
119
|
+
}
|
120
|
+
row->space_threshold = (row->max_nonspace + row->min_space) / 2;
|
121
|
+
row->space_size = row->pr_space;
|
122
|
+
row->kern_size = row->pr_nonsp;
|
123
|
+
// }
|
124
|
+
}
|
125
|
+
#ifndef GRAPHICS_DISABLED
|
126
|
+
if (textord_show_initial_words && testing_on) {
|
127
|
+
plot_word_decisions (to_win, (inT16) row->fixed_pitch, row);
|
128
|
+
}
|
129
|
+
#endif
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
/**********************************************************************
|
135
|
+
* row_words
|
136
|
+
*
|
137
|
+
* Compute the max nonspace and min space for the row.
|
138
|
+
**********************************************************************/
|
139
|
+
|
140
|
+
inT32 row_words( //compute space size
|
141
|
+
TO_BLOCK *block, //block it came from
|
142
|
+
TO_ROW *row, //row to operate on
|
143
|
+
inT32 maxwidth, //max expected space size
|
144
|
+
FCOORD rotation, //for drawing
|
145
|
+
BOOL8 testing_on //for debug
|
146
|
+
) {
|
147
|
+
BOOL8 testing_row; //contains testpt
|
148
|
+
BOOL8 prev_valid; //if decent size
|
149
|
+
BOOL8 this_valid; //current blob big enough
|
150
|
+
inT32 prev_x; //end of prev blob
|
151
|
+
inT32 min_gap; //min interesting gap
|
152
|
+
inT32 cluster_count; //no of clusters
|
153
|
+
inT32 gap_index; //which cluster
|
154
|
+
inT32 smooth_factor; //for smoothing stats
|
155
|
+
BLOBNBOX *blob; //current blob
|
156
|
+
float lower, upper; //clustering parameters
|
157
|
+
float gaps[3]; //gap clusers
|
158
|
+
ICOORD testpt;
|
159
|
+
TBOX blob_box; //bounding box
|
160
|
+
//iterator
|
161
|
+
BLOBNBOX_IT blob_it = row->blob_list ();
|
162
|
+
STATS gap_stats (0, maxwidth);
|
163
|
+
STATS cluster_stats[4]; //clusters
|
164
|
+
|
165
|
+
testpt = ICOORD (textord_test_x, textord_test_y);
|
166
|
+
smooth_factor =
|
167
|
+
(inT32) (block->xheight * textord_wordstats_smooth_factor + 1.5);
|
168
|
+
// if (testing_on)
|
169
|
+
// tprintf("Row smooth factor=%d\n",smooth_factor);
|
170
|
+
prev_valid = FALSE;
|
171
|
+
prev_x = -MAX_INT32;
|
172
|
+
testing_row = FALSE;
|
173
|
+
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ()) {
|
174
|
+
blob = blob_it.data ();
|
175
|
+
blob_box = blob->bounding_box ();
|
176
|
+
if (blob_box.contains (testpt))
|
177
|
+
testing_row = TRUE;
|
178
|
+
gap_stats.add (blob_box.width (), 1);
|
179
|
+
}
|
180
|
+
min_gap = (inT32) floor (gap_stats.ile (textord_words_width_ile));
|
181
|
+
gap_stats.clear ();
|
182
|
+
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ()) {
|
183
|
+
blob = blob_it.data ();
|
184
|
+
if (!blob->joined_to_prev ()) {
|
185
|
+
blob_box = blob->bounding_box ();
|
186
|
+
// this_valid=blob_box.width()>=min_gap;
|
187
|
+
this_valid = TRUE;
|
188
|
+
if (this_valid && prev_valid
|
189
|
+
&& blob_box.left () - prev_x < maxwidth) {
|
190
|
+
gap_stats.add (blob_box.left () - prev_x, 1);
|
191
|
+
}
|
192
|
+
prev_x = blob_box.right ();
|
193
|
+
prev_valid = this_valid;
|
194
|
+
}
|
195
|
+
}
|
196
|
+
if (gap_stats.get_total () == 0) {
|
197
|
+
row->min_space = 0; //no evidence
|
198
|
+
row->max_nonspace = 0;
|
199
|
+
return 0;
|
200
|
+
}
|
201
|
+
gap_stats.smooth (smooth_factor);
|
202
|
+
lower = row->xheight * textord_words_initial_lower;
|
203
|
+
upper = row->xheight * textord_words_initial_upper;
|
204
|
+
cluster_count = gap_stats.cluster (lower, upper,
|
205
|
+
textord_spacesize_ratioprop, 3,
|
206
|
+
cluster_stats);
|
207
|
+
while (cluster_count < 2 && ceil (lower) < floor (upper)) {
|
208
|
+
//shrink gap
|
209
|
+
upper = (upper * 3 + lower) / 4;
|
210
|
+
lower = (lower * 3 + upper) / 4;
|
211
|
+
cluster_count = gap_stats.cluster (lower, upper,
|
212
|
+
textord_spacesize_ratioprop, 3,
|
213
|
+
cluster_stats);
|
214
|
+
}
|
215
|
+
if (cluster_count < 2) {
|
216
|
+
row->min_space = 0; //no evidence
|
217
|
+
row->max_nonspace = 0;
|
218
|
+
return 0;
|
219
|
+
}
|
220
|
+
for (gap_index = 0; gap_index < cluster_count; gap_index++)
|
221
|
+
gaps[gap_index] = cluster_stats[gap_index + 1].ile (0.5);
|
222
|
+
//get medians
|
223
|
+
if (cluster_count > 2) {
|
224
|
+
if (testing_on && textord_show_initial_words) {
|
225
|
+
tprintf ("Row at %g has 3 sizes of gap:%g,%g,%g\n",
|
226
|
+
row->intercept (),
|
227
|
+
cluster_stats[1].ile (0.5),
|
228
|
+
cluster_stats[2].ile (0.5), cluster_stats[3].ile (0.5));
|
229
|
+
}
|
230
|
+
lower = gaps[0];
|
231
|
+
if (gaps[1] > lower) {
|
232
|
+
upper = gaps[1]; //prefer most frequent
|
233
|
+
if (upper < block->xheight * textord_words_min_minspace
|
234
|
+
&& gaps[2] > gaps[1]) {
|
235
|
+
upper = gaps[2];
|
236
|
+
}
|
237
|
+
}
|
238
|
+
else if (gaps[2] > lower
|
239
|
+
&& gaps[2] >= block->xheight * textord_words_min_minspace)
|
240
|
+
upper = gaps[2];
|
241
|
+
else if (lower >= block->xheight * textord_words_min_minspace) {
|
242
|
+
upper = lower; //not nice
|
243
|
+
lower = gaps[1];
|
244
|
+
if (testing_on && textord_show_initial_words) {
|
245
|
+
tprintf ("Had to switch most common from lower to upper!!\n");
|
246
|
+
gap_stats.print (stdout, TRUE);
|
247
|
+
}
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
row->min_space = 0; //no evidence
|
251
|
+
row->max_nonspace = 0;
|
252
|
+
return 0;
|
253
|
+
}
|
254
|
+
}
|
255
|
+
else {
|
256
|
+
if (gaps[1] < gaps[0]) {
|
257
|
+
if (testing_on && textord_show_initial_words) {
|
258
|
+
tprintf ("Had to switch most common from lower to upper!!\n");
|
259
|
+
gap_stats.print (stdout, TRUE);
|
260
|
+
}
|
261
|
+
lower = gaps[1];
|
262
|
+
upper = gaps[0];
|
263
|
+
}
|
264
|
+
else {
|
265
|
+
upper = gaps[1];
|
266
|
+
lower = gaps[0];
|
267
|
+
}
|
268
|
+
}
|
269
|
+
if (upper < block->xheight * textord_words_min_minspace) {
|
270
|
+
row->min_space = 0; //no evidence
|
271
|
+
row->max_nonspace = 0;
|
272
|
+
return 0;
|
273
|
+
}
|
274
|
+
if (upper * 3 < block->min_space * 2 + block->max_nonspace
|
275
|
+
|| lower * 3 > block->min_space * 2 + block->max_nonspace) {
|
276
|
+
if (testing_on && textord_show_initial_words) {
|
277
|
+
tprintf ("Disagreement between block and row at %g!!\n",
|
278
|
+
row->intercept ());
|
279
|
+
tprintf ("Lower=%g, upper=%g, Stats:\n", lower, upper);
|
280
|
+
gap_stats.print (stdout, TRUE);
|
281
|
+
}
|
282
|
+
}
|
283
|
+
row->min_space =
|
284
|
+
(inT32) ceil (upper - (upper - lower) * textord_words_definite_spread);
|
285
|
+
row->max_nonspace =
|
286
|
+
(inT32) floor (lower + (upper - lower) * textord_words_definite_spread);
|
287
|
+
row->space_threshold = (row->max_nonspace + row->min_space) / 2;
|
288
|
+
row->space_size = upper;
|
289
|
+
row->kern_size = lower;
|
290
|
+
if (testing_on && textord_show_initial_words) {
|
291
|
+
if (testing_row) {
|
292
|
+
tprintf ("GAP STATS\n");
|
293
|
+
gap_stats.print (stdout, TRUE);
|
294
|
+
tprintf ("SPACE stats\n");
|
295
|
+
cluster_stats[2].print (stdout, FALSE);
|
296
|
+
tprintf ("NONSPACE stats\n");
|
297
|
+
cluster_stats[1].print (stdout, FALSE);
|
298
|
+
}
|
299
|
+
tprintf ("Row at %g has minspace=%d(%g), max_non=%d(%g)\n",
|
300
|
+
row->intercept (), row->min_space, upper,
|
301
|
+
row->max_nonspace, lower);
|
302
|
+
}
|
303
|
+
return cluster_stats[2].get_total ();
|
304
|
+
}
|
305
|
+
|
306
|
+
|
307
|
+
/**********************************************************************
|
308
|
+
* row_words2
|
309
|
+
*
|
310
|
+
* Compute the max nonspace and min space for the row.
|
311
|
+
**********************************************************************/
|
312
|
+
|
313
|
+
inT32 row_words2( //compute space size
|
314
|
+
TO_BLOCK *block, //block it came from
|
315
|
+
TO_ROW *row, //row to operate on
|
316
|
+
inT32 maxwidth, //max expected space size
|
317
|
+
FCOORD rotation, //for drawing
|
318
|
+
BOOL8 testing_on //for debug
|
319
|
+
) {
|
320
|
+
BOOL8 testing_row; //contains testpt
|
321
|
+
BOOL8 prev_valid; //if decent size
|
322
|
+
BOOL8 this_valid; //current blob big enough
|
323
|
+
inT32 prev_x; //end of prev blob
|
324
|
+
inT32 min_width; //min interesting width
|
325
|
+
inT32 valid_count; //good gaps
|
326
|
+
inT32 total_count; //total gaps
|
327
|
+
inT32 cluster_count; //no of clusters
|
328
|
+
inT32 prev_count; //previous cluster_count
|
329
|
+
inT32 gap_index; //which cluster
|
330
|
+
inT32 smooth_factor; //for smoothing stats
|
331
|
+
BLOBNBOX *blob; //current blob
|
332
|
+
float lower, upper; //clustering parameters
|
333
|
+
ICOORD testpt;
|
334
|
+
TBOX blob_box; //bounding box
|
335
|
+
//iterator
|
336
|
+
BLOBNBOX_IT blob_it = row->blob_list ();
|
337
|
+
STATS gap_stats (0, maxwidth);
|
338
|
+
//gap sizes
|
339
|
+
float gaps[BLOCK_STATS_CLUSTERS];
|
340
|
+
STATS cluster_stats[BLOCK_STATS_CLUSTERS + 1];
|
341
|
+
//clusters
|
342
|
+
|
343
|
+
testpt = ICOORD (textord_test_x, textord_test_y);
|
344
|
+
smooth_factor =
|
345
|
+
(inT32) (block->xheight * textord_wordstats_smooth_factor + 1.5);
|
346
|
+
// if (testing_on)
|
347
|
+
// tprintf("Row smooth factor=%d\n",smooth_factor);
|
348
|
+
prev_valid = FALSE;
|
349
|
+
prev_x = -MAX_INT16;
|
350
|
+
testing_row = FALSE;
|
351
|
+
//min blob size
|
352
|
+
min_width = (inT32) block->pr_space;
|
353
|
+
total_count = 0;
|
354
|
+
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ()) {
|
355
|
+
blob = blob_it.data ();
|
356
|
+
if (!blob->joined_to_prev ()) {
|
357
|
+
blob_box = blob->bounding_box ();
|
358
|
+
this_valid = blob_box.width () >= min_width;
|
359
|
+
this_valid = TRUE;
|
360
|
+
if (this_valid && prev_valid
|
361
|
+
&& blob_box.left () - prev_x < maxwidth) {
|
362
|
+
gap_stats.add (blob_box.left () - prev_x, 1);
|
363
|
+
}
|
364
|
+
total_count++; //count possibles
|
365
|
+
prev_x = blob_box.right ();
|
366
|
+
prev_valid = this_valid;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
valid_count = gap_stats.get_total ();
|
370
|
+
if (valid_count < total_count * textord_words_minlarge) {
|
371
|
+
gap_stats.clear ();
|
372
|
+
prev_x = -MAX_INT16;
|
373
|
+
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list ();
|
374
|
+
blob_it.forward ()) {
|
375
|
+
blob = blob_it.data ();
|
376
|
+
if (!blob->joined_to_prev ()) {
|
377
|
+
blob_box = blob->bounding_box ();
|
378
|
+
if (blob_box.left () - prev_x < maxwidth) {
|
379
|
+
gap_stats.add (blob_box.left () - prev_x, 1);
|
380
|
+
}
|
381
|
+
prev_x = blob_box.right ();
|
382
|
+
}
|
383
|
+
}
|
384
|
+
}
|
385
|
+
if (gap_stats.get_total () == 0) {
|
386
|
+
row->min_space = 0; //no evidence
|
387
|
+
row->max_nonspace = 0;
|
388
|
+
return 0;
|
389
|
+
}
|
390
|
+
|
391
|
+
cluster_count = 0;
|
392
|
+
lower = block->xheight * words_initial_lower;
|
393
|
+
upper = block->xheight * words_initial_upper;
|
394
|
+
gap_stats.smooth (smooth_factor);
|
395
|
+
do {
|
396
|
+
prev_count = cluster_count;
|
397
|
+
cluster_count = gap_stats.cluster (lower, upper,
|
398
|
+
textord_spacesize_ratioprop,
|
399
|
+
BLOCK_STATS_CLUSTERS, cluster_stats);
|
400
|
+
}
|
401
|
+
while (cluster_count > prev_count && cluster_count < BLOCK_STATS_CLUSTERS);
|
402
|
+
if (cluster_count < 1) {
|
403
|
+
row->min_space = 0;
|
404
|
+
row->max_nonspace = 0;
|
405
|
+
return 0;
|
406
|
+
}
|
407
|
+
for (gap_index = 0; gap_index < cluster_count; gap_index++)
|
408
|
+
gaps[gap_index] = cluster_stats[gap_index + 1].ile (0.5);
|
409
|
+
//get medians
|
410
|
+
if (testing_on) {
|
411
|
+
tprintf ("cluster_count=%d:", cluster_count);
|
412
|
+
for (gap_index = 0; gap_index < cluster_count; gap_index++)
|
413
|
+
tprintf (" %g(%d)", gaps[gap_index],
|
414
|
+
cluster_stats[gap_index + 1].get_total ());
|
415
|
+
tprintf ("\n");
|
416
|
+
}
|
417
|
+
|
418
|
+
//Try to find proportional non-space and space for row.
|
419
|
+
for (gap_index = 0; gap_index < cluster_count
|
420
|
+
&& gaps[gap_index] > block->max_nonspace; gap_index++);
|
421
|
+
if (gap_index < cluster_count)
|
422
|
+
lower = gaps[gap_index]; //most frequent below
|
423
|
+
else {
|
424
|
+
if (testing_on)
|
425
|
+
tprintf ("No cluster below block threshold!, using default=%g\n",
|
426
|
+
block->pr_nonsp);
|
427
|
+
lower = block->pr_nonsp;
|
428
|
+
}
|
429
|
+
for (gap_index = 0; gap_index < cluster_count
|
430
|
+
&& gaps[gap_index] <= block->max_nonspace; gap_index++);
|
431
|
+
if (gap_index < cluster_count)
|
432
|
+
upper = gaps[gap_index]; //most frequent above
|
433
|
+
else {
|
434
|
+
if (testing_on)
|
435
|
+
tprintf ("No cluster above block threshold!, using default=%g\n",
|
436
|
+
block->pr_space);
|
437
|
+
upper = block->pr_space;
|
438
|
+
}
|
439
|
+
row->min_space =
|
440
|
+
(inT32) ceil (upper - (upper - lower) * textord_words_definite_spread);
|
441
|
+
row->max_nonspace =
|
442
|
+
(inT32) floor (lower + (upper - lower) * textord_words_definite_spread);
|
443
|
+
row->space_threshold = (row->max_nonspace + row->min_space) / 2;
|
444
|
+
row->space_size = upper;
|
445
|
+
row->kern_size = lower;
|
446
|
+
if (testing_on) {
|
447
|
+
if (testing_row) {
|
448
|
+
tprintf ("GAP STATS\n");
|
449
|
+
gap_stats.print (stdout, TRUE);
|
450
|
+
tprintf ("SPACE stats\n");
|
451
|
+
cluster_stats[2].print (stdout, FALSE);
|
452
|
+
tprintf ("NONSPACE stats\n");
|
453
|
+
cluster_stats[1].print (stdout, FALSE);
|
454
|
+
}
|
455
|
+
tprintf ("Row at %g has minspace=%d(%g), max_non=%d(%g)\n",
|
456
|
+
row->intercept (), row->min_space, upper,
|
457
|
+
row->max_nonspace, lower);
|
458
|
+
}
|
459
|
+
return 1;
|
460
|
+
}
|
461
|
+
|
462
|
+
|
463
|
+
/**********************************************************************
|
464
|
+
* make_real_words
|
465
|
+
*
|
466
|
+
* Convert a TO_BLOCK to a BLOCK.
|
467
|
+
**********************************************************************/
|
468
|
+
|
469
|
+
void make_real_words( //find lines
|
470
|
+
TO_BLOCK *block, //block to do
|
471
|
+
FCOORD rotation //for drawing
|
472
|
+
) {
|
473
|
+
TO_ROW *row; //current row
|
474
|
+
TO_ROW_IT row_it = block->get_rows ();
|
475
|
+
ROW *real_row = NULL; //output row
|
476
|
+
ROW_IT real_row_it = block->block->row_list ();
|
477
|
+
|
478
|
+
if (row_it.empty ())
|
479
|
+
return; //empty block
|
480
|
+
for (row_it.mark_cycle_pt (); !row_it.cycled_list (); row_it.forward ()) {
|
481
|
+
row = row_it.data ();
|
482
|
+
if (row->blob_list ()->empty () && !row->rep_words.empty ()) {
|
483
|
+
real_row = make_rep_words (row, block);
|
484
|
+
}
|
485
|
+
else if (!row->blob_list ()->empty ()) {
|
486
|
+
// tprintf("Row pitch_decision=%d",row->pitch_decision);
|
487
|
+
if (row->pitch_decision == PITCH_DEF_FIXED
|
488
|
+
|| row->pitch_decision == PITCH_CORR_FIXED)
|
489
|
+
real_row = fixed_pitch_words (row, rotation);
|
490
|
+
else if (row->pitch_decision == PITCH_DEF_PROP
|
491
|
+
|| row->pitch_decision == PITCH_CORR_PROP)
|
492
|
+
real_row = make_prop_words (row, rotation);
|
493
|
+
else
|
494
|
+
ASSERT_HOST(FALSE);
|
495
|
+
}
|
496
|
+
if (real_row != NULL) {
|
497
|
+
//put row in block
|
498
|
+
real_row_it.add_after_then_move (real_row);
|
499
|
+
}
|
500
|
+
}
|
501
|
+
block->block->set_stats (block->fixed_pitch == 0, (inT16) block->kern_size,
|
502
|
+
(inT16) block->space_size,
|
503
|
+
(inT16) block->fixed_pitch);
|
504
|
+
block->block->check_pitch ();
|
505
|
+
}
|
506
|
+
|
507
|
+
|
508
|
+
/**********************************************************************
|
509
|
+
* make_rep_words
|
510
|
+
*
|
511
|
+
* Fabricate a real row from only the repeated blob words.
|
512
|
+
* Get the xheight from the block as it may be more meaningful.
|
513
|
+
**********************************************************************/
|
514
|
+
|
515
|
+
ROW *make_rep_words( //make a row
|
516
|
+
TO_ROW *row, //row to convert
|
517
|
+
TO_BLOCK *block //block it lives in
|
518
|
+
) {
|
519
|
+
inT32 xstarts[2]; //ends of row
|
520
|
+
ROW *real_row; //output row
|
521
|
+
TBOX word_box; //bounding box
|
522
|
+
double coeffs[3]; //spline
|
523
|
+
//iterator
|
524
|
+
WERD_IT word_it = &row->rep_words;
|
525
|
+
|
526
|
+
if (word_it.empty ())
|
527
|
+
return NULL;
|
528
|
+
word_box = word_it.data ()->bounding_box ();
|
529
|
+
for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ())
|
530
|
+
word_box += word_it.data ()->bounding_box ();
|
531
|
+
xstarts[0] = word_box.left ();
|
532
|
+
xstarts[1] = word_box.right ();
|
533
|
+
coeffs[0] = 0;
|
534
|
+
coeffs[1] = row->line_m ();
|
535
|
+
coeffs[2] = row->line_c ();
|
536
|
+
row->xheight = block->xheight;
|
537
|
+
real_row = new ROW (row,
|
538
|
+
(inT16) block->kern_size, (inT16) block->space_size);
|
539
|
+
word_it.set_to_list (real_row->word_list ());
|
540
|
+
//put words in row
|
541
|
+
word_it.add_list_after (&row->rep_words);
|
542
|
+
real_row->recalc_bounding_box ();
|
543
|
+
return real_row;
|
544
|
+
}
|
545
|
+
|
546
|
+
|
547
|
+
/**********************************************************************
|
548
|
+
* make_real_word
|
549
|
+
*
|
550
|
+
* Construct a WERD from a given number of adjacent entries in a
|
551
|
+
* list of BLOBNBOXs.
|
552
|
+
**********************************************************************/
|
553
|
+
|
554
|
+
WERD *make_real_word( //make a WERD
|
555
|
+
BLOBNBOX_IT *box_it, //iterator
|
556
|
+
inT32 blobcount, //no of blobs to use
|
557
|
+
BOOL8 bol, //start of line
|
558
|
+
BOOL8 fuzzy_sp, //fuzzy space
|
559
|
+
BOOL8 fuzzy_non, //fuzzy non-space
|
560
|
+
uinT8 blanks //no of blanks
|
561
|
+
) {
|
562
|
+
OUTLINE_IT out_it; //outlines
|
563
|
+
C_OUTLINE_IT cout_it;
|
564
|
+
PBLOB_LIST blobs; //blobs in word
|
565
|
+
C_BLOB_LIST cblobs;
|
566
|
+
PBLOB_IT blob_it = &blobs; //iterator
|
567
|
+
C_BLOB_IT cblob_it = &cblobs;
|
568
|
+
WERD *word; //new word
|
569
|
+
BLOBNBOX *bblob; //current blob
|
570
|
+
inT32 blobindex; //in row
|
571
|
+
|
572
|
+
for (blobindex = 0; blobindex < blobcount; blobindex++) {
|
573
|
+
bblob = box_it->extract ();
|
574
|
+
if (bblob->joined_to_prev ()) {
|
575
|
+
if (bblob->blob () != NULL) {
|
576
|
+
out_it.set_to_list (blob_it.data ()->out_list ());
|
577
|
+
out_it.move_to_last ();
|
578
|
+
out_it.add_list_after (bblob->blob ()->out_list ());
|
579
|
+
delete bblob->blob ();
|
580
|
+
}
|
581
|
+
else if (bblob->cblob () != NULL) {
|
582
|
+
cout_it.set_to_list (cblob_it.data ()->out_list ());
|
583
|
+
cout_it.move_to_last ();
|
584
|
+
cout_it.add_list_after (bblob->cblob ()->out_list ());
|
585
|
+
delete bblob->cblob ();
|
586
|
+
}
|
587
|
+
}
|
588
|
+
else {
|
589
|
+
if (bblob->blob () != NULL)
|
590
|
+
blob_it.add_after_then_move (bblob->blob ());
|
591
|
+
else if (bblob->cblob () != NULL)
|
592
|
+
cblob_it.add_after_then_move (bblob->cblob ());
|
593
|
+
}
|
594
|
+
delete bblob;
|
595
|
+
box_it->forward (); //next one
|
596
|
+
}
|
597
|
+
|
598
|
+
if (blanks < 1)
|
599
|
+
blanks = 1;
|
600
|
+
if (!blob_it.empty ()) {
|
601
|
+
//make real word
|
602
|
+
word = new WERD (&blobs, blanks, NULL);
|
603
|
+
}
|
604
|
+
else {
|
605
|
+
word = new WERD (&cblobs, blanks, NULL);
|
606
|
+
}
|
607
|
+
if (bol) {
|
608
|
+
word->set_flag (W_BOL, TRUE);
|
609
|
+
}
|
610
|
+
if (fuzzy_sp)
|
611
|
+
//probably space
|
612
|
+
word->set_flag (W_FUZZY_SP, TRUE);
|
613
|
+
else if (fuzzy_non)
|
614
|
+
//probably not
|
615
|
+
word->set_flag (W_FUZZY_NON, TRUE);
|
616
|
+
if (box_it->at_first ()) {
|
617
|
+
word->set_flag (W_EOL, TRUE);//at end of line
|
618
|
+
}
|
619
|
+
return word;
|
620
|
+
}
|