Method, device, storage medium and equipment for correcting digital character recognition result
By obtaining the constraints of the digit character recognition results and using similar digit characters for replacement, the problems of low efficiency and low accuracy in correcting digit character recognition results are solved, and efficient and accurate digit character correction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN INT FINANCIAL LEASING CO LTD
- Filing Date
- 2023-07-24
- Publication Date
- 2026-05-08
AI Technical Summary
Existing methods for correcting digit character recognition results are inefficient and inaccurate, especially when digit characters are misidentified as other digit characters.
By obtaining the recognition results of numeric characters and their corresponding constraints, when it is determined that the recognition result is incorrect, the corresponding numeric character is replaced with a similar numeric character. The replacement rule is determined according to the constraint type, and the target numeric character correction result that meets the constraint conditions is obtained.
It greatly reduces the workload of replacement and improves the efficiency and accuracy of correction, especially in scenarios involving the recognition of documents, medical information, and insurance information.
Smart Images

Figure CN116935407B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, storage medium, and device for correcting digital character recognition results. Background Technology
[0002] Optical Character Recognition (OCR) refers to the process of analyzing and recognizing image files to obtain layout information and returning it in the form of text. However, OCR recognition may make mistakes and needs to be corrected.
[0003] Currently, when a numeric character is mistakenly identified as another numeric character, the 10 numeric characters 0-9 are used for replacement, but this method is inefficient and has low accuracy. Summary of the Invention
[0004] In view of this, the present invention provides a method, apparatus, storage medium and device for correcting the results of digital character recognition, which can solve the technical problem of low correction efficiency and low correction accuracy when digital characters are recognized as other digital characters.
[0005] According to one aspect of the present invention, a method for correcting the results of digital character recognition is provided, the method comprising:
[0006] Obtain the digit character recognition results and the corresponding constraints of the digit character recognition results;
[0007] When the constraint condition is used to determine that the digit character recognition result is incorrect, similar digit characters corresponding to each digit character in the digit character recognition result are obtained.
[0008] By replacing the corresponding numeric characters with the similar numeric characters, a target numeric character correction result that meets the constraints is obtained.
[0009] Preferably, the step of replacing the corresponding numeric character with the similar numeric character to obtain the target numeric character correction result that meets the constraints includes:
[0010] Determine the constraint type of the constraint condition, wherein the constraint type includes greater than a first preset value, less than a second preset value, and greater than the first preset value and less than the second preset value;
[0011] Based on the constraint type, a replacement rule is determined, and the corresponding numeric character is replaced with the similar numeric character using the replacement rule to obtain the target numeric character correction result that meets the constraint conditions.
[0012] Preferably, if the constraint type is greater than the first preset value, then each first target numeric character of the first preset value is determined, the first smallest similar numeric character among the similar numeric characters corresponding to the numeric character that is greater than or equal to the first target numeric character in the corresponding position is selected, and the numeric character in the same position is replaced by the first smallest similar numeric character to obtain the first numeric character correction result;
[0013] If the first numeric character correction result is greater than the first preset value, then the first numeric character correction result is taken as the minimum target numeric character correction result;
[0014] If the first numeric character correction result is equal to the first preset value, then the first least significant numeric character of the first numeric character correction result and the least significant numeric character in the numeric character recognition result are determined. It is then determined whether there is a second least similar numeric character greater than the first least similar numeric character in the similar numeric characters corresponding to the least significant numeric character. If so, the first least significant numeric character is replaced by the second least similar numeric character to obtain the minimum target numeric character correction result. If not, the first numeric character correction result is carried over step by step until the minimum target numeric character correction result is obtained.
[0015] Based on the minimum target numeric character correction result and the similar numeric characters corresponding to the numeric character, a target numeric character correction result greater than the first preset value is obtained.
[0016] Preferably, the step of determining the replacement rule according to the constraint type, and using the replacement rule and the similar numeric characters to replace the corresponding numeric characters to obtain the target numeric character correction result that meets the constraint conditions, further includes:
[0017] If the constraint type is less than the second preset value, then determine each second target numeric character of the second preset value, select the first maximum similar numeric character among the similar numeric characters corresponding to the numeric character that is less than or equal to the corresponding position of the second target numeric character, and replace the numeric character of the same position with the first maximum similar numeric character to obtain the second numeric character correction result;
[0018] If the second numeric character correction result is less than the second preset value, then the second numeric character correction result is taken as the maximum target numeric character correction result;
[0019] If the second numeric character correction result is equal to the second preset value, then the second least significant numeric character of the second numeric character correction result is determined, and it is determined whether there is a second maximum similar numeric character smaller than the first maximum similar numeric character in the similar numeric characters corresponding to the least significant numeric character. If so, the second least significant numeric character is replaced by the second maximum similar numeric character to obtain the maximum target numeric character correction result. If not, the second numeric character correction result is gradually borrowed until the maximum target numeric character correction result is obtained.
[0020] Based on the maximum target numeric character correction result and the similar numeric characters corresponding to the numeric character, a target numeric character correction result less than the second preset value is obtained.
[0021] Preferably, the step of determining the replacement rule according to the constraint type, and using the replacement rule and the similar numeric characters to replace the corresponding numeric characters to obtain the target numeric character correction result that meets the constraint conditions, further includes:
[0022] If the constraint type is greater than the first preset value and less than the second preset value;
[0023] If the minimum target numeric character correction result is less than the second preset value and the maximum target numeric character correction result is greater than the first preset value, then based on the minimum target numeric character correction result, the maximum target numeric character correction result, and the similar numeric characters corresponding to the numeric character, a target numeric character correction result greater than the first preset value and less than the second preset value is obtained.
[0024] Preferably, the stepwise carry operation includes:
[0025] Determine the second lowest digit character in the digit character recognition result;
[0026] Determine whether there exists a second minimum similar digit character that is greater than the first minimum similar digit character in the corresponding position among the similar digit characters corresponding to the second lowest digit character;
[0027] If so, then the first low-order digit character of the first digit character correction result is replaced with the second smallest similar digit character, and the first lowest digit character is replaced with the smallest number among the similar digit characters corresponding to the lowest digit character;
[0028] If not, proceed with the carry operation.
[0029] Preferably, the step-by-step borrowing operation includes:
[0030] Determine the second lowest digit character in the digit character recognition result;
[0031] Determine whether there exists a second maximum similar digit character among the similar digit characters corresponding to the second lowest digit character that is less than the first maximum similar digit character in the corresponding position;
[0032] If so, then the second least significant digit character of the second digit character correction result is replaced with the second largest similar digit character, and the second least significant digit character is replaced with the largest number among the similar digit characters corresponding to the least significant digit character;
[0033] If not, then proceed with the borrowing operation.
[0034] According to another aspect of the present invention, a device for correcting the results of digital character recognition is provided, the device comprising:
[0035] The acquisition module is used to acquire the numeric character recognition results and the constraints corresponding to the numeric character recognition results;
[0036] The judgment module is used to obtain similar digit characters corresponding to each digit character in the digit character recognition result when the constraint conditions are used to determine that the digit character recognition result is incorrect;
[0037] The correction module is used to replace the corresponding numeric character with the similar numeric character to obtain the target numeric character correction result that meets the constraints.
[0038] According to another aspect of the present invention, a storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described method for correcting the results of digital character recognition.
[0039] According to another aspect of the present invention, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the program to implement the above-described method for correcting the digital character recognition results.
[0040] By employing the above technical solution, the present invention provides a method, apparatus, storage medium, and device for correcting digit character recognition results. First, it acquires the digit character recognition results and the corresponding constraints. Then, when the constraints indicate an error in the digit character recognition result, it acquires similar digit characters corresponding to each digit character in the digit character recognition result. Finally, it replaces the corresponding digit characters with similar digit characters to obtain the target digit character correction result that meets the constraints. Through the technical solution of the present invention, using similar digit character replacement, compared to replacing each and all 10 digit characters from 0-9 individually, greatly reduces the workload of replacement, improves correction efficiency, and increases the accuracy of correcting digit character recognition results.
[0041] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0042] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of this application. In the drawings:
[0043] Figure 1 A flowchart illustrating a method for correcting digital character recognition results provided in an embodiment of the present invention is shown.
[0044] Figure 2 A flowchart illustrating another method for correcting digital character recognition results provided in an embodiment of the present invention is shown.
[0045] Figure 3 A schematic diagram of the structure of a digital character recognition result correction device provided in an embodiment of the present invention is shown;
[0046] Figure 4 A schematic diagram of another digital character recognition result correction device provided in an embodiment of the present invention is shown. Detailed Implementation
[0047] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0048] To address the technical problem of low efficiency and low accuracy in correcting the recognition of numeric characters as other numeric characters, this embodiment provides a method for correcting numeric character recognition results, such as... Figure 1As shown, the method includes:
[0049] 101. Obtain the results of numeric character recognition and the corresponding constraints.
[0050] 102. When using constraints to determine that the digit character recognition result is incorrect, obtain the similar digit characters corresponding to each digit character in the digit character recognition result.
[0051] It should be noted that steps 101-103 of this embodiment are applicable to situations where a digit in the digit character recognition result is recognized as another digit, resulting in an error in the digit character recognition result. The digit character recognition result includes at least one digit.
[0052] For steps 101 and 102 of the embodiment, firstly, the constraint conditions are used to determine whether the number character recognition result is wrong. If the number character recognition result meets the constraint conditions, then the number character recognition result is not wrong. If the number character recognition result does not meet the constraint conditions, then the number character recognition result is wrong. The constraint conditions are determined according to the specific application scenario. For example, in the scenario of document recognition, the constraint condition corresponding to the birth date must be less than the current date.
[0053] Then, when the numeric character recognition result is incorrect, the numeric character recognition result needs to be corrected, including step 102 and step 103 of the embodiment. For step 102 of the embodiment, specifically:
[0054] (1) A large-scale statistical analysis was conducted to obtain similar digit characters in terms of character shape among the 10 digit characters 0-9. For example, 9 is similar to 9, 0, and 8; 8 is similar to 8, 9, 6, and 0; 7 is similar to 7, 2, and 1; 6 is similar to 6, 8, and 0; 5 is similar to 5 and 3; 3 is similar to 3, 5, and 2; 2 is similar to 2, 7, and 3; 1 is similar to 1 and 7; and 0 is similar to 0, 9, 8, and 6. However, 4 is not similar to the other 9 digit characters. There are basically no cases of incorrect recognition (the reason for incorrect recognition is that a certain general feature in the character shape is amplified during recognition, while the distinguishing feature may be lost. For example, 7 is similar to 2 because the distinguishing feature of the bottom horizontal line of 2 is lost. Another example is 3 and 2 because the distinguishing feature of the middle horizontal line of 3 is lost).
[0055] (2) Obtain the similar digit characters corresponding to each digit character in the digit character recognition result. For example, if the recognition result is 75, obtain the similar digit characters 7, 2, and 1 for 7, and obtain the similar digit characters 5 and 3 for 5.
[0056] 103. Replace the corresponding numeric characters with similar numeric characters to obtain the target numeric character correction result that meets the constraints.
[0057] In this embodiment, as one implementation method, similar numeric characters are enumerated and replaced with corresponding numeric characters. From the replacement results, at least one target numeric character correction result that meets the constraint conditions is selected. Specifically, if the numeric character recognition result includes only one numeric character, for example, if the numeric character recognition result is 9 and the constraint condition is less than 5, then the similar numeric characters 9, 0, and 8 are obtained, and the replacement results are 9, 0, and 8. Only 0 is less than 5, so the target numeric character correction result is 0. If the numeric character recognition result includes more than one numeric character, for example, if the numeric character recognition result is 75 and the constraint condition is less than 21, then the similar numeric characters 7, 2, and 1 are obtained for 7, and the similar numeric characters 5 and 3 are obtained for 5. The replacement results are 73, 15, 13, 25, and 23, where only 15 and 13 are less than 21, so the target numeric character correction result is 15 or 13. The choice between 15 and 13 can be further determined based on the actual application scenario; either 15 or 13 can be used, and no limitation is made here.
[0058] Taking the example of a digit character recognition result containing only one digit, we can illustrate the effect of using similar digit characters: If we do not use similar digit characters to replace the corresponding digit characters, then we need to replace each of the 10 digits from 0 to 9 once. There are 5 cases from 0 to 4 that meet the constraint of less than 5. We also need to continue to determine which one is correct from a larger range of 5 cases from 0 to 4. Therefore, using similar digit characters to replace the corresponding digit characters can not only improve the correction efficiency, but also improve the correction accuracy.
[0059] This invention provides a method, apparatus, storage medium, and device for correcting digit character recognition results. First, it acquires the digit character recognition results and the corresponding constraints. Then, when the constraints indicate an error in the digit character recognition result, it acquires similar digit characters corresponding to each digit character in the digit character recognition result. Finally, it replaces the corresponding digit characters with similar digit characters to obtain the corrected target digit character that meets the constraints. By using similar digit character replacement, compared to replacing each and all 10 digits (0-9) individually, the workload of replacement is greatly reduced, efficiency is improved, and the accuracy of correcting digit character recognition results is also increased.
[0060] Furthermore, as a refinement and extension of the specific implementation methods described above, and to fully illustrate the specific implementation process in this embodiment, another method for correcting the digital character recognition results is provided, such as... Figure 2 As shown, the method includes:
[0061] 201. Obtain the results of numeric character recognition and the corresponding constraints.
[0062] 202. When the constraint conditions are used to determine that the digit character recognition result is incorrect, obtain the similar digit characters corresponding to each digit character in the digit character recognition result.
[0063] The specific implementation method is the same as steps 101 and 102 of the embodiment, and will not be repeated here.
[0064] 203. Determine the constraint type of the constraint condition, wherein the constraint type includes greater than the first preset value, less than the second preset value, and greater than the first preset value and less than the second preset value.
[0065] 204. Determine the replacement rule based on the constraint type, and use the replacement rule to replace the corresponding numeric characters with similar numeric characters to obtain the target numeric character correction result that meets the constraint conditions.
[0066] It should be noted that, for steps 203 and 204 of the embodiment, in order to further improve the correction efficiency, when replacing the corresponding numeric character with a similar numeric character, the enumeration replacement method is not adopted. Instead, different replacement rules are determined according to different constraint types. In the specific replacement, the corresponding numeric character is replaced with the replacement rule and the similar numeric character.
[0067] In specific application scenarios, if it is necessary to obtain the correction results of all target numeric characters that meet the constraints, three replacement rules are determined according to the constraint type, as follows:
[0068] The first replacement rule corresponding to the first constraint type (e.g., the numeric character recognition result is 2975, and each numeric character in the numeric character recognition result is 2, 9, 7, 5): If the constraint type is greater than the first preset value (e.g., the first preset value is 3825), then determine each first target numeric character (3, 8, 2, 5) of the first preset value (3825), and select the first smallest similar numeric character greater than or equal to the corresponding first target numeric character among the similar numeric characters corresponding to the numeric character (for the thousands place, the similar numeric characters corresponding to the numeric character 2 are 2, 7, 3, 2, 7, 3). The first target digit character 3, which is greater than or equal to the thousands place, can be either 7 or 3. However, not both 7 and 3 are suitable; the smaller of these two must be chosen. Therefore, the smallest similar digit character for the thousands place is 3. For the hundreds place, the similar digit characters corresponding to the digit 9 are 9, 0, and 8. Among these, the first target digit character 8, which is greater than or equal to the hundreds place, can be either 9 or 8. The smaller of 9 and 8 is 8. Similarly, the smallest similar digit character for the tens place is 2, and for the units place is 5. The smallest similar digit character is used to replace the digit in the same place. The character is used to obtain the first numeric character correction result (3825). If the first numeric character correction result is greater than the first preset value, the first numeric character correction result is used as the minimum target numeric character correction result. If the first numeric character correction result is equal to the first preset value (this is the case in this embodiment), the first least significant numeric character (5) of the first numeric character correction result (3825) and the least significant numeric character (5) in the numeric character recognition result (2975) are determined. It is then determined whether there is a second least similar numeric character greater than the first least similar numeric character (5 in 3825) among the similar numeric characters (5, 3) corresponding to the least significant numeric character (5 in 2975). If so, the first least significant numeric character is replaced by the second least similar numeric character to obtain the minimum target numeric character correction result. If not, the first numeric character correction result is carried over step by step (since there is no smallest number greater than 5 in 5 and 3, it is necessary to carry over step by step) until the minimum target numeric character correction result is obtained. Based on the minimum target numeric character correction result and the similar numeric characters corresponding to the numeric character, the target numeric character correction result greater than the first preset value is obtained.
[0069] The difference between the first minimum similar digit character and the second minimum similar digit character is that the first minimum similar digit character is the smallest number of similar digit characters that is greater than or equal to the first target digit character, while the second minimum similar digit character is the smallest number of similar digit characters that is greater than the first minimum similar digit character.
[0070] It should be noted that the idea of carry operation is: the lower-order digit character is carried up to the largest number in the order of similar digit characters, and then carried to the next higher position. This process is repeated recursively, and the current position is reduced to the smallest number among the similar digit characters. Specifically, the carry operation is performed step by step, including: determining the second lowest digit character in the digit character recognition result (2975) (the tens digit is the second lowest digit, and the second lowest digit character is 7); determining whether there is a second smallest similar digit character greater than the first smallest similar digit character in the corresponding position (the first smallest similar digit character in the tens digit is 2) among the similar digit characters (7, 2, 1) corresponding to the second lowest digit character (7, 2, 1) (7 is the smallest number greater than 2, so the second smallest similar digit character in the tens digit is 7); if so, then the second smallest similar digit character (7) is used to replace the first lowest digit character in the first digit character correction result (3825) (the tens digit is the second lowest digit, and the first lowest digit character is 2), and the first lowest digit character (the first lowest digit character in the first digit character correction result 3825 is 5) is replaced with the smallest number (3) among the similar digit characters (5, 3) corresponding to the lowest digit character (5 in 2975); if not, the carry operation is performed further.
[0071] After performing a carry-over operation, the value changes from 3825 to 3873. Since 3873 is the smallest number greater than the first preset value of 3825, 3873 is the smallest target numeric character correction result, and no further carry-over operation is required.
[0072] After obtaining the minimum target numeric character correction result, for similar numeric characters corresponding to the minimum target numeric character correction result, a target numeric character correction result greater than the first preset value is obtained. Specifically, since the minimum target numeric character correction result 3873 is the smallest number greater than the first preset value 3825, in order to obtain all target numeric character correction results that meet the constraints, as an implementation method, all results greater than the minimum target numeric character correction result 3873 among similar numeric characters can be enumerated. All results greater than the minimum target numeric character correction result 3873 and the minimum target numeric character correction result 3873 are all target numeric character correction results. If all similar numeric characters are used for enumeration and replacement, it is necessary to filter out those that meet the constraints from the replacement results. However, in this embodiment, the replacement rule set for values greater than the first preset value determines the minimum value greater than the first preset value, i.e., the minimum target numeric character correction result. Therefore, it is only necessary to enumerate all results greater than the minimum target numeric character correction result. The minimum target numeric character correction result and all results greater than the minimum target numeric character correction result are necessarily greater than the first preset value, eliminating the need for filtering and improving the correction efficiency.
[0073] The second type of constraint corresponds to the second replacement rule: If the constraint type is less than the second preset value (for example, the numeric character recognition result is 2975, each numeric character in the numeric character recognition result is 2, 9, 7, 5, and the second preset value is 3978), then determine each second target numeric character (3, 9, 7, 8) of the second preset value (3978), and select the first largest similar numeric character less than or equal to the corresponding second target numeric character among the similar numeric characters corresponding to the numeric character (for the thousands place, the similar numeric characters corresponding to the numeric character 2 are 2, 7, 3, among which 2, 7, 3 are less than or equal to the second target numeric character 3 of the thousands place, but not both 3 and 2 are acceptable, but the largest number among 3 and 2 must be selected, therefore, the first largest similar numeric character for the thousands place is 3; for the hundreds place, the similar numeric characters corresponding to the numeric character 9 are 9, 0, 8, among which 9, 0, and 8 are less than or equal to the second target numeric character 9 of the hundreds place, the largest number among 9, 0, and 8 is the first largest similar numeric character for the hundreds place, which is 9, and the same applies to the tens place). The largest similar digit character is 7, and the first largest similar digit character in the units place is 5. The first largest similar digit character is used to replace the digit character in the same position to obtain the second digit character correction result (3975). If the second digit character correction result is less than the second preset value, the second digit character correction result is used as the largest target digit character correction result (this embodiment belongs to this case). If the second digit character correction result is equal to the second preset value, the second least significant digit character of the second digit character correction result is determined. It is determined whether there is a second largest similar digit character less than the first largest similar digit character in the corresponding position among the similar digit characters corresponding to the least significant digit character. If so, the second least significant digit character is replaced by the second largest similar digit character to obtain the largest target digit character correction result. If not, the second digit character correction result is gradually borrowed until the largest target digit character correction result is obtained. Based on the largest target digit character correction result and the corresponding similar digit characters, the target digit character correction result less than the second preset value is obtained.
[0074] The difference between the first maximum similar digit character and the second maximum similar digit character is that the first maximum similar digit character is the largest number of similar digit characters that is less than or equal to the second target digit character, while the second maximum similar digit character is the largest number of similar digit characters that is less than the first maximum similar digit character.
[0075] It's important to explain that the borrowing operation works as follows: The lowest-order digit is determined by sequentially borrowing from the next higher digit based on similar digits, from largest to smallest. This process is repeated recursively until the current digit is raised to the largest number among similar digits. Specifically, the borrowing operation involves: identifying the second-lowest-order digit in the digit recognition result; determining if there exists a second-largest similar digit among the similar digits corresponding to the second-lowest-order digit; if so, replacing the second-lowest-order digit in the second-digit correction result with the second-largest similar digit, and replacing the second-lowest-order digit with the largest number among the similar digits corresponding to the lowest-order digit; otherwise, further borrowing is performed.
[0076] After obtaining the correction result of the maximum target numeric character, for the similar numeric characters corresponding to the numeric character, the correction result of the target numeric character less than the second preset value is obtained. Specifically, since the correction result of the maximum target numeric character is the maximum value less than the second preset value, in order to obtain all the correction results of the target numeric characters that meet the constraints, as an implementation method, all the results of the similar numeric characters corresponding to the numeric character that are less than the correction result of the maximum target numeric character can be enumerated. All the results less than the correction result of the maximum target numeric character and the correction result of the maximum target numeric character are all the correction results of the target numeric characters.
[0077] The third type of constraint corresponds to the third replacement rule: If the constraint type is greater than the first preset value (e.g., the first preset value is 3825) and less than the second preset value (e.g., the second preset value is 3978); if the minimum target numeric character correction result is less than the second preset value and the maximum target numeric character correction result is greater than the first preset value (the minimum target numeric character correction result is already greater than the first preset value, and the maximum target numeric character correction result is already less than the second preset value; in the example above, the minimum target numeric character correction result is 3873, which is less than the second preset value 3978, and the maximum target numeric character correction result is 3975, which is greater than the first preset value 3825), then based on the minimum target numeric character correction result, the maximum target numeric character correction result, and the numeric character... The similar numeric characters corresponding to the symbol are used to obtain the target numeric character correction result that is greater than the first preset value and less than the second preset value (the minimum target numeric character correction result is 3873, and the maximum target numeric character correction result is 3975. As an implementation method, all results that are greater than the minimum target numeric character correction result 3873 and less than the maximum target numeric character correction result 3975 among the similar numeric characters corresponding to the numeric character can be enumerated. All results that are greater than the minimum target numeric character correction result 3873 and less than the maximum target numeric character correction result 3975, the minimum target numeric character correction result 3873 and the maximum target numeric character correction result 3975 are all target numeric character correction results that are greater than the first preset value and less than the second preset value).
[0078] In specific application scenarios, if only a target numeric character correction result that meets the constraints is needed, then three replacement rules are determined based on the constraint type, as follows:
[0079] The first replacement rule corresponding to the first constraint type: If the constraint type is greater than the first preset value, then the minimum target numeric character correction result is the target numeric character correction result;
[0080] The second replacement rule corresponding to the second constraint type: If the constraint type is less than the second preset value, then the maximum target numeric character correction result is the target numeric character correction result.
[0081] The third replacement rule corresponding to the third constraint type: If the constraint type is greater than the first preset value and less than the second preset value, then as one implementation method, it is determined whether the minimum target numeric character correction result is less than the second preset value. If the minimum target numeric character correction result is less than the second preset value, then the minimum target numeric character correction result is the target numeric character correction result; as another implementation method, it is determined whether the maximum target numeric character correction result is greater than the first preset value. If the maximum target numeric character correction result is greater than the first preset value, then the maximum target numeric character correction result is the target numeric character correction result.
[0082] This embodiment applies to all scenarios where the recognition result of numeric characters is incorrectly identified as other numeric characters and correction is required, such as document recognition scenarios (e.g., the numeric characters of ID card numbers are incorrectly recognized), medical information recognition scenarios (e.g., the numeric characters of drug batch numbers are incorrectly recognized), insurance information recognition scenarios (e.g., the numeric characters of insurance order numbers are incorrectly recognized), etc.
[0083] This invention provides a method, apparatus, storage medium, and device for correcting digit character recognition results. First, it acquires the digit character recognition results and the corresponding constraints. Then, when the constraints indicate an error in the digit character recognition result, it acquires similar digit characters corresponding to each digit character in the digit character recognition result. Finally, it replaces the corresponding digit characters with similar digit characters to obtain the corrected target digit character that meets the constraints. By using similar digit character replacement, compared to replacing each and all 10 digits (0-9) individually, the workload of replacement is greatly reduced, efficiency is improved, and the accuracy of correcting digit character recognition results is also increased.
[0084] Furthermore, as Figure 1 and Figure 2 The specific implementation of the method shown in this invention provides a device for correcting the results of digital character recognition, such as... Figure 3 As shown, the device includes: an acquisition module 31, a judgment module 32, and a correction module 33;
[0085] The acquisition module 31 can be used to acquire the numeric character recognition result and the constraint conditions corresponding to the numeric character recognition result;
[0086] The judgment module 32 can be used to obtain similar digit characters corresponding to each digit character in the digit character recognition result when the constraint conditions are used to determine that the digit character recognition result is incorrect;
[0087] The correction module 33 can be used to replace the corresponding numeric character with the similar numeric character to obtain the target numeric character correction result that meets the constraints.
[0088] Accordingly, in order to replace the corresponding numeric character with the similar numeric character and obtain the target numeric character correction result that meets the constraints, the correction module 33 may specifically include: a determination unit 331 and a replacement unit 332;
[0089] The determining unit 331 is used to determine the constraint type of the constraint condition, wherein the constraint type includes greater than a first preset value, less than a second preset value, and greater than the first preset value and less than the second preset value;
[0090] The replacement unit 332 is used to determine the replacement rule according to the constraint type, and use the replacement rule and the similar numeric characters to replace the corresponding numeric characters to obtain the target numeric character correction result that meets the constraint conditions.
[0091] Accordingly, in order to determine the replacement rule based on the constraint type, and to replace the corresponding numeric character with the similar numeric character using the replacement rule to obtain the target numeric character correction result that meets the constraint conditions, the replacement unit 332 can be specifically used to: if the constraint type is greater than the first preset value, determine each digit of the first target numeric character of the first preset value, select the first smallest similar numeric character among the similar numeric characters corresponding to the numeric character that is greater than or equal to the corresponding digit of the first target numeric character, and replace the numeric character of the same digit with the first smallest similar numeric character to obtain the first numeric character correction result; if the first numeric character correction result is greater than the first preset value, then take the first numeric character correction result as the smallest target numeric character correction result; if the first... If the numeric character correction result is equal to the first preset value, then the first least significant numeric character of the first numeric character correction result and the least significant numeric character in the numeric character recognition result are determined. It is then determined whether there is a second least similar numeric character greater than the first least similar numeric character in the similar numeric characters corresponding to the least significant numeric character. If so, the first least significant numeric character is replaced by the second least similar numeric character to obtain the minimum target numeric character correction result. If not, the first numeric character correction result is progressively carried over until the minimum target numeric character correction result is obtained. Based on the minimum target numeric character correction result and the similar numeric characters corresponding to the numeric character, a target numeric character correction result greater than the first preset value is obtained.
[0092] Accordingly, in order to determine the replacement rule based on the constraint type, and to replace the corresponding numeric character with the similar numeric character using the replacement rule to obtain the target numeric character correction result that meets the constraint conditions, the replacement unit 332 can also be used to determine each bit of the second target numeric character of the second preset value if the constraint type is less than the second preset value, select the first maximum similar numeric character among the similar numeric characters corresponding to the numeric character that is less than or equal to the corresponding bit of the second target numeric character, and replace the numeric character at the same bit with the first maximum similar numeric character to obtain the second numeric character correction result; if the second numeric character correction result is less than the second preset value, then the second numeric character correction result is taken as the maximum target numeric character. The correction result is obtained as follows: If the second numeric character correction result is equal to the second preset value, the second least significant numeric character of the second numeric character correction result is determined. It is then determined whether there is a second maximum similar numeric character smaller than the first maximum similar numeric character in the similar numeric characters corresponding to the least significant numeric character. If so, the second least significant numeric character is replaced by the second maximum similar numeric character to obtain the maximum target numeric character correction result. If not, the second numeric character correction result is gradually borrowed until the maximum target numeric character correction result is obtained. Based on the maximum target numeric character correction result and the similar numeric characters corresponding to the numeric character, a target numeric character correction result smaller than the second preset value is obtained.
[0093] Accordingly, in order to determine the replacement rule based on the constraint type, and replace the corresponding numeric character with the similar numeric character using the replacement rule to obtain the target numeric character correction result that meets the constraint conditions, the replacement unit 332 can also be used to obtain a target numeric character correction result that is greater than the first preset value and less than the second preset value if the constraint type is greater than the first preset value and less than the second preset value; if the minimum target numeric character correction result is less than the second preset value and the maximum target numeric character correction result is greater than the first preset value, then based on the minimum target numeric character correction result, the maximum target numeric character correction result, and the similar numeric character corresponding to the numeric character, a target numeric character correction result that is greater than the first preset value and less than the second preset value is obtained.
[0094] Accordingly, in order to perform carry-over operations step by step, the replacement unit 332 can also be used to determine the second lowest digit character in the digit character recognition result; determine whether there is a second smallest similar digit character greater than the first smallest similar digit character in the similar digit characters corresponding to the second lowest digit character; if so, replace the first lowest digit character in the first digit character correction result with the second smallest similar digit character, and replace the first lowest digit character with the smallest number among the similar digit characters corresponding to the lowest digit character; if not, further perform carry-over operations.
[0095] Accordingly, in order to perform the borrowing operation step by step, the replacement unit 332 can also be used to determine the second lowest digit character in the digit character recognition result; determine whether there is a second largest similar digit character among the similar digit characters corresponding to the second lowest digit character that is smaller than the first largest similar digit character in the corresponding position; if so, then the second lowest digit character in the second digit character correction result is replaced with the second largest similar digit character, and the second lowest digit character is replaced with the largest number among the similar digit characters corresponding to the lowest digit character; if not, then the borrowing operation is further performed.
[0096] It should be noted that other corresponding descriptions of the functional units involved in the digital character recognition result correction device provided in this embodiment can be found in [reference]. Figures 1 to 2 The corresponding description will not be repeated here.
[0097] Based on the above, Figures 1 to 2 Accordingly, this embodiment also provides a storage medium, which may be volatile or non-volatile, storing a computer program that, when executed by a processor, implements the above-described method. Figures 1 to 2 The method for correcting the digit character recognition results shown.
[0098] Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present invention.
[0099] Based on the above, Figures 1 to 2 The method shown and Figure 3 , Figure 4To achieve the above objectives, the present application also provides a computer device, specifically a personal computer, server, network device, etc., as shown in the virtual device embodiment. This computer device includes a storage medium and a processor; the storage medium stores a computer program; the processor executes the computer program to achieve the above-described objectives. Figure 1 and Figure 2 The method for correcting the digit character recognition results shown.
[0100] Optionally, the computer device may also include a user interface, a network interface, a camera, radio frequency (RF) circuitry, sensors, audio circuitry, a Wi-Fi module, etc. The user interface may include a display screen, input units such as a keyboard, etc., and optional user interfaces may also include USB interfaces, card reader interfaces, etc. The network interface may optionally include standard wired interfaces, wireless interfaces (such as Wi-Fi interfaces), etc.
[0101] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or combine certain components, or have different component arrangements.
[0102] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the aforementioned computer device, supporting the operation of information processing programs and other software and / or programs. The network communication module is used to enable communication between the various components within the non-volatile storage medium, as well as communication with other hardware and software in the information processing entity device.
[0103] Through the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus necessary general-purpose hardware platform, or it can be implemented by hardware.
[0104] This invention provides a method, apparatus, storage medium, and device for correcting digit character recognition results. First, it acquires the digit character recognition results and the corresponding constraints. Then, when the constraints indicate an error in the digit character recognition result, it acquires similar digit characters corresponding to each digit character in the digit character recognition result. Finally, it replaces the corresponding digit characters with similar digit characters to obtain the corrected target digit character that meets the constraints. By using similar digit character replacement, compared to replacing each and all 10 digits (0-9) individually, the workload of replacement is greatly reduced, efficiency is improved, and the accuracy of correcting digit character recognition results is also increased.
[0105] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing the present invention. Those skilled in the art will understand that the modules in the apparatus of the embodiment can be distributed within the apparatus of the embodiment as described, or they can be located in one or more apparatuses different from this embodiment, with corresponding changes. The modules of the above-described embodiment can be combined into one module, or further divided into multiple sub-modules.
[0106] The serial numbers used above are for descriptive purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosures are merely a few specific implementation scenarios of the present invention; however, the present invention is not limited thereto, and any variations conceived by those skilled in the art should fall within the protection scope of the present invention.
Claims
1. A method for correcting the results of digital character recognition, characterized in that, The method includes: Obtain the digit character recognition results and the corresponding constraints of the digit character recognition results; When the constraint condition is used to determine that the digit character recognition result is incorrect, similar digit characters corresponding to each digit character in the digit character recognition result are obtained. By replacing the corresponding numeric character with the similar numeric character, a target numeric character correction result that meets the constraints is obtained; The step of replacing the corresponding numeric character with the similar numeric character to obtain the target numeric character correction result that meets the constraints includes: Determine the constraint type of the constraint condition, wherein the constraint type includes greater than a first preset value, less than a second preset value, and greater than the first preset value and less than the second preset value; Based on the constraint type, a replacement rule is determined, and the corresponding numeric character is replaced with the similar numeric character using the replacement rule to obtain the target numeric character correction result that meets the constraint conditions. The step of determining the replacement rule according to the constraint type, and using the replacement rule and the similar numeric characters to replace the corresponding numeric characters to obtain the target numeric character correction result that meets the constraint conditions includes: If the constraint type is greater than the first preset value, then determine each first target numeric character of the first preset value, select the first smallest similar numeric character among the similar numeric characters corresponding to the numeric character that is greater than or equal to the first target numeric character in the corresponding position, and replace the numeric character in the same position with the first smallest similar numeric character to obtain the first numeric character correction result; If the first numeric character correction result is greater than the first preset value, then the first numeric character correction result is taken as the minimum target numeric character correction result; If the first numeric character correction result is equal to the first preset value, then the first least significant numeric character of the first numeric character correction result and the least significant numeric character in the numeric character recognition result are determined. It is then determined whether there is a second least similar numeric character greater than the first least similar numeric character in the similar numeric characters corresponding to the least significant numeric character. If so, the first least significant numeric character is replaced by the second least similar numeric character to obtain the minimum target numeric character correction result. If not, the first numeric character correction result is carried over step by step until the minimum target numeric character correction result is obtained. Based on the minimum target numeric character correction result and the similar numeric characters corresponding to the numeric character, a target numeric character correction result greater than the first preset value is obtained.
2. The method according to claim 1, characterized in that, The step of determining a replacement rule based on the constraint type, and using the replacement rule and the similar numeric characters to replace the corresponding numeric characters to obtain a target numeric character correction result that meets the constraint conditions, further includes: If the constraint type is less than the second preset value, then determine each second target numeric character of the second preset value, select the first maximum similar numeric character among the similar numeric characters corresponding to the numeric character that is less than or equal to the corresponding position of the second target numeric character, and replace the numeric character of the same position with the first maximum similar numeric character to obtain the second numeric character correction result; If the second numeric character correction result is less than the second preset value, then the second numeric character correction result is taken as the maximum target numeric character correction result; If the second numeric character correction result is equal to the second preset value, then the second least significant numeric character of the second numeric character correction result is determined, and it is determined whether there is a second maximum similar numeric character smaller than the first maximum similar numeric character in the similar numeric characters corresponding to the least significant numeric character. If so, the second least significant numeric character is replaced by the second maximum similar numeric character to obtain the maximum target numeric character correction result. If not, the second numeric character correction result is gradually borrowed until the maximum target numeric character correction result is obtained. Based on the maximum target numeric character correction result and the similar numeric characters corresponding to the numeric character, a target numeric character correction result less than the second preset value is obtained.
3. The method according to claim 2, characterized in that, The step of determining a replacement rule based on the constraint type, and using the replacement rule and the similar numeric characters to replace the corresponding numeric characters to obtain a target numeric character correction result that meets the constraint conditions, further includes: If the constraint type is greater than the first preset value and less than the second preset value; If the minimum target numeric character correction result is less than the second preset value and the maximum target numeric character correction result is greater than the first preset value, then based on the minimum target numeric character correction result, the maximum target numeric character correction result, and the similar numeric characters corresponding to the numeric character, a target numeric character correction result greater than the first preset value and less than the second preset value is obtained.
4. The method according to claim 1, characterized in that, The stepwise carry operation includes: Determine the second lowest digit character in the digit character recognition result; Determine whether there exists a second minimum similar digit character that is greater than the first minimum similar digit character in the corresponding position among the similar digit characters corresponding to the second lowest digit character; If so, then the first low-order digit character of the first digit character correction result is replaced with the second smallest similar digit character, and the first lowest digit character is replaced with the smallest number among the similar digit characters corresponding to the lowest digit character; If not, proceed with the carry operation.
5. The method according to claim 2, characterized in that, The step-by-step borrowing operation includes: Determine the second lowest digit character in the digit character recognition result; Determine whether there exists a second maximum similar digit character among the similar digit characters corresponding to the second lowest digit character that is less than the first maximum similar digit character in the corresponding position; If so, then the second least significant digit character of the second digit character correction result is replaced with the second largest similar digit character, and the second least significant digit character is replaced with the largest number among the similar digit characters corresponding to the least significant digit character; If not, then proceed with the borrowing operation.
6. A device for correcting the results of digital character recognition, characterized in that, The device includes: The acquisition module is used to acquire the numeric character recognition results and the constraints corresponding to the numeric character recognition results; The judgment module is used to obtain similar digit characters corresponding to each digit character in the digit character recognition result when the constraint conditions are used to determine that the digit character recognition result is incorrect; The correction module is used to replace the corresponding numeric character with the similar numeric character to obtain the target numeric character correction result that meets the constraints. The correction module includes: a determination unit and a replacement unit; The determining unit is used to determine the constraint type of the constraint condition, wherein the constraint type includes greater than a first preset value, less than a second preset value, and greater than the first preset value and less than the second preset value; The replacement unit is used to determine a replacement rule according to the constraint type, and use the replacement rule and the similar numeric characters to replace the corresponding numeric characters to obtain a target numeric character correction result that meets the constraint conditions. The replacement unit is configured to: if the constraint type is greater than the first preset value, determine each first target numeric character of the first preset value; select the first smallest similar numeric character among the similar numeric characters corresponding to the numeric character that is greater than or equal to the first target numeric character at the corresponding position; replace the numeric character at the same position with the first smallest similar numeric character to obtain a first numeric character correction result; if the first numeric character correction result is greater than the first preset value, use the first numeric character correction result as the minimum target numeric character correction result; if the first numeric character correction result is equal to the first preset value, determine the first least significant numeric character of the first numeric character correction result and the least significant numeric character in the numeric character recognition result; determine whether there is a second smallest similar numeric character among the similar numeric characters corresponding to the least significant numeric character that is greater than the first smallest similar numeric character at the corresponding position; if so, replace the first least significant numeric character with the second smallest similar numeric character to obtain the minimum target numeric character correction result; if not, perform a carry operation on the first numeric character correction result step by step until the minimum target numeric character correction result is obtained; and obtain a target numeric character correction result greater than the first preset value based on the minimum target numeric character correction result and the similar numeric characters corresponding to the numeric character.
7. A storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method for correcting the digital character recognition results according to any one of claims 1 to 5.
8. A computer device comprising a memory, a processor, and a computer program stored on a storage medium and executable on the processor, characterized in that, When the processor executes the program, it implements the method for correcting the digital character recognition results according to any one of claims 1 to 5.
Citation Information
Patent Citations
Digital recognition method and digital recognition system for traffic lights
CN113095220A
OCR result error correction method and equipment based on verification rule
CN113128504A