Optical Character Recognition (OCR) is the process of extracting text from an im- age. The main purpose of an OCR is to make editable documents from existing paper documents or image files. OCR primarily works in two phases; they are character and word detection. In case of more sophisticated approach, an OCR also works on sentence detection to preserve documents’ structures. In this paper, we would dis- cuss the process of developing an OCR for Bengali language. Lots of efforts have been put on developing an OCR for Bengali. Though some OCRs have been devel- oped, none of them is comple tely error free. For our thesis, we trained Tesseract OCR Engine to develop an OCR for Bengali language. Tesseract is currently the most accurate OCR en gine. This engine was developed at HP labs and currently sponsored by Google. In Tesseract there are two option to training first one is Legacy Training and second is LSTM Training. We do both of them. For Legacy Training We collect various Bengali artic le from various sources like journal, websites, E -newspaper etc. We prepared forty -three text files where we have used around 65000 character and 15000 words for it. But after doing all the work we drastically fail to produce a good trained -data. Because a s we got 3 % accuracy rate . Which is obviously not a good sign for a good OCR. So that’s why we switch to Legacy Training to LSTM Training. Hopping for we can produce a good trained - data for our OCR. But after doing LSTM Training, when we want to check that how our trained -data perform. We found it perform very well. Which is very good sign for us. Because if you give any image (as input) and want to extract the image as text or want to convert PDF to DOC. Our trained -data will give you the output with 98% accuracy rate. iii Declaration We hereby declare that this thesis is based on the result found by us and no other. Materials of work found by other researcher are mentioned by reference. This thesis, neither in whole nor in part, has been previously submitted elsewhere for the award of any degree of diploma. ----------------------- Redwan Islam Date: ---------------------- Nahid Ferdaush Date : ---------------------- Tamanna Haque Nipa Date : Signature of Authors Signature of Supervisor iv Dedicated to …... Beloved Parents & Teachers. v ACKNOWLEDGEMENT We are truly all that much thankful to the Almighty Allah who helps us in every progression of our proposition work. We would like to express our gratitude and the deepest appreciation to our thesis supervisor Tamanna Haque Nipa madam for her guidance, understanding and most importantly her cordial behavior. She continuously guided us instead of his busy schedule. It is an honor for us to say thanks to her, in the light of the fact that we are equipped for building up our understanding in regards to the proposal subject and complete our work which wasn’t possible without the assistance of her direction, consolation and consistent backing. We would also like to thank Adnan Ferdous Ashrafi, senior lecturer Stamford Uni- versity Bangladesh to help us to solve various problem when we do the LSTM train- ing. We would also like to thank Shreeshrii. He is the member of Tesseract. Who demonstrated his own work to us which is related to our thesis and helped us to get an idea . We like to thanks our parents, for their faith in us and allowing us to be as ambitious as we wanted. It was under their watchful eye that we gained so much drive and an ability to tackle challenges head on . vi Table of Contents List of Figures ................................ ................................ ................................ ........................... 1 List of Tables ................................ ................................ ................................ ............................ 2 1: Introduction ................................ ................................ ................................ ...................... 3 1.1 Optical Character Recognition (OCR) ................................ ................................ ........ 3 1.1.1 Why OCR is used ................................ ................................ ................................ 4 1.2 Motivation ................................ ................................ ................................ ................... 4 1.3 Advantages and disadvantages of an OCR ................................ ................................ .. 5 1.4 Scope for Bengali Language in OCR ................................ ................................ ........... 5 1.5 Thesis Outline ................................ ................................ ................................ .............. 6 1.6 Chapter Summary ................................ ................................ ................................ ....... 7 2: Literature Review ................................ ................................ ................................ ............ 8 2.1 Chapter Summary ................................ ................................ ................................ ....... 9 3: Tesseract Architecture ................................ ................................ ................................ .. 10 3.1 Tesseract OCR Engine ................................ ................................ .............................. 10 3.2 Architecture ................................ ................................ ................................ ............... 11 3.3 Line and Word Finding ................................ ................................ ............................. 11 3.3.1 Line Finding ................................ ................................ ................................ ..... 11 3.3.2 Baseline Fitting ................................ ................................ ................................ 12 3.3.3 Fixed Pitch Detection and Chopping ................................ ............................... 13 3.3.4 Proportional Word Finding ................................ ................................ .............. 13 3.4 Word Recognition ................................ ................................ ................................ ..... 13 3.4.1 Chopping Joined Characters ................................ ................................ ............ 14 3.4.2 Associating Broken Characters ................................ ................................ ........ 14 3.5 Static Character Classifier ................................ ................................ ......................... 14 vii 3.5.1 Features ................................ ................................ ................................ ............ 14 3.5.2 Classification ................................ ................................ ................................ .... 15 3.6 Linguistic Analysis ................................ ................................ ................................ .... 15 3.7 Adaptive classifier ................................ ................................ ................................ ..... 16 3.8 Chapter Summary ................................ ................................ ................................ ...... 16 4: Important Compone nts of Bengali Charecters ................................ ......................... 17 4.1 Properties of Bangla Font ................................ ................................ .......................... 17 4.2 Properties in Bangla Language ................................ ................................ .................. 17 4.3 Chapter Summary ................................ ................................ ................................ ...... 19 5: Legacy Training ................................ ................................ ................................ ............. 20 5.1 Establishment ................................ ................................ ................................ ............ 20 5.2 JTessBoxEditor ................................ ................................ ................................ ......... 21 5.3 Working Procedure for Legacy Training ................................ ................................ .. 21 5.3.1 Preparing Text Files ................................ ................................ ......................... 22 5.3.2 Making Image Files with Noise Margin ................................ .......................... 23 5.3.3 Editing Box Files ................................ ................................ ............................. 23 5.3.4 Running Tesseract for Training ................................ ................................ ....... 24 5.3.5 Generating the Unicharset File ................................ ................................ ........ 25 5.3.6 Font Properties ................................ ................................ ................................ . 26 5.3.7 Shape Clustering ................................ ................................ .............................. 26 5.3.8 The Final Crunch of Legacy training ................................ ............................... 27 5.4 Accuracy Rate ................................ ................................ ................................ ........... 28 5.5 Chapter Summary ................................ ................................ ................................ ...... 29 6: LSTM Training ................................ ................................ ................................ .............. 30 6.1 Initiation ................................ ................................ ................................ .................... 30 6.2 Neural ................................ ................................ ................................ ........................ 30 6.3 Network Neural Network System in Tesseract ................................ ......................... 31 6.4 Integration with Tesseract ................................ ................................ ......................... 31 viii 6.5 Requirements for Training ................................ ................................ ........................ 32 6.6 Installing Tesseract Procedure in Linux ................................ ................................ .... 33 6.1.1 Installing with Auto -conf Tools ................................ ................................ ....... 33 6.7 Post Install Instruction ................................ ................................ ............................... 35 6.8 Tesseract Training Procedure from Scratch ................................ .............................. 36 6.9 Prepare Training Text ................................ ................................ ................................ 36 6.10 CORPUS ................................ ................................ ................................ ................... 36 6.11 Accuracy Rate ................................ ................................ ................................ ........... 42 6.12 Chapter Summary ................................ ................................ ................................ ...... 43 7: New Font Installation ................................ ................................ ................................ .... 44 7.1 New Font Installation ................................ ................................ ................................ 44 7.2 Problem Encounter and Solve ................................ ................................ ................... 45 7.3 Chapter Summary ................................ ................................ ................................ ...... 45 8: Legacy vs LSTM ................................ ................................ ................................ ............ 46 8.1 Comparison between Legacy and LSTM Training ................................ ................... 46 8.2 Accuracy Ratio between Legacy and LSTM Training ................................ .............. 46 8.3 Chapter Summary ................................ ................................ ................................ ...... 46 9: System Implementation ................................ ................................ ................................ . 47 9.1 Python ................................ ................................ ................................ ........................ 47 9.2 Tkinter ................................ ................................ ................................ ....................... 47 9.3 Qt Designer ................................ ................................ ................................ ................ 48 9.4 Interface of Our Software ................................ ................................ .......................... 49 9.5 Image to Text ................................ ................................ ................................ ............. 50 9.6 PDF to DOC ................................ ................................ ................................ .............. 51 9.7 Chapter Summary ................................ ................................ ................................ ...... 51 10: Conclution ................................ ................................ ................................ ....................... 52 ix 10.1 Limitation ................................ ................................ ................................ .................. 52 10.2 Future Works ................................ ................................ ................................ ............. 52