Character error correction method and device, equipment, storage medium and product
By calculating the similarity between the characters to be corrected and the first preset similar characters, and correcting the characters to be corrected, the problem of homogeneous and heterocode characters interference is solved, and the real-name rate and error correction accuracy of the service are improved.
Patent Information
- Application Number
- CN202411541044.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-14
AI Technical Summary
There is a problem of homogeneous and heterocode character interference in the prior art, resulting in the character conversion result being displayed correctly by the user but cannot pass the background service verification, affecting real-name operations.
By obtaining the error correction characters of the input image, calculating the first similarity between it and several first preset similar characters, and correcting the error correction characters according to the similarity, correcting them to the preset purpose corresponding to the target similar characters. character.
It effectively avoids interference from homogeneous and heterocode characters, reduces the number of similarity calculations for characters to be corrected, avoids repeated error correction for valid characters, and improves the service real name rate.
Smart Images

Figure CN119445583A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of character error correction technology, and in particular to a character error correction method, device, equipment, storage medium and product. Background Art
[0002] Isomorphic characters with different codes refer to similar characters with similar glyph structures but different codes under the same encoding method. They are the same word in the eyes of people, but different words in the eyes of computers. This will cause confusion in text information processing and affect subsequent services. For example, in the process of real-name authentication of Internet of Vehicles, due to the presence of isomorphic characters with different codes in the character conversion results of the certificate images uploaded by users, the character conversion results will be displayed correctly to users, but cannot pass the background services such as regular valid verification and repeatability verification, causing interference to the user's real-name operation. Therefore, it is urgent to provide a character error correction method to avoid the interference of isomorphic characters with different codes. Summary of the invention
[0003] The present application provides a character error correction method, device, equipment, storage medium and product to solve the problem in the prior art that a character error correction method is urgently needed to avoid interference from isomorphic different-code characters.
[0004] To achieve the above object, the present application provides a character error correction method, comprising:
[0005] Obtain the characters to be corrected in the input image;
[0006] Verifying the check value of the character to be corrected;
[0007] If the check fails, first similarities between the character to be corrected and a plurality of first preset similar characters are calculated, and the character to be corrected is corrected according to the first similarities.
[0008] As an improvement of the above solution, the step of correcting the characters to be corrected according to the first similarities includes:
[0009] According to the first similarities, obtaining the first preset similar characters satisfying the preset first similarity condition as target similar characters;
[0010] The character to be corrected is corrected to be a preset destination character corresponding to the target similar character.
[0011] As an improvement of the above solution, the preset first similarity condition includes at least one of the following:
[0012] The first similarity is the largest;
[0013] The first similarity is greater than a preset similarity threshold.
[0014] As an improvement to the above solution, the preset similarity threshold is obtained by:
[0015] constructing a plurality of second preset similar characters similar to the preset target character;
[0016] Calculating the second similarities between the preset target character and the plurality of the second preset similar characters respectively;
[0017] A similarity feature value is calculated according to the plurality of second similarities as the preset similarity threshold of the second preset similar characters.
[0018] As an improvement of the above solution, the step of calculating the first similarity between the character to be corrected and a plurality of first preset similar characters respectively includes:
[0019] Generating a bitmap of the character to be corrected;
[0020] The first similarities between the bitmap of the character to be corrected and the bitmaps of the first preset similar characters are calculated.
[0021] As an improvement of the above solution, the checking of the check value of the character to be corrected includes:
[0022] Calculating the check value of the character to be corrected;
[0023] The check value of the character to be corrected is compared with the check values of several preset target characters respectively.
[0024] To achieve the above purpose, the embodiment of the present application further provides a character error correction device, including:
[0025] An acquisition module, used for acquiring characters to be corrected in an input image;
[0026] A verification module, used for verifying the verification value of the character to be corrected;
[0027] The error correction module is used to calculate the first similarities between the character to be corrected and a plurality of first preset similar characters respectively if the check fails, and correct the character to be corrected according to the plurality of first similarities.
[0028] To achieve the above objectives, an embodiment of the present application also provides a character error correction device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor implements the character error correction method as described above when executing the computer program.
[0029] To achieve the above-mentioned purpose, an embodiment of the present application also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the character error correction method as described above.
[0030] To achieve the above-mentioned purpose, an embodiment of the present application further provides a computer program product, including a computer program / instruction, which implements the character error correction method as described above when executed by a processor.
[0031] Compared with the prior art, the character error correction method, device, equipment, storage medium and product provided by the embodiment of the present application first use a check value to check the character to be corrected, which can reduce the number of times the character to be corrected performs the first similarity calculation step, and avoid repeated error correction of valid characters. Further, the character to be corrected is corrected based on the first similarity between the character to be corrected and a plurality of first preset similar characters, thereby realizing error correction of isomorphic characters with different codes, and avoiding interference of isomorphic characters with different codes. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 is a flow chart of a character error correction method provided by an embodiment of the present application;
[0033] Figure 2 It is a structural block diagram of a character error correction device provided in an embodiment of the present application;
[0034] Figure 3 It is a structural block diagram of a character error correction device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0036] See also Figure 1 , Figure 1 : is a flowchart of a character error correction method provided by an embodiment of the present application, the character error correction method comprising:
[0037] S1, obtaining the characters to be corrected in the input image;
[0038] S2, verifying the check value of the character to be corrected;
[0039] S3. If the check fails, first similarities between the character to be corrected and a plurality of first preset similar characters are calculated, and the character to be corrected is corrected according to the first similarities.
[0040] In an embodiment of the present application, the character to be corrected in the input image is first obtained, and then the check value of the character to be corrected is checked; if the check passes, it means that the character to be corrected is a valid character and no correction is required, then the character to be corrected is confirmed; if the check fails, it means that the character to be corrected is not a valid character and correction is required, then the first similarities between the character to be corrected and several first preset similar characters are calculated, and the character to be corrected is corrected according to the several first similarities.
[0041] Specifically, the input image may be recognized by an OCR (Optical Character Recognition) method to generate characters on the input image, which are the characters to be corrected, and then the check values of the characters to be corrected are corrected one by one.
[0042] Optionally, the character to be corrected is a Unicode character type character, which can normally display characters with the same glyphs in different languages. This feature can develop with the evolution of languages and has wide applicability. Of course, it can also be other types of characters, which are not specifically limited in this application.
[0043] Exemplarily, a user enters the Internet of Vehicles real-name registration and uploads an ID image to submit the ID image under a valid ID type to the background; the user submits a real-name request under the corresponding ID type, such as personal real-name (using personal ID cards such as resident ID cards) and corporate real-name (using corporate ID cards such as business licenses); the background uses OCR technology to identify the uploaded ID image and generate Unicode characters of a certain length, which are the characters to be corrected. A checksum value is performed on each character to be corrected to improve the business real-name rate and reduce the interference of unknown characters on the business.
[0044] The embodiment of the present application needs to determine a preset target character, which is a correct character, and becomes a character after error correction, and then construct a number of first preset similar characters for the preset target character in advance, each preset target character has a corresponding number of first preset similar characters, and the first preset similar characters are similar characters with similar glyph structures to the preset target character but with different encodings, that is, isomorphic characters with different codes, and then correct the characters to be corrected according to the first similarities between the characters to be corrected and the first preset similar characters. Among them, isomorphic characters with different codes can be constructed according to a public easily confused character set.
[0045] The embodiment of the present application first uses a check value to check the character to be corrected, which can reduce the number of times the character to be corrected performs the first similarity calculation step, and avoid repeated correction of valid characters. Further, the character to be corrected is corrected by the first similarity between the character to be corrected and a plurality of first preset similar characters, thereby achieving correction of isomorphic characters with different codes, and avoiding interference of isomorphic characters with different codes.
[0046] In an optional embodiment, the checking the check value of the character to be corrected includes:
[0047] Calculating the check value of the character to be corrected;
[0048] The check value of the character to be corrected is compared with the check values of several preset target characters respectively.
[0049] In the embodiment of the present application, the check value of the character to be corrected is compared with the check value of the preset target character. If the two are equal, it means that the check is passed, the character to be corrected is a valid character, and no correction is required. The character to be corrected and the preset target character are the same if the check values are equal; if the two are not equal, it means that the check is not passed, the character to be corrected is not a valid character, and correction is required.
[0050] It is worth noting that a preset purpose character set is pre-set, and the preset purpose character set includes a number of preset purpose characters. For example, for a resident ID card, "0-9, X, x" is set as a total of 12 characters as preset purpose characters; for a business license, "0-9, az, AZ" is set as a total of 62 preset purpose characters. In this way, different limited preset purpose character sets can be determined for different types of certificates, and characters of different certificate types can be used for error correction.
[0051] It is worth noting that the check value of the character to be corrected and the check value of the preset target character are generated using the same check algorithm. The check algorithm includes: checksum algorithm, MD5 algorithm, SM3 algorithm, etc., which are not specifically limited in this application.
[0052] In an optional embodiment, the step of correcting the characters to be corrected according to the first similarities includes:
[0053] According to the first similarities, obtaining the first preset similar characters satisfying the preset first similarity condition as target similar characters;
[0054] The character to be corrected is corrected to be a preset destination character corresponding to the target similar character.
[0055] In the embodiment of the present application, the preset target character corresponding to the target similar character is the most likely correct character of the character to be corrected. The character to be corrected is corrected to the preset target character to achieve error correction of the character to be corrected and avoid interference from isomorphic characters with different codes.
[0056] In an optional embodiment, the preset first similarity condition includes at least one of the following:
[0057] The first similarity is the largest;
[0058] The first similarity is greater than a preset similarity threshold.
[0059] In the embodiment of the present application, the maximum first similarity can ensure that the target similar character is most similar to the character to be corrected, so that the character corrected by the target similar character is most similar to the character before correction compared to the character corrected by other first preset similar characters. The first similarity being greater than the preset similarity threshold can increase the correction threshold and the accuracy of error correction.
[0060] In an optional embodiment, the preset similarity threshold is obtained by:
[0061] constructing a plurality of second preset similar characters similar to the preset target character;
[0062] Calculating the second similarities between the preset target character and the plurality of the second preset similar characters respectively;
[0063] A similarity feature value is calculated according to the plurality of second similarities as the preset similarity threshold of the second preset similar characters.
[0064] In the embodiment of the present application, a plurality of second preset similar characters similar to the preset target character are constructed, that is, each preset target character corresponds to a set of second preset similar character sets, and each set of second preset similar character sets includes a plurality of second preset similar characters. All second preset similar characters of all preset target characters form the first preset similar character.
[0065] For each preset target character, the second similarities between the preset target character and its corresponding second preset similar characters are calculated, and based on the second similarities, similarity feature values are calculated as the preset similarity thresholds of the second preset similar characters. The similarity feature value indicates the characteristics of the second similarity, and optionally, the similarity feature value is the average value, standard deviation, variance, etc. of the second similarity, which is not specifically limited in the embodiments of the present application.
[0066] Then, when performing the preset similarity feature value comparison, the preset similarity feature value corresponding to the second preset similar character is selected for comparison. For example, assume the preset target character A, and its corresponding second preset similar character A1 and second preset similar character A2. When comparing the first similarity between the character to be corrected and the second preset similar character A1 with the preset similarity threshold, the preset similarity threshold of the second preset similar character A1 is used, that is, the similarity feature value calculated based on the preset target character A, the second preset similar character A1 and the second preset similar character A2.
[0067] In an optional embodiment, the step of calculating the first similarities between the character to be corrected and a plurality of first preset similar characters respectively includes:
[0068] Generating a bitmap of the character to be corrected;
[0069] The first similarities between the bitmap of the character to be corrected and the bitmaps of the first preset similar characters are calculated.
[0070] In the embodiment of the present application, a bitmap of each first preset similar character is generated in advance, and then the first similarity between the bitmap of the character to be corrected and the bitmaps of several first preset similar characters is calculated, so that the first similarity between the character to be corrected and the first preset similar characters can be obtained. The embodiment of the present application uses the concept of "font" to generate a bitmap of a character, and combines the first similarity comparison of the image structure to improve the accuracy of error correction.
[0071] Exemplarily, the image quality assessment index (SSIM) is used to calculate the first similarity between the bitmaps. Specifically, the calculation is performed based on the brightness item l(x, y), the contrast item c(x, y), and the structure item s(x, y):
[0072] SSIM(x,y)=[l(x,y)] α *[c(x,y)] β *[s(x,y)] γ
[0073] in,
[0074]
[0075] Where α is the brightness weight, β is the contrast weight, γ is the structure term, x is the bitmap of the character to be corrected, y is the bitmap of the first preset similar character, μ x is the local mean of the bitmap of the character to be corrected, μ y is the local mean of the bitmap of the first preset similar character, σ x is the standard deviation of the bitmap of the character to be corrected, σ y is the standard deviation of the bitmap of the first preset similar character, σxy are the bitmap of the character to be corrected and the bitmap of the first preset similar character and their mutual covariance, C1, C2, C3 are non-negative regularization constants used to avoid instability in image regions where the local mean or standard deviation is close to 0.
[0076] Furthermore, since the generated bitmaps all pass the unified logic, they have the same brightness and contrast terms, so the interference of brightness and contrast terms can be eliminated, and only the similarity of structure terms needs to be focused on. The formula is simplified as follows;
[0077] SSIM(x,y)=[s(x,y)] γ
[0078] In the embodiment of the present application, SSIM(x,y)=[s(x,y)] γ The first similarities between the bitmap of the character to be corrected and the bitmaps of a plurality of first preset similar characters are calculated.
[0079] See also Figure 2 , Figure 2 1 is a structural block diagram of a character error correction device 10 provided in an embodiment of the present application, wherein the character error correction device 10 comprises:
[0080] An acquisition module 11 is used to acquire the characters to be corrected in the input image;
[0081] A check module 12, used for checking the check value of the character to be corrected;
[0082] The error correction module 13 is used to calculate the first similarities between the character to be corrected and a plurality of first preset similar characters respectively if the check fails, and correct the character to be corrected according to the plurality of first similarities.
[0083] Optionally, the error correction module 13 is further used for:
[0084] According to the first similarities, obtaining the first preset similar characters satisfying the preset first similarity condition as target similar characters;
[0085] The character to be corrected is corrected to be a preset destination character corresponding to the target similar character.
[0086] Optionally, the preset first similarity condition includes at least one of the following:
[0087] The first similarity is the largest;
[0088] The first similarity is greater than a preset similarity threshold.
[0089] Optionally, the error correction module 13 is further used for:
[0090] constructing a plurality of second preset similar characters similar to the preset target character;
[0091] Calculating the second similarities between the preset target character and the plurality of the second preset similar characters respectively;
[0092] A similarity feature value is calculated according to the plurality of second similarities as the preset similarity threshold of the second preset similar characters.
[0093] Optionally, the error correction module 13 is further used for:
[0094] Generating a bitmap of the character to be corrected;
[0095] The first similarities between the bitmap of the character to be corrected and the bitmaps of the first preset similar characters are calculated.
[0096] Optionally, the verification module 12 is further used for:
[0097] Calculating the check value of the character to be corrected;
[0098] The check value of the character to be corrected is compared with the check values of several preset target characters respectively.
[0099] It is worth noting that the working process of each module in the character correction device 10 described in the embodiment of the present application can refer to the working process of the character correction method described in the above embodiment, and will not be repeated here.
[0100] A character error correction device 10 provided in an embodiment of the present application first uses a check value to check the character to be corrected, which can reduce the number of times the character to be corrected performs the first similarity calculation step, and avoid repeated error correction of valid characters. Further, the character to be corrected is corrected by the first similarity between the character to be corrected and a plurality of first preset similar characters, thereby achieving error correction of isomorphic characters with different codes, and avoiding interference of isomorphic characters with different codes.
[0101] In addition, an embodiment of the present application further provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, it controls the device where the computer-readable storage medium is located to execute the character error correction method as described in any of the above embodiments.
[0102] In addition, an embodiment of the present application further provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the character error correction method as described in any of the above embodiments.
[0103] See also Figure 3 , Figure 3: is a structural block diagram of a character error correction device 20 provided in an embodiment of the present application, and the character error correction device 20 includes: a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, the steps in the above-mentioned character error correction method embodiment are implemented. Alternatively, when the processor 21 executes the computer program, the functions of each module / unit in the above-mentioned device embodiments are implemented.
[0104] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the character error correction device 20.
[0105] The character error correction device 20 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will appreciate that the schematic diagram is merely an example of the character error correction device 20 and does not constitute a limitation on the character error correction device 20. The character error correction device 20 may include more or fewer components than shown in the figure, or may combine certain components, or different components. For example, the character error correction device 20 may also include an input / output device, a network access device, a bus, etc.
[0106] The processor 21 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 21 is the control center of the character error correction device 20, and various interfaces and lines are used to connect various parts of the entire character error correction device 20.
[0107] The memory 22 can be used to store the computer program and / or module. The processor 21 realizes various functions of the character error correction device 20 by running or executing the computer program and / or module stored in the memory 22 and calling the data stored in the memory 22. The memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0108] Wherein, if the module / unit integrated in the character error correction device 20 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor 21. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.
[0109] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0110] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications are also considered to be within the scope of protection of the present application.
Claims
1. A character error correction method, characterized in that: include: Obtain the characters to be corrected in the input image; Verifying the check value of the character to be corrected; If the check fails, first similarities between the character to be corrected and a plurality of first preset similar characters are calculated, and the character to be corrected is corrected according to the first similarities.
2. The character error correction method according to claim 1, characterized in that: The step of correcting the characters to be corrected according to the first similarities comprises: According to the first similarities, obtaining the first preset similar characters satisfying the preset first similarity condition as target similar characters; The character to be corrected is corrected to be a preset destination character corresponding to the target similar character.
3. The character error correction method according to claim 2, characterized in that: The preset first similarity condition includes at least one of the following: The first similarity is the largest; The first similarity is greater than a preset similarity threshold.
4. The character error correction method according to claim 3, characterized in that: The preset similarity threshold is obtained by: constructing a plurality of second preset similar characters similar to the preset target character; Calculating the second similarities between the preset target character and the plurality of the second preset similar characters respectively; A similarity feature value is calculated according to the plurality of second similarities as the preset similarity threshold of the second preset similar characters.
5. The character error correction method according to claim 1, characterized in that: The step of calculating the first similarity between the character to be corrected and a plurality of first preset similar characters respectively includes: Generating a bitmap of the character to be corrected; The first similarities between the bitmap of the character to be corrected and the bitmaps of the first preset similar characters are calculated.
6. The character error correction method according to claim 1, characterized in that: The checking of the check value of the character to be corrected includes: Calculating the check value of the character to be corrected; The check value of the character to be corrected is compared with the check values of several preset target characters respectively.
7. A character error correction device, characterized in that: include: An acquisition module, used for acquiring characters to be corrected in an input image; A verification module, used for verifying the verification value of the character to be corrected; The error correction module is used to calculate the first similarities between the character to be corrected and a plurality of first preset similar characters respectively if the check fails, and correct the character to be corrected according to the plurality of first similarities.
8. A character error correction device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the character error correction method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program; wherein, when the computer program is run, it controls the device where the computer-readable storage medium is located to execute the character error correction method according to any one of claims 1 to 6.
10. A computer program product, characterized in that It comprises a computer program / instruction, which, when executed by a processor, implements the character error correction method as claimed in any one of claims 1 to 6.
Citation Information
Cited By
Contract text comparison detection method and device and electronic equipment
CN119670724A
Comparative detection method, device and electronic equipment for contract text
CN119670724B