Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Catch Arabic/Hindi init misconfigurations. Closes #240.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmtheis committed Apr 19, 2018
1 parent b0f3c2c commit e2bea65
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,17 @@ public boolean init(String datapath, String language, @OcrEngineMode int ocrEngi
languageCode + ".traineddata");
if (!datafile.exists())
throw new IllegalArgumentException("Data file not found at " + datafile);

// Catch some common problematic initialization cases.
if (languageCode.equals("ara") || (languageCode.equals("hin") &&
ocrEngineMode == OEM_DEFAULT)) {
boolean sampleCubeFileExists = new File(tessdata +
File.separator + languageCode + ".cube.params").exists();
if (!sampleCubeFileExists) {
throw new IllegalArgumentException("Cube data files not found." +
" See https://github.com/rmtheis/tess-two/issues/239");
}
}
}
}
}
Expand Down

0 comments on commit e2bea65

Please sign in to comment.