An OCR recognition result correction method and system based on a large model drive
Patent Information
- Application Number
- CN202610048952.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-15
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2046-01-15
AI Technical Summary
[0002]光学字符识别(OCR)技术已广泛应用于文档数字化、凭证处理、档案管理等场景,但在现实应用中仍面临多种挑战:扫描质量参差、摄像头拍摄变形、复杂版式和罕见字体等都会导致识别错误;此外,OCR 引擎输出往往只给出局部置信度信息,难以保证跨句、跨段甚至跨页的一致性
本发明从OCR逐字逐行提取多维元信息,构建并归一化特征矩阵,计算每单元的局部不确定性并汇总为文档级不确定性指标,结合任务上下文生成决策分数,超过动态阈值则触发修正,触发后对高不确定片段做上下文窗标准化,调用微调小模型生成候选并补充混淆字,计算编辑代价与局部连贯度,融合语言证据排序候选,依据优势分与保守阈值决定自动替换或人工复核并记录变更,全文经局部修正后分块向量化、实体抽取并构建加权实体图,进行跨段跨页矛盾检测与证据回溯,生成结构化修正建议,同时基于页面图像与布局元数据进行视觉—文本对齐、结构重建与样式恢复,输出可渲染版式与置信度,所有修正写入短期与长期日志,聚类生成“错误—修正”样本,更新领域知识库与用户偏好,并依据生成“错误—修正”样本周期性调整模型参数,避免“大模型全量调用”的无差别计算方式,大幅降低算力消耗与延迟,实现“文本准确+版式保真”的双重保证,能够更加适应特定文档类型,在批量场景下能够保持术语一致性,能应对扭曲、噪声、罕见字体、复杂背景等极端条件,在真实工程场景中表现更稳定,具有高自动化率、稳定性与可扩展性。
Smart Images

Figure CN121904782B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text correction technology, and in particular to a method and system for correcting OCR recognition results based on a large model. Background Technology
[0002] Optical Character Recognition (OCR) technology has been widely used in document digitization, voucher processing, and record management, but it still faces several challenges in real-world applications: inconsistent scan quality, camera distortion, complex layouts, and rare fonts can all lead to recognition errors; furthermore, OCR engine outputs often only provide partial confidence information, making it difficult to guarantee consistency across sentences, paragraphs, or even pages. Traditional rule-based or lightweight statistical post-processing methods can typically only resolve surface-level errors and are insufficient for addressing semantic contradictions, ambiguous entity names, or complex layout restoration needs.
[0003] Existing OCR recognition result correction methods and systems employ the traditional, undifferentiated calculation method of calling the entire large model, which increases computational power consumption and latency. At the same time, they cannot achieve the dual guarantee of "text accuracy + layout fidelity", cannot meet the needs of specific document types, and cannot cope with extreme conditions such as distortion, noise, rare fonts, and complex backgrounds. Their automation rate, stability, and scalability are also low. To address these issues, we propose an OCR recognition result correction method and system based on a large model. Summary of the Invention
[0004] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method and system for correcting OCR recognition results based on a large model.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: A method for correcting OCR recognition results based on a large model is described below. Ⅰ: After obtaining the initial OCR text, perform uncertainty assessment on the OCR text based on multi-dimensional features, and determine whether a correction process needs to be triggered; II: After the correction process is triggered, the marked OCR text is locally corrected using a small language model, and then a comprehensive analysis is performed in combination with the ability to understand the full text structure. III: After the text semantic correction is completed, the text is reformatted and rearranged according to the layout structure provided by the original document image or OCR; IV: Real-time recording of "error-correction pairs" generated by each correction operation, periodic adjustment of small language model parameters, and joint correction across documents; V: Construct adversarial OCR output and adjust document correction parameters based on the adversarial OCR output and regular OCR error samples; VI: Output the final corrected text, generate corresponding structured explanation information, and visualize the sources of various corrections and the model's judgment logic.
[0006] As a further aspect of the present invention, the specific steps of step I, which involve evaluating the uncertainty of the OCR text based on multi-dimensional features and determining whether a correction process needs to be triggered, are as follows: S1.1: Read the original output and the meta-information returned by the OCR engine line by line or character by character, and then construct initial features for each text unit of characters, words and lines according to the predefined feature set, configure a uniform unit granularity, then discretize the initial features, and generate the original feature matrix based on the discretized initial features. S1.2: Perform independent scaling transformation on each item in the feature data of the feature matrix, normalize the transformed feature data and map it to the interval [0, 1] to obtain normalized features, and then use truncation or Winsorize to process the extreme values in each normalized feature. S1.3: Extract character confidence, candidate distribution entropy, layout anomaly and recognition time from normalized features, assign corresponding weights, and then linearly combine each factor according to the weights and obtain the local uncertainty score of each text unit through nonlinear mapping. S1.4: Summarize the local uncertainty scores of all text units in the document, calculate the document-level uncertainty statistics, and then perform cross-line statistics on each entity or number to detect the deviation between the treatment reliability and text consistency of the same entity or number in different occurrences. If the deviation exceeds the preset threshold, the corresponding entity or number is marked as inconsistent with the context. Combining the document-level statistics with the entity or number inconsistency marking, the global uncertainty composite index of the corresponding document is obtained. S1.5: Collect the user-specified accuracy level, document importance level, allowable delay budget, and user-preferred error correction tendency for each task context parameter, and map each context parameter to a normalized context factor for adjusting the threshold and weight. Then, based on the document global uncertainty index and context factor, calculate the decision score and compare it with the current dynamic threshold to determine whether to trigger the correction process. If the decision score is higher than the current dynamic threshold, the correction process is triggered. S1.6: When a correction is triggered, calculate the resource priority score based on the decision score and the existing resource constraints, and map it to the corresponding discrete model level. At the same time, output the recommended model level number, the estimated additional delay, and the expected confidence gain.
[0007] As a further aspect of the present invention, the original output and the metadata returned by the engine in S1.1 specifically include: character confidence, candidate word list, page position, recognition time, line / segment confidence, etc. The model levels described in S1.6 are specifically divided into 0 for lightweight, local small models, 1 for medium-sized remote models, and 2 for large models.
[0008] As a further aspect of the present invention, the specific steps of step II, which involves performing local error correction on the tagged OCR text using a small language model, are as follows: S2.1: Extract text segments from the OCR document that triggers correction and whose local uncertainty scores are below a preset threshold, remove the whitespace at both ends of each text segment, unify the character set, and mark the original position index. Then, extract a preset number of words or characters from the left and right sides of each text segment from the original text to establish corresponding context triples, and then calculate the importance factor of each text segment. S2.2: Input each context triple into a small language model, and use top-k sampling to perform restricted decoding on each context triple to generate a set of candidate alternative texts. Based on historically known common OCR errors, supplement the candidate alternative texts, and then calculate the log probability of the corresponding small model for each set of candidate alternative texts as the basic language evidence for the candidates. S2.3: Calculate the Levenshtein edit distance between each candidate replacement text and the original OCR text segment, and use it as the edit cost of each candidate replacement text. If the candidate replacement text is supplemented by historically known common OCR errors, the corresponding edit cost weight is reduced; otherwise, the original weight remains unchanged. At the same time, according to the importance factor of each text segment, a corresponding penalty factor is added to each edit cost, and the obtained edit costs are normalized to the range of [0, 1]. S2.4: Substitute each candidate alternative text into the corresponding complete local context, detect key structural information such as table rows, numbering, and special symbols in the context, calculate the local coherence score of the coherent text, and then weight and fuse each candidate alternative text, language evidence, local coherence score, and editing cost to generate the final comprehensive score. S2.5: Sort each candidate alternative text in descending order of comprehensive score and generate a corresponding alternative text list. Then, calculate the normalized probability distribution of each candidate alternative text based on the comprehensive score, and take the candidate alternative text ranked first as the best candidate. At the same time, calculate the advantage score of the best candidate relative to "preserve the original text", and then dynamically set the acceptance threshold based on the importance of the fragment, the conservative preference of the task and the current system risk preference. S2.6: If the best candidate advantage score is higher than the current acceptance threshold, the best candidate is accepted and recorded as the final correction; otherwise, the original text is retained and the list of alternative texts is submitted for manual review. The comprehensive score of the candidate alternative texts used as the final correction is mapped to the confidence value in the interval [0, 1] by the Sigmoid function, and the corresponding evidence item is output. S2.7: When the best candidate is accepted, the original text fragment is converted into the best candidate through the replacement, insertion and deletion sequence of each editing operation, and the modification is written to the change log. Otherwise, the modification is temporarily stored in the "pending approval" state, and all modification operations and corresponding context and scores are written to the system log.
[0009] As a further aspect of the present invention, the specific calculation formula for the importance factor in S2.1 is as follows: ; In the formula, Representing the Importance factor of each text segment; This represents an indicator function; it returns 1 if the condition is true, and 0 otherwise. Representing the A text fragment; Represents a set of key entities; Representing the The ranking of the positions of each text fragment in the document; Represents a document length metric; These represent non-negative scalar weights; The specific calculation formula for the editing cost mentioned in S2.3 is as follows: ; In the formula, Representing the The candidate alternative text is relative to the first The cost of normalizing and editing a text segment; Representing the The first text fragment One candidate alternative text; This represents the Levenshtein edit distance function; This represents a string length function. Representing the Each text segment importance factor; Represents the importance penalty coefficient; The representative candidate source adjustment factor.
[0010] As a further aspect of the present invention, the specific steps of the comprehensive analysis based on the ability to understand the full text structure described in step II are as follows: S3.1: First, divide the entire document that has undergone partial repair into large blocks by page or paragraph. Then, divide each large block into smaller blocks by sentence or fixed length. At the same time, assign a unique index identifier to each smaller block and record the original page number, paragraph number, start and end character offsets within the block, and block length of each block. Build an inverted index through each smaller block to record each entity that appears in the block and the adjacency relationship between blocks. S3.2: Use a text encoder to map each block into a fixed-dimensional semantic vector, and perform L2 normalization on each generated semantic vector. Then, store the processed semantic vectors in an approximate nearest neighbor index structure. Then, use named entity recognition and table / number parser to extract entity mentions in each block and record the character range and type label of each mention in the block. S3.3: Map the extracted entity mentions to a standardized form and normalize the units of the values or amounts. Then, generate a unique key for each standardized entity mention and map all entity mentions to that key to form an inverted index of entity → mention. Then, aggregate the entity mentions of all blocks in the document by entity key to generate an entity occurrence list and record the occurrence position distribution. S3.4: Based on the co-occurrence of each entity mentioned, i.e., simultaneous occurrence in the same block or adjacent blocks, and semantic vector similarity, calculate the initial relation strength between each entity and establish a corresponding weighted entity graph. In the graph, nodes represent entity keys, edges represent the relationship between entity keys, record the evidence vector of each entity, and for each entity pair that appears in the same sentence or adjacent sentences, predict the semantic relation type and relation confidence through the relation extractor. S3.5: If the relation confidence is higher than the preset threshold, add it to the weighted entity graph and update the edge weights using a weighted average. At the same time, add directionality and evidence sentence index to the edge. Then, perform PageRank-style weight propagation processing based on edge weights on the weighted entity graph. Collect the assertion set of each entity in all mentions in the document and record the source block ID and assertion confidence of each assertion text in the assertion set. S3.6: Use cross-sentence natural language reasoning to determine whether two sets of assertion texts are contradictory, implied or neutral, and perform unit or numerical comparison on numerical assertion texts to detect numerical conflicts. When assertion text pairs that are determined to be contradictory are recorded as potential conflicts, the conflict severity of each contradictory assertion pair is calculated and sorted from high to low conflict severity. S3.7: Based on the weighted entity graph and evidence vectors, backtrack the corresponding occurrence positions of contradictory assertion text pairs in descending order of conflict severity, construct corresponding contradictory evidence subgraphs, and evaluate the evidence strength of each assertion text based on the occurrence frequency, text confidence, and contextual support strength of each assertion text. Then, generate correction suggestions based on the assertion text with the highest evidence strength and generate a corresponding structured report.
[0011] As a further aspect of the present invention, the entity references in S3.2 include personal names, organizations, place names, time, amount, number, etc. The specific revision suggestions in S3.7 include: retaining the original assertion and indicating that it has been manually reviewed; replacing it with an alternative assertion and providing the reasons for the replacement and an index of evidence; merging it into an interval / uncertain value and indicating that the source is inconsistent. Each suggestion is accompanied by an estimated confidence level and the scope of impact.
[0012] A large model-driven OCR recognition result correction system includes a result acquisition module, a feature analysis module, a trigger scheduling module, a processing and segmentation module, a semantic error correction module, a global correction module, a recognition and parsing module, a layout reconstruction module, a preference management module, a learning and updating module, an optimization processing module, an output annotation module, and an integration and export module. The result acquisition module is used to receive the preliminary recognized text, character confidence, candidate character list and page structure information output by the OCR engine; The feature analysis module is used to quantitatively evaluate the reliability of the initial recognized text output by the OCR engine; The triggering and scheduling module determines whether to initiate the correction process based on the analysis results, and allocates computing power according to the task scenario, real-time resource status, and text risk level. The processing and segmentation module is used to analyze the text logical structure, segment text fragments in error areas, delineate paragraph boundaries, and locate candidate replacement points. The semantic error correction module is used to repair text fragments in erroneous areas; The global correction module detects the syntactic analysis, contextual intent recognition, entity chain establishment, and cross-paragraph contradictions of the entire document, and performs semantic deep proofreading on the corrected text. The recognition and analysis module identifies the document format and layout based on the original document image, OCR layout frame, or metadata. The layout reconstruction module rearranges the corrected text into structured content in the form of the original document based on the layout analysis results and visual structure information. The preference management module is used to build and maintain a dynamic domain knowledge base and user preference profiles, and to record proprietary terms, common abbreviations, professional expression patterns and user style preferences in documents; The learning update module is used to collect various types of information generated during the operation and to update the small language model or rule base regularly. The optimization processing module is used to simulate various extreme situations, construct adversarial OCR samples, and adjust document correction parameters; The output annotation module is used to provide explanations, references, contextual links, and comprehensive confidence scores for each modification when outputting the final revised document. The integration and export module is used to integrate content that has undergone semantic proofreading, format reconstruction, and interpretable annotation, and generate structured results that can be used for archiving, printing, further editing, or system integration.
[0013] As a further aspect of the present invention, the specific steps of the layout reconstruction module in rearranging the corrected text into structured content in the original document format are as follows: S4.1: Read the border coordinates, confidence, row and column information and other layout metadata of each OCR block from the original OCR document, and load the corresponding original page image. If the border information is not read from the original OCR document, use the layout detector to generate alternative borders on the original page image. S4.2: Scale according to DPI standard, unify the resolution of each page image, then perform perspective correction and background denoising processing respectively, and record the preprocessing transformation matrix of each border. Then, based on the page image preprocessing results, generate an image feature description table and a set of standardized borders. Then, based on each standardized border, crop the corresponding page image and input it into the visual encoder. S4.3: Extract texture features, shape features, and font and character appearance features of each page image through a visual encoder, calculate the overall page image layout-level visual context features, identify the header, footer, margin and in-page alignment grid of each page image, and then associate a set of visual labels and corresponding visual confidence scores with each standardized border. S4.4: Based on spatial overlap, character coordinate coincidence, and visual label compatibility, the text block after semantic correction by the global correction module is matched with all standardized borders on the page image. The matching score of each pair of <text block, standardized border> is calculated. If the text block does not have a standardized border with a matching score higher than the preset threshold on the same page, a cross-page search is triggered, and the corresponding text block is marked as "position uncertain" for manual review. S4.5: After the initial matching is completed, the table, ordered and unordered lists and the structural units of the title level are detected and constructed. The vertical alignment and numerical format consistency of each structural type are checked by the corresponding rule validator. The structure is judged as a chapter title based on visual thickness and semantic vector. The identified structure is then recorded in the form of a hierarchical tree. Each node contains member block ID, structure type and confidence. S4.6: Based on the preliminary matching and structure recognition results of text blocks and standardized borders, the optimal text-to-box mapping and text layout in each box are obtained through approximate discretization search. After optimization, the final layout instruction for each box is output. At the same time, based on visual features and hierarchical trees, the visual style attributes of each text block are identified, and the font attributes are subjected to global consistency constraints. Meanwhile, the corresponding style mapping table is generated. S4.7: Based on the style mapping table and hierarchy tree, merge rows and columns of the table, restore cross-column or cross-row cells, calculate the column width of each cell based on the content width of the member block and layout constraints, generate placeholders for embedded images or chart blocks and associate them with their annotations and title text blocks, and then output the reconstructed layout model and mark the areas that need to be manually reviewed.
[0014] As a further aspect of the present invention, the visual style attributes described in S4.6 specifically include relative font size, font weight, italic markings, and whether it is a small footnote / header.
[0015] As a further aspect of the present invention, the specific steps for the preference management module to construct and maintain a dynamic domain knowledge base and user preference profiles are as follows: S5.1: Each time an automatic correction or manual review occurs, a corresponding structured log is generated, the availability score of each log is calculated, and the log items are written to the short-term fast access layer and the long-term archive layer respectively. An audit tag is added to the content of the long-term layer. Logs with availability scores higher than the preset threshold in the short-term fast access layer are periodically extracted, and the extracted logs are standardized. S5.2: Combine editing cost and semantic vector similarity to construct a text similarity metric. Based on the constructed text similarity metrics, merge logs representing the same "error pattern" into an aggregated sample. At the same time, take the log with the highest frequency in the aggregated sample as the representative sample. Then write the aggregation result into the candidate queue of the knowledge base and record the statistical information within the cluster. S5.3: Extract entities or facts from the representative samples after clustering, and map the extraction results to the patterns of the domain knowledge base. If the representative sample corresponds to a KB entry in the domain knowledge base, a weighted Bayesian fusion is used to correct the confidence and priority of the KB entry. Otherwise, a draft entry is created and marked with "to be verified", and feedback is sent to human review. S5.4: Maintain a corresponding updatable preference vector for each user or organization. Each time a user accepts, rejects, or modifies any explicit feedback item, the preference vector is updated online using an exponentially weighted moving average strategy, and the organizational-level preferences are hierarchically merged with the corresponding individual preferences.
[0016] As a further aspect of the present invention, the structured log item in S5.1 includes the original text fragment, the corrected text, the document ID, the block / line index, the source of the correction, the timestamp, the original OCR confidence, the corrected confidence, and the context window; The preference vector described in S5.4 includes automatic replacement tendency, preferred naming conventions, preferred date / unit formats, and style preferences.
[0017] As a further aspect of the present invention, the specific steps of the optimization processing module in adjusting the document correction parameters are as follows: P1.1: Extract common error samples from historical OCR logs, manual review records, and externally available OCR corpora, calculate the error type label, frequency statistics, and sample quality score of each common error sample, and then bin each common error sample according to error type and document domain. P1.2: Based on real error analysis and engineering assumptions, an adversarial error mode family is set up, and each error mode is defined as a parameterized perturbation template. At the same time, the corresponding mode parameter space is set up and an initial priority is assigned. Then, based on real observations or artificially set extreme value ranges, a corresponding parameterized probability distribution is established for each type of error mode, and the perturbation parameters are generated from the probability distribution using the Monte Carlo sampling method. P1.3: Select base samples from the regular error sample pool, and randomly select an adversarial error pattern and its corresponding perturbation parameter. Then apply the perturbation parameter to the image slice corresponding to the sample. At the same time, generate similar character replacement sequences or insert OCR misidentification candidates for non-image scenes. Then rerun the target OCR engine on the perturbed image to obtain adversarial OCR output while preserving the alignment relationship with the corrected text. P1.4: The adversarial OCR output, the corresponding corrected text, the perturbation mode meta-information, and the OCR confidence at the time of generation are written into the adversarial sample repository as a set and labeled as adversarial samples. Then, through semantic vector similarity verification, the alignment reliability score between the adversarial OCR output and the corresponding corrected text is calculated, and a training-available weight is assigned to each adversarial sample based on the calculation results. P1.5: Text correction is performed on adversarial examples and regular error samples. Then, the corrected loss value is calculated using a hybrid loss function, and the gradient value of the loss value with respect to each correction parameter is calculated. Then, the Adam optimizer is used to optimize and adjust each correction parameter based on the obtained gradient value. After that, each correction parameter is iteratively updated until the loss value converges to the preset range. P1.6: Using unused adversarial examples and regular error samples, verify the error correction accuracy, adversarial recovery rate, misclassification rate and overcorrection rate of the parameter correction after parameter optimization, and obtain the robustness comprehensive score by weighted summation of importance. If the robustness comprehensive score does not reach the preset score value, readjust the correction parameters.
[0018] As a further aspect of the present invention, the conventional error sample described on page 6.1 includes the following fields: original OCR output, manually or backend corrected text, context window, OCR engine confidence, image slice ID, and occurrence environment metadata. The adversarial error pattern family described in P6.2 includes strong geometric distortion causing character stretching / compression, local blurring causing character fusion, rare fonts causing extreme deviations in character shape, background texture interference, extreme misalignment of character spacing, color noise occlusion, and complex mixing; the pattern parameter space includes blur radius, rotation angle distribution, font substitution probability, and local contrast attenuation ratio. When an adversarial example described in P6.4 has a low alignment reliability score but represents a significant extreme error, it is marked as "recommended by manual review" and sent to a small-batch manual annotation queue.
[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention extracts multidimensional meta-information character by character and line by line from OCR, constructs and normalizes a feature matrix, calculates the local uncertainty of each unit and summarizes it into a document-level uncertainty index, generates a decision score based on the task context, and triggers correction if the score exceeds a dynamic threshold. After triggering, high-uncertainty segments are standardized using a context window, a fine-tuned small model is called to generate candidates and supplement confusing words, the editing cost and local coherence are calculated, and the candidates are ranked by fusing language evidence. Based on the advantage score and a conservative threshold, automatic replacement or manual review is determined and changes are recorded. After local correction, the entire text is segmented and vectorized, entities are extracted and a weighted entity graph is constructed, cross-segment and cross-page contradiction detection and evidence backtracking are performed, and structured correction suggestions are generated. At the same time, based on page images and layout... Metadata undergoes visual-text alignment, structural reconstruction, and style restoration, outputting renderable layouts and confidence levels. All corrections are written to short-term and long-term logs, clustering generates "error-correction" samples, updates the domain knowledge base and user preferences, and periodically adjusts model parameters based on the generated "error-correction" samples. This avoids the indiscriminate calculation method of "full call of large models," significantly reducing computational power consumption and latency, achieving a dual guarantee of "text accuracy + layout fidelity." It is more adaptable to specific document types, maintains terminology consistency in batch scenarios, and can cope with extreme conditions such as distortion, noise, rare fonts, and complex backgrounds. It performs more stably in real engineering scenarios and has high automation, stability, and scalability. Attached Figure Description
[0020] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.
[0021] Figure 1 This is a flowchart of a method for correcting OCR recognition results based on a large model, as proposed in this invention. Figure 2 This is a system block diagram of an OCR recognition result correction system based on a large model driven by the present invention. Detailed Implementation
[0022] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0023] Example 1, referring to Figure 1 This embodiment discloses a method for correcting OCR recognition results based on a large model. The specific steps of this correction method are as follows: After obtaining the initial OCR text, the uncertainty of the OCR text is evaluated based on multi-dimensional features, and it is determined whether a correction process needs to be triggered.
[0024] Specifically, the process reads the original output and metadata returned by the OCR engine line by line or character by character. Then, based on a predefined feature set, initial features are constructed for each text unit (character, word, and line). A uniform unit granularity is configured. The initial features are then discretized, and an original feature matrix is generated based on these discretized features. Each item in the feature matrix undergoes an independent scaling transformation. The transformed feature data is then normalized and mapped to the [0, 1] interval to obtain normalized features. Extreme values in each normalized feature are then processed using truncation or Winsorize. Character confidence, candidate distribution entropy, layout anomalies, and recognition time are extracted from the normalized features and assigned corresponding weights. Simultaneously, these factors are linearly combined according to their weights and nonlinearly mapped to obtain the local uncertainty score for each text unit. The local uncertainty scores of all text units within the document are summarized, and document-level uncertainty statistics are calculated. Finally, cross-line statistics are performed on each entity. The system detects deviations in the reliability and textual consistency of the same entity or number in different occurrences. If the deviation exceeds a preset threshold, the corresponding entity or number is marked as contextually inconsistent. Combining document-level statistics with the entity or number inconsistency markers, a global uncertainty composite index for the corresponding document is obtained. The system collects context parameters for each task, including the user-specified accuracy level, document importance level, allowable delay budget, and user-preferred error correction tendency. Each context parameter is mapped to a normalized context factor used to adjust the threshold and weight. Then, based on the document's global uncertainty index and context factors, a decision score is calculated and compared with the current dynamic threshold to determine whether to trigger a correction process. If the decision score is higher than the current dynamic threshold, a correction process is triggered. When correction is triggered, a resource priority score is calculated based on the decision score and the current existing resource constraints, and mapped to the corresponding discrete model level. The system also outputs the recommended model level number, estimated additional delay, and expected confidence gain.
[0025] In this embodiment, the original output and the metadata returned by the engine specifically include: character confidence, candidate word list, page position, recognition time, line / segment confidence, etc. The model level is specifically divided into 0 for lightweight, local small model, 1 for medium-sized remote model, and 2 for large model.
[0026] After the correction process is triggered, a small language model is used to perform local error correction on the marked OCR text, and then a comprehensive analysis is performed in combination with the ability to understand the full text structure.
[0027] Specifically, the process involves extracting text segments from the OCR document that trigger correction, where the local uncertainty score is below a preset threshold. Whitespace at both ends of each segment is removed, the character set is standardized, and the original position index is annotated. Then, a preset number of words or characters are extracted from the left and right sides of each segment to create corresponding context triples. The importance factor of each text segment is calculated, and these context triples are input into a small language model. Top-k sampling is used to perform restricted decoding on each context triple, generating a set of candidate replacement texts. Based on historically known common OCR errors, the candidate replacement texts are supplemented, and the importance factor of each set is then calculated. The logarithmic probability of the corresponding small model of the candidate replacement text is used as the basic linguistic evidence for the candidates. The Levenshtein edit distance between each candidate replacement text and the original OCR text segment is calculated and used as the edit cost of each candidate replacement text. If the candidate replacement text is supplemented by historically known common OCR errors, the corresponding edit cost weight is reduced; otherwise, the original weight remains unchanged. At the same time, a corresponding penalty factor is added to each edit cost based on the importance factor of each text segment, and the obtained edit costs are normalized to the range [0, 1]. Each candidate replacement text is substituted into the corresponding complete local context for detection. The context includes key structural information such as table rows, numbering, and special symbols. Then, the local coherence score of the coherent text is calculated. Next, each candidate alternative text, linguistic evidence, local coherence score, and editing cost are weighted and fused to generate a final comprehensive score. The candidate alternative texts are then sorted in descending order of their comprehensive scores, and a corresponding list of alternative texts is generated. Based on the comprehensive score, the normalized probability distribution of each candidate alternative text is calculated, and the top-ranked candidate alternative text is selected as the best candidate. Simultaneously, the advantage score of the best candidate relative to "preserving the original text" is calculated. Finally, the optimal score is dynamically set based on fragment importance, task conservatism preference, and the current system risk preference. If the score of the best candidate is higher than the current acceptance threshold, the best candidate is accepted and recorded as the final correction. Otherwise, the original text is retained and the list of alternative texts is submitted for manual review. The comprehensive score of the candidate alternative texts used as the final correction is mapped to the confidence value in the interval [0, 1] by the Sigmoid function, and the corresponding evidence item is output. When the best candidate is accepted, the original text fragment is converted into the best candidate through various editing operations such as replacement, insertion and deletion, and the modification is written to the change log. Otherwise, the modification is temporarily stored in the "pending approval" state, and all modification operations and corresponding context and scores are written to the system log.
[0028] Specifically, the partially repaired document is first divided into large blocks by page or paragraph, and then each large block is further divided into smaller blocks by sentence or fixed length. Each smaller block is assigned a unique index identifier, and metadata such as the original page number, paragraph number, start and end character offsets, and block length are recorded. An inverted index is built for each smaller block, recording the entities appearing within the block and the adjacency relationships between blocks. A text encoder maps each block to a fixed-dimensional semantic vector, and L2 normalization is performed on the generated semantic vectors. The processed semantic vectors are then stored in an approximate nearest neighbor index structure, and finally, named entity recognition and a table / number parser are used. The process involves extracting entity mentions from each block and recording the character range and type label for each mention within the block. Different extracted entity mentions are then mapped to a standardized form, and units are normalized for numerical or monetary values. A unique key is generated for each standardized entity mention, and all entity mentions are mapped to this key, forming an inverted index of entity → mention. Next, entity mentions from all blocks within the document are aggregated by entity key to generate an entity occurrence list and record the distribution of occurrence positions. Based on the co-occurrence of entity mentions (i.e., simultaneous occurrence within the same block or adjacent blocks) and semantic vector similarity, the initial relationship strength between entities is calculated, and a corresponding weighted entity graph is constructed. In the graph, nodes represent entities. The key and edge represent the relationship between entity keys. An evidence vector for each entity is recorded. For each entity pair appearing in the same or adjacent sentences, a relation extractor predicts the semantic relation type and relation confidence. If the relation confidence is higher than a preset threshold, it is added to the weighted entity graph, and the edge weights are updated using a weighted average. Directionality and evidence sentence indexes are also added to the edges. The weighted entity graph then undergoes PageRank-style weight propagation based on edge weights. Next, assertion sets for each entity at all mentions in the document are collected, and the source block ID and assertion confidence of each assertion text in the assertion set are recorded. Cross-sentence natural language inference is used to determine the two sets of assertion texts. The system determines whether assertion texts are contradictory, implied, or neutral, and performs unit or numerical comparisons to detect numerical conflicts. When assertion texts are determined to be contradictory, they are recorded as potential conflicts. The severity of each contradictory assertion text is calculated and sorted from highest to lowest severity. Based on a weighted entity graph and evidence vectors, the system traces back the corresponding occurrence positions of contradictory assertion texts from highest to lowest severity, constructs corresponding contradictory evidence subgraphs, and evaluates the evidence strength of each assertion text based on its occurrence frequency, text confidence, and contextual support strength. Finally, a correction suggestion is generated based on the assertion text with the highest evidence strength, and a corresponding structured report is generated.
[0029] It should be further clarified that entity references include names of people, organizations, locations, times, amounts, and numbers; specific revision suggestions include retaining the original assertion and indicating manual review; replacing it with an alternative assertion and providing reasons for the replacement and an index of evidence; merging into ranges / uncertain values and indicating inconsistent sources. Each suggestion includes an estimated confidence level and scope of impact; The specific formula for calculating the importance factor is as follows: ; In the formula, Representing the Importance factor of each text segment; This represents an indicator function; it returns 1 if the condition is true, and 0 otherwise. Representing the A text fragment; Represents a set of key entities; Representing the The ranking of the positions of each text fragment in the document; Represents a document length metric; These represent non-negative scalar weights; The specific formula for calculating the editing cost is as follows: ; In the formula, Representing the The candidate alternative text is relative to the first The cost of normalizing and editing a text segment; Representing the The first text fragment One candidate alternative text; This represents the Levenshtein edit distance function; This represents a string length function. Representing the Each text segment importance factor; Represents the importance penalty coefficient; The representative candidate source adjustment factor.
[0030] After the text semantic correction is completed, the text is reformatted and rearranged according to the layout structure provided by the original document image or OCR.
[0031] The system records the "error-correction pairs" generated by each correction operation in real time, adjusts the parameters of the small language model periodically, and performs joint corrections across documents.
[0032] Construct adversarial OCR output and adjust document correction parameters based on the adversarial OCR output and regular OCR error samples.
[0033] The final corrected text is output, along with corresponding structured explanation information and a visual representation of the sources of various corrections and the model's judgment logic.
[0034] Example 2, refer to Figure 2 This embodiment discloses an OCR recognition result correction system based on a large model, including a result acquisition module, a feature analysis module, a trigger scheduling module, a processing and segmentation module, a semantic error correction module, a global correction module, a recognition and parsing module, a layout reconstruction module, a preference management module, a learning and updating module, an optimization processing module, an output annotation module, and an integration and export module.
[0035] The result acquisition module receives the initial recognized text, character confidence, candidate character list, and page structure information output by the OCR engine; the feature analysis module is used to quantitatively evaluate the reliability of the initial recognized text output by the OCR engine; the trigger scheduling module determines whether to start the correction process based on the analysis results, and allocates computing power according to the task scenario, real-time resource status, and text risk level. The text segmentation module analyzes the logical structure of the text, segments text fragments in erroneous areas, delineates paragraph boundaries, and locates candidate replacement points; the semantic error correction module repairs text fragments in erroneous areas; the global correction module detects the syntactic analysis, contextual intent recognition, entity chain establishment, and cross-paragraph contradictions of the entire document, and performs deep semantic proofreading on the corrected text; the recognition and parsing module identifies the document format and layout based on the original document image, OCR layout framework, or meta-information; and the layout reconstruction module rearranges the corrected text into structured content in the original document format based on the layout parsing results and visual structure information.
[0036] Specifically, the system reads the border coordinates, confidence score, row and column information, and other layout metadata for each OCR block from the original OCR document and loads the corresponding original page image. If border information is not read from the original OCR document, a layout detector is used to generate alternative borders on the original page image. These are then scaled according to the DPI standard to unify the resolution of each page image. Perspective correction and background denoising are then performed separately, and the preprocessing transformation matrix for each border is recorded. Based on the page image preprocessing results, an image feature description table and a standardized border set are generated. Finally, based on each standardized border, the corresponding page image is cropped. The input is a visual encoder, which extracts texture features, shape features, and font and character appearance features from each page image. It calculates the overall page layout-level visual context features, identifies headers, footers, margins, and in-page alignment grids for each page image, and then associates a set of visual labels and corresponding visual confidence scores with each standardized border. Based on spatial overlap, character coordinate coincidence, and visual label compatibility, the text blocks, semantically corrected by the global correction module, are matched with all standardized borders on the page image. A matching score is calculated for each <text block, standardized border> pair. If a text block has no match on the same page, a score is awarded. If the standardized border score exceeds a preset threshold, a cross-page search is triggered, and the corresponding text block is marked as "position uncertain" for manual review. After the initial matching, tables, ordered and unordered lists, and structural units at the title level are detected and constructed. The vertical alignment and numerical format consistency of each structural type are checked using a corresponding rule validator. Based on visual thickness and semantic vectors, it is determined whether the structure is a chapter title. The identified structures are then recorded in a hierarchical tree format, with each node containing a member block ID, structural type, and confidence score. Based on the initial matching and structural recognition results of text blocks and standardized borders, an approximate discretization search is performed. The algorithm obtains the optimal text-to-box mapping and text layout within each box. Once optimization is complete, it outputs the final layout instructions for each box. Simultaneously, based on visual features and a hierarchical tree, it identifies the visual style attributes of each text block and applies global consistency constraints to font attributes. It also generates a corresponding style mapping table. Based on the style mapping table and the hierarchical tree, it merges rows and columns in the table, restores cross-column or cross-row cells, calculates the column width of each cell based on the content width of the member block and layout constraints, generates placeholders for embedded image or chart blocks, and associates them with their annotation and title text blocks. Finally, it outputs the reconstructed layout model and marks the areas requiring manual review.
[0037] It should be noted that visual style attributes specifically include relative font size, font weight, italic markings, and whether it is a small footnote / header.
[0038] The preference management module is used to build and maintain a dynamic domain knowledge base and user preference profiles, and to record proprietary terms, common abbreviations, professional expressions, and user style preferences in documents.
[0039] Specifically, each time an automatic correction or manual review occurs, a corresponding structured log is generated, and the availability score of each log entry is calculated. The log entries are then written to both the short-term fast access layer and the long-term archive layer, with audit tags added to the long-term archive content. Logs with availability scores higher than a preset threshold in the short-term fast access layer are periodically extracted. These extracted logs are then normalized, and a text similarity metric is constructed by combining editing costs and semantic vector similarity. Based on this metric, logs representing the same "error pattern" are merged into an aggregated sample. The log with the highest frequency in the aggregated sample is then used as the representative sample. Finally, the aggregation result is written to the knowledge base. Select a queue and record statistical information within the cluster. Extract entities or facts from the representative samples after clustering and map the extraction results to the schema of the domain knowledge base. If the representative sample corresponds to a KB entry already existing in the domain knowledge base, use weighted Bayesian fusion to correct the confidence and priority of the KB entry. Otherwise, create a draft entry and mark it as "to be verified" and feed it back to human review. Maintain a corresponding updatable preference vector for each user or organization. Each time a user accepts, rejects, or modifies any explicit feedback on any correction item, use an exponentially weighted moving average strategy to update the preference vector online and perform hierarchical fusion of organizational preferences and corresponding individual preferences.
[0040] Furthermore, in this invention, the structured log item includes the original text fragment, the corrected text, the document ID, the block / line index, the source of the correction, the timestamp, the original OCR confidence, the corrected confidence, and the context window; the preference vector includes automatic replacement preference, preferred naming conventions, preferred date / unit formats, and style preferences.
[0041] The learning and updating module is used to collect various information generated during operation and to regularly update the small language model or rule base; the optimization and processing module is used to simulate various extreme cases, build adversarial OCR samples, and adjust document correction parameters.
[0042] Specifically, common error samples are extracted from historical OCR logs, manual review records, and publicly available OCR corpora. Error type labels, frequency statistics, and sample quality scores are calculated for each common error sample. Then, the common error samples are binned according to error type and document domain. Based on real error analysis and engineering assumptions, adversarial error pattern families are set up, and each error pattern is defined as a parameterized perturbation template. Corresponding pattern parameter spaces are set, and initial priorities are assigned. Based on real-world observations or manually set extreme value ranges, a corresponding parameterized probability distribution is established for each type of error pattern. Monte Carlo sampling is used to generate perturbation parameters from the probability distribution. Base samples are selected from the common error sample pool, and an adversarial error pattern and its corresponding perturbation parameters are randomly selected. The perturbation parameters are then applied to the image slice corresponding to the sample. Simultaneously, similar-looking character replacement sequences are generated or OCR misidentification candidates are inserted for non-image scenes. Finally, the target OCR engine is re-run on the perturbated image to obtain adversarial OCR output, while preserving and modifying the original data. The alignment of the main text is determined by writing the adversarial OCR output, corresponding corrected text, perturbation mode metadata, and OCR confidence at the time of generation into an adversarial sample repository and labeling them as adversarial samples. Then, semantic vector similarity is used to calculate the alignment reliability score between the adversarial OCR output and the corresponding corrected text. Based on the calculation results, a training-available weight is assigned to each adversarial sample. The adversarial samples and regular error samples are then corrected. The corrected loss value is calculated using a hybrid loss function, and the gradient value of the loss value with respect to each correction parameter is calculated. The Adam optimizer is then used to optimize and adjust each correction parameter based on the obtained gradient value. The correction parameters are then iteratively updated until the loss value converges to a preset range. Unused adversarial samples and regular error samples are used to verify the error correction accuracy, adversarial recovery rate, misclassification rate, and overcorrection rate of the parameter correction after parameter optimization. A robustness comprehensive score is obtained by weighted summation based on importance. If the robustness comprehensive score does not reach the preset score value, the correction parameters are readjusted.
[0043] It should be noted that a typical error sample includes the following fields: original OCR output, manually or backend corrected text, context window, OCR engine confidence, image slice ID, and environmental metadata. Adversarial error patterns include strong geometric distortion causing character stretching / compression, local blurring causing character fusion, rare fonts causing extreme character shape deviations, background texture interference, extreme character spacing misalignment, color noise occlusion, and complex text mixing. The pattern parameter space includes blur radius, rotation angle distribution, font substitution probability, and local contrast attenuation ratio. When an adversarial sample has a low alignment reliability score but represents a significant extreme error, it is marked as "recommended for manual review" and sent to a small-batch manual annotation queue.
[0044] The output annotation module provides explanations, references, contextual links, and overall confidence scores for each modification when outputting the final revised document; the integration and export module integrates the content that has undergone semantic proofreading, format reconstruction, and interpretable annotation, and generates structured results that can be used for archiving, printing, further editing, or system integration.
Claims
1. A method for correcting OCR recognition results based on a large model, characterized in that, The specific steps of this correction method are as follows: Ⅰ: After obtaining the initial OCR text, perform uncertainty assessment on the OCR text based on multi-dimensional features, and determine whether a correction process needs to be triggered; II: After the correction process is triggered, the marked OCR text is locally corrected using a small language model, and then a comprehensive analysis is performed in combination with the ability to understand the full text structure. III: After the text semantic correction is completed, the text is reformatted and rearranged according to the layout structure provided by the original document image or OCR; IV: Record the "error-correction pairs" generated by each correction operation in real time, and periodically adjust the parameters of the small language model while performing joint corrections across documents; V: Construct adversarial OCR output and adjust document correction parameters based on the adversarial OCR output and regular OCR error samples; VI: Output the final corrected text, generate corresponding structured explanation information, and visualize the sources of various corrections and the model's judgment logic; The specific steps for comprehensive analysis based on the ability to understand the overall structure of the text, as described in Step II, are as follows: S3.1: First, divide the entire document that has undergone partial repair into large blocks by page or paragraph. Then, divide each large block into smaller blocks by sentence or fixed length. At the same time, assign a unique index identifier to each smaller block and record the original page number, paragraph number, start and end character offsets within the block, and block length of each block. Build an inverted index through each smaller block to record each entity that appears in the block and the adjacency relationship between blocks. S3.2: Use a text encoder to map each block into a fixed-dimensional semantic vector, and perform L2 normalization on each generated semantic vector. Then, store the processed semantic vectors in an approximate nearest neighbor index structure. Then, use named entity recognition and table / number parser to extract entity mentions in each block and record the character range and type label of each mention in the block. S3.3: Map the extracted entity mentions to a standardized form and normalize the units of the values or amounts. Then, generate a unique key for each standardized entity mention and map all entity mentions to that key to form an inverted index of entity → mention. Then, aggregate the entity mentions of all blocks in the document by entity key to generate an entity occurrence list and record the occurrence position distribution. S3.4: Based on the co-occurrence of each entity mentioned, i.e., simultaneous occurrence in the same block or adjacent blocks, and semantic vector similarity, calculate the initial relation strength between each entity and establish a corresponding weighted entity graph. In the graph, nodes represent entity keys, edges represent the relationship between entity keys, record the evidence vector of each entity, and for each entity pair that appears in the same sentence or adjacent sentences, predict the semantic relation type and relation confidence through the relation extractor. S3.5: If the relation confidence is higher than the preset threshold, add it to the weighted entity graph and update the edge weights using a weighted average. At the same time, add directionality and evidence sentence index to the edge. Then, perform PageRank-style weight propagation processing based on edge weights on the weighted entity graph. Collect the assertion set of each entity in all mentions in the document and record the source block ID and assertion confidence of each assertion text in the assertion set. S3.6: Use cross-sentence natural language reasoning to determine whether two sets of assertion texts are contradictory, implied or neutral, and perform unit or numerical comparison on numerical assertion texts to detect numerical conflicts. When assertion text pairs that are determined to be contradictory are recorded as potential conflicts, the conflict severity of each contradictory assertion pair is calculated and sorted from high to low conflict severity. S3.7: Based on the weighted entity graph and evidence vectors, the occurrence positions of contradictory assertion text pairs are traced back in descending order of conflict severity. At the same time, a corresponding contradictory evidence subgraph is constructed. The evidence strength of each assertion text is evaluated based on the occurrence frequency, text confidence, and contextual support strength of each assertion text. Then, a correction suggestion is generated based on the assertion text with the highest evidence strength, and a corresponding structured report is generated.
2. The method for correcting OCR recognition results based on a large model as described in claim 1, characterized in that, The specific steps for evaluating the uncertainty of OCR text based on multi-dimensional features and determining whether to trigger the correction process in step I are as follows: S1.1: Read the original output and the meta-information returned by the OCR engine line by line or character by character, and then construct initial features for each text unit of characters, words and lines according to the predefined feature set, configure a uniform unit granularity, then discretize the initial features, and generate the original feature matrix based on the discretized initial features. S1.2: Perform independent scaling transformation on each item in the feature data of the feature matrix, normalize the transformed feature data and map it to the interval [0, 1] to obtain normalized features, and then use truncation or Winsorize to process the extreme values in each normalized feature. S1.3: Extract character confidence, candidate distribution entropy, layout anomaly and recognition time from normalized features, assign corresponding weights, and then linearly combine each factor according to the weights and obtain the local uncertainty score of each text unit through nonlinear mapping. S1.4: Summarize the local uncertainty scores of all text units in the document, calculate the document-level uncertainty statistics, and then perform cross-line statistics on each entity or number to detect the deviation between the treatment reliability and text consistency of the same entity or number in different occurrences. If the deviation exceeds the preset threshold, the corresponding entity or number is marked as inconsistent with the context. Combining the document-level statistics with the entity or number inconsistency marking, the global uncertainty composite index of the corresponding document is obtained. S1.5: Collect the user-specified accuracy level, document importance level, allowable delay budget, and user-preferred error correction tendency for each task context parameter, and map each context parameter to a normalized context factor for adjusting the threshold and weight. Then, based on the document global uncertainty index and context factor, calculate the decision score and compare it with the current dynamic threshold to determine whether to trigger the correction process. If the decision score is higher than the current dynamic threshold, the correction process is triggered. S1.6: When a correction is triggered, calculate the resource priority score based on the decision score and the existing resource constraints, and map it to the corresponding discrete model level. At the same time, output the recommended model level number, the estimated additional delay, and the expected confidence gain.
3. The method for correcting OCR recognition results based on a large model as described in claim 2, characterized in that, The specific steps for performing local error correction on the labeled OCR text using a small language model, as described in step II, are as follows: S2.1: Extract text segments from the OCR document that triggers correction and whose local uncertainty scores are below a preset threshold, remove the whitespace at both ends of each text segment, unify the character set, and mark the original position index. Then, extract a preset number of words or characters from the left and right sides of each text segment from the original text to establish corresponding context triples, and then calculate the importance factor of each text segment. S2.2: Input each context triple into a small language model, and use top-k sampling to perform restricted decoding on each context triple to generate a set of candidate alternative texts. Based on historically known common OCR errors, supplement the candidate alternative texts, and then calculate the log probability of the corresponding small model for each set of candidate alternative texts as the basic language evidence for the candidates. S2.3: Calculate the Levenshtein edit distance between each candidate replacement text and the original OCR text segment, and use it as the edit cost of each candidate replacement text. If the candidate replacement text is supplemented by historically known common OCR errors, the corresponding edit cost weight is reduced; otherwise, the original weight remains unchanged. At the same time, according to the importance factor of each text segment, a corresponding penalty factor is added to each edit cost, and the obtained edit costs are normalized to the range of [0, 1]. S2.4: Substitute each candidate alternative text into the corresponding complete local context, detect key structural information such as table rows, numbering, and special symbols in the context, calculate the local coherence score of the coherent text, and then weight and fuse each candidate alternative text, language evidence, local coherence score, and editing cost to generate the final comprehensive score. S2.5: Sort each candidate alternative text in descending order of comprehensive score and generate a corresponding alternative text list. Then, calculate the normalized probability distribution of each candidate alternative text based on the comprehensive score, and take the candidate alternative text ranked first as the best candidate. At the same time, calculate the advantage score of the best candidate relative to "preserve the original text". Then, dynamically set the acceptance threshold based on the importance of the fragment, the conservative preference of the task and the current system risk preference. S2.6: If the best candidate advantage score is higher than the current acceptance threshold, the best candidate is accepted and recorded as the final correction; otherwise, the original text is retained and the list of alternative texts is submitted for manual review. The comprehensive score of the candidate alternative texts used as the final correction is mapped to the confidence value in the interval [0, 1] by the Sigmoid function, and the corresponding evidence item is output. S2.7: When the best candidate is accepted, the original text fragment is converted into the best candidate through the replacement, insertion and deletion sequence of each editing operation, and the modification is written to the change log. Otherwise, the modification is temporarily stored in the "pending approval" state, and all modification operations and corresponding context and scores are written to the system log.
4. The OCR recognition result correction method based on a large model as described in claim 3, characterized in that, The specific calculation formula for the importance factor mentioned in S2.1 is as follows: ; In the formula, Representing the Importance factor of each text segment; This represents an indicator function; it returns 1 if the condition is true, and 0 otherwise. Representing the A text fragment; Represents a set of key entities; Representing the The ranking of the positions of each text fragment in the document; Represents a document length metric; These represent non-negative scalar weights; The specific calculation formula for the editing cost mentioned in S2.3 is as follows: ; In the formula, Representing the The candidate alternative text is relative to the first The cost of normalizing and editing a text segment; Representing the The first text fragment One candidate alternative text; This represents the Levenshtein edit distance function; This represents a string length function. Representing the Each text segment importance factor; Represents the importance penalty coefficient; The representative candidate source adjustment factor.
5. A large-model-driven OCR recognition result correction system, used to implement the large-model-driven OCR recognition result correction method according to any one of claims 1-4, characterized in that, It includes a result acquisition module, a feature analysis module, a trigger scheduling module, a processing and segmentation module, a semantic error correction module, a global correction module, a recognition and parsing module, a layout reconstruction module, a preference management module, a learning and updating module, an optimization processing module, an output annotation module, and an integration and export module; The result acquisition module is used to receive the preliminary recognized text, character confidence, candidate character list and page structure information output by the OCR engine; The feature analysis module is used to quantitatively evaluate the reliability of the initial recognized text output by the OCR engine; The triggering and scheduling module determines whether to initiate the correction process based on the analysis results, and allocates computing power according to the task scenario, real-time resource status, and text risk level. The processing and segmentation module is used to analyze the text logical structure, segment text fragments in error areas, delineate paragraph boundaries, and locate candidate replacement points. The semantic error correction module is used to repair text fragments in erroneous areas; The global correction module detects the syntactic analysis, contextual intent recognition, entity chain establishment, and cross-paragraph contradictions of the entire document, and performs semantic deep proofreading on the corrected text. The recognition and parsing module identifies the document format and layout based on the original document image, OCR layout frame, or metadata. The layout reconstruction module rearranges the corrected text into structured content in the form of the original document based on the layout analysis results and visual structure information. The preference management module is used to build and maintain a dynamic domain knowledge base and user preference profiles, and to record proprietary terms, common abbreviations, professional expression patterns and user style preferences in documents; The learning update module is used to collect various types of information generated during the operation and to update the small language model or rule base regularly. The optimization processing module is used to simulate various extreme situations, construct adversarial OCR samples, and adjust document correction parameters; The output annotation module is used to provide explanations, references, contextual links, and comprehensive confidence scores for each modification when outputting the final revised document; The integration and export module is used to integrate content that has undergone semantic proofreading, format reconstruction, and interpretable annotation, and generate structured results that can be used for archiving, printing, further editing, or system integration.
6. The OCR recognition result correction system based on a large model as described in claim 5, characterized in that, The specific steps by which the layout reconstruction module rearranges the corrected text into structured content in the original document format are as follows: S4.1: Read the border coordinates, confidence, row and column information and other layout metadata of each OCR block from the original OCR document, and load the corresponding original page image. If the border information is not read from the original OCR document, use the layout detector to generate alternative borders on the original page image. S4.2: Scale according to DPI standard, unify the resolution of each page image, then perform perspective correction and background denoising processing respectively, and record the preprocessing transformation matrix of each border. Then, based on the page image preprocessing results, generate an image feature description table and a set of standardized borders. Then, based on each standardized border, crop the corresponding page image and input it into the visual encoder. S4.3: Extract texture features, shape features, and font and character appearance features of each page image through a visual encoder, calculate the overall page image layout-level visual context features, identify the header, footer, margin and in-page alignment grid of each page image, and then associate a set of visual labels and corresponding visual confidence scores with each standardized border. S4.4: Based on spatial overlap, character coordinate coincidence, and visual label compatibility, the text block after semantic correction by the global correction module is matched with all standardized borders on the page image. The matching score of each pair of <text block, standardized border> is calculated. If the text block does not have a standardized border with a matching score higher than the preset threshold on the same page, a cross-page search is triggered, and the corresponding text block is marked as "position uncertain" for manual review. S4.5: After the initial matching is completed, the table, ordered and unordered lists and the structural units of the title level are detected and constructed. The vertical alignment and numerical format consistency of each structural type are checked by the corresponding rule validator. The structure is judged as a chapter title based on visual thickness and semantic vector. The identified structure is then recorded in the form of a hierarchical tree. Each node contains member block ID, structure type and confidence. S4.6: Based on the preliminary matching and structure recognition results of text blocks and standardized borders, the optimal text-to-box mapping and text layout in each box are obtained through approximate discretization search. After optimization, the final layout instruction for each box is output. At the same time, based on visual features and hierarchical trees, the visual style attributes of each text block are identified, and the font attributes are subjected to global consistency constraints. Meanwhile, the corresponding style mapping table is generated. S4.7: Based on the style mapping table and hierarchy tree, merge rows and columns of the table, restore cross-column or cross-row cells, calculate the column width of each cell based on the content width of the member block and layout constraints, generate placeholders for embedded images or chart blocks and associate them with their annotations and title text blocks, and then output the reconstructed layout model and mark the areas that need to be manually reviewed.
7. The OCR recognition result correction system based on a large model as described in claim 5, characterized in that, The specific steps for the preference management module to build and maintain a dynamic domain knowledge base and user preference profiles are as follows: S5.1: Each time an automatic correction or manual review occurs, a corresponding structured log is generated, the availability score of each log is calculated, and the log items are written to the short-term fast access layer and the long-term archive layer respectively. An audit tag is added to the content of the long-term layer. Logs with availability scores higher than the preset threshold in the short-term fast access layer are periodically extracted, and the extracted logs are standardized. S5.2: Combine editing cost and semantic vector similarity to construct a text similarity metric. Based on the constructed text similarity metrics, merge logs representing the same "error pattern" into an aggregated sample. At the same time, take the log with the highest frequency in the aggregated sample as the representative sample. Then write the aggregation result into the candidate queue of the knowledge base and record the statistical information within the cluster. S5.3: Extract entities or facts from the representative samples after clustering, and map the extraction results to the patterns of the domain knowledge base. If the representative sample corresponds to a KB entry in the domain knowledge base, a weighted Bayesian fusion is used to correct the confidence and priority of the KB entry. Otherwise, a draft entry is created and marked with "to be verified", and feedback is sent to human review. S5.4: Maintain a corresponding updatable preference vector for each user or organization. Each time a user accepts, rejects, or modifies any explicit feedback item, the preference vector is updated online using an exponentially weighted moving average strategy, and the organizational-level preferences are hierarchically merged with the corresponding individual preferences.
Citation Information
Patent Citations
LLM-driven complex report OCR error self-correction method and system
CN120412000A
Intelligent data labeling method and system based on multi-modal fusion and large model verification
CN121281056A