An OCR recognition method for airline itinerary
By dividing the air trip order into six partitions and performing OCR identification processing, the problem of low accuracy and completeness of the air trip order identification in traditional technology is solved, and efficient data sorting and structured processing is achieved.
Patent Information
- Application Number
- CN202411113565.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-08-14
AI Technical Summary
When handling air travel orders, traditional OCR recognition technology is prone to decrease the accuracy of information processing and the completeness of information content due to background anti-counterfeiting patterns, multi-content printing and inconsistent formats.
An OCR recognition method for air travel orders is proposed. By pre-dividing the air travel order into six partitions, defining the reference printing field items of each partition, determining the partition coordinate range, positioning the partitions to which the string belongs, performing row classification and peer sorting, and finally generating a structured air travel order information table through regular expression matching and sorting.
The data processing accuracy and information completeness rate after the OCR identification of the aviation itinerary is improved, and disordered and unstructured data can be efficiently organized into an ordered and structured aviation itinerary information table.
Smart Images

Figure CN119027954B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of recognition technology, and in particular to an OCR recognition method for an airline itinerary. Background Art
[0002] The air itinerary, also known as the electronic air ticket itinerary, is supervised by the State Administration of Taxation and is included in the invoice management of the tax authorities in accordance with the invoice management regulations. It is the payment and reimbursement voucher for passengers who purchase domestic air transport electronic tickets. The air itinerary adopts a one-person-one-ticket system, cannot be printed repeatedly, and will not be replaced if lost. Passengers can pick up the air itinerary at the ticket sales place or the airport electronic ticket service counter within 7 days before or after the flight.
[0003] In order to improve the automation and processing efficiency of financial and tax reimbursement and itinerary records, technical personnel usually need to perform OCR (Optical Character Recognition) on airline itineraries, automatically identify the passenger's name, date, departure station, destination station, fare and other information and enter them into the system, effectively reducing manual entry and accounting costs, and improving the user experience of passengers and financial personnel.
[0004] The current data processing method for airline itinerary after OCR recognition is mainly: first establish a key field dictionary for the airline itinerary, then use regular expression matching to match the string content and coordinates with the key field dictionary items for the OCR recognized data, and after a successful match, assign the string to the corresponding field, thereby gradually completing the structured airline itinerary information, and then correct the structured field information through error correction processing, and finally obtain the recognition result of the airline itinerary.
[0005] When the background is relatively simple (such as no anti-counterfeiting patterns), the content on the ticket is mainly printed fonts, the printed content of the ticket is relatively small and the printing is relatively standardized (such as value-added tax invoices), the accuracy of information processing and the integrity of information content of traditional OCR recognition technology will be relatively high. However, for airline itineraries, the background has anti-counterfeiting patterns, the printed content is relatively large, and the content format of each airline is not uniform. The printed content often has wrong lines or misalignments. The use of traditional OCR recognition technology for processing is prone to a decrease in the accuracy of information processing and a decrease in the integrity of information content. Summary of the invention
[0006] In view of this, an embodiment of the present application proposes an OCR recognition method for an airline itinerary, which can ensure high accuracy and information completeness when processing the airline itinerary data after OCR recognition, and can efficiently process the disordered and unstructured data generated after OCR recognition into ordered and structured airline itinerary information.
[0007] To achieve the above-mentioned purpose, an embodiment of the present application proposes an OCR recognition method for an airline itinerary, comprising the following steps: pre-dividing the airline itinerary into six partitions according to the contents of the printed field items, and defining the reference benchmark printed field items corresponding to each of the six partitions; wherein the six partitions are respectively partition No. 1 representing the passenger name information, partition No. 2 representing the ID number and endorsement information, partition No. 3 representing the flight number and seat number information, partition No. 4 representing the airport and terminal information, partition No. 5 representing the ticket amount information, and partition No. 6 representing other ticket information; performing OCR recognition on the airline itinerary, and based on the reference benchmark printed field items of each partition identified The coordinates of the four vertices are used to determine the coordinate range of each partition; based on the coordinates of the center point of each identified string and the coordinate range of each partition, the partition to which each string belongs is determined, and the content and coordinate information of each string is added to the content list of the partition to which it belongs; for each string in each partition, the rows are classified and sorted according to the coordinates of the center point of the string; each string is traversed partition by partition and row by row, and regular expression matching is performed based on the row number and column number of the string to determine the printed body field item and printed body field item corresponding to each string; according to the printed body field item and printed body field item corresponding to each string, a complete structured airline itinerary information table is sorted and generated.
[0008] To achieve the above-mentioned purpose, the embodiment of the present application further proposes an OCR recognition system for airline itinerary, the system comprising: a pre-partitioning module, an identification module, a positioning module, a sorting module, a matching module and a sorting module; the pre-partitioning module is used to pre-divide the airline itinerary into six partitions according to the contents of the printed field items, and define the reference benchmark printed field items corresponding to each of the six partitions, wherein the six partitions are respectively Partition 1 representing passenger name information, Partition 2 representing ID number and endorsement information, Partition 3 representing flight number and seat number information, Partition 4 representing airport and terminal information, Partition 5 representing ticket amount information and Partition 6 representing other ticket information; the identification module is used to perform OCR recognition on the airline itinerary, based on the reference of each partition identified The coordinates of the four vertices of the reference printed body field item are used to determine the coordinate range of each partition; the positioning module is used to determine the partition to which each string belongs based on the coordinates of the center point of each identified string and the coordinate range of each partition, and add the content and coordinate information of each string to the content list of the partition to which it belongs; the sorting module is used to classify and sort the strings of each partition according to the coordinates of the center point of the string; the matching module is used to traverse each string partition by partition and row by row, perform regular expression matching based on the row number and column number of the string, and determine the printed body field item and printed body field item corresponding to each string; the sorting module is used to sort and generate a complete structured airline itinerary information form based on the printed body field item and printed body field item corresponding to each string.
[0009] To achieve the above-mentioned purpose, an embodiment of the present application further proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute an OCR recognition method for an airline itinerary as described above.
[0010] To achieve the above objectives, an embodiment of the present application further proposes a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned OCR recognition method for an airline itinerary.
[0011] The embodiment of the present application proposes an OCR recognition method for an air itinerary. First, the air itinerary is divided into six partitions according to the content of the printed field items, and the reference base printed field items corresponding to each of the six partitions are defined. The six partitions provide a good basis for subsequent data sorting, effectively improving the efficiency of data sorting. Subsequently, the air itinerary is subjected to OCR recognition. Based on the coordinates of the four vertices of the reference base printed field items of each partition identified, the coordinate range of each partition is determined. Then, based on the coordinates of the center point of each identified string and the coordinate range of each partition, the partition to which each string belongs is determined, and the content and coordinate information of each string is added to the content list of the partition to which it belongs. Then, each string of each partition is classified and sorted in the same row according to the coordinates of the center point of the string. At this time, each string has been classified into each row of each partition and sorted according to the actual position. The structured foundation of the air itinerary information has been established. Then, each string is traversed partition by partition and row by row, and regular expression matching is performed based on the row number and column number of the string to determine the printed body field items and printed body field items corresponding to each string. Finally, a complete structured airline itinerary information table is generated based on the printed body field items and printed body field items corresponding to each string, thereby ensuring that when processing the airline itinerary data after OCR recognition, it has a high accuracy rate and information completeness rate, and can efficiently organize the disordered and unstructured data (strings) generated after OCR recognition into an ordered and structured airline itinerary information table.
[0012] Optionally, OCR recognition is performed on the air itinerary, and the coordinate range of each partition is determined based on the coordinates of the four vertices of the reference reference printed body field item of each partition identified, including: performing OCR recognition on the air itinerary, finding the reference reference printed body field item of each partition in each character string recognized by OCR, and respectively determining the coordinates of the four vertices of the reference reference printed body field item of each partition; traversing each partition, and determining the coordinate range of the current partition based on the coordinates of the four vertices of the reference reference printed body field item of the current partition.
[0013] Optionally, based on the coordinates of the center point of each identified string and the coordinate range of each partition, the partition to which each string belongs is determined, and the content and coordinate information of each string is added to the content list of the partition to which it belongs, including: traversing each identified string, matching the coordinate range of each partition in turn according to the sequence number of each partition based on the coordinates of the center point of the current string, determining the coordinate range in which the coordinates of the center point of the current string fall, determining the partition corresponding to the coordinate range in which the coordinates of the center point of the current string fall as the partition to which the current string belongs; adding the content and coordinate information of the current string to the content list of the partition to which it belongs. When printing an airline itinerary, it is easy for rows and fields to be misaligned. However, even if misalignment occurs, the center point of the string will most likely fall within the coordinate range of the corresponding partition. Therefore, taking the center point of the string as a reference, the partition to which the string belongs can be more accurately and quickly delineated, thereby improving the processing speed and accuracy of the data after OCR recognition of the airline itinerary.
[0014] Optionally, the character strings in each partition are classified and sorted in the same row according to the coordinates of the center points of the character strings, including: traversing each partition, classifying the rows based on the ordinate values of the center points of the character strings in the current partition, classifying the character strings whose ordinate value deviations are within a first preset range as the same row, and classifying the character strings whose ordinate value deviations are outside the first preset range as different rows; for the character strings in the same row, sorting them from small to large according to the horizontal coordinate values of the center points of the character strings, to obtain the sorted character strings in the rows of the current partition. Even if the row and field are misaligned when printing the airline itinerary, the same row will generally not be misaligned too much. Therefore, by classifying the rows based on the ordinate values of the center points of the character strings in the partition and sorting the same row from small to large based on the horizontal coordinate values of the center points of the character strings in the same row, the disordered data generated after OCR recognition can be quickly and efficiently sorted into ordered data.
[0015] Optionally, a complete structured airline itinerary information form is generated based on the printed body field items and printed body field items corresponding to each character string, including: traversing each character string, checking the format and content of the printed body field items corresponding to the current character string based on the printed body field items corresponding to the current character string, and correcting them if errors are detected; and generating a complete structured airline itinerary information form based on the corrected printed body field items and printed body field items corresponding to each character string. There may be some recognition errors during OCR recognition, so before generating a complete structured airline itinerary information form, error checking and correction are required to further improve the accuracy and information completeness of the airline itinerary data after OCR recognition.
[0016] Optionally, a complete structured airline itinerary information form is generated based on the corrected printed body fields and printed body fields corresponding to each character string, including: judging whether the airline itinerary is authentic based on the corrected printed body fields and printed body fields corresponding to each character string, and the anti-counterfeiting mark on the airline itinerary; if the airline itinerary is determined to be authentic, a complete structured airline itinerary information form is generated based on the corrected printed body fields and printed body fields corresponding to each character string. The corrected printed body fields and printed body fields corresponding to each character string can also be used as a partial benchmark for authenticity inspection of the airline itinerary, so as to timely identify false airline itineraries and reduce losses.
[0017] Optionally, after a complete structured airline itinerary information form is generated according to the printed body field items and printed body field items corresponding to each character string, the method further includes: a UI displays the generated airline itinerary information form. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 is a flow chart of an OCR recognition method for an airline itinerary provided in one embodiment of the present application;
[0020] Figure 2 is a schematic diagram of six partitions of an air itinerary provided in one embodiment of the present application;
[0021] Figure 3 is a schematic diagram of an air itinerary with misaligned rows provided in one embodiment of the present application;
[0022] Figure 4 is a schematic diagram of an air itinerary with misaligned fields provided in one embodiment of the present application;
[0023] Figure 5 is a schematic diagram of a reference reference printed body field item of zone 3 provided in one embodiment of the present application;
[0024] Figure 6 is a schematic diagram of determining the coordinates of the center point of a string provided in an embodiment of the present application;
[0025] Figure 7is a schematic diagram of an OCR recognition system for an airline itinerary provided in another embodiment of the present application;
[0026] Figure 8 It is a structural schematic diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. In the various embodiments of the present application, many technical details are proposed in order to make the reader better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is only for the convenience of description, and the specific implementation mode of the present application should not constitute any limitation. The various embodiments can be combined with each other and referenced to each other under the premise of no contradiction.
[0028] An embodiment of the present application proposes an OCR recognition method for an airline itinerary receipt, which is applied to an electronic device. The electronic device may be a terminal or a server. In this embodiment and the following embodiments, the electronic device is described using a server as an example. The implementation details of the OCR recognition method for an airline itinerary receipt proposed in this embodiment are specifically described below. The following content is only the implementation details provided for ease of understanding and is not necessary for implementing this solution.
[0029] The specific process of the OCR recognition method of an air itinerary bill proposed in this embodiment is as follows: Figure 1 As shown, including:
[0030] Step 101, pre-dividing the air itinerary into six partitions according to the contents of the printed field items, and defining reference base printed field items corresponding to each of the six partitions.
[0031] In the specific implementation, before the server performs OCR recognition and data sorting on the air itinerary, it is necessary to pre-divide the air itinerary into six partitions according to the content of the printed field items. The partition division is as follows: Figure 2 As shown, the six partitions are Partition 1 representing passenger name information, Partition 2 representing ID number and endorsement information, Partition 3 representing flight number and seat number information, Partition 4 representing airport and terminal information, Partition 5 representing ticket amount information, and Partition 6 representing other ticket information.
[0032] After the partition division is completed, the server also needs to define the reference reference printed body field items corresponding to each of the six partitions. Generally, there are multiple reference reference printed body field items corresponding to one partition, which are stored and recorded in the form of a list. The reference reference printed body field items corresponding to each partition have been pre-defined as a keyword dictionary. The reference reference printed body field items refer to the key printed body field items used to determine the coordinates of the range of each partition. Based on the coordinates of the four vertices of these reference reference printed body field items, the coordinates of the four vertices of each partition can be obtained, that is, the coordinate range of each partition is determined.
[0033] The reference benchmark printed body field item should be the printed body field items at the four corners of the partition as much as possible. For a partition with a printed body field item inside the partition, when determining the reference benchmark printed body field item, you can choose from the printed body field items inside it. For a partition without a printed body field item inside the partition, you can choose the printed body field item in the adjacent partition that best identifies the range of the partition.
[0034] In an example, Figure 2 As shown, the selection of reference datum printed text field items corresponding to each partition is as follows:
[0035] Partition 1: "Passenger name", "CARRIER";
[0036] Partition 2: "Valid ID number", "Free baggage";
[0037] Section 3: “Carrier”, “Free Baggage”, “Fare”;
[0038] Partition 4: "CARRIER", "E-ticket number";
[0039] Partition 5: "Fare", "Free Baggage", "E-ticket Number";
[0040] Partition 6: “E-ticket number”, “Free baggage”, “AGENT”.
[0041] Step 102, performing OCR recognition on the air itinerary, and determining the coordinate range of each partition based on the coordinates of the four vertices of the reference base printed text field item of each partition.
[0042] In a specific implementation, the server performs OCR recognition on the flight itinerary, and determines the coordinate range of each partition based on the coordinates of the four vertices of the reference base printed text field item of each partition.
[0043] When printing an air itinerary, it is easy for lines and fields to be misplaced. Figure 3For an air itinerary with misaligned rows, the name, e-ticket number, amount and other fields are misaligned. Figure 4 For an air itinerary with field misalignment, its date and time fields are misaligned, so OCR recognition and data sorting of the air itinerary are indispensable. After OCR recognition of the air itinerary, the data sorting stage is immediately entered, that is, to sort the disordered and unstructured data into an ordered and structured air itinerary information table. The first step of data sorting is to determine the coordinate range of each partition based on the coordinates of the four vertices of the reference base printed field items of each partition, thereby laying the foundation for order and structure.
[0044] Printed field items refer to the field names printed on a blank air itinerary, such as "passenger name", "electronic ticket number", "carrier", etc. The opposite of printed field items is printed field items, which refer to the specific information printed on a blank itinerary when a passenger issues a ticket, such as "Zhang San", "1024.00 yuan", etc.
[0045] In one example, after the server completes the pre-partitioning of the air itinerary and defines the reference reference printed body field items corresponding to each of the six partitions, it can perform OCR recognition on the air itinerary, find the reference reference printed body field items of each partition in each character string recognized by OCR, and determine the coordinates of the four vertices of the reference reference printed body field items of each partition respectively. Then the server traverses each partition and determines the coordinate range of the current partition based on the coordinates of the four vertices of the reference reference printed body field item of the current partition. Using the reference reference printed body field items can quickly and more accurately determine the coordinate range of each partition, thereby improving the OCR recognition speed of the air itinerary.
[0046] Taking the No. 3 partition representing the flight number and seat number information as an example, there is no printed field item below the No. 3 partition. Therefore, when determining the reference benchmark printed field item of the No. 3 partition, it is necessary to determine it from the printed field items at adjacent positions outside the No. 3 partition, such as Figure 5 As shown, the server selects the printed field items "Carrier", "Fare" and "Free Baggage" as the reference benchmark printed field items for partition No. 3. Based on the coordinates of the upper left vertex of "Carrier" (x5, y5), the coordinates of the upper right vertex of "Free Baggage" (x6, y6), and the coordinates of the upper left vertex of "Fare" (x7, y7), the coordinate range of partition No. 3 can be determined as follows: the horizontal coordinate value is x∈[x5,x6], and the vertical coordinate value is y∈[y5,y7].
[0047] The determination of the coordinate ranges of the remaining partitions is similar to that of partition No. 3 and will not be repeated here.
[0048] It is worth noting that when determining the partition into which the string falls, it is determined by calculating whether the coordinate value of the center point of the string falls within the coordinate range of this partition. This leaves a certain offset redundancy for the string, so the coordinate range of the determined partition does not need to be particularly accurate, which reduces the difficulty of determining the coordinate range of the partition.
[0049] Step 103 : based on the coordinates of the center points of the identified character strings and the coordinate ranges of the respective partitions, determine the partition to which each character string belongs, and add the content and coordinate information of each character string to the content list of the partition to which it belongs.
[0050] In a specific implementation, after determining the coordinate range of each partition, the server can determine the partition to which each string belongs based on the coordinates of the center point of each identified string and the coordinate range of each partition, and add the content and coordinate information of each string to the content list of the partition to which it belongs.
[0051] In one example, the server traverses each identified string, and based on the coordinates of the center point of the current string, matches the coordinate range of each partition in turn according to the serial number of each partition, determines the coordinate range in which the coordinates of the center point of the current string fall, determines the partition corresponding to the coordinate range in which the coordinates of the center point of the current string fall as the partition to which the current string belongs, and adds the content and coordinate information of the current string to the content list of the partition to which it belongs. After completing the traversal of all strings, the partition to which all strings belong is determined. When printing an airline itinerary, it is easy for rows and fields to be misaligned. However, even if misalignment occurs, the center point of the string will most likely fall within the coordinate range of the corresponding partition. Therefore, using the center point of the string as a reference, the partition to which the string belongs can be more accurately and quickly delineated, thereby improving the processing speed and accuracy of the data after OCR recognition of the airline itinerary.
[0052] like Figure 6 As shown in the figure, when determining the center point of a string, it is necessary to obtain the coordinates of the four vertices of the string, and determine the coordinates of the center point of the string based on the coordinates of the four vertices of the string. For example, the coordinates of the four vertices of "String 1" are: (x1, y1), (x2, y2), (x3, y3) and (x4, y4). Suppose the coordinate value of the center point of "String 1" is (x c ,y c ), we can get it by formula calculation:
[0053] x c =[min(x1,x2,x3,x4)+max(x1,x2,x3,x4)] / 2
[0054] yc =[min(y1,y2,y3,y4)+max(y1,y2,y3,y4)] / 2
[0055] Among them, min(·) means to find the minimum value, and max(·) means to find the maximum value.
[0056] Step 104 , classify and sort the strings in each partition according to the coordinates of the center points of the strings.
[0057] In a specific implementation, after determining the partition to which each string belongs, the server can classify and sort the strings in each partition according to the coordinates of the center point of the string, and obtain the sorted strings in each row of each partition. Even if the row and field are misaligned when printing the airline itinerary, the same row will generally not be misaligned too much. Therefore, by classifying the rows based on the vertical coordinate value of the center point of each string in the partition and sorting the strings in the same row from small to large based on the horizontal coordinate value of the center point of each string in the same row, the disordered data generated after OCR recognition can be quickly and efficiently sorted into ordered data.
[0058] In one example, the server traverses each partition and classifies the rows based on the vertical coordinate value of the center point of each string in the current partition, classifies the strings whose vertical coordinate value deviation is within a first preset range into the same row, and classifies the strings whose vertical coordinate value deviation is outside the first preset range into different rows. For each string in the same row, the horizontal coordinate value of the center point of each string is sorted from small to large to obtain the sorted strings of each row in the current partition.
[0059] In one example, the first preset range is ±10px, that is, character strings whose vertical coordinate value deviation is within ±10px are considered to be character strings in the same row.
[0060] It is worth noting that the data recognized by OCR is recognized based on the top vertex of the string, that is, the minimum value of the vertical coordinate, so there is no need to sort multiple rows. Each partition may include multiple rows of content, and the content of each row may be one or more strings.
[0061] Step 105 , traverse each string partition by partition and row by row, perform regular expression matching based on the row number and column number of the string, and determine the printed body field item and printed body field item corresponding to each string.
[0062] In a specific implementation, after completing the row classification and row sorting of the strings, the server can traverse each string partition by partition and row by row, perform regular expression matching based on the row and column numbers of the strings, and determine the printed body field items and printed body field items corresponding to each string.
[0063] In one example, for a certain string in Partition 1, the corresponding printed body field item is "Zhang San", and then the corresponding printed form field item is "Name".
[0064] Step 106: Generate a complete structured air ticket itinerary information table based on the printed body field items and printed form field items corresponding to each string.
[0065] In a specific implementation, after the server determines the printed body field items and printed form field items corresponding to each string, it can generate a complete structured air ticket itinerary information table based on the printed body field items and printed form field items corresponding to each string, and display the generated air ticket itinerary information table on the UI.
[0066] In one example, the server traverses each string, checks the format and content of the printed body field item corresponding to the current string based on the printed form field item corresponding to the current string, corrects it in case of errors, and finally generates a complete structured air ticket itinerary information table based on the corrected printed body field items and printed form field items corresponding to each string. There may be some recognition errors during OCR recognition. Therefore, before generating a complete structured air ticket itinerary information table, error checking and correction are required to further improve the accuracy and information integrity rate of processing the air ticket itinerary data after OCR recognition.
[0067] During OCR recognition, the capital letter "O" is easily recognized as the number "0". For a certain string, the corresponding printed form field item is "Flight Number", and the corresponding printed body field item is "H01679". The server determines that there is an error in "H01679" based on "Flight Number". There is no airline named "H0", while the airline "HO" actually exists. Therefore, "H01679" needs to be corrected to "HO1679".
[0068] In one example, the server needs to determine whether the air ticket itinerary is genuine based on the corrected printed body field items and printed form field items corresponding to each string and the anti-counterfeiting mark on the air ticket itinerary. If it is determined that the air ticket itinerary is genuine, a complete structured air ticket itinerary information table is generated based on the corrected printed body field items and printed form field items corresponding to each string. The corrected printed body field items and printed form field items corresponding to each string can also be used as part of the benchmark for verifying the authenticity of the air ticket itinerary to promptly identify false air ticket itineraries and reduce losses.
[0069] In one example, after simulation experiments, it was demonstrated that the OCR recognition method for an airline itinerary proposed in this embodiment can increase the recognition completeness rate to more than 98% when there is no serious misalignment of the printed information on the airline itinerary, and can also increase the recognition completeness rate to more than 93% even if there is a serious misalignment within the printed field line.
[0070] In this embodiment, the air itinerary is first divided into six partitions according to the content of the printed field items, and the reference base printed field items corresponding to each of the six partitions are defined. The six partitions lay a good foundation for subsequent data sorting, effectively improving the efficiency of data sorting. Then, the air itinerary is subjected to OCR recognition, and the coordinate range of each partition is determined based on the coordinates of the four vertices of the reference base printed field items of each partition identified. Then, based on the coordinates of the center point of each identified string and the coordinate range of each partition, the partition to which each string belongs is determined, and the content and coordinate information of each string is added to the content list of the partition to which it belongs. Then, each string of each partition is row-classified and row-sorted according to the coordinates of the center point of the string. At this time, each string has been classified into each row of each partition and sorted according to the actual position, and the structural foundation of the air itinerary information has been established. Then, each string is traversed partition by partition and row by row, and regular expression matching is performed based on the row number and column number of the string to determine the printed body field items and printed body field items corresponding to each string. Finally, a complete structured airline itinerary information table is generated based on the printed body field items and printed body field items corresponding to each string, thereby ensuring that when processing the airline itinerary data after OCR recognition, it has a high accuracy rate and information completeness rate, and can efficiently organize the disordered and unstructured data (strings) generated after OCR recognition into an ordered and structured airline itinerary information table.
[0071] Another embodiment of the present application proposes an OCR recognition system for an airline itinerary. The implementation details of the OCR recognition system for an airline itinerary proposed in this embodiment are specifically described below. The following content is only for the convenience of understanding the implementation details provided, and is not necessary for implementing this example. Figure 7 2 is a schematic diagram of the structure of an OCR recognition system for an airline itinerary proposed in this embodiment, the system comprising: a pre-partitioning module 201, a recognition module 202, a positioning module 203, a sorting module 204, a matching module 205 and a sorting module 206.
[0072] The pre-partitioning module 201 is used to pre-partition the air itinerary into six partitions according to the contents of the printed field items, and define the reference base printed field items corresponding to each of the six partitions, wherein the six partitions are respectively Partition 1 representing passenger name information, Partition 2 representing ID number and endorsement information, Partition 3 representing flight number and seat number information, Partition 4 representing airport and terminal information, Partition 5 representing ticket amount information, and Partition 6 representing other ticket information.
[0073] The recognition module 202 is used to perform OCR recognition on the air itinerary, and determine the coordinate range of each partition based on the coordinates of the four vertices of the reference base printed text field item of each partition.
[0074] The positioning module 203 is used to determine the partition to which each string belongs based on the coordinates of the center point of each identified string and the coordinate range of each partition, and add the content and coordinate information of each string to the content list of the partition to which it belongs.
[0075] The sorting module 204 is used to classify and sort the strings in each partition according to the coordinates of the center points of the strings.
[0076] The matching module 205 is used to traverse each string partition by partition and row by row, perform regular expression matching based on the row number and column number of the string, and determine the printed body field item and the printed body field item corresponding to each string.
[0077] The sorting module 206 is used to sort and generate a complete structured airline itinerary information form according to the printed body field items and printed body field items corresponding to each character string.
[0078] It is not difficult to find that this embodiment is a system embodiment corresponding to the above method embodiment, and this embodiment can be implemented in conjunction with the above method embodiment. The relevant technical details and technical effects mentioned in the above embodiments are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the above embodiments.
[0079] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of this application, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by this application, but this does not mean that there are no other units in this embodiment.
[0080] Another embodiment of the present application provides an electronic device, such as Figure 8As shown, it includes: at least one processor 301; and a memory 302 that is communicatively connected to the at least one processor 301; wherein the memory 302 stores instructions that can be executed by the at least one processor 301, and the instructions are executed by the at least one processor 301 so that the at least one processor 301 can execute the OCR recognition method of an air itinerary described in the above embodiments.
[0081] Among them, the memory and the processor are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor.
[0082] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.
[0083] Another embodiment of the present application relates to a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the OCR recognition method of an air itinerary sheet described in the above embodiments is implemented.
[0084] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, ROM (Read-Only Memory), RAM (Random Access Memory), disk or optical disk and other media that can store program codes.
[0085] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.
Claims
1. An OCR recognition method for an airline itinerary, characterized in that: include: The air itinerary is pre-divided into six partitions according to the contents of the printed fields, and the reference base printed fields corresponding to the six partitions are defined; the six partitions are partition 1 representing the passenger name information, partition 2 representing the ID number and endorsement information, partition 3 representing the flight number and seat number information, partition 4 representing the airport and terminal information, partition 5 representing the ticket amount information, and partition 6 representing other ticket information; Perform OCR recognition on the air itinerary, and determine the coordinate range of each partition based on the coordinates of the vertices of the reference base printed field items of each partition; Based on the coordinates of the center point of each identified character string and the coordinate range of each partition, determine the partition to which each character string belongs, and add the content and coordinate information of each character string to the content list of the partition to which it belongs; For each string in each partition, classify and sort the rows according to the coordinates of the center point of the string; Traverse each string partition by partition and row by row, perform regular expression matching based on the row number and column number of the string, and determine the printed body field item and printed body field item corresponding to each string; Traverse each string, check the format and content of the printed text field item corresponding to the current string according to the printed text field item corresponding to the current string, and correct it if an error is found; Based on the corrected printed body field items and printed body field items corresponding to each character string, and the anti-counterfeiting mark on the air itinerary, determine whether the air itinerary is authentic; When it is determined that the airline itinerary is authentic, a complete structured airline itinerary information table is generated based on the corrected printed body field items and printed body field items corresponding to each character string.
2. The OCR recognition method of an air itinerary according to claim 1, characterized in that: Perform OCR recognition on the air itinerary, and determine the coordinate range of each partition based on the coordinates of the vertices of the reference base printed field items of each partition, including: Perform OCR recognition on the air itinerary, find the reference base printed text field item of each partition in each character string recognized by OCR, and determine the coordinates of the four vertices of the reference base printed text field item of each partition respectively; Each partition is traversed, and the coordinate range of the current partition is determined based on the coordinates of the four vertices of the reference base printed body field item of the current partition.
3. The OCR recognition method of an air itinerary according to claim 2, characterized in that: Based on the coordinates of the center point of each identified string and the coordinate range of each partition, the partition to which each string belongs is determined, and the content and coordinate information of each string is added to the content list of the partition to which it belongs, including: Traverse the recognized strings, match the coordinate ranges of the partitions in turn based on the coordinates of the center point of the current string according to the sequence numbers of the partitions, determine the coordinate range in which the coordinates of the center point of the current string fall, and determine the partition corresponding to the coordinate range in which the coordinates of the center point of the current string fall as the partition to which the current string belongs; Add the content and coordinate information of the current string to the content list of the partition to which it belongs.
4. The OCR recognition method for an air itinerary according to claim 1, characterized in that: For each string in each partition, the rows are classified and sorted according to the coordinates of the center point of the string, including: Traversing each partition, classifying the rows based on the ordinate value of the center point of each string in the current partition, classifying the strings whose ordinate value deviation is within a first preset range into the same row, and classifying the strings whose ordinate value deviation is outside the first preset range into different rows; For each string in the same row, sort them from small to large according to the horizontal coordinate value of the center point of each string to obtain the sorted strings of each row in the current partition.
5. An OCR recognition method for an air itinerary according to any one of claims 1 to 4, characterized in that: After the complete structured air itinerary information form is generated according to the printed body field items and printed body field items corresponding to each character string, it also includes: The UI displays the generated airline itinerary information table.
6. An OCR recognition system for airline itinerary, characterized in that: include: Pre-partitioning module, identification module, positioning module, sorting module, matching module and sorting module; A pre-partitioning module is used to pre-partition the air itinerary into six partitions according to the contents of the printed field items, and define the reference base printed field items corresponding to each of the six partitions, wherein the six partitions are partition 1 representing passenger name information, partition 2 representing ID number and endorsement information, partition 3 representing flight number and seat number information, partition 4 representing airport and terminal information, partition 5 representing ticket amount information, and partition 6 representing other ticket information; A recognition module, used for performing OCR recognition on the air itinerary, and determining the coordinate range of each partition based on the coordinates of the four vertices of the reference base printed body field item of each partition; A positioning module, used to determine the partition to which each string belongs based on the coordinates of the center point of each identified string and the coordinate range of each partition, and add the content and coordinate information of each string to the content list of the partition to which it belongs; A sorting module is used to classify and sort the strings in each partition according to the coordinates of the center points of the strings; A matching module, used to traverse each string partition by partition and row by row, perform regular expression matching based on the row number and column number of the string, and determine the printed body field item and printed body field item corresponding to each string; The sorting module is used to traverse each character string, check the format and content of the printed body field item corresponding to the current character string according to the printed body field item corresponding to the current character string, and correct it if an error is detected, and judge whether the airline itinerary is authentic based on the corrected printed body field item and printed body field item corresponding to each character string, and the anti-counterfeiting mark on the airline itinerary. If the airline itinerary is determined to be authentic, sort and generate a complete structured airline itinerary information form according to the corrected printed body field item and printed body field item corresponding to each character string.
7. An electronic device, characterized in that: include: at least one processor; and, a memory communicatively coupled to the at least one processor; Wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute an OCR recognition method for an air itinerary as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it is possible to implement an OCR recognition method for an air itinerary receipt as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Document structured extraction method and device based on multi-modal information
CN117711007A