diff --git a/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java b/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java index a11095d69..57b0718a2 100644 --- a/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java +++ b/tess-two/src/com/googlecode/tesseract/android/TessBaseAPI.java @@ -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"); + } + } } } }