Buyer and seller name identification method and device suitable for invoices

Through the combination of optical character recognition technology and preset name database, the typos and missing words in buyer and seller name recognition in invoices are solved, the accuracy and completeness of the recognition are improved, and automation and adaptive optimization are achieved.

CN119514526APending Publication Date: 2025-02-25CLOUDCHAIN GRP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411470037.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The prior art is prone to typos and missing words when identifying buyers and sellers' names in invoices, resulting in low recognition accuracy, especially when processing complex or uncommon enterprise names, lacking effective error correction and completion mechanisms.

Method used

The invoice image is obtained through optical character recognition technology, and the preset keywords are selected according to the invoice type. The buyer and seller name information is located based on the Chinese character position, the spacing between characters and confidence, and missed words and suspected typos are judged and corrected, and the preset name database is used to find candidate names for error correction and replenishment.

Benefits of technology

It improves the accuracy and completeness of buyer and seller name recognition in invoices, reduces manual intervention, and realizes automation and adaptive optimization of recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119514526A_ABST
    Figure CN119514526A_ABST
Patent Text Reader

Abstract

The invention provides a buyer and seller name recognition method and device suitable for invoices, and the method comprises the steps: recognizing a to-be-processed invoice image based on optical characters, and searching the name information of a buyer and a seller which are connected with the to-be-processed invoice image according to a keyword corresponding to an invoice type; and for the identified name information, checking whether missing characters exist or not according to the inter-character spacing, and judging whether suspected wrong characters exist or not according to the confidence coefficient. The method comprises the following steps of: distinguishing four conditions that only missing characters exist, only suspected wrong characters exist, the missing characters and the suspected wrong characters exist at the same time, and the missing characters or the suspected wrong characters do not exist, searching corresponding candidate names according to identified correct characters and character intervals by virtue of a preset name database, and then correcting and supplementing the suspected wrong characters or the missing characters on the basis of the candidate names. And for the identified name information without missing characters or suspected wrong characters, the fact is that the name information is added into the preset name database for continuous updating, so that the identification automation and self-adaptive optimization are realized, and the identification precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of text recognition, and in particular to a method and device for identifying the names of the buyer and seller of an invoice. Background Art

[0002] In modern business activities, invoices are one of the important vouchers for daily business operations. Whether it is internal financial management, tax declaration, or business dealings with partners, the processing and management of invoices are crucial. With the advancement of technology, the popularization and development of electronic invoices have greatly improved the efficiency of invoice processing. At the same time, the automatic identification of invoices has become a key part of the enterprise management system.

[0003] In the process of automatic invoice recognition, optical character recognition (OCR) is usually introduced to extract text data. However, in complex application scenarios, due to the quality of the invoice image, the invoice may be unclearly printed, the image resolution is low, the paper is damaged, etc., making it difficult for OCR technology to accurately recognize all the information on the invoice. Different font types and character complexity lead to a decrease in recognition accuracy. When processing key information such as the buyer and seller, OCR technology often has typos and omissions due to complex font shapes, fuzzy characters, incomplete vocabulary, etc. These problems not only affect the recognition accuracy of the invoice, but may also lead to data errors in subsequent corporate management and financial processing.

[0004] The application of OCR technology in invoice recognition has been developed for many years. Although the technical level is constantly improving, the high-precision recognition of key information in invoices is still a problem that needs to be solved. Especially in the recognition of the names of the buyer and the seller, due to the diversity and complexity of Chinese characters, the existing technology has not yet fully met the needs of practical applications. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and device for identifying the names of the buyer and seller of an invoice, so as to eliminate or improve one or more defects existing in the prior art and overcome the problems of typos and omissions in the process of identifying the names of the buyer and seller of an invoice in the prior art.

[0006] One aspect of the present invention provides a method for identifying the name of a buyer and seller applicable to an invoice, the method comprising the following steps:

[0007] Obtaining an invoice image to be processed and an invoice type, and using an optical character recognition model to recognize the invoice image to obtain a preliminary recognition result;

[0008] Selecting a preset keyword according to the invoice type, locating the preset keyword in the preliminary recognition result, obtaining the text information connected with the preset keyword to confirm that the seller and the seller's name information, the name information including the position of Chinese characters, the spacing between characters, and the position subscript and confidence of each recognized Chinese character in the character library;

[0009] Determine whether there is a missing character according to a preset rule based on the spacing between the Chinese characters; and determine whether there is a suspected wrong character with a confidence level less than a first set value in the name information;

[0010] Perform name information correction and completion, including:

[0011] If only the missing characters exist, searching a preset name database for a first category of candidate names based on the correct characters in the name information whose confidence is greater than the first set value and the character spacing between the correct characters, aligning the first category of candidate names with the name information through the positions of the correct characters, and using the first category of candidate names to complete the missing characters in the name information and outputting the completed names;

[0012] If only the suspected wrong character exists, the suspected wrong character is eliminated, and one or more second-category candidate names are searched in the preset name database according to the correct characters in the name information whose confidence is greater than the first set value and the character spacing between the correct characters. The second-category candidate names are aligned with the name information through the position of the correct characters, and the candidate Chinese characters aligned with the position of the suspected wrong character in each of the second-category candidate names are obtained; each of the suspected wrong characters and the corresponding candidate Chinese characters are converted into a Chinese character structure description sequence, and a similarity comparison is performed, and the suspected wrong character is replaced and corrected with the candidate Chinese character with the highest similarity and output;

[0013] If the missing characters and the suspected wrong characters exist at the same time, the suspected wrong characters are eliminated, and the preset name database is searched for one or more third-category candidate names according to the correct characters in the name information whose confidence is greater than the first set value and the character spacing between the correct characters. The third-category candidate names are aligned with the name information through the positions of the correct characters, and the candidate Chinese characters aligned with the positions of the suspected wrong characters in each of the third-category candidate names are obtained; each of the suspected wrong characters and the corresponding candidate Chinese characters are converted into a Chinese character structure description sequence, and a similarity comparison is performed, and the suspected wrong characters are replaced and corrected with the candidate Chinese characters with the highest similarity, and the missing characters are supplemented;

[0014] If the missing character or the suspected wrong character does not exist, the recognized name information is output and saved in the preset name database.

[0015] In some embodiments, the method further comprises:

[0016] In the case where only the missing characters exist during the name information error correction and completion process, when there are multiple first-category candidate names, generating and outputting first-category prompt information;

[0017] In the case where only the suspected wrong character exists during the name information correction and completion process, when there are multiple different second-category candidate Chinese characters, and the similarity with the suspected wrong character is the same and the highest, generating and outputting the second-category prompt information;

[0018] When the missing characters and the suspected wrong characters exist simultaneously during the name information correction and completion process, when there are multiple different third-category candidate Chinese characters, and their similarity with the suspected wrong characters is the same and the highest, the third-category prompt information is generated and output; when there are multiple third-category candidate Chinese characters, and their similarity with the suspected wrong characters is the same and the highest, and the Chinese characters aligned with the missing characters in each of the third-category candidate Chinese characters are different, or the fourth-category prompt information is generated and output.

[0019] In some embodiments, the method further includes: during the process of executing name information error correction and completion, if there is no missing character or suspected wrong character, and the confidence of each Chinese character is higher than a second set value, the identified name information is added to the preset name database.

[0020] In some embodiments, the name information is expressed in an array, wherein non-zero numbers represent the position subscripts of the Chinese characters recognized by the optical character recognition model in the character library, the distance between Chinese characters is marked with the character 0, and the number of the character 0 between the non-zero numbers is proportional to the distance between the corresponding Chinese characters.

[0021] In some embodiments, judging whether there is a missing character according to a preset rule based on the spacing between Chinese characters includes:

[0022] The number of characters between the non-zero numbers in the array is used as the distance between the corresponding Chinese characters, and the median is taken;

[0023] A multiple threshold is set. If the distance between Chinese characters is greater than the product of the median value and the multiple threshold, it indicates that there are missing characters between the corresponding Chinese characters.

[0024] In some embodiments, the preset name database is connected to the tax department server for update at a set interval.

[0025] In some embodiments, the first setting value is greater than or equal to 85%, and the second setting value is greater than or equal to 99%.

[0026] On the other hand, the present invention also provides a device for identifying the names of the buyer and seller of an invoice, comprising a processor, a memory, and a computer program / instructions stored in the memory, wherein the processor is used to execute the computer program / instructions, and when the computer program / instructions are executed, the device implements the steps of the above method.

[0027] On the other hand, the present invention further provides a computer-readable storage medium having a computer program / instruction stored thereon, which implements the steps of the above method when the computer program / instruction is executed by a processor.

[0028] On the other hand, the present invention also provides a computer program product, comprising a computer program / instruction, which implements the steps of the method when executed by a processor.

[0029] The beneficial effects of the present invention are at least:

[0030] The method and device for identifying the names of the buyer and seller of an invoice according to the present invention searches for the name information of the buyer and seller connected to the invoice image based on the keywords corresponding to the invoice type based on the optical character recognition of the invoice image to be processed. For the recognized name information, check whether there are missing characters based on the spacing between characters, and judge whether there are suspected wrong characters based on the confidence level. Distinguish between four situations: only missing characters, only suspected wrong characters, both missing characters and suspected wrong characters, and no missing characters or suspected wrong characters. With the help of a preset name database, search for corresponding candidate names based on the recognized correct characters and their character spacing, and then correct and complete the suspected wrong characters or missing characters based on the candidate names. For the recognized name information without missing characters or suspected wrong characters, the facts are added to the preset name database for continuous updating, so as to realize the automation and adaptive optimization of recognition and improve the recognition accuracy.

[0031] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.

[0032] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:

[0034] Figure 1The figure is a flow chart of a method for identifying the names of the buyer and seller of an invoice according to an embodiment of the present invention.

[0035] Figure 2 This is a logical diagram of a method for identifying the names of a buyer and seller applicable to an invoice according to an embodiment of the present invention. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.

[0037] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.

[0038] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0039] Existing OCR systems often make mistakes when processing text information in invoices, especially when recognizing the names of the buyer and seller. This is mainly because the OCR system's recognition confidence in some characters is not high enough, especially for some vague or uncommon Chinese characters, which are prone to errors in recognition. In addition, existing systems usually lack an effective error correction mechanism for typos, and cannot perform effective corrections after recognition errors, resulting in low accuracy of recognition results. The problem of missing Chinese characters is also common. Especially when processing more complex bills such as invoices, the OCR system is prone to being unable to detect all Chinese characters due to reasons such as large character spacing, damaged or blurred characters, etc., resulting in incomplete recognition results. Although the existing technology can slightly improve the phenomenon of missing characters by improving image resolution, it has not yet fundamentally solved the problem.

[0040] In the actual application of invoice recognition, the company names of the buyer and seller are often very critical information. However, due to the diversity and particularity of company names, existing OCR systems lack optimized recognition strategies for company names. When faced with complex or uncommon company names, existing technologies cannot use known company name databases for error correction or completion, resulting in frequent name errors in the recognition results, affecting the accuracy and reliability of the data.

[0041] After each invoice recognition, the existing OCR system usually does not save the correct recognition results for subsequent learning and optimization. This means that the system cannot gradually improve its recognition accuracy, especially in the recognition of company names. The system cannot perform adaptive optimization based on previous recognition records, resulting in the same mistakes being repeated in subsequent recognitions.

[0042] The present invention provides a method for identifying the names of the buyer and seller of an invoice, such as Figure 1 As shown, the method includes the following steps S101 to S104:

[0043] Step S101: obtaining the invoice image to be processed and the invoice type, and using an optical character recognition model to recognize the invoice image to obtain a preliminary recognition result.

[0044] Step S102: Select preset keywords according to the invoice type, locate the preset keywords in the preliminary recognition results, obtain the text information connected with the preset keywords to confirm the seller and the seller's name information, the name information includes the position of Chinese characters, the spacing between characters, and the position subscript and confidence of each recognized Chinese character in the character library.

[0045] Step S103: determining whether there is a missing character according to a preset rule based on the spacing between the characters; and determining whether there is a suspected wrong character with a confidence level less than a first set value in each Chinese character in the name information.

[0046] Step S104: Execute name information error correction and completion, refer to Figure 2 , including steps S1041 to S1044:

[0047] Step S1041: If there are only missing characters, the preset name database is searched for the first category of candidate names based on the correct characters in the name information whose confidence is greater than the first set value and the character spacing between the correct characters. The first category of candidate names are aligned with the name information through the positions of the correct characters, and the first category of candidate names are used to complete the missing characters in the name information and output.

[0048] Step S1042: If there are only suspected wrong characters, the suspected wrong characters are eliminated, and one or more second-category candidate names are searched in a preset name database based on the correct characters in the name information whose confidence is greater than the first set value and the character spacing between each correct character. The second-category candidate names are aligned with the name information through the position of the correct characters, and the candidate Chinese characters aligned with the position of the suspected wrong characters in each second-category candidate name are obtained; each suspected wrong character and the corresponding candidate Chinese characters are converted into a Chinese character structure description sequence, and a similarity comparison is performed, and the suspected wrong characters are replaced and corrected with the candidate Chinese characters with the highest similarity and output.

[0049] Step S1043: If there are both missing characters and suspected wrong characters, the suspected wrong characters are eliminated, and one or more third-category candidate names are searched in a preset name database based on the correct characters in the name information whose confidence is greater than the first set value and the character spacing between each correct character. The third-category candidate names are aligned with the name information through the position of the correct characters, and the candidate Chinese characters aligned with the position of the suspected wrong characters in each third-category candidate name are obtained; each suspected wrong character and the corresponding candidate Chinese characters are converted into a Chinese character structure description sequence, and a similarity comparison is performed, and the suspected wrong characters are replaced and corrected using the candidate Chinese characters with the highest similarity, and the missing characters are supplemented.

[0050] Step S1044: If there are no missing characters or suspected wrong characters, the recognized name information is output and saved in a preset name database.

[0051] In step S101, in actual application scenarios, invoices include multiple types, such as special VAT invoices, general VAT invoices, etc., and electronic invoices and paper invoices are distinguished, and there are certain differences in format. In invoice recognition applications, the names of the buyer and seller are key information. Invoices with fixed formats generally require the names of the buyer and seller to be filled in at fixed locations, and keywords related to "name" will be prompted at the corresponding locations. After the optical character recognition model recognizes the characters and positions in the invoice, the names of the buyer and seller can be locked through location search and keyword search.

[0052] In step S102, the preset keyword can be set to "name". According to the fixed format of the corresponding invoice, the name is followed by the name of the buyer and seller. Furthermore, according to the position of the recognized Chinese characters, it can be determined whether it is the name of the seller or the name of the buyer. The present invention is based on OCR technology. OCR (optical character recognition) technology is a technology that converts printed or handwritten text into a machine-readable format. It scans the document, recognizes the characters therein, and converts them into digital text. After the invoice is recognized, the names of the buyer and seller are extracted and located through keyword query. The corresponding name information includes the position of the Chinese characters, the spacing between characters, and the position subscript and confidence of each recognized Chinese character in the character library.

[0053] In step S103, in order to accurately recognize the name information of the buyer and seller, it is necessary to exclude missing characters and suspected wrong characters as much as possible. During the recognition process, OCR will synchronously output the position subscript, character spacing and confidence of the recognized Chinese characters in the character library.

[0054] Specifically, the name information is expressed in an array, in which non-zero numbers represent the position subscripts of Chinese characters recognized by the optical character recognition model in the character library, the distance between Chinese characters is marked with the character 0, and the number of character 0s between non-zero numbers is proportional to the distance between the corresponding Chinese characters.

[0055] If the character spacing is inconsistent, and the spacing between some Chinese characters is significantly larger than the minimum character spacing or there are significant differences, it can be determined that there may be missing characters at the corresponding positions. According to the confidence level of each recognized Chinese character, it can be determined whether it is a suspected misspelled character. Specifically, the first set value is set to be greater than or equal to 85%. If the confidence level of a Chinese character is less than this value, it is considered a suspected misspelled character. Further, when the confidence level is greater than or equal to 99%, it is determined as a correctly recognized character.

[0056] Exemplarily, for the name "Beijing Zhongqi Yunlian", the output of the optical character recognition model may be [0, 5, 0, 0, 70, 0, 21, 0, 0, 12, 0, 0, 4, 0, 8, 0]. Among them, the non-zero numbers are the position subscripts of the corresponding Chinese characters in the font library, and "0" represents the interval. The number of "0"s is proportional to the distance between Chinese characters. At the same time, the corresponding confidence level will also be output for the recognized Chinese characters. In practical applications, the recognized character distances may fluctuate. For example, there is 1 "0" between "Bei" and "Jing", and 2 "0"s between "Jing" and "Zhong". The reason for this is the difference in the strokes and glyphs of different Chinese characters. However, if there are 4 "0"s in the middle, it can be determined that there are missing characters. If the confidence level of each Chinese character is less than 85%, it can be marked as a suspected misspelled character.

[0057] In some embodiments, it is determined whether there are missing characters according to the inter-character spacing between Chinese characters according to a preset rule, including steps S1031 to S1032:

[0058] Step S1031: Use the number of characters between non-zero numbers in the array as the distance between the corresponding Chinese characters, and take the median value.

[0059] Step S1032: Set a multiple threshold. If the distance between Chinese characters is greater than the product of the median value and the multiple threshold, it indicates that there are missing characters between the corresponding Chinese characters.

[0060] In step S104, error correction and filling are performed in four cases respectively. The present invention introduces a preset name database for name lookup, and the preset name database can be generated based on an official database. In some embodiments, the preset name database is updated by connecting to the tax department server at a set interval.

[0061] The present invention uses the recognized correct characters and their corresponding spacings to look up the preset name database, and corresponding candidate names can be obtained.

[0062] For the case where there are only missing characters, after querying the first type of candidate names, by aligning the correct characters and filling in the missing characters, effective recognition output can be achieved. When there are only the missing characters during the execution of the name information error correction and filling process, when there are multiple first type of candidate names, the first type of prompt information is generated and output.

[0063] In the case where there are only suspected wrong characters, the suspected wrong characters are eliminated, and after querying the preset name database to obtain at least one second-category candidate name, the characters in the corresponding positions are compared by Chinese character structure description sequence (IDS) distance, that is, similarity comparison. In practice, the second-category candidate names with the highest similarity can be used for replacement and error correction. At the same time, restriction conditions can also be set. For the second-category candidate names with the highest similarity, they are only replaced when the similarity is higher than a set threshold, such as 90%. Otherwise, the suspected wrong characters are directly output and marked. When there are multiple different second-category candidate Chinese characters, and the similarity with the suspected wrong characters is the same and highest, a second-category prompt information is generated and output.

[0064] When there are missing characters and suspected wrong characters at the same time, the suspected wrong characters are eliminated, and at least one third-category candidate name can be obtained by querying the preset name database. At this time, priority is given to correcting suspected wrong characters, and each suspected wrong character and the corresponding candidate Chinese characters are converted into a Chinese character structure description sequence (IDS), and a similarity comparison is performed. The suspected wrong characters are replaced and corrected using the candidate Chinese characters with the highest similarity. At the same time, restriction conditions can also be set. For the third-category candidate name with the highest similarity, only when the similarity is higher than the set threshold, such as 90%, is it replaced. After performing IDS error correction, there is a high probability that only one third-category candidate name is left, which can be directly used to fill the missing characters. When there are multiple different third-category candidate Chinese characters, and the similarity with the suspected wrong character is the same and the highest, the third-category prompt information is generated and output; when there are multiple third-category candidate Chinese characters with the same and the highest similarity with the suspected wrong character, and the Chinese characters aligned with the missing character in each of the third-category candidate Chinese characters are different, or the fourth-category prompt information is generated and output.

[0065] If there is no missing character or suspected wrong character, it is directly output. In some embodiments, during the name information error correction and completion process, if there is no missing character or suspected wrong character, and the confidence of each Chinese character is higher than the second set value, the recognized name information is added to the preset name database. In some embodiments, the second set value is greater than or equal to 99%.

[0066] On the other hand, the present invention also provides a device for identifying the names of the buyer and seller of an invoice, comprising a processor, a memory, and a computer program / instructions stored in the memory, wherein the processor is used to execute the computer program / instructions, and when the computer program / instructions are executed, the device implements the steps of the above method.

[0067] On the other hand, the present invention further provides a computer-readable storage medium having a computer program / instruction stored thereon, which implements the steps of the above method when the computer program / instruction is executed by a processor.

[0068] On the other hand, the present invention also provides a computer program product, comprising a computer program / instruction, which implements the steps of the method when executed by a processor.

[0069] The present invention is described below in conjunction with a specific embodiment:

[0070] This embodiment provides a system for identifying the names of buyers and sellers of invoices. The system first performs OCR recognition on the invoice image to obtain the name information of the buyer and seller on the invoice. The recognition result of each Chinese character is accompanied by a confidence level, indicating the system's confidence in the recognition of the Chinese character. In addition, the OCR text recognition result is accompanied by a Chinese character recognition spacing information.

[0071] The system checks the confidence of each Chinese character. If the confidence of a Chinese character is less than 85%, it will be marked as a suspected wrong character and enter the next step of the error correction process. For each suspected wrong character, the system removes the Chinese character and forms a name without the suspected wrong character.

[0072] The system retrieves candidate names similar to the one after removing the suspected typos from the Elasticsearch database. The system compares the candidate name with the name recognized by OCR. If the part after removing the typos completely matches the candidate name, the system takes the candidate name as the candidate result.

[0073] The system further checks the similarity between the suspected wrong character and the Chinese character in the corresponding position in the candidate name. If the similarity is greater than 80%, the candidate name is considered to be the correct name and is used as the final recognition result.

[0074] The system checks the distance between Chinese characters recognized by OCR. If the distance between two Chinese characters is significantly larger than the normal distance, the system marks the position as a suspected missing character.

[0075] In the process of correcting suspected wrong characters, the OCR system will attach a confidence level to the recognition result of each Chinese character. According to experience, when the confidence level of a Chinese character is lower than 85%, the Chinese character is likely to be a wrongly recognized character. In order to solve this problem, the present invention proposes the following error correction scheme:

[0076] First, after OCR recognition is completed, the system will check the confidence of each Chinese character. If the confidence of a Chinese character is less than 85%, the system will mark it as a suspected wrong character. Then, the system will remove the suspected wrong character from the recognized name to form a name without the suspected wrong character.

[0077] Next, the system will use the Elasticsearch database to search for similar names. Elasticsearch stores a large number of correct company names. The system can retrieve similar candidate names based on the names after removing the suspected typos. If the candidate name is exactly the same as the name recognized by OCR after removing the characters in the same position (the order and content of the Chinese characters match), the system will further verify the similarity between the suspected erroneous Chinese characters and the corresponding Chinese characters in the candidate name. If the similarity is greater than 80%, the candidate name is considered to be the correct name and is used as the final recognition result.

[0078] This typo correction mechanism based on confidence and corporate name database can greatly improve the accuracy of buyer and seller name recognition and reduce recognition errors caused by typos.

[0079] Exemplary:

[0080] In the invoice recognition, the company name "Beijing Zhongqiyunlian" was recognized, and the confidence corresponding to each Chinese character was [0.9993, 0.9887, 0.9969, 0.9999, 0.9987, 0.6975], and the threshold threshold was set to 0.90. If there is a confidence less than the threshold, it is considered that there is a suspected typo at that position. First, remove the suspected typo and get "Beijing Zhongqiyun". Use these five characters to search for candidate names in Elasticsearch. If not found, directly return the OCR recognition result. If the candidate name is found, such as "Beijing Zhongqiyunxin" and "Beijing Zhongqiyunlian", the suspected typo "lian" is compared with "xin" and "lian" to calculate the similarity of Chinese characters. The method of calculating the similarity is based on the edit distance calculation of IDS (IdeographicDescription Sequence). It can be obtained that the similarity with "xin" is 0.543, and the similarity with "lian" is 0.91. Therefore, the real name is "Beijing China Enterprise Cloud Chain".

[0081] In the process of solving the problem of missing characters, this embodiment utilizes the characteristic that Chinese characters in the invoice are printed at equal distances. Under normal circumstances, the Chinese characters in the invoice should be arranged at equal distances. However, during the OCR recognition process, if the distance between two Chinese characters is significantly greater than the distance between other Chinese characters, it is likely that there is a missing character at that position.

[0082] The system automatically detects the distance between each Chinese character and marks the position with abnormally large distance as the suspected missing character position. Then, the system removes the suspected missing character position from the recognized name to form a name without missing characters.

[0083] Subsequently, the system will once again utilize the Elasticsearch database to retrieve candidate names that are similar to the name after eliminating the missing characters. If a candidate name exactly matches the name recognized by OCR after eliminating the missing characters, then this candidate name is considered the correct name, and the system will use it as the final recognition result. In this way, the present invention can effectively complete the Chinese characters missing in OCR recognition and improve the integrity of the recognition result.

[0084] Exemplary:

[0085] 1) During the process of recognizing the text image of the four characters "Beijing Zhongqi Yunlian", the final recognition result will obtain an array A. A may be equal to [0, 5, 0, 0, 70, 0, 21, 0, 0, 12, 0, 0, 4, 0, 8, 0]. The non-zero numbers in A represent the positions of the predicted words in the word library constructed by all the Chinese characters used in the OCR recognition model. For example, in the case of correct prediction, "5" indicates that the character at position index "5" in the word library is "北" (North), and similarly, "70" is "京" (Beijing). And "0" represents the interval size between every two characters during the OCR recognition process. Of course, the number of "0"s between two characters is not necessarily the same. For example, in A, there is 1 "0" between "北" and "京", and 2 "0"s between "京" and "中". The reason for this is the difference in the strokes and glyphs of different Chinese characters, resulting in slight differences in the OCR recognition model during the recognition process. However, since the names on the invoice are machine-typed and the spaces between machine-typed characters are equal. Therefore, the conclusion is that although the distances between two Chinese characters in a text are not exactly the same, the difference in the size of the intervals is not particularly large. The above example is the array A obtained when OCR can correctly recognize all Chinese characters. If there is a missing character "京", the array A may be [0, 5, 0, 0, 0, 0, 21, 0, 0, 12, 0, 0, 4, 0, 8, 0].

[0086] 2) Based on the above premise, we can obtain the subscripts where the non-zero numbers in A are located. In the case of missing characters, the subscripts are indices = [1, 6, 9, 12, 14] (the subscripts start from 0), and thus obtain the differences between the subscripts distance = [5, 3, 3, 2]. Among distance, find the median median = 3. We set a multiple threshold threshold = 1.5. If the value in distance is greater than median × threshold, then there may be a situation of missing characters at this position. For example, for "北中企云链", it can be found that there is a missing character between "北" and "中", and the subscript of the missing character is 1.

[0087] 3) After getting the subscript of the missing word, we get the text according to the missing word, search for the possible real name in Elasticsearch, and get the candidate name. If the candidate name is not obtained, it is impossible to correct the missing word, and the recognized text is directly returned. If the candidate name is obtained (for example, "Beijing Yunlian Zhongqi", "Beijing Zhongqi Yunlian") is found. The position of the missing word is marked in the candidate name, and the text at the marked position is removed first. "Beiyunlian Zhongqi" "Beizhongqi Yunlian". By comparing the recognized text "Beizhongqi Yunlian" to see if it is exactly the same as the candidate text after the text is removed, if it is exactly the same, it is considered that the candidate name that is exactly the same is the real name, that is, "Beijing Zhongqi Yunlian" can be found as the real name in the invoice.

[0088] Furthermore, if there are both suspected typos and missing characters, the positions of the typos and missing characters are found at the same time, and then the typos are eliminated, and candidate names are searched through Elasticsearch. After finding the candidate names, the typos are compared first. Here, the positions of the missing characters need to be considered, and the missing characters need to be filled in the names recognized by OCR, so that the corresponding characters of the suspected typos in the candidate names can be found. After error correction, the missing characters are filled in.

[0089] Furthermore, this embodiment not only provides a solution for wrong characters and missing characters, but also continuously optimizes the recognition ability of the system by building a dynamic company name library. Whenever the system correctly recognizes a company name, if the confidence of each Chinese character in the company name exceeds 0.999 and there is no missing character, the company name is considered to be correctly recognized, and the system will store the name in the Elasticsearch database to form a dynamically expanded name library. As the number of recognitions increases, the system can gradually accumulate more company names, thereby having stronger error correction and completion capabilities in subsequent recognition processes. This dynamic learning and optimization mechanism not only improves the recognition accuracy of the system, but also can adapt to the actual needs of constantly changing company names, forming an adaptive and intelligent invoice recognition system.

[0090] It can be seen that the advantages of this embodiment include at least the following:

[0091] 1. Greatly improved the accuracy of name recognition: Through the confidence-based error correction mechanism, the system can intelligently determine which Chinese characters have recognition errors, and use the company names in the Elasticsearch database to match similar names, further improving the accuracy of recognition.

[0092] 2. Solved the problem of missing characters: The existing OCR system is often powerless in detecting missing characters, while the present invention can automatically detect the position of suspected missing characters by analyzing the distance between Chinese characters, and complete the missing characters by matching the names in the database, thereby ensuring the integrity of the recognition results.

[0093] 3. Possessing self-learning ability: By establishing a dynamic enterprise name database, the system can store the results after each correct recognition and continuously optimize them in the subsequent recognition process. This adaptive learning ability enables the system to gradually improve the accuracy and efficiency of recognition as the use time increases.

[0094] 4. Strong adaptability and wide coverage: The present invention can not only process common company names, but also process uncommon or newly emerging company names as the database expands. By combining with Elasticsearch, the system can quickly query and match company names, greatly improving the adaptability and application scope of the invoice recognition system.

[0095] 5. Effectively reduce manual intervention: Through automated error correction and missing word completion, the present invention can reduce the need for manual inspection and error correction, and reduce the cost of manual intervention in invoice recognition. Enterprises can process a large number of invoices more quickly and accurately in daily management, improving work efficiency.

[0096] Corresponding to the above method, the present invention also provides an apparatus / system, which includes a computer device, the computer device includes a processor and a memory, the memory stores computer instructions, the processor is used to execute the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the apparatus / system implements the steps of the method described above.

[0097] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned edge computing server deployment method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0098] As described in the summary, the method and device for identifying the names of the buyer and seller of an invoice according to the present invention searches for the name information of the buyer and seller connected thereto based on the keywords corresponding to the invoice type and optically recognizes the invoice image to be processed. For the recognized name information, check whether there are missing characters based on the spacing between characters, and determine whether there are suspected wrong characters based on the confidence level. Distinguish between four situations: only missing characters, only suspected wrong characters, both missing characters and suspected wrong characters, and no missing characters or suspected wrong characters. With the help of a preset name database, search for corresponding candidate names based on the recognized correct characters and their character spacing, and then correct and complete the suspected wrong characters or missing characters based on the candidate names. For the recognized name information without missing characters or suspected wrong characters, the facts are added to the preset name database for continuous updating, which realizes the automation and adaptive optimization of recognition and improves the recognition accuracy.

[0099] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0100] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0101] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.

[0102] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for identifying the names of buyers and sellers of invoices, characterized in that: The method comprises the following steps: Obtaining an invoice image to be processed and an invoice type, and using an optical character recognition model to recognize the invoice image to obtain a preliminary recognition result; Selecting a preset keyword according to the invoice type, locating the preset keyword in the preliminary recognition result, obtaining the text information connected with the preset keyword to confirm that the seller and the seller's name information, the name information including the position of Chinese characters, the spacing between characters, and the position subscript and confidence of each recognized Chinese character in the character library; Determine whether there is a missing character according to a preset rule based on the spacing between the Chinese characters; and determine whether there is a suspected wrong character with a confidence level less than a first set value in the name information; Perform name information correction and completion, including: If only the missing characters exist, searching a preset name database for a first category of candidate names based on the correct characters in the name information whose confidence is greater than the first set value and the character spacing between the correct characters, aligning the first category of candidate names with the name information through the positions of the correct characters, and using the first category of candidate names to complete the missing characters in the name information and outputting the completed names; If only the suspected wrong character exists, the suspected wrong character is eliminated, and one or more second-category candidate names are searched in the preset name database according to the correct characters in the name information whose confidence is greater than the first set value and the character spacing between the correct characters. The second-category candidate names are aligned with the name information through the position of the correct characters, and the candidate Chinese characters aligned with the position of the suspected wrong character in each of the second-category candidate names are obtained; each of the suspected wrong characters and the corresponding candidate Chinese characters are converted into a Chinese character structure description sequence, and a similarity comparison is performed, and the suspected wrong character is replaced and corrected with the candidate Chinese character with the highest similarity and output; If the missing characters and the suspected wrong characters exist at the same time, the suspected wrong characters are eliminated, and the preset name database is searched for one or more third-category candidate names according to the correct characters in the name information whose confidence is greater than the first set value and the character spacing between the correct characters. The third-category candidate names are aligned with the name information through the positions of the correct characters, and the candidate Chinese characters aligned with the positions of the suspected wrong characters in each of the third-category candidate names are obtained; each of the suspected wrong characters and the corresponding candidate Chinese characters are converted into a Chinese character structure description sequence, and a similarity comparison is performed, and the suspected wrong characters are replaced and corrected with the candidate Chinese characters with the highest similarity, and the missing characters are supplemented; If the missing character or the suspected wrong character does not exist, the recognized name information is output and saved in the preset name database.

2. The method for identifying the names of the buyer and seller of an invoice according to claim 1, characterized in that: The method further comprises: In the case where only the missing characters exist during the name information error correction and completion process, when there are multiple first-category candidate names, generating and outputting first-category prompt information; In the case where only the suspected wrong character exists during the name information correction and completion process, when there are multiple different second-category candidate Chinese characters, and the similarity with the suspected wrong character is the same and the highest, generating and outputting the second-category prompt information; When the missing characters and the suspected wrong characters exist simultaneously during the name information correction and completion process, when there are multiple different third-category candidate Chinese characters, and their similarity with the suspected wrong characters is the same and the highest, the third-category prompt information is generated and output; when there are multiple third-category candidate Chinese characters, and their similarity with the suspected wrong characters is the same and the highest, and the Chinese characters aligned with the missing characters in each of the third-category candidate Chinese characters are different, or the fourth-category prompt information is generated and output.

3. The method for identifying the names of the buyer and seller of an invoice according to claim 1, characterized in that: The method further comprises: During the process of executing the name information error correction and completion, if there are no missing characters or suspected wrong characters, and the confidence of each Chinese character is higher than the second set value, the recognized name information is added to the preset name database.

4. The method for identifying the names of the buyer and seller of an invoice according to claim 1, characterized in that: The name information is expressed in an array, wherein non-zero numbers represent the position subscripts of the Chinese characters recognized by the optical character recognition model in the character library, the distance between Chinese characters is marked with the character 0, and the number of the character 0 between the non-zero numbers is proportional to the distance between the corresponding Chinese characters.

5. The method for identifying the names of the buyer and seller of an invoice according to claim 4, characterized in that: According to the spacing between Chinese characters, determine whether there are missing characters according to preset rules, including: The number of characters between the non-zero numbers in the array is used as the distance between the corresponding Chinese characters, and the median is taken; A multiple threshold is set. If the distance between Chinese characters is greater than the product of the median value and the multiple threshold, it indicates that there are missing characters between the corresponding Chinese characters.

6. The method for identifying the names of the buyer and seller of an invoice according to claim 1, characterized in that: The preset name database is connected to the tax department server for updating at set intervals.

7. The method for identifying the names of the buyer and seller of an invoice according to claim 3, characterized in that: The first setting value is greater than or equal to 85%, and the second setting value is greater than or equal to 99%.

8. A device for identifying the name of a buyer or seller of an invoice, comprising a processor, a memory, and a computer program / instruction stored in the memory, characterized in that: The processor is used to execute the computer program / instructions. When the computer program / instructions are executed, the device implements the steps of the method according to any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method as claimed in any one of claims 1 to 7 are implemented.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.