An Ensemble Regression Approach for Ocr Error Correction
Total Page:16
File Type:pdf, Size:1020Kb
AN ENSEMBLE REGRESSION APPROACH FOR OCR ERROR CORRECTION by Jie Mei Submitted in partial fulfillment of the requirements for the degree of Master of Computer Science at Dalhousie University Halifax, Nova Scotia March 2017 © Copyright by Jie Mei, 2017 Table of Contents List of Tables ................................... iv List of Figures .................................. v Abstract ...................................... vi List of Symbols Used .............................. vii Acknowledgements ............................... viii Chapter 1 Introduction .......................... 1 1.1 Problem Statement............................ 1 1.2 Proposed Model .............................. 2 1.3 Contributions ............................... 2 1.4 Outline ................................... 3 Chapter 2 Background ........................... 5 2.1 OCR Procedure .............................. 5 2.2 OCR-Error Characteristics ........................ 6 2.3 Modern Post-Processing Models ..................... 7 Chapter 3 Compositional Correction Frameworks .......... 9 3.1 Noisy Channel ............................... 11 3.1.1 Error Correction Models ..................... 12 3.1.2 Correction Inferences ....................... 13 3.2 Confidence Analysis ............................ 16 3.2.1 Error Correction Models ..................... 16 3.2.2 Correction Inferences ....................... 17 3.3 Framework Comparison ......................... 18 ii Chapter 4 Proposed Model ........................ 21 4.1 Error Detection .............................. 22 4.2 Candidate Search ............................. 22 4.3 Feature Scoring .............................. 24 4.3.1 Edit Distance Family ....................... 26 4.3.2 Character n-Gram Family .................... 30 4.3.3 Contextual word n-Gram Family . 34 4.4 Candidate Ranking ............................ 36 Chapter 5 Evaluation ............................ 38 5.1 Experimental Setup ............................ 38 5.1.1 OCR Dataset ........................... 38 5.1.2 Evaluation Setup ......................... 39 5.2 Detection Evaluation ........................... 43 5.2.1 Detection Recall ......................... 43 5.2.2 Word Boundary Detection Recall . 43 5.3 Correction Evaluation .......................... 46 5.3.1 Selected Features Evaluation ................... 46 5.3.2 Ranking Method Selection .................... 46 5.3.3 Error Correction Model Comparsion . 47 5.3.4 Overall Performance ....................... 48 Chapter 6 Conclusion ............................ 50 Bibliography ................................... 51 Appendix A Theories and Definitions ................... 59 A.1 Edit Distance ............................... 59 Appendix B Evaluation Dataset Preprocessing ............. 61 iii List of Tables 3.1 Correction inferences adopted by models under noisy channel framework ............................. 14 3.2 Weighting schemes and correction inferences adopted by models under confidence analysis framework............... 18 4.1 Overview of applied features in feature families......... 27 4.2 List of applied edit distance measures and according edit oper- ation sets............................... 28 5.1 Precision and recall of OCR on evaluation image files . 40 5.2 The Levenshtein edit distance distribution of errors in the ex- perimental dataset. ........................ 40 5.3 The type distribution of error in the experimental dataset. 40 5.4 Overview of applied evaluation measures and their according feature families ........................... 42 5.5 Confusion matrix for error detection . 43 5.6 The number of detected errors and recall of bounded and un- bounded detections ........................ 44 5.7 The number and the percentage of errors, where correction ex- ists among the top 10 candidates of any applied feature. 45 5.8 Candidate ranking models comparsion . 47 5.9 Correction models comparsion . 48 5.10 The percentage of errors in the proposed OCR dataset, where correction exists among top 1, 3, 5, and 10 candidates suggested by the proposed model. ...................... 49 A.1 List of applied edit distance measures and according edit oper- ation sets. .............................. 60 B.1 Character substitutions in preprocessing the ground truth. 62 iv List of Figures 2.1 Four major processing steps in a typical OCR procedure. 6 3.1 A simple diagram of the noisy channel model . 11 4.1 Proposed model overview. .................... 23 4.2 Examples of edit distance family . 31 4.3 Examples of character n-gram family . 33 4.4 Examples of context generation . 37 5.1 A image segment (a) and its according OCR-generated text (b) of the evaluation dataset. The recognition errors are high- lighted in red. ........................... 41 5.2 Feature distinctiveness evaluation . 45 B.1 The comparison between U+00B0 and U+02DA. 62 v Abstract This thesis deals with the problem of error correction for Optical Character Recog- nition (OCR) generated text, or OCR-postprocessing: how to detect error words in a text generated from OCR process and to suggest the most appropriate candidates to correct such errors. The thesis demonstrates that OCR errors are inherently more protean and volatile than handwriting or typing errors, while existing OCR- postprocessing approaches have different limitations. Through analyzing the recent development of error correction techniques, we illustrate that the compositional ap- proach incorporating correction inferences is broadly researched and practically use- ful. Thus, we propose an ensemble regression approach that composite correction inferences for ranking correction candidates of complex OCR errors. On practical side, we make available a benchmark dataset for this task and conduct a comprehen- sive study on performance analysis with different correction inferences and ensemble algorithms. In particular, the experimental results show that the proposed ensem- ble method is a robust approach that is able to handle complex OCR errors and outperform various baselines. vi List of Symbols Used Constants Z a normalization constant Λ an empty symbol, Λ 2= Σ Functions g a general math function δ an edit distance measure φ a correction likelihood inference function f a frequency lookup function p a probability function Sequences S = fsign; s:t:si 2 Σ; n ≥ 0, a string S<i;j> = fsi; : : : ; sjg, a substring of S Σ∗ a symbol sequences of any length Sets R real numbers Σ finite set of symbols Σ+ = Σ [ fΛg vii Acknowledgements I would like to give sincere thanks to my supervisor Evangelos E. Milios and advisors Aminul Islam and Abidalrahman Moh'd, for their continued support and encourage- ment. I would like to dedicate this thesis to my parents, whose love accompanied me through every step of my way. viii Chapter 1 Introduction 1.1 Problem Statement An increasing amount of data is produced and transformed into the digital form these days, including magazines, books, and scientific articles. Using the graphic formats, like Portable Document Format (PDF) or Joint Picture Group (JPG), is a comprehensive solution for efficient digitization as well as better preserving the page layout and the graphical information (i.e., charts and figures). Since information in such formats is not machine-readable, analyzing such data relies heavily on the accuracy of Optical Character Recognition (OCR) (Doermann, 1998). However, OCR systems are imperfect and prone to errors. Post-processing is an important step in improving the quality of OCR output, which is crucial to the success of any text analyzing system in pipeline. An OCR post-processing model attempts to detect misspellings in noisy OCR output and correct such errors to their intended representations. Many machine learning ap- proaches (Lund and Ringger, 2009; Lund et al., 2011, 2013a,b) correct the OCR- generated errors by selecting the most appropriate correction among candidates. OCR-generated errors are more diverse than handwriting errors in many aspects (Jones et al., 1991; Kukich, 1992b). For example, <Lanius ! Lioiiits> is a typical OCR error, of which is hard to guess the according correct form given the error word. Ma- chine learning approaches incorporate different features enabling more robust can- didate selection, instead of inferring from limited observations, for example, using a probabilistic-based model (Taghva and Stofsky, 2001). While machine learning approach exhibits advantages in correcting OCR-generated 1 2 texts, two problems emerge from the existing models: First, some models (Lund and Ringger, 2009; Lund et al., 2011, 2013a,b; Kissos and Dershowitz, 2016) limit candidate suggestions from the recognition output of OCR engines. The errors un- recognized by all OCR engines are thus unable to be corrected. This issue can be problematic especially when original input suffers from degradation, for example, historical documents (Ntirogiannis et al., 2013). Secondly, another class of mod- els (Kissos and Dershowitz, 2016) uses the frequencies of both candidate and related n-grams from corpus as features for training. Although n-gram statistics is shown to be effective in correcting real-word spelling errors (Islam and Inkpen, 2009c), train- ing with only n-gram features does not capture the diverse nature of OCR errors and may lead to a biased model where candidates with low frequency in the corpus tend to be not selected. 1.2 Proposed Model In this thesis, we propose an OCR post-processing error correction model that lever- ages different features through a learning process. Our model applies different fea- tures