Skip to content

Commit

Permalink
returns the correct dictionary if lstm only used
Browse files Browse the repository at this point in the history
  • Loading branch information
jm committed Sep 14, 2017
1 parent d962d34 commit 2a77d5a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ccmain/tesseractclass.cpp
Expand Up @@ -634,6 +634,19 @@ Tesseract::~Tesseract() {
#endif
}

Dict& Tesseract::getDict()
{
if (0 == Classify::getDict().NumDawgs() && AnyLSTMLang())
{
if (lstm_recognizer_ && lstm_recognizer_->GetDict())
{
return *const_cast<Dict*>(lstm_recognizer_->GetDict());
}
}
return Classify::getDict();
}


void Tesseract::Clear() {
STRING debug_name = imagebasename + "_debug.pdf";
pixa_debug_.WritePDF(debug_name.string());
Expand Down
3 changes: 3 additions & 0 deletions ccmain/tesseractclass.h
Expand Up @@ -166,6 +166,9 @@ class Tesseract : public Wordrec {
Tesseract();
~Tesseract();

// Return appropriate dictionary
Dict& getDict() override;

// Clear as much used memory as possible without resetting the adaptive
// classifier or losing any other classifier data.
void Clear();
Expand Down
2 changes: 1 addition & 1 deletion classify/classify.h
Expand Up @@ -62,7 +62,7 @@ class Classify : public CCStruct {
public:
Classify();
virtual ~Classify();
Dict& getDict() {
virtual Dict& getDict() {
return dict_;
}

Expand Down

0 comments on commit 2a77d5a

Please sign in to comment.