java - Tesseract OCR Android app for multiple languages ? -


i'm working ocr app use tesseract library , use tutorial uses 1 language want use 2 languages. how should modify code copy 2 traineddata files ?

here's copy traineddata code

 private void copyfiles() {     try {         //location want file @         string filepath = datapath + "/tessdata/tha.traineddata";          //get access assetmanager         assetmanager assetmanager = getassets();          //open byte streams reading/writing         inputstream instream = assetmanager.open("tessdata/tha.traineddata");         outputstream outstream = new fileoutputstream(filepath);          //copy file location specified filepath         byte[] buffer = new byte[1024];         int read;         while ((read = instream.read(buffer)) != -1) {             outstream.write(buffer, 0, read);         }         outstream.flush();         outstream.close();         instream.close();      } catch (filenotfoundexception e) {         e.printstacktrace();     } catch (ioexception e) {         e.printstacktrace();     }   }  private void checkfile(file dir) {     //directory not exist, can create     if (!dir.exists()&& dir.mkdirs()){         copyfiles();     }     //the directory exists, there no data file in     if(dir.exists()) {         string datafilepath = datapath+ "/tessdata/tha.traineddata";         file datafile = new file(datafilepath);         if (!datafile.exists()) {             copyfiles();         }     } } 

thank :d


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -