A purchase order OCR recognition method and system
By using OCR recognition and template matching technology, the supplier's sales orders are automatically converted into the repair shop's purchase orders, solving the problems of long data entry time and high error rate, and achieving efficient and accurate purchase order management.
Patent Information
- Application Number
- CN202311588021.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-27
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2043-11-27
AI Technical Summary
When repair shops purchase goods and receive them into the system, they need to manually enter a large number of purchase orders, which leads to long entry times and is prone to errors, resulting in discrepancies between system data and physical inventory data.
Using OCR recognition technology, sales orders provided by suppliers are directly converted into purchase orders for stores. Combined with a scoring system and template matching technology, manual operation and error probability are reduced, and it also has memory function and automatic data optimization function.
This greatly reduces the complexity of manual operations and the probability of errors, improves the efficiency and accuracy of purchase order entry, and reduces repetitive operations and verification workload.
Smart Images

Figure CN117894018B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of document data processing, and more specifically, to a purchase order OCR recognition method and system. Background Art
[0002] In the prior art, in addition to repair services, repair shops also rely on suitable accessories. Moreover, because the brands and types of vehicles are complex and diverse, in order to quickly serve car owners, shops often need to purchase many types of goods from suppliers in advance to cope with different models.
[0003] Stores generally use some software systems to manage the inventory quantity of these goods. Therefore, after the purchase occurs, it is also necessary to record a purchase order in its own software system and enter it into the warehouse so that the inventory of these goods can be recorded in the software system.
[0004] However, when repair shops are purchasing and warehousing, they need to spend a lot of time to record the system order. Because there are many types of goods, the number of goods purchased at one time ranges from dozens to hundreds. There are two problems with manual purchase order entry: first, it takes a long time to enter, and similar brands may be recorded incorrectly. Second, once a problem occurs, the system data will not match the actual store data.
[0005] Therefore, the present invention provides a purchase order OCR recognition method and system to improve the above technical problems. Summary of the invention
[0006] The disclosed embodiment aims to address the deficiencies of the prior art and provide a purchase order OCR recognition method and system. The present invention utilizes some OCR recognition systems on the market to directly convert the sales orders provided by suppliers to maintenance stores into purchase orders in the store's system. First, it greatly reduces the complexity of personnel operations and the probability of errors, and changes from selecting dozens or hundreds of products to taking photos and checking. At the same time, this function also has a memory function and a spontaneous data tuning function. When the next entry is made, it will automatically reduce the repeated operations of the previous entry based on the analysis results of the previous entry, and it can also more accurately match the products to reduce the workload during verification.
[0007] The above technical objectives of the present invention are achieved through the following technical solutions: A purchase order OCR recognition method and system, comprising the following steps:
[0008] S1. Input the document image provided by the supplier into the OCR recognition engine, and obtain the purchase order result after recognition and conversion based on the OCR recognition engine;
[0009] S2, the OCR docking module docks the OCR recognition engine based on the general OCR recognition form, and processes the docked purchase order results into a unified data format and transmits them to the core control module;
[0010] S3. For borderless data, matching is performed using a scoring system;
[0011] S4. The core control module dispatches the data to the identification and matching module, which matches the data with the document fields, stores and retrieves the document templates for suppliers that have been matched by the user before, and stores and calculates the Chinese names corresponding to the purchase order fields;
[0012] S5. Match the identified material name with the store-specific material information or the platform-level material information.
[0013] As a preferred technical solution of the present invention, the unified data format is divided into: key-value class and multi-line table class; wherein the key-value class is used for subsequent conversion into the overall information of the purchase order; the multi-line table class is used for subsequent conversion into the material details information of the purchase order; the unified data format needs to perform the following normalization function to process the data of the recognition engine:
[0014] S21, multi-table screening;
[0015] Convert OCR recognition results into general table model data;
[0016] The parsing process only processes the format of the results, and the table values and corresponding positions will not change;
[0017] In the scenario where there are multiple tables: the first one is selected by default. When the table attribute column is larger than the selected table and the number of cells is larger than the selected table, the table is selected;
[0018] S22, header screening;
[0019] Filter cells and their rows whose number of columns is less than the configured number;
[0020] Filter the cells and rows where the merged cell data is greater than the configured value;
[0021] Filtering rules: record the matching degree of each row, select the table row with the highest matching degree, and select the first row if the scores are the same;
[0022] Matching rules: Current row and column up to +20, each header keyword matched +10;
[0023] S23, table body screening;
[0024] Filter the cell data and rows that are inconsistent with the header column format;
[0025] The table body cell data recalculates startRow.
[0026] As a preferred technical solution of the present invention, when an OCR recognition engine fails, a quick switch to another recognition engine is achieved by modifying a configuration file for processing a class name.
[0027] As a preferred technical solution of the present invention, for borderless data, a scoring system is used for matching, and the process is as follows:
[0028] S31, converting the positioning result data returned by the purchase order image recognition into a text data set;
[0029] Process OCR return data and add positioning to text model data;
[0030] Process OCR return data and split table model data into text data sets;
[0031] S32, the borderless recognition switch is turned on and the data of the table model that is not correctly recognized will be parsed by the borderless algorithm;
[0032] Process the model data into a text data set;
[0033] The text block area within a certain error is collected as a row through the Y coordinate to obtain each row of data for the purchase order image recognition;
[0034] When the X-coordinate range increases and the data within the two error ranges are merged into one row, the error rule is an OR relationship, and the data that meets rule 1 or rule 2 are identified as one row;
[0035] Error rule 1: The Y coordinate error of the baseline Y is the Y coordinate error of the first element in each row, which is the current row height * cell offset rate;
[0036] Error rule 2: The Y coordinate error of the baseline is the Y coordinate of the field before the current text field, which is the current row height * cell offset rate;
[0037] Calculate the header row according to the original filtering rule algorithm;
[0038] Filter when the header length is less than the minimum value;
[0039] Calculate the X coordinate of the header row and divide the X-axis area into table columns;
[0040] Range division rule: the starting point of the first column header is: (X / 2);
[0041] The range division rule is that the midpoint of the blank space between two adjacent columns is the end point of the previous header column and the starting point of the next header column;
[0042] Range division rule: the end point of the last header column is: the midpoint between the maximum X-axis data of the current table and the current text field;
[0043] Take out each row of data and confirm the cell column data according to the X coordinate range;
[0044] Rule 1: filter rows with coordinates smaller than the table header;
[0045] Rule 2: If the X coordinate range occupies more than 3 columns in the header column, filter it;
[0046] Rule 3: If the ratio of the width of the cell text field to the width of the current column exceeds the minimum ratio of the table column width, then the corresponding column coordinates, if Rule 3 is not satisfied, then Rule 4 is used to determine the column to which the current text field belongs;
[0047] Rule 4: When the ratio of the current column width to the header width exceeds the minimum ratio of the table column width and header, the corresponding column coordinates are used;
[0048] Define the table range based on row and column data;
[0049] Rule 1: Filter the data in the header row and before it;
[0050] Rule 2: Data filtering without column coordinates;
[0051] Rule 3: Table footer keyword: A keyword in the text field is scored 10 points. Select the continuous rows with the total score exceeding the minimum score at the end of the table as the end of the table. The data not filtered by rule 3 is checked by rule 4 and filtered again.
[0052] Rule 4: Filter data when the number of empty columns is greater than the error. Since there is data with empty table content, the number of empty columns is obtained by multiplying the number of header columns by the error rate. Print the warn log. If the keyword has a good effect, it can be removed.
[0053] Rule 5: Merge data in the same row and column, add up the word content in the text field, and only keep the previous text field.
[0054] As a preferred technical solution of the present invention, the process of matching the data with the document field by the recognition and matching module is as follows: according to the recognition result, the text initially matched is bordered data, which is converted into purchase order data;
[0055] When unmatched documents appear, but the user still wants to match them to the purchase order module, the interface allows the user to choose to match the two by themselves; the matching results will be stored in the template module; the template itself will be reused the next time it identifies a purchase order from the same supplier, without the need for manual matching again; at the same time, the template module will regularly aggregate these non-platform data, and if the total exceeds the threshold, it will be incorporated into the platform matching rules.
[0056] As a preferred technical solution of the present invention, the material name matching process is:
[0057] S51. If there is a name in the parameter, 80% of the word count must be matched after word segmentation;
[0058] S52: If there is a part number in the parameter, the word segmentation must match 100% of the word segmentation number.
[0059] S53. If there is a brand name or applicable model in the parameter, it will not be included in the filtering, and the matching one will be given a higher priority score; each has a weight of 50%;
[0060] Material matching first matches the material information of the store; if the material information of the store is not matched, the material information of the platform is matched; if there is still no match, it needs to be created and changed to the material information of the store; if it is created, the store material information will be matched the next time it is matched.
[0061] A purchase order OCR recognition system, the system comprising a core control module, an OCR docking module, a document recognition and matching module, a commodity recognition and matching module, and a purchase order module;
[0062] The core control module is used for scheduling between the OCR docking module, the document identification and matching module, and the commodity identification and matching module, and finally assembling data and returning it to the purchase order module;
[0063] The OCR docking module is used to dock with external mature OCR table recognition services, process the docked data into a unified data format and transmit it to the core control module; on the other hand, it is used to switch the recognition engine;
[0064] Identify and match document modules, which are used to match data with document fields, store and retrieve document templates for suppliers that have been matched by users before, and store and calculate the Chinese names corresponding to purchase order fields;
[0065] The commodity identification and matching module is used to match the identified material name with the store-specific material information or platform-level material information;
[0066] The purchase order module is used to record the store's purchase data in order to accurately manage the store's inventory data.
[0067] In summary, the present invention has the following beneficial effects:
[0068] First, the present invention directly converts the sales order provided by the supplier to the maintenance store into a purchase order in the store's system, reducing the complexity of personnel operations and the probability of errors, and changing the process from selecting dozens or hundreds of products to taking photos and checking.
[0069] Secondly, the present invention has a memory function and a spontaneous data tuning function. When the next entry is made, the repeated operation of the previous entry will be automatically reduced according to the analysis result of the previous entry, so as to more accurately match the goods and reduce the workload during verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 A flowchart of a purchase order OCR recognition method provided by an embodiment of the present invention;
[0071] Figure 2 A framework diagram of a purchase order OCR recognition system provided by an embodiment of the present invention;
[0072] Figure 3 A schematic diagram of a general table model provided in an embodiment of the present invention;
[0073] Figure 4 A schematic diagram of a table cell model provided by an embodiment of the present invention;
[0074] Figure 5 A schematic diagram of the main fields of a purchase order provided by an embodiment of the present invention;
[0075] Figure 6 A schematic diagram of a scoring system matching method provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0076] The present application is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present application, but do not limit the present application in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements can also be made without departing from the concept of the present application. These all belong to the protection scope of the present application.
[0077] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0078] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional module division is performed in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a sequence different from the module division in the device or the flow chart. In addition, the words "first", "second", "third", etc. used herein do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.
[0079] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in this specification and in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.
[0080] In addition, the technical features involved in each embodiment of the present application described below can be combined with each other as long as they do not conflict with each other.
[0081] The disclosed embodiment aims to solve the problem that when maintenance stores are carrying out system purchase and warehousing, they need to spend a lot of time to record the system order. Because there are many types of goods, the number of goods purchased at one time ranges from dozens to hundreds. Manual entry takes a long time and is relatively complicated. In addition, errors may be made, which ultimately leads to inconsistency between the system data and the physical data of the store. OCR recognition of purchase orders is mainly to solve these two problems. In view of this, the disclosed embodiment proposes a purchase order OCR recognition method for directly converting the sales order provided by the supplier to the maintenance store into a purchase order in the store's system, greatly reducing the complexity of personnel operations and the probability of errors. At the same time, this function also has a memory function and a spontaneous data tuning function. When the next entry is made, it will automatically reduce the repeated operations of the previous entry based on the analysis results of the previous entry. At the same time, it can also more accurately match the goods and reduce the workload during verification.
[0082] Please refer to Figure 1 , Figure 1 The flowchart of the purchase order OCR recognition method described in the embodiment of the present disclosure is shown. The overall process mainly includes the following 5 steps:
[0083] Step 1: Input the document image provided by the supplier into the OCR recognition engine, and obtain the purchase order result after recognition and conversion based on the OCR recognition engine.
[0084] First, take a picture of the document provided by the supplier, then input the document picture into the existing OCR recognition engine, and obtain the purchase order result after the document picture recognition and conversion based on the OCR recognition engine.
[0085] Step 2: The OCR docking module docks the OCR recognition engine based on the universal OCR recognition form, and processes the docked purchase order results into a unified data format and transmits them to the core control module. At the same time, the recognition engine can be switched. When a recognition engine fails, it can quickly switch to other recognition engines to achieve high service availability.
[0086] There are two main types of unified data formats: key-value type and multi-line table type. Among them, the key-value type is mainly used for subsequent conversion into the overall information of the purchase order, such as: purchase time, supplier order number, etc. The multi-line table type is mainly used for subsequent conversion into the material details of the purchase order.
[0087] Different existing OCR recognition systems have different recognition engines, and the returned recognition content is different. For example, Huawei Cloud will return the table header, but other recognition engines will not. Therefore, it is necessary to use normalization to retain and name the required fields in the general table and table cells as the field names in the general table and table cells, and discard the unnecessary fields; general table models, such as Figure 3 As shown. Table cell model, such as Figure 4 shown.
[0088] At the same time, in order to obtain a unified format, the following normalization function is used to process the data of the recognition engine: 1 Multi-table screening
[0089] Convert OCR recognition results into general table model data;
[0090] The parsing process only processes the format of the results, and the table values and corresponding positions will not change (there may be filtering, which can be seen from the blank space in the results);
[0091] In the scenario where there are multiple tables: the first one is selected by default. When the table attribute column is larger than the selected table and the number of cells is larger than the selected table, the table is selected;
[0092] 2 Header Filter
[0093] Filter cells and their rows whose number of columns is less than the configuration (purchase-ocr-header-min-col-count, for example, 2);
[0094] Filter cells and their rows whose merged cell data is greater than the configuration (purchase-ocr-header-max-merge-count, for example, 2);
[0095] Filtering rules: record the matching degree of each row, select the table row with the highest matching degree, and select the first row if the scores are the same;
[0096] Matching rules: The current row has a maximum of +20 header keywords (document template keywords), and +10 for each match;
[0097] 3. Table body screening
[0098] Filter the cell data and rows that are inconsistent with the header column format (startCol and mergeCol are inconsistent);
[0099] The table body cell data recalculates the startRow (the position from the table header row).
[0100] The switching process of the recognition engine is achieved by modifying the configuration file of the processing class name. Each time the recognition is called, the system reads the configuration file to confirm the default configuration class name. For example, the class name of Huawei Cloud's recognition engine is huaWeiOcrService, and the class name of Alibaba Cloud's recognition engine is aliOcrService. The recognition class configured in the default configuration file can be huaWeiOcrService. When Huawei Cloud fails, modify the configuration value in the configuration file to aliOcrService.
[0101] Step 3: For borderless data, a scoring system is used to match the borderless data, converting it into standard data with tables to match the F6 purchase order. Figure 6 , the specific process is:
[0102] S31. Convert the positioning result data returned by the purchase order image recognition into a text data set.
[0103] Process OCR return data (including positioning), and add positioning to text model data;
[0104] Process OCR return data (including positioning), split table model data (wordsList) into text data sets (blockList);
[0105] S32. The data of the table model that has the borderless recognition switch turned on and has not been correctly recognized (there is no data in the header or body of the table) will be parsed by the borderless algorithm.
[0106] Process the model data into a text data set (including positioning);
[0107] The text block area within a certain error is collected as a row through the Y coordinate to obtain each row of data for the purchase order image recognition;
[0108] When the X coordinate range increases and the data within the two error ranges are merged into one line (if the X coordinate of the current text field is smaller than that of the previous text field, the Y coordinate offset problem is not considered and it is treated as a new line), the error rule is an OR relationship, and the data that meets rule 1 or rule 2 are recognized as one line;
[0109] Error rule 1: The Y coordinate error of the baseline Y is the Y coordinate error of the first element in each row, which is the current row height * cell offset rate (the default is 0.8);
[0110] Error rule 2: The Y coordinate error of the baseline is the Y coordinate of the field before the current text field, which is the current row height * cell offset rate (the default is 0.8);
[0111] Calculate the header row according to the original filtering rule algorithm (the rules remain unchanged);
[0112] When the header length is less than the minimum value (the default is 2), it is filtered (original logic);
[0113] Calculate the X coordinate of the header row and divide the X-axis area into table columns;
[0114] Range division rule: the starting point of the first column header is: (X / 2);
[0115] The range division rule is that the midpoint of the blank space between two adjacent columns is the end point of the previous header column and the starting point of the next header column;
[0116] Range division rule: the end point of the last header column is: the midpoint between the maximum X-axis data of the current table and the current text field;
[0117] Take out each row of data and confirm the cell column data according to the X coordinate range;
[0118] Rule 1: filter rows with coordinates smaller than the table header;
[0119] Rule 2: If the X coordinate range occupies more than 3 columns in the header column, filter it;
[0120] Rule 3: If the ratio of the width of the cell text field to the width of the current column exceeds the minimum ratio of the table column width (the default is 0.5), then the corresponding column coordinates are used. If Rule 3 is not satisfied, Rule 4 is used to determine the column to which the current text field belongs.
[0121] Rule 4: When the ratio of the current column width to the header width exceeds the minimum ratio of the table column width and header (the default is 0.9), the corresponding column coordinates are set;
[0122] Define the table range based on row and column data;
[0123] Rule 1: Filter the data in the header row and before it;
[0124] Rule 2: Data filtering without column coordinates;
[0125] Rule 3: Table footer keyword: A keyword hit in the text field is worth 10 points. The starting row with continuous row scores (the allowable error is 1 row, that is, there is a row without a keyword hit) and a total score exceeding the minimum score at the end of the table (30 points by default) is selected as the end of the table. The data not filtered by rule 3 is checked by rule 4 and filtered again.
[0126] Rule 4: Filter data when the number of empty columns is greater than the error. Since there may be data with empty table content, the number of empty columns (minimum 3) is obtained by multiplying the number of header columns by the error rate (default 0.3). Print the warn log. If the keyword has a good effect, it can be removed.
[0127] Rule 5: Merge data in the same row and column, add up the word content of the text field, and only keep the previous text field.
[0128] Step 4: The core control module dispatches the data to the recognition and matching module, which matches the data with the document fields, stores and retrieves the document templates for suppliers that the user has matched before, and stores and calculates the possible Chinese names corresponding to the purchase order fields. The recognition result returns the bordered data to match the F6 purchase order.
[0129] Based on the current market research, the initial matching copy is given. According to the recognition results, the supplier document may initially be matched with bordered data through the copy, which is converted into purchase order data. The main fields of the purchase order, such as Figure 5 shown.
[0130] The matching process of border data and initial copy is as follows: Figure 5 , match the possible fields of the supplier document with the F6 field name with bordered data; the matching process is: for example, according to the recognition result, when the supplier document may have fields such as: part name, name, accessory name, product name, commodity name, product name, product name rule, product, material name, product full name, etc., they are converted into the purchase order data in the F6 field name, that is, material name.
[0131] When the supplier document may have fields such as: part code, accessory code, commodity code, code, item code, number, part number, etc., it is converted into the purchase order data in the F6 field name, that is, part number.
[0132] When there is an unmatched copy, but the user still wants to match it to the purchase order module, the interface allows the user to choose to match the two by themselves. The matching results will be stored in the template module. The template itself will be reused the next time the purchase order of the same supplier is identified, without the need for manual matching again. At the same time, the template module will regularly aggregate these non-platform data. If the total exceeds the threshold, it will be incorporated into the platform matching rules.
[0133] For example: the platform threshold is 10, and the platform will collect the supplier document names and F6 system names in the custom template (template matched by the user) once a week. If 10 repair shops identify their own purchase orders and believe that the column identified as "number" corresponds to the "quantity" of the F6 system, then according to the collection results, after excluding the words that have been matched in the platform, it is found that the word "number" is not in the platform's matching words corresponding to "quantity", so "number" will be added to the platform matching words. The next time any user on the platform identifies a new supplier document, if there is a "number" column in the supplier document table, F6 will automatically match the data in the "number" column to the "quantity" column of the F6 document.
[0134] Step 5: Match the material name after the above identification with the store-specific material information or platform-level material information.
[0135] The main specific matching schemes for material names are as follows:
[0136] S51. If there is a name in the parameter, 80% of the word count must be matched after word segmentation
[0137] S52, if there is a part number (supplierCode) in the parameter, the word segmentation must match 100% of the word segmentation number
[0138] S53. If the parameters include a brand name or an applicable vehicle model, they will not be included in the filtering, and the matching ones will be given a higher priority score, each accounting for 50% of the weight.
[0139] Material matching gives priority to the store's material information. If the store's material information is not matched, the platform's material information is matched. If there is still no match, it needs to be created and converted to the store's material information. If it is created, the store's material information can be matched the next time it is matched.
[0140] The disclosed embodiment also provides a purchase order OCR recognition system, the structure of which is as follows: Figure 2 As shown, it includes a core control module, an OCR docking module, a document identification and matching module, a commodity identification and matching module, and a purchase order module.
[0141] The core control module is used for scheduling between the OCR docking module, the document identification and matching module, and the commodity identification and matching module, and finally assembling data and returning it to the purchase order module.
[0142] The OCR docking module is used to connect to external mature OCR table recognition services, and process the docked data into a unified data format and transmit it to the core control module; on the other hand, it is used to switch the recognition engine.
[0143] The document identification and matching module is used to match data with document fields, store and retrieve document templates for suppliers that have been matched by users before, and store and calculate the possible Chinese names corresponding to purchase order fields.
[0144] The commodity identification and matching module is used to match the identified material name with the store-specific material information or platform-level material information.
[0145] The purchase order module is used to record the store's purchase data in order to accurately manage the store's inventory data.
[0146] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A purchase order OCR recognition method, characterized in that: The method comprises the following steps: S1. Input the document image provided by the supplier into the OCR recognition engine, and obtain the purchase order result after recognition and conversion based on the OCR recognition engine; S2, the OCR docking module docks the OCR recognition engine based on the general OCR recognition form, and processes the docked purchase order results into a unified data format and transmits them to the core control module; S3. For borderless data, matching is performed using a scoring system; S4. The core control module dispatches the data to the identification and matching module, which matches the data with the document fields, stores and retrieves the document templates for suppliers that have been matched by the user before, and stores and calculates the Chinese names corresponding to the purchase order fields; S5. Match the identified material name to the store-specific material information or platform-level material information; For borderless data, a scoring system is used for matching, and the process is as follows: S31, converting the positioning result data returned by the purchase order image recognition into a text data set; Process OCR return data and add positioning to text model data; Process OCR return data and split table model data into text data sets; S32, the borderless recognition switch is turned on and the data of the table model that is not correctly recognized will be parsed by the borderless algorithm; Process the model data into a text data set; The text block area within a certain error is collected as a row through the Y coordinate to obtain each row of data for the purchase order image recognition; When the X-coordinate range increases and the data within the two error ranges are merged into one row, the error rule is an OR relationship, and the data that meets rule 1 or rule 2 are identified as one row; Error rule 1: The Y coordinate error of the baseline Y is the Y coordinate error of the first element in each row, which is the current row height * cell offset rate; Error rule 2: The Y coordinate error of the baseline is the Y coordinate of the field before the current text field, which is the current row height * cell offset rate; Calculate the header row according to the original filtering rule algorithm; Filter when the header length is less than the minimum value; Calculate the X coordinate of the header row and divide the X-axis area into table columns; Range division rule: the starting point of the first column header is: (X / 2); The range division rule is that the midpoint of the blank space between two adjacent columns is the end point of the previous header column and the starting point of the next header column; Range division rule: the end point of the last header column is: the midpoint between the maximum X-axis data of the current table and the current text field; Take out each row of data and confirm the cell column data according to the X coordinate range; Rule 1: filter rows with coordinates smaller than the table header; Rule 2: If the X coordinate range occupies more than 3 columns in the header column, filter it; Rule 3: If the ratio of the width of the cell text field to the width of the current column exceeds the minimum ratio of the table column width, then the corresponding column coordinates, if Rule 3 is not satisfied, then Rule 4 is used to determine the column to which the current text field belongs; Rule 4: When the ratio of the current column width to the header width exceeds the minimum ratio of the table column width and header, the corresponding column coordinates are used; Define the table range based on row and column data; Rule 1: Filter the data in the header row and before it; Rule 2: Data filtering without column coordinates; Rule 3: Table footer keyword. A keyword hit in the text field is worth 10 points. Select consecutive rows with scores, and the starting row whose total score exceeds the minimum score at the end of the table is used as the end of the table. Data not filtered by rule 3 is checked by rule 4 and filtered again. Rule 4: Filter data when the number of empty columns is greater than the error. Since there is data with empty table content, the number of empty columns is obtained by multiplying the number of header columns by the error rate. Print the warn log. If the keyword has a good effect, it can be removed. Rule 5: merge the data in the same row and column, add the word content data of the text field, and only keep the previous text field; The process of matching data with document fields by the recognition and matching module is as follows: based on the recognition result, the text initially matched is bordered data, which is converted into purchase order data; When unmatched documents appear, but the user still wants to match them to the purchase order module, the interface allows the user to choose to match the two by themselves; the matching results will be stored in the template module; the template itself will be reused the next time it identifies a purchase order from the same supplier, without the need for manual matching again; at the same time, the template module will regularly aggregate these non-platform data, and if the total exceeds the threshold, it will be incorporated into the platform matching rules.
2. A purchase order OCR recognition method according to claim 1, characterized in that: The unified data format is divided into: key-value class and multi-line table class; wherein the key-value class is used for subsequent conversion into the overall information of the purchase order; the multi-line table class is used for subsequent conversion into the material details information of the purchase order; the unified data format needs to perform the following normalization function to process the data of the recognition engine: S21, multi-table screening; Convert OCR recognition results into general table model data; The parsing process only processes the format of the results, and the table values and corresponding positions will not change; In the scenario where there are multiple tables: the first one is selected by default. When the table attribute column is larger than the selected table and the number of cells is larger than the selected table, the table is selected; S22, header screening; Filter cells and their rows whose number of columns is less than the configured number; Filter the cells and rows where the merged cell data is greater than the configured value; Filtering rules: record the matching degree of each row, select the table row with the highest matching degree, and select the first row if the scores are the same; Matching rules: Current row and column up to +20, each header keyword matched +10; S23, table body screening; Filter the cell data and rows that are inconsistent with the header column format; The table body cell data recalculates startRow.
3. A purchase order OCR recognition method according to claim 1, characterized in that: When the OCR recognition engine fails, you can quickly switch to other recognition engines by modifying the configuration file that processes the class name.
4. A purchase order OCR recognition method according to claim 1, characterized in that: The material name matching process is: S51. If there is a name in the parameter, 80% of the word count must be matched after word segmentation; S52: If there is a part number in the parameter, the word segmentation must match 100% of the word segmentation number. S53. If there is a brand name or applicable model in the parameter, it will not be included in the filtering, and the matching one will be given a higher priority score; each has a weight of 50%; Material matching first matches the material information of the store; if the material information of the store is not matched, the material information of the platform is matched; if there is still no match, it needs to be created and changed to the material information of the store; if it is created, the store material information will be matched the next time it is matched.
5. A purchase order OCR recognition system, characterized in that: The system is used to implement the purchase order OCR recognition method according to any one of claims 1 to 4, and the system includes a core control module, an OCR docking module, a document identification and matching module, a commodity identification and matching module, and a purchase order module; The core control module is used for scheduling between the OCR docking module, the document identification and matching module, and the commodity identification and matching module, and finally assembling data and returning it to the purchase order module; The OCR docking module is used to dock with external mature OCR table recognition services, process the docked data into a unified data format and transmit it to the core control module; on the other hand, it is used to switch the recognition engine; Identify and match document modules, which are used to match data with document fields, store and retrieve document templates for suppliers that have been matched by users before, and store and calculate the Chinese names corresponding to purchase order fields; The commodity identification and matching module is used to match the identified material name with the store-specific material information or platform-level material information; The purchase order module is used to record the store's purchase data in order to accurately manage the store's inventory data.
