Self-adaptive text extraction method and system based on artificial intelligence
By using document structure entropy analysis and a multi-level confidence verification mechanism, and adaptively configuring preprocessing and recognition parameters, the problem of insufficient recognition accuracy and adaptability caused by differences in document quality is solved, and efficient text extraction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-08
- Publication Date
- 2026-03-13
AI Technical Summary
Existing text extraction technologies cannot adapt to the differences in document quality, resulting in wasted computational resources when processing high-quality documents, while the recognition accuracy is insufficient when processing low-quality documents. Furthermore, they lack multi-level verification and semantic-assisted decision-making mechanisms, resulting in insufficient robustness.
By dynamically configuring preprocessing and recognition parameters through document structure entropy analysis, combined with a multi-level confidence verification mechanism, the preprocessing pipeline strength level is adaptively selected, and an AI recognition model is used to generate recognition engine instances for text detection and recognition. Combined with rule-based coarse screening and multi-person collaborative verification, structured text extraction information is output.
It achieves accurate processing of documents of different quality, improves extraction accuracy and system robustness, reduces the risk of recognition errors, and improves recognition performance in complex scenarios.
Smart Images

Figure CN121658657A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically to an adaptive text extraction method and system based on artificial intelligence. Background Technology
[0002] In the field of document digitization, text extraction technology has become an important means of extracting key information from unstructured documents, and is widely used in business scenarios such as compliance supervision, invoice recognition, and document information collection. Existing technologies typically combine image preprocessing based on fixed rules with text recognition. This involves standardizing the document through pre-set image correction and noise removal steps, and then using optical character recognition (OCR) technology to obtain the text content. However, in actual business operations, the quality of documents varies significantly, including complex situations such as image blurring, geometric distortion, background interference, and stamp overlay. Traditional methods often use a uniform preprocessing intensity, which is difficult to adapt to the structural complexity of different documents. This "one-size-fits-all" approach leads to unnecessary waste of computational resources when dealing with high-quality documents, while insufficient noise removal or correction affects recognition accuracy when processing low-quality documents. Furthermore, most existing systems rely on manual configuration of recognition parameters and extraction rules, lacking a quantitative evaluation mechanism for document quality and failing to dynamically adjust processing strategies based on the actual state of the document. When there is uncertainty in the recognition results, the system usually relies on a single confidence threshold for judgment, lacking multi-level verification and semantic auxiliary decision-making mechanisms. This makes the extraction results of key fields insufficiently robust when faced with recognition errors, disordered formats, or semantic ambiguity. Summary of the Invention
[0003] In view of the above problems, the present invention provides an adaptive text extraction method and system based on artificial intelligence. It dynamically configures preprocessing and recognition parameters through document structure entropy analysis and combines a multi-level confidence verification mechanism to solve the problems of insufficient extraction accuracy and adaptability caused by differences in document quality and rigid rules.
[0004] To achieve the above objectives, in a first aspect, this application provides an artificial intelligence-based adaptive text extraction method, comprising:
[0005] Receive a text extraction service definition request and the corresponding sample document set. The text extraction service definition request includes the target document type and a description of the key fields to be extracted.
[0006] Document structure entropy analysis is performed on the example document set. By quantitatively evaluating the noise density, geometric distortion, and background complexity of the document images, the structure entropy value of each example document is calculated.
[0007] Based on the distribution range of structural entropy, the intensity level of the preprocessing pipeline is adaptively selected. The preprocessing pipeline includes a multi-level processing module from basic correction to enhanced denoising.
[0008] Based on the selected preprocessing pipeline intensity level, the image preprocessing parameters and AI recognition model parameters are dynamically configured to generate a recognition engine instance that is adapted to the current document quality.
[0009] The recognition engine instance is used to perform text detection and recognition on the input sample document, and the preliminary recognized text is output.
[0010] Based on the description of key fields, a rule-based coarse screening extraction is performed on the initially identified text to obtain candidate text fragments for each key field;
[0011] For each candidate text segment, a confidence level is evaluated. If the confidence level is lower than the first confidence threshold, a multi-candidate generation strategy is initiated to generate several alternative segments based on contextual semantic similarity.
[0012] For low-confidence segments with a confidence level below the second confidence threshold, a multi-person collaborative verification process is triggered to aggregate independent judgment results to determine the final extracted segments;
[0013] Segments with a confidence level higher than the first confidence threshold are categorized as high-confidence segments;
[0014] The high-confidence segment, several candidate segments, and the final extracted segment determined by collaborative verification are input into the text normalization module. The module performs format unification and semantic standardization processing, and outputs structured text extraction information.
[0015] Furthermore, document structure entropy analysis is performed on the example document set. By quantitatively evaluating the noise density, geometric distortion, and background complexity of the document images, the structure entropy value of each example document is calculated, including:
[0016] Extract image features from each example document in the example document set. Image features include local binary pattern texture features, edge density features, and connected component distribution features.
[0017] Based on image features, an unsupervised clustering algorithm is used to divide the document image into uniform regions, noisy regions, and text regions;
[0018] The noise density index is calculated as the proportion of the noise region relative to the total area of the image. The degree of tilt and curvature of document edges is detected based on Hough transform as a geometric distortion index. The complexity of background texture is evaluated through frequency domain analysis as a background complexity index.
[0019] The noise density index, geometric distortion index, and background complexity index are input into the entropy calculation model, which outputs the structural entropy value. The entropy calculation model is trained by fitting manually annotated document quality levels through multiple linear regression.
[0020] Furthermore, based on the distribution range of structural entropy values, the preprocessing pipeline intensity level is adaptively selected. The preprocessing pipeline includes multi-stage processing modules from basic correction to enhanced denoising, including:
[0021] Set a first interval threshold and a second interval threshold for the structural entropy value, where the first interval threshold is less than the second interval threshold;
[0022] When the structural entropy value of the example document is less than the first interval threshold, the basic correction level preprocessing pipeline is selected. The basic correction level preprocessing pipeline only includes the image orientation correction module and the binarization processing module.
[0023] When the structural entropy value of the sample document is greater than or equal to the first interval threshold and less than the second interval threshold, the standard enhanced preprocessing pipeline is selected. The standard enhanced preprocessing pipeline adds a Gaussian denoising module and a perspective correction module on the basis of the basic correction preprocessing pipeline.
[0024] When the structural entropy value of the example document is greater than or equal to the second interval threshold, the enhanced denoising level preprocessing pipeline is selected. The enhanced denoising level preprocessing pipeline adds an image inpainting module and a complex background separation module based on generative adversarial networks on the basis of the standard enhanced level preprocessing pipeline.
[0025] Based on the distribution of structural entropy values of all documents in the example document set, the dominant entropy value range is determined, and the preprocessing pipeline intensity level corresponding to the dominant entropy value range is used as the default configuration level of the text extraction service.
[0026] Furthermore, based on the selected preprocessing pipeline intensity level, the image preprocessing parameters and AI recognition model parameters are dynamically configured to generate a recognition engine instance adapted to the current document quality, including:
[0027] Based on the preprocessing pipeline intensity level, the corresponding image preprocessing parameter combination is loaded from the preset parameter configuration library. The image preprocessing parameters include Gaussian filter kernel size, binarization threshold range, and perspective correction intensity coefficient.
[0028] Based on the preprocessing pipeline strength level, the input image size and recognition accuracy parameters of the AI recognition model are dynamically adjusted. The basic correction level preprocessing pipeline adopts a standard input size and balanced accuracy mode, while the enhanced noise reduction level preprocessing pipeline adopts a high-resolution input size and high-precision recognition mode.
[0029] Based on the target document type, pre-trained domain-adaptive recognition models are selected from the model repository. These domain-adaptive recognition models include contract document recognition models, invoice recognition models, and certificate recognition models.
[0030] By combining image preprocessing parameters, AI recognition model parameters, and domain-adaptive recognition models, an instantiated recognition engine instance with processing capabilities adapted to the current document quality is generated.
[0031] Furthermore, the recognition engine instance is used to perform text detection and recognition on the input sample document, outputting preliminary recognized text, including:
[0032] Input the sample document into the recognition engine instance, and execute the bound image preprocessing operations in sequence to generate the optimized image to be recognized;
[0033] Based on the domain-adaptive recognition model, text region detection is performed on the image to be recognized to obtain the position coordinates of the text lines and the region confidence.
[0034] Optical character recognition (OCR) is performed on each detected text region to generate the original recognized text and character-level confidence scores.
[0035] By combining regional confidence and character-level confidence, a weighted fusion algorithm is used to calculate the overall confidence of each text line.
[0036] The recognition results are analyzed to reconstruct the document's logical structure based on the position coordinates of the text lines, generating structured text data containing paragraphs and tables.
[0037] The structured text data, the original recognized text of each line of text, and their corresponding comprehensive confidence scores are associated and stored as the initial recognized text output.
[0038] Furthermore, based on the key field descriptions, a rule-based coarse-screening extraction is performed on the initially identified text to obtain candidate text fragments for each key field, including:
[0039] Parse key field descriptions, extract semantic features and format constraints, and generate field extraction rule templates;
[0040] Based on the field extraction rule template, multi-pattern matching is performed on the structured text data of the initially identified text. Multi-pattern matching includes keyword-triggered matching, regular expression matching, and contextual semantic matching.
[0041] Perform position verification on the successfully matched text fragments to ensure that they are in a logical context within the document;
[0042] Calculate the rule matching score for each matching segment. The rule matching score includes keyword coverage, format conformity, and context relevance.
[0043] The initial extraction confidence of each matching segment is calculated based on the rule matching score and the line-level comprehensive confidence of the corresponding text line.
[0044] The matching results are sorted according to the initial extraction confidence, and the top-ranked text fragments are selected as candidate text fragments for each key field.
[0045] Each candidate text fragment is appended with its corresponding rule matching score and source text line position information to form a complete candidate text fragment.
[0046] Furthermore, a confidence level assessment is performed on each candidate text segment. If its confidence level is lower than the first confidence threshold, a multi-candidate generation strategy is initiated to generate several alternative segments based on contextual semantic similarity, including:
[0047] The initial extraction confidence of the candidate text fragments is compared with a preset first confidence threshold;
[0048] When the initial extraction confidence is lower than the first confidence threshold, the semantic similarity algorithm is used to retrieve text content that is semantically similar to the candidate text fragment in the initially identified text.
[0049] By combining the edit distance algorithm with word vector cosine similarity, several similar text segments with the highest rankings are selected as candidate segments from the search results.
[0050] Furthermore, the methods also include:
[0051] If the initial extraction confidence level is lower than the first confidence threshold, then the initial extraction confidence level is compared with the preset second confidence threshold.
[0052] If the initial extraction confidence level is lower than the second confidence threshold, it is recorded as a low-confidence segment;
[0053] For low-confidence segments with a confidence level below the second confidence threshold, a multi-person collaborative verification process is triggered to aggregate independent judgment results to determine the final extracted segments, including:
[0054] The low-confidence segments and their corresponding initial extraction confidence and context information are encapsulated into a verification task unit;
[0055] According to the preset verification personnel allocation rules, the verification task unit is distributed to multiple independent verification personnel;
[0056] Receive correction results from each verification personnel. The correction results include confirmation of the original segment, provision of corrected text, or annotations indicating that the segment is unrecognizable.
[0057] A weighted voting algorithm is used to aggregate the correction results, with the historical accuracy of the verification personnel serving as a weighting factor.
[0058] When the weighted voting result exceeds the preset consistency threshold, the text segment corresponding to the weighted voting result is determined as the final extracted segment;
[0059] If the weighted voting result does not reach the consensus threshold, the verification task unit will be upgraded to the arbitration node for final adjudication to obtain the final extracted fragment.
[0060] Furthermore, the high-confidence segment, several candidate segments, and the final extracted segment determined through collaborative verification are input into the text normalization module to perform format unification and semantic standardization processing, outputting structured text extraction information, including:
[0061] Perform character-level cleaning operations on various input text fragments to remove illegal characters, extra spaces, and invisible control characters;
[0062] Based on a pre-defined domain dictionary and synonym mapping table, the terminology of text fragments is standardized to unify the professional terms in different expressions;
[0063] Based on the data type requirements of the key fields, perform format standardization conversion, including standardizing date formats, standardizing monetary units, and formatting document numbers in segments;
[0064] By combining rule engine and semantic parsing, the normalized text fragments are logically validated to detect and correct obvious logical contradictions or format errors.
[0065] The validated text fragments are restructured according to key fields to generate JSON format data containing field names, extracted values, confidence levels, and data sources;
[0066] The JSON format data is associated and encapsulated with the corresponding business document metadata to form the final structured text extraction information and output it.
[0067] In a second aspect, the present invention also provides an adaptive text extraction system based on artificial intelligence, applicable to the method described in the first aspect. The system includes: a service definition request receiving module, a document structure entropy analysis module, a preprocessing pipeline selection module, a recognition engine instance generation module, a text recognition processing module, a rule-based coarse screening extraction module, a multi-candidate generation module, a multi-person collaborative verification module, a text normalization processing module, and a structured output module. The service definition request receiving module is used to receive text extraction service definition requests and corresponding example document sets; the document structure entropy analysis module is used to perform structural entropy quantification analysis on the example document sets and calculate the structural entropy value; the preprocessing pipeline selection module is used to adaptively select the preprocessing pipeline intensity level according to the distribution of structural entropy values. The recognition engine instance generation module dynamically configures image preprocessing parameters and AI recognition model parameters to generate recognition engine instances; the text recognition processing module performs text detection and recognition on example documents using the recognition engine instances and outputs preliminary recognized text; the rule-based coarse screening extraction module performs rule matching on the preliminary recognized text based on key field descriptions and generates candidate text fragments; the multi-candidate generation module generates alternative fragments based on semantic similarity for low-confidence candidate fragments; the multi-person collaborative verification module triggers a collaborative verification process for low-confidence fragments and determines the final extracted fragments; the text normalization processing module performs format unification and semantic standardization processing on various types of text fragments; and the structured output module generates and outputs structured text extraction information.
[0068] Unlike existing technologies, the above-mentioned technical solution provides an adaptive text extraction method and system based on artificial intelligence. It analyzes the document structure entropy of a sample document set to quantify its noise density, geometric distortion, and background complexity, and adaptively selects the preprocessing pipeline intensity level accordingly. It dynamically configures image preprocessing parameters and AI recognition model parameters to generate recognition engine instances to output preliminary recognized text. After regularized coarse extraction based on key field descriptions, a multi-candidate generation strategy is initiated for low-confidence candidate text segments, and a multi-person collaborative verification process is triggered for even lower-confidence segments. Finally, all segments are processed by a text normalization module to output structured text extraction information. This invention achieves precise adaptation of processing intensity through quantitative document quality assessment, effectively improves the extraction accuracy and system robustness of complex heterogeneous documents using a multi-level confidence verification mechanism, and reduces the risk of recognition errors caused by image quality fluctuations or rule rigidity.
[0069] The above description of the invention is merely an overview of the technical solution of this application. In order to enable those skilled in the art to better understand the technical solution of this application and to implement it based on the description and drawings, and to make the above-mentioned objectives and other objectives, features and advantages of this application easier to understand, the following description is provided in conjunction with the specific embodiments and drawings of this application. Attached Figure Description
[0070] The accompanying drawings are only used to illustrate the principles, implementation methods, applications, features, and effects of specific embodiments of the present invention and other related contents, and should not be considered as limitations on this application.
[0071] In the accompanying drawings of the instruction manual:
[0072] Figure 1 This is a schematic diagram illustrating steps S101 to S110 of the method described in the specific implementation embodiment;
[0073] Figure 2 This is a schematic diagram illustrating steps S201 to S204 of the method described in a specific implementation.
[0074] Figure 3 This is a schematic diagram illustrating steps S301 to S305 of the method described in a specific implementation.
[0075] Figure 4 This is a schematic diagram illustrating steps S401 to S404 of the method described in a specific embodiment;
[0076] Figure 5 This is an architecture diagram of the system described in a specific implementation. Detailed Implementation
[0077] To illustrate the possible application scenarios, technical principles, implementable specific solutions, and achievable objectives and effects of this application in detail, the following description, in conjunction with the listed specific embodiments and accompanying drawings, provides a detailed explanation. The embodiments described herein are merely illustrative of the technical solutions of this application and are therefore intended to limit the scope of protection of this application.
[0078] In this document, the term "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The term "embodiment" appearing in various places throughout the specification does not necessarily refer to the same embodiment, nor does it specifically limit its independence or connection with other embodiments. In principle, in this application, as long as there are no technical contradictions or conflicts, the technical features mentioned in each embodiment can be combined in any way to form corresponding implementable technical solutions.
[0079] Unless otherwise defined, the technical terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the use of related terms herein is merely for the purpose of describing particular embodiments and is not intended to limit this application.
[0080] In the description of this application, the term "and / or" is used to describe the logical relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A exists, B exists, and A and B exist simultaneously. Additionally, the character " / " in this document generally indicates that the preceding and following objects have an "or" logical relationship.
[0081] In this application, terms such as “first” and “second” are used only to distinguish one entity or operation from another, and do not necessarily require or imply any actual quantity, hierarchy or order relationship between these entities or operations.
[0082] Without further limitations, the use of terms such as “comprising,” “including,” “having,” or other similar open-ended expressions in this application is intended to cover non-exclusive inclusion, which does not exclude the presence of additional elements in a process, method, or product that includes the stated elements, such that a process, method, or product that includes a list of elements may include not only those defined elements but also other elements not expressly listed, or elements inherent to such a process, method, or product.
[0083] As understood in the Examination Guidelines, in this application, expressions such as "greater than," "less than," and "exceeding" are understood to exclude the stated number; expressions such as "above," "below," and "within" are understood to include the stated number. Furthermore, in the description of the embodiments in this application, "multiple" means two or more (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups" and "multiple times," unless otherwise explicitly specified.
[0084] In the description of the embodiments of this application, the space-related expressions used, such as "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "vertical," "top," "bottom," "inner," "outer," "clockwise," "counterclockwise," "axial," "radial," and "circumferential," indicate the orientation or positional relationship based on the orientation or positional relationship shown in the specific embodiments or drawings. They are only for the purpose of describing the specific embodiments of this application or for the reader's understanding, and do not indicate or imply that the device or component referred to must have a specific position, a specific orientation, or be constructed or operated in a specific orientation. Therefore, they should not be construed as limitations on the embodiments of this application.
[0085] The processor described in the embodiments of this application can be implemented by hardware, firmware, software, or a combination thereof. It can be a circuit, one or more of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, or a microprocessor. It also includes other physical, biological, or chemical structures that can implement the same or equivalent functions as the processors listed above, such as biological neurons, quantum computing units, DNA computing units, etc., so that the processor can execute some or all of the steps in the computer program or method involved in the various embodiments of this application, or any combination of the steps mentioned therein.
[0086] The computer program involved in the embodiments can be stored in a computer device readable storage medium, which includes, but is not limited to, disks, magnetic tapes, magnetic cards, floppy disks, flash memory, optical disks, optical cards, read-only memory (ROM), random access memory (RAM), erasable programmable ROM (EPROM), and electrically erasable programmable ROM (EEPROM), etc., and also includes other biological, physical, or chemical structures that can achieve the same or equivalent functions as the storage media listed above, such as DNA, RNA, proteins, and other units with information storage capabilities. In specific embodiments, the storage medium involved can be one of the above-mentioned media types, or a combination of the above-mentioned media types. In different embodiments, the computer program involved in the embodiments can be centrally stored in a single medium, or distributed and stored in multiple media. The memory containing the computer device readable storage medium can be non-volatile memory or random access memory. These computer device readable storage media can be built into the device, or can be connected to the device involved in the embodiments as an external device or part of an external device. In some embodiments, the memory having a computer device readable storage medium is deployed locally; in other embodiments, the memory may be deployed remotely from the processor, for example, as a network-attached memory accessed via RF circuitry or an external port and a communication network, wherein the communication network may be the Internet, one or more intranets, a local area network (LAN), a wide area network (WLAN), a storage area network (SAN), or a suitable combination thereof, as long as computer device access to the memory is enabled. Furthermore, the computer program involved in the embodiments may be stored in plaintext / ciphertext form, or it may be designed as training data, integrated and recombined through model training and implicitly stored in the parameter states of a deep neural network or other machine learning model.
[0087] Please see Figure 1 In a first aspect, this embodiment provides an adaptive text extraction method based on artificial intelligence, including:
[0088] S101. Receive a text extraction service definition request and a corresponding set of sample documents. The text extraction service definition request includes the target document type and a description of the key fields to be extracted.
[0089] S102. Perform document structure entropy analysis on the example document set. Calculate the structure entropy value of each example document by quantitatively evaluating the noise density, geometric distortion, and background complexity of the document images.
[0090] S103. Based on the distribution range of structural entropy values, adaptively select the preprocessing pipeline intensity level. The preprocessing pipeline includes a multi-level processing module from basic correction to enhanced denoising.
[0091] S104. Based on the selected preprocessing pipeline intensity level, dynamically configure the image preprocessing parameters and AI recognition model parameters to generate a recognition engine instance that is adapted to the current document quality.
[0092] S105. Use the recognition engine instance to perform text detection and recognition on the input sample document, and output the preliminary recognized text;
[0093] S106. Based on the description of key fields, perform regular coarse screening extraction on the initially identified text to obtain candidate text fragments for each key field.
[0094] S107. Calculate the confidence level of each candidate text segment. If the confidence level is lower than the first confidence threshold, start the multi-candidate generation strategy and generate several alternative segments based on the semantic similarity of the context.
[0095] S108. For low-confidence segments with a confidence level below the second confidence threshold, trigger a multi-person collaborative verification process to aggregate independent judgment results to determine the final extracted segment.
[0096] S109. Confidence segments with a confidence level higher than the first confidence threshold are categorized as high-confidence segments.
[0097] S110. Input the high-confidence segment, several candidate segments, and the final extracted segment determined by collaborative verification into the text normalization module, perform format unification and semantic standardization processing, and output the structured text extraction information.
[0098] In step S101, the text extraction service definition request refers to the text extraction task configuration information submitted by the user through the service interface. The target document type identifies the business category of the document to be processed (e.g., contract, invoice, certificate), while the key field description specifies the specific information items and their semantic features to be extracted from the document. The example document set serves as training and evaluation samples, containing representative target document images. This step, through a standardized service definition interface, achieves a unified encapsulation of text extraction requirements under different business scenarios.
[0099] In step S102, document structure entropy analysis is a process of reflecting the structural complexity of a document image by quantitatively evaluating its quality features. Noise density characterizes the distribution density of non-textual interference elements in the image, geometric distortion measures the degree of deformation of the document image, and background complexity assesses the texture complexity of non-textual regions. The structure entropy value is a comprehensive quality score calculated by fusing the above indicators using a multiple regression model, and its value is positively correlated with the difficulty of document processing. This step provides an objective quality assessment basis for subsequent adaptive processing.
[0100] It should be noted that the structural entropy mentioned is a custom comprehensive index specifically used to quantify the structural complexity and quality of document images. This index is calculated by fusing multiple dimensions such as noise density, geometric distortion, and background complexity. Its value directly reflects the quality of the document image and the expected difficulty of subsequent processing. The concept of "entropy" here aims to vividly express the chaotic and disordered state of document structure, and it differs significantly from the "entropy" in information theory, which refers to the amount of information, in both definition and application.
[0101] In step S103, the preprocessing pipeline intensity level is a multi-level processing strategy dynamically selected based on the distribution of structural entropy values. The basic correction level mainly addresses simple geometric distortion problems, while the enhanced denoising level performs in-depth processing on complex backgrounds and severe noise. Automatic division of intensity levels is achieved by setting interval thresholds, ensuring that the processing intensity matches the document quality and avoiding over-processing or under-processing.
[0102] In step S104, the dynamic configuration process loads the corresponding image preprocessing parameter combination from the parameter library according to the selected intensity level, and simultaneously adjusts the input specifications and recognition accuracy of the AI recognition model. The recognition engine instance binds the preprocessing parameters, model parameters, and domain-adaptive recognition model to form a dedicated processing unit for the current document quality, achieving optimal configuration of processing resources.
[0103] In step S105, the text detection and recognition process sequentially performs image preprocessing, text region detection, character recognition, and layout analysis. A line-level comprehensive confidence score is obtained by weighted fusion of region confidence and character-level confidence scores, and structured text data with logical relationships is generated by combining this with layout structure information, providing a high-quality recognition foundation for subsequent field extraction.
[0104] In step S106, rule-based coarse screening extracts rule templates generated based on key field descriptions, and performs multi-pattern matching on the initially identified text. By calculating the rule matching score and combining it with line-level confidence, candidate text fragments that meet the field requirements are selected. This step achieves the initial location of key information through the rule engine, providing input for subsequent refined processing.
[0105] In step S107, the multi-candidate generation strategy is a supplementary processing mechanism for low-confidence segments. When the initial extraction confidence of a candidate segment is lower than the first confidence threshold, a semantic similarity algorithm is used to retrieve semantically similar alternative content in the context, effectively improving the recall rate of information extraction.
[0106] In step S108, preferably, the multi-person collaborative verification process uses a distributed task allocation and weighted voting mechanism to manually verify fragments with extremely low confidence, which not only ensures the reliability of the verification results, but also improves the processing efficiency through weight allocation and arbitration mechanisms.
[0107] In step S109, high-confidence segments refer to reliable extraction results whose confidence assessment results are higher than the first confidence threshold. These segments will directly enter the subsequent processing flow without additional verification.
[0108] In step S110, the text normalization module performs operations such as character cleaning, terminology standardization, and format conversion to unify various extraction results into a standardized format that meets business requirements, and finally generates structured text extraction information.
[0109] This embodiment establishes a complete technical chain, including quantitative assessment of document quality, adaptive selection of processing intensity, and multi-level confidence verification, to achieve intelligent adaptive processing of documents of different quality. This method effectively solves the problem of fluctuating recognition accuracy in traditional text extraction systems due to differences in document quality, significantly improving the system's robustness and practicality in complex scenarios. In particular, by precisely matching the processing intensity with document quality, it ensures processing effectiveness while avoiding unnecessary consumption of computational resources.
[0110] Please see Figure 2 In some embodiments, document structure entropy analysis is performed on the example document set. This involves quantitatively evaluating the noise density, geometric distortion, and background complexity of the document images to calculate the structure entropy value for each example document, including:
[0111] S201. Extract the image features of each example document in the example document set. The image features include local binary pattern texture features, edge density features, and connected component distribution features.
[0112] S202. Based on image features, an unsupervised clustering algorithm is used to divide the document image into uniform regions, noisy regions, and text regions;
[0113] S203. Calculate the proportion of the noise region relative to the total area of the image as a noise density index, detect the tilt and curvature of document edges based on Hough transform as a geometric distortion index, and evaluate the complexity of background texture through frequency domain analysis as a background complexity index.
[0114] S204. Input the noise density index, geometric distortion index and background complexity index into the entropy calculation model, and output the structural entropy value. The entropy calculation model is trained by fitting manually annotated document quality levels through multiple linear regression.
[0115] In step S201, image feature extraction is a fundamental step in document structure analysis. Local binary pattern texture features characterize the local texture pattern of the image by comparing the grayscale relationship between pixels and their neighbors; edge density features calculate the number of edge pixels per unit area using edge detection operators such as Sobel or Canny, reflecting the clarity of the document structure; connected component distribution features analyze the connected components of the binary image to statistically determine the size, spacing, and arrangement patterns of text blocks. These features together constitute a multi-dimensional representation of the document image, providing data support for subsequent region segmentation.
[0116] In step S202, the region partitioning uses unsupervised clustering algorithms such as K-means or DBSCAN to automatically classify the image feature vectors. Uniform regions refer to areas with smooth backgrounds and simple textures; noisy regions contain scattered points, stains, and other interfering elements; and text regions consist of continuous characters. Using distance metrics in the feature space, the algorithm assigns pixels or superpixels to their corresponding categories, achieving semantic partitioning of the document content. This step provides an accurate basis for region definition in quality index calculation.
[0117] In step S203, the quality indicators are calculated using targeted quantification methods. The noise density indicator is quantified by the ratio of the total number of pixels in the noise region to the total number of pixels in the entire image; the geometric distortion indicator uses Hough transform to detect straight lines at document edges, and assesses the degree of distortion by calculating the angular deviation and curvature change between the actual edge and the ideal rectangle; the background complexity indicator uses Fourier transform to convert the image to the frequency domain, and analyzes the proportion of high-frequency components and spectral distribution characteristics to assess the complexity of the background texture. These indicators objectively reflect the image quality of the document from different dimensions.
[0118] In step S204, the entropy calculation model establishes a mapping relationship between quality indicators and document quality levels through multiple linear regression. During model training, manually labeled document quality levels (e.g., excellent, good, average, poor) are used as the dependent variable, and the three quality indicators are used as independent variables. The regression coefficients are fitted using the least squares method. In application, the quality indicators of the document to be evaluated are input into the trained model, which then outputs a quantified structural entropy value. This model realizes the transformation of subjective quality evaluation into objective numerical values, providing a reliable basis for subsequent processing intensity selection.
[0119] This embodiment constructs a complete document structure entropy analysis process through systematic feature extraction, region segmentation, index calculation, and model fusion. By combining image processing technology with statistical modeling, it achieves an objective quantitative assessment of document quality. In particular, it automatically identifies document structure regions through unsupervised clustering, avoiding the limitations of traditional methods that rely on manual annotation. Furthermore, the entropy calculation model based on multiple regression effectively solves the problem of comprehensive evaluation of multi-dimensional quality indicators. The structure entropy analysis method in this embodiment provides the adaptive text extraction system with accurate quality perception capabilities, significantly improving the targeting and effectiveness of subsequent processing steps.
[0120] Please see Figure 3 In some embodiments, the preprocessing pipeline intensity level is adaptively selected based on the distribution range of structural entropy values. The preprocessing pipeline includes a multi-stage processing module from basic correction to enhanced denoising, including:
[0121] S301. Set a first interval threshold and a second interval threshold for the structural entropy value, wherein the first interval threshold is less than the second interval threshold.
[0122] S302. When the structural entropy value of the example document is less than the first interval threshold, select the basic correction level preprocessing pipeline. The basic correction level preprocessing pipeline only includes the image orientation correction module and the binarization processing module.
[0123] S303. When the structural entropy value of the sample document is greater than or equal to the first interval threshold and less than the second interval threshold, select the standard enhanced preprocessing pipeline. The standard enhanced preprocessing pipeline adds a Gaussian denoising module and a perspective correction module on the basis of the basic correction preprocessing pipeline.
[0124] S304. When the structural entropy value of the example document is greater than or equal to the second interval threshold, select the enhanced denoising level preprocessing pipeline. The enhanced denoising level preprocessing pipeline adds an image inpainting module and a complex background separation module based on generative adversarial network on the basis of the standard enhanced level preprocessing pipeline.
[0125] S305. Based on the distribution of structural entropy values of all documents in the example document set, determine the dominant entropy value range, and use the preprocessing pipeline intensity level corresponding to the dominant entropy value range as the default configuration level of the text extraction service.
[0126] In step S301, setting the interval thresholds is a key basis for preprocessing intensity grading. The first interval threshold and the second interval threshold are determined by analyzing the structural entropy distribution characteristics of a large number of document samples, and can be calculated using the percentile method or the cluster center method. Preferably, the first interval threshold corresponds to the upper limit of the entropy value of high-quality documents, and the second interval threshold corresponds to the upper limit of the entropy value of medium-quality documents.
[0127] In step S302, the basic correction-level preprocessing pipeline performs only necessary image orientation correction and binarization processing on high-quality documents with low structural entropy values. Image orientation correction eliminates document tilt through rotation correction, and binarization converts the image to black and white to highlight text information. This lightweight processing preserves the original document features to the maximum extent while ensuring basic quality.
[0128] In step S303, the standard enhanced preprocessing pipeline adds Gaussian denoising and perspective correction modules to the basic correction. Gaussian denoising eliminates image noise through filtering algorithms, while perspective correction repairs document distortion through geometric transformations. This level is suitable for documents with minor quality issues, achieving a balance between denoising and geometric correction.
[0129] In step S304, the enhanced denoising preprocessing pipeline adds image inpainting and complex background separation modules based on generative adversarial networks for low-quality documents with high structural entropy values. The image inpainting module reconstructs the missing text regions using deep learning techniques, while the background separation module removes complex background interference using semantic segmentation techniques. This deep processing can effectively restore severely damaged document content.
[0130] In step S305, the dominant entropy interval is determined by statistically analyzing the structural entropy distribution of the example document set. The mode interval or the interval with the highest density can be used as the dominant interval. Setting the preprocessing level corresponding to the dominant interval to the default configuration ensures the service's processing efficiency when dealing with typical documents, while retaining the ability to dynamically adjust for special documents.
[0131] This embodiment establishes a three-tiered preprocessing pipeline and a hierarchical correspondence with document quality, achieving precise matching between processing intensity and document condition. This hierarchical processing strategy avoids overprocessing of high-quality documents while ensuring sufficient repair of low-quality documents, significantly improving the adaptability and processing efficiency of the text extraction system on documents of different quality levels. In particular, the system's practicality and ease of use are further enhanced through intelligent identification of the dominant entropy value interval and optimization of default configuration. In practical applications, the specific values of the first interval threshold and the second interval threshold can be determined by analyzing the structural entropy value distribution of a large number of historical documents in the target business scenario. For example, a specific quantile of the structural entropy value distribution can be selected as the threshold boundary, so that most high-quality documents fall into the basic correction level, most typical documents fall into the standard enhancement level, and a few extremely poor-quality documents trigger the enhanced denoising level processing. Those skilled in the art can adaptively adjust the above thresholds according to the different emphases on processing efficiency and quality in actual business.
[0132] Please see Figure 4In some embodiments, image preprocessing parameters and AI recognition model parameters are dynamically configured based on the selected preprocessing pipeline intensity level to generate a recognition engine instance adapted to the current document quality, including:
[0133] S401. Based on the preprocessing pipeline intensity level, load the corresponding image preprocessing parameter combination from the preset parameter configuration library. The image preprocessing parameters include Gaussian filter kernel size, binarization threshold range, and perspective correction intensity coefficient.
[0134] S402. Based on the preprocessing pipeline strength level, dynamically adjust the input image size and recognition accuracy parameters of the AI recognition model. The basic correction stage preprocessing pipeline adopts a standard input size and balanced accuracy mode, while the enhanced noise reduction stage preprocessing pipeline adopts a high-resolution input size and high-precision recognition mode.
[0135] S403. Based on the target document type, select a pre-trained domain-adaptive recognition model from the model repository. The domain-adaptive recognition models include contract document recognition model, invoice recognition model, and certificate recognition model.
[0136] S404. Instantiate and bind the image preprocessing parameters, AI recognition model parameters, and domain-adaptive recognition model to generate a recognition engine instance with processing capabilities adapted to the current document quality.
[0137] In step S401, the parameter configuration library stores parameter combinations corresponding to different preprocessing intensity levels. The Gaussian filter kernel size controls the degree of noise reduction, the binarization threshold range affects the separation effect between text and background, and the perspective correction intensity coefficient determines the correction strength of geometric deformation. These parameters are determined through experimental optimization to ensure that each intensity level provides the most suitable processing effect.
[0138] In step S402, the dynamic adjustment of the AI recognition model parameters is adapted according to the preprocessing level. The standard input size is suitable for high-quality documents, the balanced accuracy mode achieves a balance between speed and accuracy; the high-resolution input size retains more detailed information, and the high-precision recognition mode improves recognition accuracy by increasing computational complexity. This hierarchical configuration achieves a precise match between computational resources and recognition requirements.
[0139] In step S403, the domain-adaptive recognition model is a specialized model optimized for specific document types. The contract document recognition model is trained with an emphasis on legal terminology and complex layouts, the invoice recognition model optimizes for recognizing numbers and tables, and the document recognition model focuses on recognizing fixed formats and anti-counterfeiting features. Through pre-training and domain fine-tuning, these models exhibit higher recognition accuracy in their respective domains.
[0140] In step S404, the instantiation binding process combines the configured parameters and model into an executable recognition engine. This instance contains a complete processing pipeline and optimized parameters, and can independently complete the entire process from image input to text output, ensuring the consistency and repeatability of the processing environment.
[0141] Through the aforementioned dynamic configuration process, this method achieves precise adaptation of the recognition engine instance to the current document quality. Specifically, it configures lightweight processing parameters for high-quality documents to improve efficiency, and enables high-intensity preprocessing and high-precision recognition models for low-quality documents to ensure effectiveness. It is precisely based on the quantitative quality assessment obtained from the aforementioned document structure entropy analysis that this targeted and dynamic parameter configuration and model selection becomes possible, thereby generating a recognition engine instance that truly "fits the current document quality."
[0142] This embodiment constructs a processing engine that precisely matches document quality through dynamic loading of a parameter library, hierarchical model configuration, and instantiation binding. This method achieves collaborative optimization of preprocessing parameters and recognition model parameters, effectively improving the system's processing performance for documents of varying quality. Furthermore, the intelligent selection of domain-specific models further enhances the system's professionalism and accuracy in specific business scenarios.
[0143] In some embodiments, the recognition engine instance is used to perform text detection and recognition on the input sample document, and output preliminary recognized text, including:
[0144] Input the sample document into the recognition engine instance, and execute the bound image preprocessing operations in sequence to generate the optimized image to be recognized;
[0145] Based on the domain-adaptive recognition model, text region detection is performed on the image to be recognized to obtain the position coordinates of the text lines and the region confidence.
[0146] Optical character recognition (OCR) is performed on each detected text region to generate the original recognized text and character-level confidence scores.
[0147] By combining regional confidence and character-level confidence, a weighted fusion algorithm is used to calculate the overall confidence of each text line.
[0148] The recognition results are analyzed to reconstruct the document's logical structure based on the position coordinates of the text lines, generating structured text data containing paragraphs and tables.
[0149] The structured text data, the original recognized text of each line of text, and their corresponding comprehensive confidence scores are associated and stored as the initial recognized text output.
[0150] In this embodiment, the image preprocessing operation is executed sequentially according to the parameter configuration bound to the recognition engine instance, including image denoising, geometric correction, binarization and other processing steps. The original document image is converted into an optimized image suitable for text recognition in a pipeline manner, ensuring that the input image quality meets the subsequent recognition requirements.
[0151] Text region detection is achieved through a detection network in a domain-adaptive recognition model. This network, based on a deep learning architecture, accurately identifies the locations of text lines in an image and outputs the coordinates and region confidence score for each detection box. The region confidence score reflects the reliability of the detection results and provides an important reference for subsequent processing.
[0152] Optical character recognition (OCR) processes perform fine-grained identification of each detected text region. Preferably, a deep learning-based character recognition model is employed to convert pixel information of image regions into text content, while simultaneously outputting the recognition result of each character and its corresponding confidence score. The character-level confidence score reflects the accuracy of individual character recognition.
[0153] The overall confidence score is calculated using a weighted fusion algorithm, which integrates regional confidence scores with character-level confidence scores. Specifically, the character-level confidence scores can be averaged or weighted based on the number of characters, and then fused with the regional confidence scores according to preset weights to obtain a comprehensive score reflecting the reliability of the entire line of text recognition.
[0154] Page layout analysis reconstructs the logical structure of a document based on the positional coordinates and spatial relationships of text lines. By analyzing the relative positions, alignment, and spacing characteristics between text lines, it identifies document elements such as paragraph boundaries and table structures, forming a hierarchical organization of text data.
[0155] The associated storage manages the structured text data and the original recognized text and its confidence information in a unified manner, preserving complete information of the recognition process and providing sufficient data support for subsequent field extraction and confidence assessment.
[0156] This embodiment achieves accurate conversion from document images to structured text through a complete process of text detection, character recognition, confidence fusion, and layout analysis. It not only provides high-quality recognition results but also lays a solid foundation for subsequent text extraction tasks through multi-level confidence assessment and layout structure reconstruction. By accurately calculating the comprehensive confidence and completely preserving the structured data, it significantly improves the accuracy and reliability of subsequent processing steps.
[0157] In some embodiments, based on key field descriptions, a rule-based coarse-screening extraction is performed on the initially identified text to obtain candidate text fragments for each key field, including:
[0158] Parse key field descriptions, extract semantic features and format constraints, and generate field extraction rule templates;
[0159] Based on the field extraction rule template, multi-pattern matching is performed on the structured text data of the initially identified text. Multi-pattern matching includes keyword-triggered matching, regular expression matching, and contextual semantic matching.
[0160] Perform position verification on the successfully matched text fragments to ensure that they are in a logical context within the document;
[0161] Calculate the rule matching score for each matching segment. The rule matching score includes keyword coverage, format conformity, and context relevance.
[0162] The initial extraction confidence of each matching segment is calculated based on the rule matching score and the line-level comprehensive confidence of the corresponding text line.
[0163] The matching results are sorted according to the initial extraction confidence, and the top-ranked text fragments are selected as candidate text fragments for each key field.
[0164] Each candidate text fragment is appended with its corresponding rule matching score and source text line position information to form a complete candidate text fragment.
[0165] In this embodiment, the field extraction rule template is a set of matching rules generated by parsing key field descriptions. Field semantic features describe the meaning of the target content, and format constraints specify the text's formatting requirements. The field extraction rule template converts natural language descriptions into machine-executable matching rules, providing a standardized basis for subsequent extraction.
[0166] Multi-pattern matching combines various matching strategies to find target content in structured text data. Keyword-triggered matching performs precise matching based on preset vocabulary, regular expression matching processes text with fixed patterns, and contextual semantic matching identifies semantically related content through semantic similarity calculation. This combined matching approach improves the comprehensiveness of field discovery.
[0167] Position verification ensures that the matched fragments are logically positioned within the document. By analyzing the fragments' positional relationships within the page structure, it verifies whether they appear in a reasonable context, avoiding mismatches caused by recognition errors or layout clutter.
[0168] Rule matching score evaluates matching quality from multiple dimensions. Keyword coverage measures the degree of overlap between the matched fragment and the target keywords; format conformity assesses the consistency of text format with constraints; and context relevance calculates the semantic connection strength between the fragment and surrounding text through semantic analysis. The comprehensive score of these three dimensions objectively reflects the accuracy of the match.
[0169] The initial extraction confidence score is calculated by fusing the rule matching score and the row-level comprehensive confidence score. In practice, weighted summation or multiplication can be used to combine the quality assessment of rule matching with the reliability assessment of character recognition, forming a comprehensive credibility evaluation of the extraction results.
[0170] Candidate text fragments are selected based on the initial extraction confidence ranking. Selecting several top-ranked fragments as candidates ensures the reliability of the extraction results while preserving sufficient options for subsequent processing. Furthermore, by adding rule matching scores and location information, a complete decision-making basis is provided for subsequent refined processing.
[0171] This embodiment achieves preliminary location and filtering of key fields through steps such as rule template parsing, multi-pattern matching, location verification, and confidence calculation. This method combines the accuracy of rule matching with the flexibility of semantic understanding, improving the system's adaptability while ensuring extraction quality. Through multi-dimensional matching degree evaluation and confidence fusion, it effectively enhances the quality of candidate fragments, laying a solid foundation for subsequent refined processing.
[0172] In some embodiments, a confidence level assessment is performed on each candidate text segment. If the confidence level is lower than a first confidence threshold, a multi-candidate generation strategy is initiated to generate several alternative segments based on contextual semantic similarity, including:
[0173] The initial extraction confidence of the candidate text fragments is compared with a preset first confidence threshold;
[0174] When the initial extraction confidence is lower than the first confidence threshold, the semantic similarity algorithm is used to retrieve text content that is semantically similar to the candidate text fragment in the initially identified text.
[0175] By combining the edit distance algorithm with word vector cosine similarity, several similar text segments with the highest rankings are selected as candidate segments from the search results.
[0176] In this embodiment, the first confidence threshold is an important parameter used to determine whether candidate text fragments need supplementary processing. It is determined by analyzing the accuracy distribution of historical extraction data and can be adjusted according to the needs of different business scenarios. When the initial extraction confidence level is lower than the first confidence threshold, it indicates that the current extraction result has significant uncertainty, and a supplementary processing mechanism needs to be activated.
[0177] Similarly, the setting of the first and second confidence thresholds relies on statistical analysis of the relationship between the initial extraction confidence level and the final manual verification accuracy of candidate text segments in historical extraction tasks. Preferably, the first confidence threshold is set at a higher level to ensure that segments exceeding this threshold can be directly adopted; the second confidence threshold is set at a lower level to filter out difficult segments that require manual intervention. The specific values of these thresholds are not fixed constants, but parameters that can be configured and optimized during system deployment according to the business requirements for automation and accuracy.
[0178] Semantic similarity retrieval calculates the semantic distance between text fragments to find semantically similar content in the initial text identification. Employing a deep learning-based semantic representation model, text is converted into high-dimensional vectors, and semantic similarity is measured by distance calculation in the vector space, enabling the discovery of text content that appears different but has similar meanings.
[0179] The combined use of edit distance and word vector cosine similarity assesses text similarity from different dimensions. Edit distance measures the literal differences between two text strings, reflecting surface-level similarity; word vector cosine similarity, calculated based on semantic vectors, reflects deeper semantic relevance. By integrating these two metrics, the similarity of text fragments can be evaluated more comprehensively.
[0180] The selection of candidate segments is based on a ranking of comprehensive similarity scores. A comprehensive similarity score is calculated for the retrieved similar text segments, and the top-ranked segments are selected as candidate results. These candidate segments provide more options for low-confidence scenarios, increasing the system's fault tolerance.
[0181] This embodiment provides an effective supplementary processing mechanism for low-confidence extraction results through confidence threshold judgment and semantic similarity retrieval. This ensures the direct adoption of high-confidence results while improving the extraction success rate in low-quality cases through a multi-candidate generation strategy. In particular, by combining literal and semantic similarity evaluation, the quality and relevance of candidate segments are ensured, effectively enhancing the system's robustness and practicality.
[0182] In some embodiments, the method further includes:
[0183] If the initial extraction confidence level is lower than the first confidence threshold, then the initial extraction confidence level is compared with the preset second confidence threshold.
[0184] If the initial extraction confidence level is lower than the second confidence threshold, it is recorded as a low-confidence segment;
[0185] For low-confidence segments with a confidence level below the second confidence threshold, a multi-person collaborative verification process is triggered to aggregate independent judgment results to determine the final extracted segments, including:
[0186] The low-confidence segments and their corresponding initial extraction confidence and context information are encapsulated into a verification task unit;
[0187] According to the preset verification personnel allocation rules, the verification task unit is distributed to multiple independent verification personnel;
[0188] Receive correction results from each verification personnel. Correction results include confirmation of the original segment, provision of corrected text, or annotations indicating that the segment is unrecognizable.
[0189] A weighted voting algorithm is used to aggregate the correction results, with the historical accuracy of the verification personnel serving as a weighting factor.
[0190] When the weighted voting result exceeds the preset consistency threshold, the text segment corresponding to the weighted voting result is determined as the final extracted segment;
[0191] If the weighted voting result does not reach the consensus threshold, the verification task unit will be upgraded to the arbitration node for final adjudication to obtain the final extracted fragment.
[0192] In this embodiment, the second confidence threshold is a key parameter used to identify low-quality segments requiring manual intervention. The second confidence threshold is lower than the first confidence threshold and is determined by analyzing the confidence distribution of segments requiring manual verification in historical data. When the initial extraction confidence level is lower than this second confidence threshold, it indicates that automated processing can no longer guarantee the reliability of the results, and a higher-level verification mechanism needs to be initiated.
[0193] A verification task unit is a processing unit that packages the content to be verified and related information. This unit includes the low-confidence fragment itself, its initial extraction confidence level, and contextual information to ensure that verifiers can make accurate judgments based on complete information. Contextual information includes the fragment's position in the document, surrounding text, and other supporting evidence for judgment.
[0194] The personnel allocation rules are intelligently applied based on task characteristics and personnel capabilities. Optimized allocation can be performed based on factors such as the personnel's area of expertise, historical accuracy, and current workload, ensuring that each verification task is assigned to suitable personnel, thereby improving verification efficiency and quality.
[0195] The correction results are the professional judgment output of the verification personnel regarding the verification task. Confirming the original fragment indicates acceptance of the automatically extracted results; providing correction text indicates the corrected content; and marking it as unrecognizable indicates that the current information is insufficient to make an accurate judgment. These three result types cover all possible situations during the verification process.
[0196] The weighted voting algorithm improves the reliability of the aggregation results by taking into account the historical performance of the verifiers. Verifiers with high historical accuracy have higher voting weights, making the overall judgment more inclined to the opinions of experienced verifiers, thus improving the accuracy of the final result.
[0197] The consensus threshold is the standard for determining whether a voting result has reached a consensus. When the weighted voting result exceeds this threshold, it indicates that the validators have reached a valid consensus, and the voting result can be directly adopted. The consensus threshold is set according to actual business needs, with a preference given to those requiring a higher pass rate.
[0198] Arbitration nodes serve as the final decision-making body when consensus cannot be reached. When the weighted voting result fails to reach the consensus threshold, an arbitration node with higher authority makes the final ruling, ensuring that each verification task receives a definite processing result.
[0199] This embodiment provides a reliable manual intervention solution for extraction results with extremely low confidence levels by establishing a multi-level confidence judgment and hierarchical verification mechanism. This method ensures both the efficiency of automated processing of high-confidence results and the accuracy of extraction under low-quality conditions through multi-person collaborative verification. By combining weighted voting and arbitration mechanisms, it effectively balances verification efficiency and result quality, providing a final quality assurance for the system.
[0200] In some embodiments, a high-confidence segment, several candidate segments, and the final extracted segment determined by collaborative verification are input into a text normalization module to perform format unification and semantic standardization processing, and output structured text extraction information, including:
[0201] Perform character-level cleaning operations on various input text fragments to remove illegal characters, extra spaces, and invisible control characters;
[0202] Based on a pre-defined domain dictionary and synonym mapping table, the terminology of text fragments is standardized to unify the professional terms in different expressions;
[0203] Based on the data type requirements of the key fields, perform format standardization conversion, including standardizing date formats, standardizing monetary units, and formatting document numbers in segments;
[0204] By combining rule engine and semantic parsing, the normalized text fragments are logically validated to detect and correct obvious logical contradictions or format errors.
[0205] The validated text fragments are restructured according to key fields to generate JSON format data containing field names, extracted values, confidence levels, and data sources;
[0206] The JSON format data is associated and encapsulated with the corresponding business document metadata to form the final structured text extraction information and output it.
[0207] In this embodiment, character-level cleaning is achieved through regular expressions and character encoding detection technology. Specifically, it includes identifying and removing characters that do not conform to encoding standards, deleting consecutive redundant spaces, and filtering non-display characters such as control characters, ensuring that text fragments meet basic character specification requirements.
[0208] Terminology standardization is based on a domain dictionary and a thesaurus. The domain dictionary contains specialized vocabulary for specific business areas, while the thesaurus establishes equivalence relationships between different expressions. Through dictionary matching and mapping substitution, various expressions are unified into standard terms, eliminating semantic ambiguity.
[0209] Format standardization conversion employs appropriate processing rules based on field data types. Date formats are identified using regular expressions and converted to a uniform format; monetary units are standardized through numerical extraction and unit conversion; and ID numbers are segmented and formatted according to type characteristics. These conversions ensure that data conforms to the format requirements of the business system.
[0210] Logical validation combines a rule engine and semantic parsing technology. The rule engine detects obvious errors based on predefined business rules, while semantic parsing identifies logical contradictions by analyzing the semantic relationships between text fragments. When an anomaly is detected, the system can automatically correct it or mark it for further processing according to preset strategies.
[0211] The structured reorganization process organizes the standardized text fragments into JSON format according to key fields, including field name identifiers, actual extracted values, confidence level assessments, and data source information, forming a complete structured data record. The association and encapsulation process binds the JSON data with document metadata, including information such as document identifier, processing time, and business type. A unique identifier is used to establish a relationship, forming a complete extraction result that can be directly used by downstream systems.
[0212] This embodiment transforms various extraction results into high-quality structured data through systematic cleaning, standardization, formatting, and validation. This method effectively resolves inconsistencies in format, terminology, and logic among text extraction results, significantly improving data usability and interoperability. Through complete metadata association and standardized output formats, it facilitates subsequent data integration and application.
[0213] In a second aspect, this embodiment also provides an adaptive text extraction system based on artificial intelligence, applicable to the method described in the first aspect. The system includes: a service definition request receiving module, a document structure entropy analysis module, a preprocessing pipeline selection module, a recognition engine instance generation module, a text recognition processing module, a rule-based coarse screening extraction module, a multi-candidate generation module, a multi-person collaborative verification module, a text normalization processing module, and a structured output module. The service definition request receiving module is used to receive text extraction service definition requests and corresponding example document sets; the document structure entropy analysis module is used to perform structural entropy quantification analysis on the example document sets and calculate the structural entropy value; the preprocessing pipeline selection module is used to adaptively select the preprocessing pipeline strength level according to the distribution of structural entropy values. The recognition engine instance generation module dynamically configures image preprocessing parameters and AI recognition model parameters to generate a recognition engine instance; the text recognition processing module performs text detection and recognition on example documents using the recognition engine instance and outputs preliminary recognized text; the rule-based coarse screening extraction module performs rule matching on the preliminary recognized text based on key field descriptions and generates candidate text fragments; the multi-candidate generation module generates alternative fragments based on semantic similarity for low-confidence candidate fragments; the multi-person collaborative verification module triggers a collaborative verification process for low-confidence fragments and determines the final extracted fragments; the text normalization processing module performs format unification and semantic standardization processing on various types of text fragments; and the structured output module generates and outputs structured text extraction information.
[0214] In this embodiment, the service definition request receiving module receives text extraction task information configured by the user through a standardized interface, realizing unified access for different business needs; the document structure entropy analysis module provides an objective quality assessment basis for subsequent processing by quantitatively evaluating the document image quality features; and the preprocessing pipeline selection module automatically determines the most suitable processing intensity level based on the entropy value distribution, ensuring the optimal allocation of processing resources.
[0215] The recognition engine instance generation module constructs a dedicated processing unit through dynamic parameter configuration to achieve a precise match between processing capabilities and document quality; the text recognition processing module executes a complete detection and recognition process to generate structured text data with confidence assessment; and the rule-based coarse screening extraction module achieves preliminary location of key information based on a multi-pattern matching strategy.
[0216] The multi-candidate generation module provides a supplementary solution for low-confidence cases through semantic similarity retrieval; the multi-person collaborative verification module ensures the processing quality of extremely low-confidence segments through distributed task allocation and weighted voting mechanisms; the text normalization processing module performs format unification and semantic standardization operations; and the structured output module finally generates standardized extraction results that meet business requirements.
[0217] This system employs a modular design to achieve a complete processing flow from document reception to result output. The modules work collaboratively to form a complete technical chain encompassing quality assessment, adaptive processing, and multi-level verification. When a document is input into the system, it first undergoes quantitative quality analysis. Then, processing parameters are dynamically configured based on the analysis results. During the recognition process, rule matching and semantic understanding are combined to extract fields. Finally, multi-level verification ensures the quality of the extracted data. This system effectively solves the accuracy problems caused by variations in document quality and rigid rules in traditional methods, significantly improving the adaptability and reliability of text extraction.
[0218] Furthermore, the following example can be derived from the above technical solutions:
[0219] This solution primarily addresses the text recognition needs in compliance and regulatory operations, particularly for tasks such as extracting key text content from unstructured documents, recognizing invoices, and identifying certificates. It avoids the pain point of frequent adjustments to text recognition programs due to document customization. By encapsulating the text recognition services used in these operations into a general framework, and by unifying the definition of various text recognition services through a unified system, the solution allows for parameterized configuration of recognition parameters for numerous unstructured document types and rule-based configuration of document content extraction. This enables on-demand configuration and combinations to improve recognition accuracy for different customization requirements. For refined document content extraction, a two-stage processing approach of "coarse screening + text standardization" is employed, thereby meeting the needs of compliance and regulatory operations.
[0220] For detailed architecture, please refer to [link / reference]. Figure 5 The system consists of a compliance and regulatory application system and a text recognition service system. The compliance and regulatory application system primarily includes services that require the text recognition service system to recognize unstructured documents for business needs such as meeting decisions and task lists. This includes key text extraction from unstructured documents, invoice recognition, and document recognition. The text recognition service system mainly consists of a text recognition service engine, text recognition service management, recognition parameter settings and region annotation, text extraction rules, and text normalization rules. Before providing text recognition services, it is necessary to analyze the business-side text recognition requirements and the structure of the documents to be recognized, clarifying whether the documents to be recognized contain recognition interference such as stamps, distortions, or watermarks. After completing the requirements analysis, the text recognition service system needs to complete the service definition and release as follows:
[0221] Text Recognition Service Definition: Enter the text recognition service management interface, define a special text recognition service according to business needs, and select service types such as PDF document recognition, invoice recognition, and corresponding certificate recognition as needed;
[0222] Recognition parameters and recognition area settings: After completing the definition of the special text recognition service, proceed to the text recognition preprocessing rules (including image blur to clear, orientation correction, distortion correction, removal of stamps, and removal of text watermarks) and recognition rules (including language recognition, whether to recognize stamp information, whether to return line confidence, etc.) parameter settings. For document recognition, it is also necessary to mark the recognition area of the document according to the selected document type. AI can be combined in the recognition area setting to achieve accurate area positioning of similar documents.
[0223] Key content extraction rule settings: Due to business needs, it is necessary to extract relevant key content from the recognized text. The system adopts a two-stage processing. After completing the text recognition service definition and setting of recognition parameters and recognition areas, the text extraction content is coarsely screened by setting text extraction rules, such as AI, regular expressions, functions, etc. The text that passes the coarse screening basically meets the extraction requirements. Furthermore, due to the presence of line breaks or recognition errors, it is also necessary to set text standardization rules, mainly including: removing spaces and blank lines, and replacing synonyms.
[0224] Service Operation and Maintenance: After completing the above steps, you can enable and disable the text recognition service to provide and reclaim the corresponding business capabilities.
[0225] This solution provides centralized management of text recognition-related services, allowing for the activation or deactivation of services and the revocation of related capabilities as needed. Furthermore, through the generalized encapsulation of the recognition process and content extraction, it can quickly and flexibly respond to customized text recognition service requirements. This avoids the problem of developers frequently modifying code due to changes in files or extraction rules in actual business operations. Additionally, the generalized encapsulation saves development and management costs and is not limited to compliance and regulatory applications.
[0226] By adopting the above technical solutions, the present invention differs from the prior art and has the following beneficial effects:
[0227] By quantitatively evaluating document image quality through document structure entropy analysis and adaptively selecting the preprocessing pipeline intensity level based on the structure entropy value distribution, a precise match between processing intensity and document quality is achieved. Adaptive recognition engine instances are generated by dynamically configuring image preprocessing parameters and AI recognition model parameters. Combined with rule-based coarse-screening extraction and multi-level confidence verification mechanisms, the text extraction accuracy of documents of varying quality is effectively improved. This technical solution addresses the issue of fluctuating recognition accuracy in traditional text extraction systems due to differences in document quality, significantly enhancing the system's adaptability and robustness in complex scenarios. Furthermore, standardized service definition interfaces enable unified encapsulation of different business requirements, avoiding frequent program adjustments caused by document customization.
[0228] Finally, it should be noted that although the above embodiments have been described in the text and drawings of this application, this should not limit the scope of patent protection of this application. Any technical solutions that are based on the essential concept of this application and utilize the content described in the text and drawings of this application, resulting in equivalent structural or procedural substitutions or modifications, as well as the direct or indirect application of the technical solutions of the above embodiments to other related technical fields, are all included within the scope of patent protection of this application.
Claims
1. An adaptive text extraction method based on artificial intelligence, characterized in that, include: Receive a text extraction service definition request and a corresponding set of sample documents. The text extraction service definition request includes the target document type and a description of the key fields to be extracted. Document structure entropy analysis is performed on the example document set. By quantitatively evaluating the noise density, geometric distortion, and background complexity of the document images, the structure entropy value of each example document is calculated. Based on the distribution range of the structural entropy value, the intensity level of the preprocessing pipeline is adaptively selected. The preprocessing pipeline includes a multi-level processing module from basic correction to enhanced denoising. Based on the selected preprocessing pipeline intensity level, the image preprocessing parameters and AI recognition model parameters are dynamically configured to generate a recognition engine instance that is adapted to the current document quality. The recognition engine instance is used to perform text detection and recognition on the input sample document, and the preliminary recognized text is output. Based on the description of the key fields, a regularized coarse screening extraction is performed on the initially identified text to obtain candidate text fragments for each key field; For each candidate text segment, a confidence level is evaluated. If the confidence level is lower than the first confidence threshold, a multi-candidate generation strategy is initiated to generate several alternative segments based on contextual semantic similarity. For low-confidence segments with a confidence level below the second confidence threshold, a multi-person collaborative verification process is triggered to aggregate independent judgment results to determine the final extracted segments; Segments with a confidence level higher than the first confidence threshold are categorized as high-confidence segments; The high-confidence segment, several candidate segments, and the final extracted segment determined by collaborative verification are input into the text normalization module. The module performs format unification and semantic standardization processing, and outputs structured text extraction information.
2. The adaptive text extraction method based on artificial intelligence according to claim 1, characterized in that, Document structure entropy analysis is performed on the example document set. By quantitatively evaluating the noise density, geometric distortion, and background complexity of the document images, the structure entropy value of each example document is calculated, including: Extract image features from each example document in the example document set. The image features include local binary pattern texture features, edge density features, and connected component distribution features. Based on the image features, an unsupervised clustering algorithm is used to divide the document image into uniform regions, noisy regions, and text regions. The noise region is calculated as the proportion of the total area of the image as a noise density index. The degree of tilt and curvature of document edges is detected based on Hough transform as a geometric distortion index. The complexity of background texture is evaluated through frequency domain analysis as a background complexity index. The noise density index, geometric distortion index, and background complexity index are input into the entropy calculation model, and the structural entropy value is output. The entropy calculation model is trained by fitting manually annotated document quality levels through multiple linear regression.
3. The adaptive text extraction method based on artificial intelligence according to claim 1, characterized in that, Based on the distribution range of the structural entropy value, the preprocessing pipeline intensity level is adaptively selected. The preprocessing pipeline includes a multi-stage processing module from basic correction to enhanced denoising, including: Set a first interval threshold and a second interval threshold for the structural entropy value, wherein the first interval threshold is less than the second interval threshold; When the structural entropy value of the example document is less than the first interval threshold, the basic correction level preprocessing pipeline is selected. The basic correction level preprocessing pipeline only includes an image orientation correction module and a binarization processing module. When the structural entropy value of the example document is greater than or equal to the first interval threshold and less than the second interval threshold, the standard enhanced level preprocessing pipeline is selected. The standard enhanced level preprocessing pipeline adds a Gaussian denoising module and a perspective correction module on the basis of the basic correction level preprocessing pipeline. When the structural entropy value of the example document is greater than or equal to the second interval threshold, the enhanced denoising level preprocessing pipeline is selected. The enhanced denoising level preprocessing pipeline adds an image inpainting module and a complex background separation module based on generative adversarial networks on the basis of the standard enhanced level preprocessing pipeline. Based on the distribution of structural entropy values of all documents in the example document set, a dominant entropy value range is determined, and the preprocessing pipeline intensity level corresponding to the dominant entropy value range is used as the default configuration level of the text extraction service.
4. The adaptive text extraction method based on artificial intelligence according to claim 1, characterized in that, Based on the selected preprocessing pipeline intensity level, the image preprocessing parameters and AI recognition model parameters are dynamically configured to generate a recognition engine instance adapted to the current document quality, including: Based on the preprocessing pipeline intensity level, the corresponding image preprocessing parameter combination is loaded from the preset parameter configuration library. The image preprocessing parameters include Gaussian filter kernel size, binarization threshold range, and perspective correction intensity coefficient. Based on the preprocessing pipeline strength level, the input image size and recognition accuracy parameters of the AI recognition model are dynamically adjusted. The basic correction level preprocessing pipeline adopts a standard input size and a balanced accuracy mode, while the enhanced noise reduction level preprocessing pipeline adopts a high-resolution input size and a high-precision recognition mode. Based on the target document type, a pre-trained domain-adaptive recognition model is selected from the model repository, including a contract document recognition model, an invoice recognition model, and a certificate recognition model. The image preprocessing parameters, AI recognition model parameters, and domain-adaptive recognition model are instantiated and bound to generate a recognition engine instance with processing capabilities adapted to the current document quality.
5. The adaptive text extraction method based on artificial intelligence according to claim 1, characterized in that, The recognition engine instance is used to perform text detection and recognition on the input example document, and outputs preliminary recognized text, including: The example document is input into the recognition engine instance, and the bound image preprocessing operations are executed sequentially to generate an optimized image to be recognized; Based on the domain-adaptive recognition model, text region detection is performed on the image to be recognized to obtain the position coordinates of the text lines and the region confidence. Optical character recognition (OCR) is performed on each detected text region to generate the original recognized text and character-level confidence scores. Combining the regional confidence and character-level confidence, a weighted fusion algorithm is used to calculate the overall confidence of each text line; The recognition results are analyzed to reconstruct the document's logical structure based on the position coordinates of the text lines, generating structured text data containing paragraphs and tables. The structured text data, the original recognized text of each line of text, and their corresponding comprehensive confidence scores are associated and stored as the initial recognized text output.
6. The adaptive text extraction method based on artificial intelligence according to claim 5, characterized in that, Based on the description of the key fields, a rule-based coarse screening extraction is performed on the initially identified text to obtain candidate text fragments for each key field, including: Parse the key field descriptions, extract the semantic features and format constraints of the fields, and generate a field extraction rule template; Based on the field extraction rule template, multi-pattern matching is performed on the structured text data of the initially identified text. The multi-pattern matching includes keyword-triggered matching, regular expression matching, and contextual semantic matching. Perform position verification on the successfully matched text fragments to ensure that they are in a logical context within the document; Calculate the rule matching score for each matching segment, which includes keyword coverage, format conformity, and context relevance; The initial extraction confidence of each matching segment is calculated based on the rule matching score and the line-level comprehensive confidence of the corresponding text line. The matching results are sorted according to the initial extraction confidence, and the top-ranked text fragments are selected as candidate text fragments for each key field. Each candidate text fragment is appended with its corresponding rule matching score and source text line position information to form a complete candidate text fragment.
7. The adaptive text extraction method based on artificial intelligence according to claim 6, characterized in that, For each candidate text segment, a confidence level is evaluated. If the confidence level is lower than the first confidence threshold, a multi-candidate generation strategy is initiated to generate several alternative segments based on contextual semantic similarity, including: The initial extraction confidence of the candidate text fragment is compared with a preset first confidence threshold; When the initial extraction confidence is lower than the first confidence threshold, a semantic similarity algorithm is used to retrieve text content that is semantically similar to the candidate text fragment in the preliminarily identified text. By combining the edit distance algorithm with word vector cosine similarity, several similar text segments with the highest rankings are selected as candidate segments from the search results.
8. The adaptive text extraction method based on artificial intelligence according to claim 7, characterized in that, The method further includes: If the initial extraction confidence level is lower than the first confidence threshold, then the initial extraction confidence level is compared with a preset second confidence threshold. If the initial extraction confidence level is lower than the second confidence threshold, it is recorded as a low-confidence segment; For low-confidence segments with a confidence level below the second confidence threshold, a multi-person collaborative verification process is triggered to aggregate independent judgment results to determine the final extracted segments, including: The low-confidence segment and its corresponding initial extraction confidence and context information are encapsulated into a verification task unit; According to the preset verification personnel allocation rules, the verification task unit is distributed to multiple independent verification personnel; Receive correction results returned by each verification personnel, including confirmation of the original segment, provision of corrected text, or annotation that the segment is unrecognizable; The corrected results are aggregated using a weighted voting algorithm, with the historical accuracy rate of the verification personnel serving as a weighting factor. When the weighted voting result exceeds a preset consistency threshold, the text segment corresponding to the weighted voting result is determined as the final extracted segment; If the weighted voting result does not reach the consensus threshold, the verification task unit will be upgraded to the arbitration node for final adjudication to obtain the final extracted fragment.
9. The adaptive text extraction method based on artificial intelligence according to claim 1, characterized in that, The high-confidence segment, several candidate segments, and the final extracted segment determined through collaborative verification are input into the text normalization module. Format unification and semantic standardization processing are performed, and structured text extraction information is output, including: Perform character-level cleaning operations on various input text fragments to remove illegal characters, extra spaces, and invisible control characters; Based on a pre-defined domain dictionary and synonym mapping table, the terminology of text fragments is standardized to unify the professional terms in different expressions; Based on the data type requirements of the key fields, perform format standardization conversion, including standardizing date formats, standardizing monetary units, and formatting document numbers in segments; By combining rule engine and semantic parsing, the normalized text fragments are logically validated to detect and correct obvious logical contradictions or format errors. The validated text fragments are restructured according to key fields to generate JSON format data containing field names, extracted values, confidence levels, and data sources; The JSON format data is associated and encapsulated with the corresponding business document metadata to form the final structured text extraction information and output.
10. An adaptive text extraction system based on artificial intelligence, characterized in that, The system applicable to the method of any one of claims 1 to 9 comprises: The service definition request receiving module is used to receive text extraction service definition requests and the corresponding set of sample documents; The document structure entropy analysis module is used to perform quantitative analysis of the structure entropy of the example document set and calculate the structure entropy value. The preprocessing pipeline selection module is used to adaptively select the preprocessing pipeline intensity level based on the structural entropy value distribution. The recognition engine instance generation module is used to dynamically configure image preprocessing parameters and AI recognition model parameters and generate recognition engine instances. The text recognition processing module is used to detect and recognize text in sample documents using a recognition engine instance and output preliminary recognized text. The rule-based coarse screening extraction module is used to perform rule matching in the initially identified text based on key field descriptions and generate candidate text fragments. A multi-candidate generation module is used to generate alternative segments based on semantic similarity from low-confidence candidate segments; The multi-person collaborative verification module is used to trigger the collaborative verification process for low-confidence segments and determine the final extracted segments; The text normalization module is used to standardize the format and semantics of various text fragments. The structured output module is used to generate and output structured text extraction information.
Citation Information
Cited By
Parameter verification method, device, equipment and medium
CN121934544A
Method and equipment for identifying pathological number of pathological section and storage medium
CN122090432A