Bill recognition processing method and apparatus
Patent Information
- Application Number
- CN202611073449.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-11-03
AI Technical Summary
现有技术中,表格定位与字段切分割裂设计导致系统复杂性高,维护成本高,且对格式变化敏感,难以实现零配置自适应解析。
The system uses a predefined structural feature model to identify table regions, determines string format specifications through pattern matching, and uses table boundaries to segment fields, thus achieving an organic integration of table location and field segmentation and reducing maintenance costs.
It achieves zero-configuration adaptive parsing, which can automatically adapt to changes in bill format without modifying the code, reducing system maintenance costs and improving robustness and scalability.
Smart Images

Figure CN123033251A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of aviation clearing and settlement technology, and in particular to a bill recognition and processing method and apparatus. Background Technology
[0002] In industries such as airline clearing and settlement, finance, and waybill processing, invoices (such as electricity bills, telephone bills, and bank statements) are high-frequency and critical business documents. These invoices may exist in paper form or circulate as scanned images or PDFs, and their content usually includes structured expense detail tables.
[0003] In automating the processing of business documents such as invoices, bills of lading, and air waybills, OCR (Optical Character Recognition) technology is widely used to convert paper or image-formatted documents into machine-readable text, which is then parsed to extract key information. However, due to the diversity and dynamic changes in document formats, existing parsing solutions generally suffer from high maintenance costs and are greatly affected by format changes.
[0004] 1. Separate Design of Table Location and Field Segmentation: In existing technologies, table area location and field segmentation are usually two independent and unrelated steps, using different rule systems. For example, the location step relies on keyword rules, while the segmentation step relies on delimiter rules. This separate design leads to high system complexity, and both steps may fail simultaneously when there are complex changes in document format (such as modifying the table header text and adjusting column spacing at the same time).
[0005] 2. High maintenance costs: With N different document formats, N sets of keyword rules and N sets of segmentation rules need to be maintained. Any minor adjustments by the supplier (such as adding a note or changing a field name) require manual intervention to modify the code.
[0006] 3. Vulnerability to format changes: Taking the keyword method as an example, once the header text changes (e.g., "FlightDate" becomes "Flight Departure Date"), the entire table positioning will fail. Similarly, taking space-based segmentation as an example, if the number of spaces becomes unstable due to OCR, field segmentation will produce errors.
[0007] Therefore, there is an urgent need for a technical solution that can organically integrate table positioning and field segmentation, and achieve zero-configuration adaptive parsing. Summary of the Invention
[0008] This invention provides a bill recognition processing method that organically integrates table positioning and field segmentation to reduce bill recognition and maintenance costs. The method includes: Obtain the OCR recognition result of aviation business documents; the OCR recognition result includes a text line sequence; A predefined structural feature model is used to identify text line sequences line by line to determine target text lines belonging to table areas; the structural feature model uses multiple structural features to jointly determine whether a single text line belongs to a table area; the structural features determine whether the string conforms to predefined format specifications through pattern matching. The first line of the target text is scanned to obtain the starting positions of all consecutive spaces that appear two or more times, which are used as table boundaries; The remaining rows in the target text line, excluding the first row, are segmented using table boundaries to output bill table data.
[0009] This invention also provides a bill recognition processing device for organically integrating table positioning and field segmentation, thereby reducing bill recognition and maintenance costs. The device includes: An optical character recognition processing module is used to obtain the OCR recognition results of aviation business documents; the OCR recognition results include a text line sequence. The structure recognition processing module is used to identify text line sequences line by line using a predefined structure feature model to determine target text lines belonging to table areas; the structure feature model uses multiple structure features to jointly determine whether a single text line belongs to a table area; the structure features determine whether the string conforms to predefined format specifications through pattern matching. The layout parsing and processing module is used to scan the first line of the target text line to obtain the starting positions of all consecutive spaces that appear twice or more, which are used as table boundaries; the remaining lines in the target text line excluding the first line are segmented using the table boundaries, and the bill table data is output.
[0010] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described bill recognition processing method.
[0011] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described bill recognition processing method.
[0012] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described bill recognition processing method.
[0013] In this embodiment of the invention, the OCR recognition result of aviation business documents is obtained; the OCR recognition result includes a text line sequence; a predefined structural feature model is used to recognize the text line sequence line by line to determine the target text line belonging to the table area; the structural feature model uses multiple structural features to jointly determine whether a single text line belongs to the table area; the structural features determine whether the string conforms to the predefined format specification through pattern matching; the first line in the target text line is scanned to obtain the starting position of all consecutive spaces appearing two or more times, which is used as the table boundary; the remaining lines in the target text line excluding the first line are segmented using the table boundary to output bill table data. This invention first uses a predefined structural feature model to identify which rows belong to the table area. Then, based on the determined table area, it confirms and divides the table boundaries to form bill table data. Compared with the existing technology that confirms the table by keywords, this invention judges the detail rows by the structural features of the data rows and determines the table boundaries accordingly. This achieves the organic integration of table positioning and field segmentation. Even if the table header text is modified, the bill table can still be determined by structural features, which is highly robust. When the supplier adjusts the bill format, no code or configuration file needs to be modified. The system automatically adapts to the new format, reducing the cost of bill recognition and maintenance. Attached Figure Description
[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings: Figure 1 This is a flowchart illustrating the bill recognition processing method in an embodiment of the present invention; Figure 2 This is a specific example diagram of the bill recognition processing method in an embodiment of the present invention; Figure 3 This is another specific example of the bill recognition processing method in the embodiments of the present invention; Figure 4 This is a specific example of the OCR recognition result of an airline bill in an embodiment of the present invention; Figure 5 This is a schematic diagram of the bill recognition processing device in an embodiment of the present invention. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0016] In existing airline bill recognition technology, a typical processing flow is as follows: Step 1: Locate the starting position of the table using a preset keyword (such as "VAT").
[0017] Step 2: Split the field by recognizing spaces or specific delimiters.
[0018] This solution has the following drawbacks: 1. The positioning and segmentation rules are independent of each other and both depend on preset information: positioning depends on keywords, and segmentation depends on delimiter rules. Both need to be manually preset and there is no collaborative relationship between them.
[0019] 2. Poor adaptability to complex changes: When the document undergoes simultaneous modification of the header text and adjustment of column spacing, the positioning and segmentation steps may fail simultaneously, and the system cannot restore the overall functionality by adjusting the parameters of one layer.
[0020] 3. Inability to utilize structural information for location assistance: Existing technologies fail to effectively utilize the structural patterns of data rows themselves (such as the combination patterns of dates, flight numbers, and amounts) to assist in table location, resulting in a single and fragile location method.
[0021] To address the aforementioned technical deficiencies, this invention provides a bill recognition processing method and apparatus, aiming to solve the following technical problems: 1. How to decouple the functions of table positioning and field splitting so that they can evolve and be optimized independently, thereby reducing system complexity.
[0022] 2. How to establish a collaborative mechanism between the two layers so that the structure recognition layer and the layout parsing layer can cooperate with each other to improve the robustness of the overall parsing.
[0023] 3. How to achieve zero-configuration, adaptive end-to-end parsing, that is, input any bill document that conforms to the basic structural rules, the system can automatically output structured field data without any manual preset rules.
[0024] Figure 1 This is a flowchart illustrating the bill recognition processing method in an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes: Step 101: Obtain the OCR recognition result of the aviation business document; the OCR recognition result includes a text line sequence; Step 102: Use a predefined structural feature model to identify each line of the text line sequence and determine the target text line belonging to the table area; the structural feature model uses multiple structural features to jointly determine whether a single text line belongs to the table area; the structural features use pattern matching to determine whether the string conforms to the predefined format specification; Step 103: Scan the first line of the target text line to obtain the starting positions of all consecutive spaces that appear twice or more, and use them as table boundaries; Step 104: Use table boundaries to segment the remaining rows in the target text line except for the first row, and output the bill table data.
[0025] from Figure 1 As shown in the diagram, this embodiment of the invention provides a bill recognition processing method based on a two-layer adaptive parsing framework. This framework decomposes the entire parsing process into two independent but collaborative layers: Layer 1: Structure Recognition Layer. This layer does not rely on any keywords; it identifies which rows are valid detail rows solely based on the structural features of the data rows themselves, and dynamically determines the start and end rows of the table. This layer outputs a filtered text array containing only detail rows.
[0026] The second layer is the layout parsing layer. This layer extracts the header row from the table area defined in the first layer, automatically generates column splitting rules by analyzing the position boundary model of the header row, and then applies these rules to all detail rows to complete the accurate extraction of fields.
[0027] The bill recognition processing method and apparatus in the embodiments of the present invention are described in detail below.
[0028] First, obtain the aviation business documents. Then, process the documents using OCR recognition to obtain the OCR recognition result, specifically a sequence of text lines. For example, refer to... Figure 4 , which is the sequence of text lines to be identified.
[0029] In step 102, a predefined structural feature model is used to identify the text line sequence line by line to determine the target text line belonging to the table area.
[0030] The structural feature model uses multiple structural features to jointly determine whether a single text line belongs to a table area. The structural features determine whether the string conforms to the predefined format specification through pattern matching. The pattern matching includes regular expressions, character matching rules, dictionary matching, or any combination thereof.
[0031] A structural feature model is a set of judgment rules consisting of a set of text line structural features (such as date format, alphanumeric mixed pattern, number of numeric fields, etc.) that are independent of specific keywords, used to identify target data lines.
[0032] For example, the structural feature model is composed of date format features, alphanumeric combination features, and pure numeric features.
[0033] In one embodiment, the structural feature model includes the following structural features: Structural Feature 1: The first independent unit in a text line conforms to a date format; Structural Feature 2: The second independent unit in a text line is a mixed pattern of letters and numbers; Structural Feature 3: The third independent unit in a text line contains multiple independent strings of Arabic numerals; Structural Feature 4: The monetary amount appears after multiple independent strings of Arabic numerals in the text line.
[0034] Figure 2 This is a specific example diagram of the bill recognition processing method in an embodiment of the present invention, such as... Figure 2 As shown, step 102 uses a predefined structural feature model to identify the text line sequence line by line, determining the target text lines belonging to the table area, including for each text line: Step 201: Extract multiple independent units based on whitespace characters; Step 202: Use a predefined structural feature model to sequentially judge multiple independent units to determine whether a text line belongs to a detail line; Step 203: Use the detail rows to determine the target text lines that belong to the table area.
[0035] During implementation, a line classifier is designed to determine whether each line of text is a detail line.
[0036] For example, each text line is distinguished into multiple independent units using whitespace characters. A structural feature model is used to determine whether each independent unit in a line belongs to a bill detail line, thus defining the detail line area. Then, the text line preceding the first detail line is designated as the header line of the table area, and the text line following the last detail line is designated as the end position of the table area. The table area includes a header line and multiple detail lines.
[0037] Figure 3 This is another specific example of the bill recognition processing method in this invention. In order to accurately truncate valid detail lines, a predefined structural feature model is used to sequentially judge multiple independent units to determine whether a text line belongs to a detail line, including: Step 301: Set a consecutive non-target line counter, initially set to 0; this consecutive non-target line counter is used to record the number of times text lines that do not belong to the table area appear consecutively. Step 302: Scan the text lines line by line, and use a predefined structural feature model to determine whether the text line is a detail line. When a detail line is encountered, the counter is reset to zero. When a non-detail line is encountered for the first time after encountering a detail line, the counter is incremented by 1. When the counter reaches a preset threshold, the table is determined to end. Among them, when a detail line is encountered for the first time, it is marked as the start of the table.
[0038] The following section explains how the structure recognition layer achieves table region recognition, based on the above content.
[0039] The core idea of the structure recognition layer is to define a set of structural features that define "what a detail row should look like," rather than specific keywords. A row classifier then judges each row to automatically identify table regions.
[0040] 1. Predefined structural feature model: Construct a model consisting of multiple features independent of specific keywords. For example, for an airline bill detail line, it can be defined as: Feature A: The first independent unit conforms to the date format (e.g., \d{2} / \d{2} / \d{4}).
[0041] Feature B: The second independent unit contains a mixed pattern of letters and numbers (e.g., flight number [AZ]{2}\s+\d+).
[0042] Feature C: The line contains at least 3 independent cells in numeric format.
[0043] Feature D: The last independent unit is a monetary number (e.g., \d+(\.\d+)?).
[0044] 2. Line Classifier Determination: For each line of text recognized by OCR, extract its independent units (segmented by whitespace characters) and check whether they meet the above features. Adjust the determination strategy for the structural feature model, such as "all structural features must be satisfied" or "satisfy any three of all structural features", and mark each line as "detailed line" or "non-detailed line" according to the determination result.
[0045] 3. Dynamic detection of table boundaries: Set a counter for consecutive non-target rows, initially set to 0.
[0046] Scan line by line. When a "details line" is first encountered, mark it as the start of the table and reset the counter to zero.
[0047] When a "detail row" is encountered and the table is currently inside, the counter is reset to zero and the process continues.
[0048] When a "non-detail row" is encountered and the table is currently inside, the counter is incremented by 1.
[0049] The table is terminated when the counter value reaches a preset threshold (e.g., 3 consecutive non-detail rows).
[0050] Output: the starting and ending row numbers of the table, and all text lines within the table area (including header and data rows).
[0051] In step 103, the first line of the target text line is scanned to obtain the starting positions of all consecutive spaces that appear twice or more, which are used as table boundaries; in step 104, the remaining lines of the target text line excluding the first line are segmented using the table boundaries, and the bill table data is output.
[0052] The following describes how the layout parsing layer implements table boundary recognition.
[0053] The core idea of the layout parsing layer is to not rely on unstable "spaces" as the basis for segmentation, but to use the fixed character positions defined in the header row as boundaries.
[0054] Position boundary model implementation: A boundary list generated based on the starting character index of consecutive spaces in the header row, used to define the starting position of each field in the data row.
[0055] Specific steps: 1. Get the header row: Extract the first row from the table area output by the first level as the header row.
[0056] 2. Automatically generate a list of location boundaries: Scan the header row string to find the starting index of all consecutive spaces that appear two or more times.
[0057] Set the starting position of the first field to 0.
[0058] The starting index of each consecutive space segment is used as the starting position of the subsequent fields.
[0059] Generate a boundary list, such as [0, 15, 32, 52, ...], whose length is equal to the number of fields in the table header.
[0060] 3. Split data rows by boundaries: For each data row within the table area (including the header row itself, optional), a fixed character position is extracted based on the boundary list.
[0061] For the i-th field, extract the substring from boundary [i] to boundary [i+1] (from the last field to the end of the line).
[0062] The `trim()` operation is used to remove leading and trailing whitespace from a string, resulting in the field value.
[0063] Output: A two-dimensional array or structured object, where each row corresponds to a data record and each column corresponds to a field. Based on this, a billing table of data is generated.
[0064] In one embodiment, after segmenting the remaining rows of the target text line excluding the first row using table boundaries and before outputting the bill table data, the method may further include: determining whether the number of fields obtained by segmenting the remaining rows of the target text line excluding the first row using table boundaries is equal to the number of fields in the first row; if not, reducing the number of structural features that must be satisfied in the structural feature model, and re-performing the target text line recognition and table boundary recognition.
[0065] In this embodiment of the invention, a feedback and self-correction mechanism (optional enhancement) is introduced. After the layout parsing layer completes the partitioning, it checks whether the number of fields obtained from the partitioning is equal to the number of fields in the table header (i.e., the length of the boundary list minus 1). If they are not equal, it indicates that the following situation may exist: The first layer mistakenly included non-detail rows (such as note rows containing irregular spaces) in the table area.
[0066] Table header row identification error (e.g., multiple rows are mistakenly identified as table header).
[0067] Self-calibration process: 1. Lower the decision threshold of the first-layer feature model (for example, change "satisfies all features" to "satisfies any 3 features") and re-execute the first-layer recognition.
[0068] 2. Re-execute the second-level split.
[0069] 3. If it still fails, then it will be processed according to the preset fault tolerance strategy (such as taking the mode or manual labeling).
[0070] This mechanism enables synergy between the two layers, further enhancing robustness.
[0071] Figure 4 This is a specific example of the OCR recognition result of an airline bill in an embodiment of the present invention. The following uses the OCR recognition result of an airline bill as an example to illustrate the complete processing flow of the two-layer frame in an embodiment of the present invention.
[0072] First, input the OCR recognition result of the airline bill. Figure 4 Only a portion of the OCR recognition results are shown in the image.
[0073] First layer: Structure recognition layer.
[0074] The predefined structural feature model includes: Feature 1: The first token matches the date format \d{2} / \d{2} / \d{4}; Feature 2: The combination of the second and third tokens matches the flight number pattern [AZ]{2}\s+\d+; Feature 3: Number of digital tokens ≥ 3; Line-by-line analysis: Line 1 (Header): The first token "Flight" does not match the date → non-detail row.
[0075] Line 2: "01 / 01 / 2026" matches the date; "MU" + "201" matches the flight number; there are 3 numeric tokens: "28140.0", "116.36", and "0.00" → Details line. Marks the start of the table.
[0076] Line 3: Similarly → Detailed line.
[0077] Row 4: Does not meet any feature → Non-detail row. The counter for consecutive non-detail rows is incremented by 1. When the threshold is reached (assuming threshold = 1), the judgment table ends.
[0078] Output: The table area contains rows 1, 2, and 3.
[0079] Second layer: Layout parsing layer.
[0080] Get the header row (row 1): "Flight Date Flight Number Air Waybill Detail Charge Weight GBP NettGBP VAT".
[0081] Generate a boundary list: Scan the starting index of consecutive spaces (≥2), assuming you get [0, 15, 32, 52, 70, 81] (a total of 6 starting positions, corresponding to 6 fields).
[0082] Split the second row of data by the boundary: Field 1: [0,15) → "01 / 01 / 2026" → "01 / 01 / 2026"; Field 2: [15,32) → "MU 201 " → "MU 201"; Field 3: [32,52) → "MANIFEST " → "MANIFEST"; Field 4: [52,70) → "28140.0 " → "28140.0"; Field 5: [70,81) → "116.36 " → "116.36"; Field 6: [81, end of line) → "0.00" → "0.00"; Similarly, split the third row to obtain the second set of field values.
[0083] Output: Structured tabular data, containing 3 rows (header + 2 rows of data) or only data rows.
[0084] Application of feedback self-correction mechanism.
[0085] Suppose that due to OCR noise, a certain row of data is incorrectly identified as: "01 / 01 / 2026 MU 201 MANIFEST 28140.0 Airside Transport 116.36 0.00"; Note that a text field "Airside Transport" was unexpectedly inserted after "28140.0", resulting in 7 tokens in the line instead of the normal 6.
[0086] In the first layer of recognition, the row still meets the structural features (date, flight number, numeric token ≥ 3) and is correctly identified as a detail row.
[0087] After entering the second layer, the row is split according to the boundary list (6 boundaries), resulting in: Field 1: "01 / 01 / 2026"; Field 2: "MU 201"; Field 3: "MANIFEST"; Field 4: "28140.0"; Field 5: "Airside Transport 116.36" ← Abnormal merging; Field 6: "0.00".
[0088] The system checks the number of fields: The split yields 6 fields, which is 1 less than the length of the boundary list (note that the boundary list has 6 starting positions, corresponding to 6 fields; after splitting, there should be 6 fields). The actual number of fields is correct. If the number of fields is incorrect due to boundary offset (e.g., 7 fields are split), self-correction is triggered. 1. Lower the feature threshold of the first layer (e.g., from "satisfying all 3 features" to "satisfying 2 features") and re-identify the table rows.
[0089] 2. If the table area changes after re-identification (e.g., the abnormal row is excluded), then re-segment it; if it is still abnormal, log it and submit it for manual review.
[0090] This mechanism ensures that the system does not completely crash when it encounters a single line of anomalies, and has the opportunity to recover by adjusting the identification strategy.
[0091] Referring to Table 1 below, the differences between the embodiments of the present invention and the prior art are shown.
[0092] Table 1
[0093] Referring to Table 2 below, the embodiments of the present invention have the following beneficial effects: Table 2
[0094] Specific effects described in the embodiments of the present invention: 1. Zero-configuration deployment: The system can directly process bills of any format without any pre-built keyword library, feature dictionary or delimiter rules, achieving "out-of-the-box" functionality.
[0095] 2. High robustness: Even if the header text is modified, the first layer can still locate the table through the data row structure features; even if OCR causes changes in the number of spaces between fields, the second layer can still correctly segment the data through fixed position boundaries.
[0096] 3. Low maintenance costs: When the supplier adjusts the invoice format, no code or configuration file needs to be modified, and the system automatically adapts to the new format.
[0097] 4. Scalability: The interface between the two layers is standardized, the algorithm of a certain layer can be upgraded independently, and the structural feature model can be replaced with a machine learning model without affecting the implementation of the other layer.
[0098] This invention also provides a bill recognition processing device, as described in the following embodiments. Since the principle by which this device solves the problem is similar to that of the bill recognition processing method, the implementation of this device can refer to the implementation of the bill recognition processing method; repeated details will not be elaborated further.
[0099] Figure 5 This is a schematic diagram of the bill recognition processing device in an embodiment of the present invention, as shown below. Figure 5 As shown, the device 500 includes: The optical character recognition processing module 501 is used to acquire the OCR recognition result of aviation business documents; the OCR recognition result includes a text line sequence. The structure recognition processing module 502 is used to identify text line sequences line by line using a predefined structure feature model to determine target text lines belonging to table areas; the structure feature model uses multiple structure features to jointly determine whether a single text line belongs to a table area; the structure features determine whether the string conforms to predefined format specifications through pattern matching. The layout parsing and processing module 503 is used to scan the first line of the target text line to obtain the starting positions of all consecutive spaces that appear twice or more, and use the table boundaries to segment the remaining lines of the target text line except the first line, and output bill table data.
[0100] In one embodiment, the pattern matching includes one or any combination of regular expressions, character matching rules, and dictionary matching.
[0101] In one embodiment, the structural feature model includes the following structural features: Structural Feature 1: The first independent unit in a text line conforms to a date format; Structural Feature 2: The second independent unit in a text line is a mixed pattern of letters and numbers; Structural Feature 3: The third independent unit in a text line contains multiple independent strings of Arabic numerals; Structural Feature 4: The monetary amount appears after multiple independent strings of Arabic numerals in the text line.
[0102] In one embodiment, the structure recognition processing module 502 is specifically used for: For each line of text: Extract multiple independent units based on whitespace characters; By using a predefined structural feature model, multiple independent units are judged sequentially to determine whether a text line belongs to a detail line; Use the detail rows to identify the target text lines that belong to the table area.
[0103] In one embodiment, the structure recognition processing module 502 is specifically used for: Set a consecutive non-target line counter, initially set to 0; this consecutive non-target line counter is used to record the number of times text lines that do not belong to the table area appear consecutively. The text lines are scanned line by line, and a predefined structural feature model is used to determine whether a text line is a detail line. When a detail line is encountered, the counter is reset to zero. When a non-detail line is encountered for the first time after encountering a detail line, the counter is incremented by 1. When the counter reaches a preset threshold, the table is determined to end. When a detail line is encountered for the first time, it is marked as the start of the table.
[0104] In one embodiment, the device 500 further includes a calibration module for: After splitting the remaining rows of the target text line excluding the first row using table boundaries, and before outputting the bill table data, it is determined whether the number of fields obtained by splitting the remaining rows of the target text line excluding the first row using table boundaries is equal to the number of fields in the first row. If they are not equal, reduce the number of structural features that must be satisfied in the structural feature model, and re-perform target text line recognition and table boundary recognition.
[0105] This invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described bill recognition processing method.
[0106] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described bill recognition processing method.
[0107] This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described bill recognition processing method.
[0108] This invention proposes a two-layer decoupled architecture: the two functions of table row recognition and field segmentation are placed in independent processing layers, wherein the first layer is based on a structural feature model and the second layer is based on a position boundary model.
[0109] In this embodiment of the invention, the row classifier of the structure recognition layer does not rely on any keywords, but determines whether a row belongs to a detail row by using predefined data row structure features (date pattern, alphanumeric mixed pattern, numeric field density, etc.).
[0110] In this embodiment of the invention, the automatic boundary generator of the layout parsing layer automatically generates a list of field position boundaries by analyzing the starting character index of consecutive spaces in the header row, and performs fixed-width field segmentation based on this list.
[0111] The two-layer collaborative feedback mechanism in this embodiment of the invention: when the second-layer segmentation result is abnormal, the judgment threshold of the first layer is automatically adjusted and the recognition is re-executed to achieve self-correction.
[0112] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0113] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0114] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0115] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0116] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A bill recognition and processing method, characterized in that, include: Obtain the OCR recognition results of aviation business documents; The OCR recognition result includes a sequence of text lines; A predefined structural feature model is used to identify each line of a text line sequence to determine the target text line belonging to a table area; the structural feature model uses multiple structural features to jointly determine whether a single text line belongs to a table area; the structural features use pattern matching to determine whether the string conforms to a predefined format specification. The first line of the target text is scanned to obtain the starting positions of all consecutive spaces that appear two or more times, which are used as table boundaries; The remaining rows in the target text line, excluding the first row, are segmented using table boundaries to output bill table data.
2. The method as described in claim 1, characterized in that, The pattern matching includes regular expressions, character matching rules, dictionary matching, or any combination thereof.
3. The method as described in claim 2, characterized in that, The structural feature model includes the following structural features: Structural Feature 1: The first independent unit in a text line conforms to a date format; Structural Feature 2: The second independent unit in a text line is a mixed pattern of letters and numbers; Structural Feature 3: The third independent unit in a text line contains multiple independent strings of Arabic numerals; Structural Feature 4: The monetary amount appears after multiple independent strings of Arabic numerals in the text line.
4. The method according to any one of claims 1 to 3, characterized in that, Using a predefined structural feature model, the text line sequence is identified line by line to determine the target text lines belonging to the table area, including: For each line of text: Extract multiple independent units based on whitespace characters; By using a predefined structural feature model, multiple independent units are judged sequentially to determine whether a text line belongs to a detail line; Use the detail rows to identify the target text lines that belong to the table area.
5. The method as described in claim 4, characterized in that, Using a predefined structural feature model, multiple independent units are evaluated sequentially to determine whether a text line belongs to a detail line, including: Set a consecutive non-target line counter, initially set to 0; this consecutive non-target line counter is used to record the number of times text lines that do not belong to the table area appear consecutively. The text lines are scanned line by line, and a predefined structural feature model is used to determine whether a text line is a detail line. When a detail line is encountered, the counter is reset to zero. When a non-detail line is encountered for the first time after encountering a detail line, the counter is incremented by 1. When the counter reaches a preset threshold, the table is determined to end. When a detail line is encountered for the first time, it is marked as the start of the table.
6. The method as described in claim 1, characterized in that, After segmenting the remaining rows of the target text line (excluding the first row) using table boundaries, and before outputting the bill table data, the process also includes: Determine whether the number of fields obtained by segmenting the remaining rows of the target text line excluding the first row using table boundaries is equal to the number of fields in the first row; If they are not equal, reduce the number of structural features that must be satisfied in the structural feature model, and re-perform target text line recognition and table boundary recognition.
7. A bill recognition and processing device, characterized in that, include: The optical character recognition processing module is used to obtain the OCR recognition results of aviation business documents; The OCR recognition result includes a sequence of text lines; The structure recognition processing module is used to identify text line sequences line by line using a predefined structure feature model to determine target text lines belonging to table areas; the structure feature model uses multiple structure features to jointly determine whether a single text line belongs to a table area; the structure features determine whether the string conforms to predefined format specifications through pattern matching. The layout parsing and processing module is used to scan the first line of the target text line to obtain the starting positions of all consecutive spaces that appear twice or more, which are used as table boundaries; the remaining lines in the target text line excluding the first line are segmented using the table boundaries, and the bill table data is output.
8. The apparatus as claimed in claim 7, characterized in that, The pattern matching includes regular expressions, character matching rules, dictionary matching, or any combination thereof.
9. The apparatus as claimed in claim 8, characterized in that, The structural feature model includes the following structural features: Structural Feature 1: The first independent unit in a text line conforms to a date format; Structural Feature 2: The second independent unit in a text line is a mixed pattern of letters and numbers; Structural Feature 3: The third independent unit in a text line contains multiple independent strings of Arabic numerals; Structural Feature 4: The monetary amount appears after multiple independent strings of Arabic numerals in the text line.
10. The apparatus according to any one of claims 7 to 9, characterized in that, The structure recognition and processing module is specifically used for: For each line of text: Extract multiple independent units based on whitespace characters; By using a predefined structural feature model, multiple independent units are judged sequentially to determine whether a text line belongs to a detail line; Use the detail rows to identify the target text lines that belong to the table area.
11. The apparatus as claimed in claim 10, characterized in that, The structure recognition and processing module is specifically used for: Set a consecutive non-target line counter, initially set to 0; this consecutive non-target line counter is used to record the number of times text lines that do not belong to the table area appear consecutively. The text lines are scanned line by line, and a predefined structural feature model is used to determine whether a text line is a detail line. When a detail line is encountered, the counter is reset to zero. When a non-detail line is encountered for the first time after encountering a detail line, the counter is incremented by 1. When the counter reaches a preset threshold, the table is determined to end. When a detail line is encountered for the first time, it is marked as the start of the table.
12. The apparatus as claimed in claim 7, characterized in that, It also includes a calibration module for: After splitting the remaining rows of the target text line excluding the first row using table boundaries, and before outputting the bill table data, it is determined whether the number of fields obtained by splitting the remaining rows of the target text line excluding the first row using table boundaries is equal to the number of fields in the first row. If they are not equal, reduce the number of structural features that must be satisfied in the structural feature model, and re-perform target text line recognition and table boundary recognition.
13. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1 to 6.
15. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 6.
