Skip to content

Commit 39a63c2

Browse files
authored
Merge pull request #2663 from bertsky/fix-lstm-user-patterns
fix langdata (user words/patterns) file suffixes for LSTMs:
2 parents 0c7cc5a + 5b976bf commit 39a63c2

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/ccmain/tessedit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ bool Tesseract::init_tesseract_lang_data(
175175
tessedit_ocr_engine_mode == OEM_TESSERACT_LSTM_COMBINED) {
176176
# endif // ndef DISABLED_LEGACY_ENGINE
177177
if (mgr->IsComponentAvailable(TESSDATA_LSTM)) {
178-
lstm_recognizer_ = new LSTMRecognizer;
178+
lstm_recognizer_ = new LSTMRecognizer(language_data_path_prefix);
179179
ASSERT_HOST(lstm_recognizer_->Load(
180180
this->params(), lstm_use_matrix ? language : nullptr, mgr));
181181
} else {

src/lstm/lstmrecognizer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ const double kDictRatio = 2.25;
4949
// Default certainty offset to give the dictionary a chance.
5050
const double kCertOffset = -0.085;
5151

52+
LSTMRecognizer::LSTMRecognizer(const STRING language_data_path_prefix)
53+
: LSTMRecognizer::LSTMRecognizer() {
54+
ccutil_.language_data_path_prefix = language_data_path_prefix;
55+
}
56+
5257
LSTMRecognizer::LSTMRecognizer()
5358
: network_(nullptr),
5459
training_flags_(0),

src/lstm/lstmrecognizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enum TrainingFlags {
5353
class LSTMRecognizer {
5454
public:
5555
LSTMRecognizer();
56+
LSTMRecognizer(const STRING language_data_path_prefix);
5657
~LSTMRecognizer();
5758

5859
int NumOutputs() const { return network_->NumOutputs(); }

0 commit comments

Comments
 (0)