Commit Graph

996 Commits

Author SHA1 Message Date
Stefan Weil
970622fbd1 Remove unused functions create_edges_window, draw_raw_edge
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 15:04:10 +02:00
Stefan Weil
23e605911f Remove unused function truncate_path and related files
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 14:48:56 +02:00
Stefan Weil
bce585286d Remove global array kPolyBlockNames from Tesseract library
It is only used in unittest/layout_test.cc after moving a test from
baseapi_test.cc to that file, so it can be made local.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 14:33:55 +02:00
Stefan Weil
beec85e023 Remove UNICHARSET::load_from_inmemory_file and related code
The method was only used in unittest where it can be replaced by
UNICHARSET::load_from_file which also simplifies the code.

This allows removing the class InMemoryFilePointer and fixes a TODO.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-12 13:07:15 +02:00
Stefan Weil
315dd9df3f cmake: Don't link pthread on Windows
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-07 15:24:00 +02:00
Stefan Weil
b8079d8ce1 universalambigs: Add hack to fix builds with Microsoft compiler
The MS compiler only accepts string constants up to 65535 characters,
so shorten the string for that compiler to fix the compilation.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-06 15:46:07 +02:00
Zdenko Podobný
c5a50b93ce move fileio.cpp and fileio.h to training (this fix android build) 2019-08-04 21:26:39 +02:00
Stefan Weil
6acab45837 universalambigs: Replace octal characters by UTF-8 string
This improves readability and reduces the file size.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-04 19:21:59 +02:00
Stefan Weil
8127b4dd27 Clean ambigs.h
* Remove unused kUnigramAmbigsBufferSize and kAmbigNgramSeparator
* Move some declarations to ambigs.cpp

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-08-04 19:21:59 +02:00
Stefan Weil
23ef93ac4d cmake: Add missing pthread library
It is needed for C++ threads since commit 85068be405.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-26 07:45:51 +02:00
Stefan Weil
e6ca7f3ec6 hocrrenderer: Add missing escaping of special characters in HTML output
This converts special character like '<' or '>' to the
correct HTML entities.

Optimize also the code a little bit.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-19 13:53:36 +02:00
Stefan Weil
2679cae5d8 Simplify code by using ClipToRange
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-19 13:37:39 +02:00
Stefan Weil
4b2927ae41 LSTMRecognizer: Add non const get functions
This allows removing several const casts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-18 11:26:51 +02:00
Stefan Weil
4cb3f34c09 Improve formatting of hOCR output with character boxes
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-18 11:07:18 +02:00
Stefan Weil
9195a904a7 Use auto data type for results of std::ftell
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-18 10:56:17 +02:00
Stefan Weil
4132194c49 Remove unused filesize_ from class InputBuffer
This also simplifies the constructors.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-18 10:48:27 +02:00
Stefan Weil
a2b13b49ff Simplify shell code (fixes warning from Codacy)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-17 21:33:24 +02:00
Stefan Weil
d4e0ab3014 Use long instead of off_t for result from ftell
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-17 21:14:42 +02:00
Stefan Weil
467f8f4140 Fix training script for macOS (issue #2578)
Bash on macOS does not support "|&":

    tesstrain_utils.sh: line 80: syntax error near unexpected token `&'

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-17 17:18:44 +02:00
Stefan Weil
f92181561c Fix some compiler warnings (unused local variables)
gcc warnings:

    src/classify/protos.cpp:85:7: warning: unused variable ‘i’ [-Wunused-variable]
    src/classify/protos.cpp:86:7: warning: unused variable ‘Bit’ [-Wunused-variable]
    src/classify/protos.cpp:89:14: warning: unused variable ‘Config’ [-Wunused-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-17 07:47:28 +02:00
Stefan Weil
a419f2d78b Modernize BIT_VECTOR a little bit
This removes one more user of Emalloc / Efree.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-16 22:09:08 +02:00
zdenop
c8374cc528
Merge pull request #2576 from noahmetzger/LSTMChoiceRIL
Implemented improved character bounding box algorithm
2019-07-16 12:25:17 +02:00
zdenop
f4925077e8
Merge pull request #2574 from stweil/fix
classify: Use fixed size bit vector
2019-07-16 12:22:48 +02:00
zdenop
cb5c78be7d
Merge pull request #2572 from adaptech-cz/wordBoundsOn2ndPass
Give word's bounds to callback also during second pass
2019-07-16 12:19:31 +02:00
Noah Metzger
3a5e508934 Implemented improved bounding box algorithm
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2019-07-16 11:38:50 +02:00
Stefan Weil
028fff6edd classify: Use fixed size bit vector
The vector was already limited to MAX_NUM_PROTOS (512) entries or 64 bytes
in the old code. Now it uses that size right from the start which avoids
reallocating it later when entries are added.

The old code which reallocated the vector to expand it was buggy because
the realloc function can return a different pointer, but the code still
used the original pointer to reset the new bits.

Function ExpandBitVector is now unused and therefore removed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-16 10:18:11 +02:00
Robert Pösel
f99fcd7691 Give word's bounds to callback also during second pass 2019-07-16 09:11:06 +02:00
Stefan Weil
5bbb7f59a6 Remove structures.*
It only provided the functions new_cell, free_cell which could be replaced by new, delete.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-16 07:03:52 +02:00
Stefan Weil
3621272051 Remove cutil_class.*
It is no longer needed since commit 4523ce9f7d.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-16 07:03:52 +02:00
Stefan Weil
ea462b2c03 Remove unused functions reverse16, reverse32
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 21:50:46 +02:00
Stefan Weil
c8cb925813 Remove non portable sleep by std::this_thread::sleep_for
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 16:00:07 +02:00
Stefan Weil
fcfdb7e56f Remove unused include statements
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:48:31 +02:00
Stefan Weil
ba0c55adc5 svutil: Remove SVSync::StartThread and SVSync::ExitThread
Both are unused now.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:30:51 +02:00
Stefan Weil
85068be405 lstmtester: Replace SVSync::StartThread by std::thread
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:30:51 +02:00
Stefan Weil
43a281893f scrollview: Replace SVSync::StartThread by std::thread
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:30:51 +02:00
Stefan Weil
a6d723bf10 Replace SVSync::StartThread by std::thread and use std::this_thread::yield
Using yield instead of a sleep makes running imagedata_test much faster.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 14:30:51 +02:00
Stefan Weil
13bb4623b1 Use std::lock_guard to protect a code block
This is simpler than using lock() / unlock() explicitly.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 12:01:28 +02:00
Stefan Weil
93427391c1 Replace SVAutoLock by std::lock_guard
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 12:01:28 +02:00
Stefan Weil
c0b8ee3b82 Replace CCUtilMutex by std::mutex
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 12:01:28 +02:00
Stefan Weil
36026e3c35 Replace SVMutex by std::mutex
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-15 12:01:28 +02:00
zdenop
56d4fdce00
Merge pull request #2554 from noahmetzger/LSTMChoiceRIL
Improved lstm_choice_mode
2019-07-15 11:51:52 +02:00
Noah Metzger
2dd5d0d60a Fixed a bug when first decode iteration stays empty and added some comments.
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2019-07-15 10:05:22 +02:00
Stefan Weil
61eab60fe3 arch: Reduce number of include files for dot product functions
dotproductavx.h and dotproductsse.h declared only two functions.
Move those declarations to dotproduct.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-12 23:18:00 +02:00
Stefan Weil
2d5b166876 Add dot product implementation for Intel FMA (double = tessdata_best)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-12 23:18:00 +02:00
Stefan Weil
9259ed8f26 Optimize tprintf implementation
It no longer uses a local buffer, so it needs less memory
and no mutex.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 20:59:07 +02:00
Stefan Weil
2aebd10fb7 FPRow: Add missing initialisation for scalar (CID 1402754)
Modernize the code also a little bit.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 17:15:55 +02:00
Stefan Weil
bdc7abf518 Fix format strings for size_t arguments (CID 1402762, 1402767)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:57:19 +02:00
Noah Metzger
11a4cd298b Added parameters for the LSTM CTC Choice mode
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2019-07-10 16:34:41 +02:00
Noah Metzger
f2d685a90f Added CTC-based Symbolchoices.
Signed-off-by: Noah Metzger <noah.metzger@bib.uni-mannheim.de>
2019-07-10 16:34:41 +02:00
Stefan Weil
ee04347347 Fix format string for 64 bit integer (CID 1402986)
Commit c1264c189e was not the right fix.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-07-10 16:20:50 +02:00