OCR recognition result optimization method based on reference text comparison
By introducing contextual co-occurrence analysis of candidate character sets and external reference texts into the OCR system, the OCR recognition results are optimized, the problems of typos and missing characters are solved, and efficient automatic error correction and intelligent recognition are achieved.
Patent Information
- Application Number
- CN202511107217.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-08-08
AI Technical Summary
Existing OCR systems are prone to typos and omissions when recognizing handwriting, similar character structures, or complex typesetting, and lack the ability to correct errors based on contextual semantics, making it difficult to automatically optimize recognition results.
By establishing a candidate character set and combining it with the contextual co-occurrence relationship of external reference text, probability analysis and optimal replacement are performed to optimize OCR recognition results.
It improves the accuracy of text recognition, reduces the cost of manual proofreading, and enhances the system's automation and intelligence level.
Smart Images

Figure CN120599641B_ABST
Abstract
Claims
1. The OCR recognition result optimization method based on reference text comparison is characterized by: It includes the following steps: Step A1: Establish a candidate character set storing a number of candidate replacement characters. Step A2: Receive the OCR recognition result and an external reference text. After sentence segmentation of the OCR recognition result, obtain a character sequence, where the character sequence includes a sentence index divided by layer and a position index divided by the character sequence of the belonging sentence. Step A3: Traverse all characters of all sentences obtained after segmentation. Search for optimizable characters in the candidate character set, and directly perform optimization and then enter Step A7 for result output. For the characters to be optimized not recorded in the candidate character set, enter Step A4. For sentences that do not need optimization, directly enter Step A7 for result output. Step A4: Receive the character to be optimized, and extract the context characters at the current position of the character to be optimized. Step A5: Use the external reference text for co-occurrence statistical analysis to obtain the adjacent characters of the context characters, respectively construct adjacent character sets, and after merging and removing duplicates, sort them by frequency to generate a context recommended character set. Step A6: Traverse all candidate characters in the candidate character set. When a candidate character appears in the context recommended character set, update the character at the same position in the character sequence, and terminate this round of traversal. If it does not appear, keep the character at the same position in the character sequence unchanged and terminate this round of traversal. After this round of traversal, return to Step A3 to perform traversal of the next position character. Step A7: Loop through Steps A3 to A6 until all sentences are processed. Concatenate each sentence in the finally updated character sequence into a string, and assign it to the optimized output result as the final optimized recognition result.
2. The method for optimizing OCR recognition results based on reference text comparison according to claim 1, characterized in that: In Step A1, the candidate character set CandidateSet_sentences is a nested dictionary structure, including an outer dictionary and an inner dictionary, and is expressed as follows: The key of the outer dictionary is the sentence index, denoted as s, representing the s-th sentence, where s = 0, 1, 2... The key of the inner dictionary is the character index, denoted as i, representing the i-th character in sentence s, where i = 0, 1, 2...
3. The method for optimizing OCR recognition results based on reference text comparison according to claim 2, wherein: In Step A2, the character sequence obtained after sentence segmentation is expressed as C_ocr_sentences. Among them, for the s-th sentence after segmentation, it is expressed as C_ocr_sentences[s], and the i-th character of the s-th sentence is expressed as C_ocr_sentences[s][i]. s is the sentence index same as the key of the outer dictionary, and i is the position index of the character in the sentence same as the key of the inner dictionary.
4. The method for optimizing OCR recognition results based on reference text comparison according to claim 3, wherein: In Step A3, the process of searching for the required sentence includes the following steps: Step A301: Initialize the sentence index of the current character sequence, and set s = 0. Step A302: When s < len(C_ocr_sentences), enter Step A303, otherwise enter Step A308. Step A303: Initialize the character index i = 0 of the current sentence. Step A304: When i < len(C_ocr_sentences[s]), enter Step A305 to process each character in turn; otherwise enter Step A306. Step A305: Determine whether the position (s, i) exists in the candidate character set CandidateSet_sentences and the corresponding candidate list is not empty: If not, keep the original character C_ocr_sentences[s][i] in the character sequence unchanged, execute i=i+1, and return to step A304 to continue processing the next character; If yes, proceed to step A4 for context extraction and processing; Step A306: When i≥len(C_ocr_sentences[s]), proceed to step A307; Step A307: Execute s=s+1 and return to step A303 to process the next sentence; Step A308: until s≥len(C_ocr_sentences), it means that all sentences have been processed, and then go to step A7 to output the results.
5. The method for optimizing OCR recognition results based on reference text comparison according to claim 1, wherein: In step A4, during the process of extracting context characters, the following rules are followed: When the character is at the beginning of the sentence, extract the next character; If the character is at the end of the sentence, extract the previous character; Otherwise, extract both the previous and next characters.
6. The method for optimizing OCR recognition results based on reference text comparison according to claim 5, characterized in that: The implementation of step A5 includes the following steps: When there is a subsequent character, the frequency of the subsequent characters is counted to construct a subsequent character set; When there is a previous character, count the frequencies of its preceding characters and construct a preceding character set; The following character set is combined with the preceding character set to remove duplicates, and then sorted by the frequency of occurrence of the characters to generate a contextually recommended character set.
7. The method for optimizing OCR recognition results based on reference text comparison according to claim 2, wherein: The value of the inner dictionary is a pre-generated string list List[str], which represents candidate replacement characters. They are arranged in a priority sequence from high to low according to the similarity of the characters. The higher the similarity of the characters, the higher the priority sequence. In step A6, during the process of traversing the candidate character set, the traversal is performed in order of priority sequence.
Citation Information
Patent Citations
Single-template workflow optimization method
CN113011406A
Medical OCR (Optical Character Recognition) error correction method
CN116306594A