Permalink
Browse files

returns the correct dictionary if lstm only used

  • Loading branch information...
jm
jm committed Sep 14, 2017
1 parent d962d34 commit 2a77d5ad691b53c0fff7400fc4fd66102a24bc27
Showing with 17 additions and 1 deletion.
  1. +13 −0 ccmain/tesseractclass.cpp
  2. +3 −0 ccmain/tesseractclass.h
  3. +1 −1 classify/classify.h
View
@@ -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());
View
@@ -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();
View
@@ -62,7 +62,7 @@ class Classify : public CCStruct {
public:
Classify();
virtual ~Classify();
Dict& getDict() {
virtual Dict& getDict() {
return dict_;
}

0 comments on commit 2a77d5a

Please sign in to comment.