A method and system for correcting optical character recognition text for drug names

By establishing a drug name database and an error segmentation database, and combining character similarity and structural algorithms, the system automatically corrects errors in the optical character recognition of drug names, solving the error correction problem when OCR recognition is complex or has serious errors, and achieving stability and efficiency in drug name recognition.

CN116844176BActive Publication Date: 2025-11-25DATUM DATA CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310864285.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-14
Publication Date
2025-11-25
Estimated Expiration
2043-07-14

AI Technical Summary

Technical Problem

Existing technologies are unable to effectively correct errors in optical character recognition of drug names, especially when OCR recognition is complex or has serious errors, resulting in poor reliability of results and affecting practical applications.

Method used

By establishing a correct drug name database, generating preliminary and final error segmentation databases, and using filtering and expansion based on word segmentation, combined with character similarity and structural algorithms, optical character recognition errors are automatically corrected, resulting in the final error correction system.

Benefits of technology

When OCR recognition is complex or has serious errors, it can quickly and accurately correct drug names, improve drug name collection efficiency, and ensure the stability and reliability of results without manual annotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116844176B_ABST
    Figure CN116844176B_ABST
Patent Text Reader

Abstract

The application provides a kind of error correction method and system for drug name optical character recognition text, comprising: step S1, according to the original drug name data collected to establish and generate correct drug name library;Step S2, obtain optical character recognition drug name by optical character recognition, compare and difference process optical character recognition drug name with collected drug name, generate the first error word segmentation database of preliminary mapping;Step S3, filter and expand error word segmentation in word segmentation unit, generate the final error word segmentation database;Step S4, carry out error correction and replacement to the optical character recognition error drug name.The application is simple in operation, convenient to use and less in running time, can give correct result when OCR recognition is more complex or error is serious, and effectively realizes error correction.The application not only avoids the disadvantage of long time consumption in real-time calculation during matching, but also provides a more stable, reliable and accurate technical solution for optical character recognition drug name.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a text correction method, particularly to a method for correcting text using optical character recognition of drug names, and further to a correction system employing the method for correcting text using optical character recognition of drug names. Background Technology

[0002] With the deepening development of the information age, the digitization of text information has become a basic requirement, which involves the extraction of a large amount of image information. Optical Character Recognition (OCR) is a commonly used technique for extracting text information from images before processing. In this article, OCR is referred to as Optical Character Recognition. While OCR technology has reached a certain level of practicality, the recognized text still needs proofreading and error correction for documents or receipts with poor image quality, especially in areas requiring precise data entry, such as drug name recognition on medical insurance claims documents.

[0003] In existing technologies, some literature uses retrieval and phonetic-graphic similarity to find a candidate set similar to the OCR text, and then scores it to find the optimal result; others use CRNN networks and Viterbi to calculate the combination probability of candidate characters given by OCR and find an optimized solution, and then combine edit distance and longest common substring to find a matching solution; still others use drug name segmentation to further subdivide the properties of drug names, or compare the allowed character set with the recognition result to distinguish missing strings and non-existent strings for error correction. However, these existing technical solutions have poor reliability when the OCR recognition is complex or has serious errors, and cannot give correct results or effectively correct errors, thus affecting practical applications. Summary of the Invention

[0004] The technical problem this invention aims to solve is to provide an error correction method for optical character recognition (OCR) text of drug names. This method is designed to provide correct results even when OCR recognition is complex or contains significant errors, and to effectively correct errors. In practical applications, it offers a more stable, reliable, and accurate technical solution that is fast and efficient, requiring no manual annotation. Furthermore, an error correction system employing this OCR method for drug name OCR text is also provided.

[0005] To address this issue, the present invention provides a method for correcting errors in optical character recognition text of drug names, comprising the following steps:

[0006] Step S1: Establish and generate a correct drug name database based on the collected original drug name data;

[0007] Step S2: Obtain the optical character recognition drug name through optical character recognition, compare and process the differences between the optical character recognition drug name and the collected drug name, and generate the first error segmentation database of preliminary mapping;

[0008] Step S3: Filter and expand the incorrect word segments by word segmentation unit to generate the final incorrect word segmentation database;

[0009] Step S4: Correct and replace the drug names with optical character recognition errors.

[0010] A further improvement of the present invention is that step S1 includes the following sub-steps:

[0011] Step S101: Perform preliminary screening based on the frequency and source information of drug names in the original drug name data, and select drug names with a frequency greater than the preset frequency threshold and different source information as the initial screening drug names.

[0012] Step S102: For drug names with the same length in the initial screening, obtain drug name pairs with a difference of 1 to 2 characters. Then, segment the two drug names in the drug name pair. If the two groups of words have the same number of words, replace the drug name containing the misspelled words as a whole. If the two groups of words have different numbers of words, select the drug name that contains the drug name keyword and has a smaller number of words in the two groups of words and keep it. Select the drug name that does not contain the drug name keyword and has a larger number of words in the two groups of words and filter it.

[0013] A further improvement of the present invention is that step S2 includes the following sub-steps:

[0014] Step S201: Perform word segmentation processing on the optical character recognition drug name based on drug name keywords;

[0015] Step S202: Select drug name pairs from the optical character recognition drug names whose word segmentation count is greater than the word segmentation count of the entered drug name;

[0016] Step S203: Select drug name pairs with 1 to 2 different characters;

[0017] Step S204: Determine if the number of different characters is 2. If yes, convert the drug name pair with 2 different characters to 1 different character and then jump to step S205. If no, jump directly to step S205.

[0018] Step S205: Based on the corresponding collected drug name, compare the collected drug name and the optical character recognition drug name, remove the same word segments in the same position of the collected drug name and the optical character recognition drug name, and concatenate the remaining string of the optical character recognition drug name as the erroneous word segment.

[0019] A further improvement of the present invention is that, in step S204, an incorrect character in the optical character recognition drug name is replaced with a correct character, and then it is determined whether the number of word segments has changed. If it has changed, it means that the two incorrect characters are not in the same word segment, and it is determined whether the number of different characters is 2. After replacing the two incorrect characters respectively, the process jumps to step S205; if it has not changed, it means that the two incorrect characters are in the same word segment, and the process jumps directly to step S205.

[0020] A further improvement of the present invention is that step S3 includes the following sub-steps:

[0021] Step S301: Extract the erroneous characters from the erroneous word segmentation and filter them using a similar character shape algorithm;

[0022] Step S302: Traverse the drug names in the drug name database and perform word segmentation. Find the correct character corresponding to the erroneous character in step S301, replace the correct character with the corresponding erroneous character, and generate a new erroneous word segmentation database to obtain the second erroneous word segmentation database.

[0023] Step S303: Merge the first and second erroneous word segmentation databases to obtain a third erroneous word segmentation database;

[0024] Step S304: Iterate through the drug names in the drug name database again and perform word segmentation. When a word segmentation is found in the third erroneous word segmentation database, remove the word segmentation from the current erroneous word segmentation database to generate the final erroneous word segmentation database.

[0025] A further improvement of the present invention is that step S301 includes the following sub-steps:

[0026] Step S3011: Determine whether the incorrect character and the correct character are both compound structures by querying the Chinese character structure dictionary. If yes, proceed to step S3012; otherwise, proceed to step S3013.

[0027] Step S3012: Calculate the similarity between the incorrect character and the correct character using four-corner encoding. If the similarity is greater than the lower limit of the similarity threshold, the incorrect character is retained; otherwise, the incorrect character is excluded.

[0028] Step S3013: Determine whether the erroneous character and the correct character have the same radical. If they do, retain the erroneous character; otherwise, proceed to step S3014.

[0029] Step S3014: Calculate the similarity between the erroneous character and the correct character using four-corner encoding. If the similarity is greater than the upper limit of the similarity threshold, the erroneous character is retained; otherwise, the erroneous character is excluded.

[0030] A further improvement of the present invention is that, in step S304, the correct drug names in the drug name database are used again to add the third erroneous word segmentation database from step S303 to the word segmenter to segment the drug names. If a word segmentation existing in the third erroneous word segmentation database is found, the word segmentation is excluded from the erroneous word segmentation database, thereby obtaining the final erroneous word segmentation database.

[0031] A further improvement of the present invention is that step S4 includes the following sub-steps:

[0032] Step S401: Add the erroneous word segments from the erroneous word segmentation database to the word segmenter. After obtaining the new optical character recognition drug name, perform word segmentation processing on the new optical character recognition drug name based on the erroneous word segments.

[0033] Step S402: Search the error segmentation database for the new optical character recognition of the drug name;

[0034] Step S403: Replace the incorrect word segment by mapping between the incorrect and correct word segments;

[0035] Step S404: Search for the corresponding optical character recognition drug name in the drug name database. If not found, return to step S402 to search a preset number of times. If found, define the replaced optical character recognition drug name as the replacement drug name and jump to step S405.

[0036] Step S405: Search for the drug name and obtain the drug name in the drug name database that has a difference of less than n characters and the same character length as the replacement drug name, where n is the number of erroneous characters replaced in the replacement drug name; if the search is successful, define the found drug name as a similar drug name and jump to step S406; if the search fails, jump directly to step S407.

[0037] Step S406: Check the similar drug names to confirm whether the similar drug names can replace the replacement drug names;

[0038] Step S407: Confirm that the replacement drug name is a matching optical character recognition drug name, extract the price identified by the optical character from the document, compare it with the price already included in the drug name database, and if a price match is found, then determine that the replacement drug name is used to replace the optical character recognition drug name as the correct drug name.

[0039] A further improvement of the present invention is that the process of confirming whether the similar drug name can replace the replacement drug name in step S406 is as follows: the similar drug name is compared with the optical character recognition drug name before replacement, and the positions of the erroneous characters in the replacement drug name are compared. After excluding the characters at these positions, if the other characters are the same, it means that the similar drug name matches the optical character recognition drug name before replacement, and it is confirmed that the similar drug name cannot replace the replacement drug name; if not, it means that there are no other drug names that meet the similarity conditions, and it is determined that the optical character recognition drug name uniquely matches the replacement drug name.

[0040] The present invention also provides an error correction system for optical character recognition text of drug names, which employs the error correction method for optical character recognition text of drug names as described above, and includes:

[0041] The drug name database generation module establishes and generates a correct drug name database based on the collected raw drug name data;

[0042] The initial error segmentation database generation module obtains optical character recognition drug names through optical character recognition, compares and processes the differences between the optical character recognition drug names and the collected drug names, and generates the first error segmentation database with preliminary mapping.

[0043] The error segmentation filtering and expansion module filters and expands error segments on a word-by-word basis, generating the final error segmentation database;

[0044] The error segmentation and replacement module corrects and replaces drug names with errors in optical character recognition.

[0045] Compared with existing technologies, the advantages of this invention are as follows: By comparing the collected correct drug names with those identified by optical character recognition (OCR), and automatically generating incorrect word segments through mapping, filtering, and expansion, this invention can automatically correct and replace errors to find the correct drug names when collecting new OCR-recognized drug names. This invention is simple to operate, convenient to use, and has low processing time. By replacing word segmentation errors in the OCR process as a whole, it ensures accuracy and effectively improves the efficiency of drug name collection. It can provide correct results even when OCR recognition is complex or has serious errors, and effectively corrects errors. Furthermore, this invention combines a character shape similarity algorithm with character shape structure to filter the error character library. This not only avoids the drawback of long real-time calculations during matching but also provides a more stable, reliable, and accurate technical solution for OCR-recognized drug names, requiring no manual annotation and being fast and efficient. Attached Figure Description

[0046] Figure 1 This is a schematic diagram of the workflow of one embodiment of the present invention;

[0047] Figure 2 This is a schematic diagram of the workflow of step S2 in one embodiment of the present invention;

[0048] Figure 3 This is a schematic diagram of the workflow of step S3 in one embodiment of the present invention;

[0049] Figure 4 This is a schematic diagram of the workflow of step S301 in one embodiment of the present invention;

[0050] Figure 5 This is a schematic diagram of the workflow of step S4 in one embodiment of the present invention. Detailed Implementation

[0051] In the description of this invention, the term "several" means one or more; the term "multiple" means two or more; the terms "greater than," "less than," and "exceeding" are all understood to exclude the stated number; and the terms "above," "below," and "within" are all understood to include the stated number. The terms "first," "second," etc., are understood to be used only to distinguish identical or similar technical feature names, and should not be construed as implying / indicating the relative importance of the technical features, the number of technical features, or the sequential relationship between the technical features.

[0052] The preferred embodiments of the present invention will now be described in further detail with reference to the accompanying drawings.

[0053] Due to differences in optical character recognition (OCR) application scenarios, including factors such as image acquisition, uploading, and document quality, the forms of recognition errors can vary. Analyzing and mining the data of erroneously segmented words is necessary for more effective and targeted correction of these errors. Semantically, incorrectly segmented drug names may differ from correct ones, typically involving a larger number of segments. From a glyph perspective, similarity in character structure provides credibility to the erroneous word segmentation database used for OCR recognition.

[0054] Therefore, this embodiment focuses on how to provide a definitively correct result for incorrectly identified drug names using OCR. This avoids the situation in existing technologies where, in cases of severe errors, it is impossible to determine whether the given result is correct. This application aims to determine the correct error correction result, making it more meaningful in practical applications. The databases used in this application can be generated and optimized using the corresponding program for the error correction method, eliminating the need for manual annotation. The matching process only requires searching the database for precise matching, resulting in fewer comparisons during matching, no scoring calculations, short processing time, and fast response.

[0055] like Figure 1As shown, this embodiment provides an error correction method for optical character recognition text of drug names, including the following steps:

[0056] Step S1: Establish and generate a correct drug name database based on the collected original drug name data;

[0057] Step S2: Obtain the optical character recognition drug name through optical character recognition, compare and process the differences between the optical character recognition drug name and the collected drug name, and generate the first error segmentation database of preliminary mapping;

[0058] Step S3: Filter and expand the incorrect word segments by word segmentation unit to generate the final incorrect word segmentation database;

[0059] Step S4: Correct and replace the drug names with optical character recognition errors.

[0060] To ensure the accuracy of the results, a correct drug name database is first generated in step S1 for matching. For an incorrect OCR drug name, the incorrect word segmentation is replaced by the error segmentation database. If the replaced OCR drug name can be uniquely matched (see step S4), the replaced OCR drug name is confirmed to be correct. The error segmentation database plays a crucial role, providing the possibility for matching incorrect OCR drug names in the drug name database. How to automatically generate a high-quality error segmentation database using existing resources is a challenge. This embodiment achieves this through processes such as collection (see step S2), filtering (see steps S301 and S304 in step S3), and expansion (see step S302 in step S3). In the filtering part, for characters with large differences in glyphs in OCR errors, in order to avoid the limitations of glyph similarity calculation, they are processed according to the glyph structure (see step S3).

[0061] Step S1 in this embodiment includes the following sub-steps:

[0062] Step S101: Perform preliminary screening based on the frequency and source information of drug names in the original drug name data, and select drug names with a frequency greater than the preset frequency threshold and different source information as the initial screening drug names.

[0063] Step S102: For drug names with the same length in the initial screening, obtain drug name pairs with a difference of 1 to 2 characters. Then, segment the two drug names in the drug name pair. If the two groups of words have the same number of words, replace the drug name containing the misspelled words as a whole. If the two groups of words have different numbers of words, select the drug name that contains the drug name keyword and has a smaller number of words in the two groups of words and keep it. Select the drug name that does not contain the drug name keyword and has a larger number of words in the two groups of words and filter it.

[0064] Step S1 in this embodiment is used to establish a correct drug name database. More specifically, the first step is to establish a correct drug name database based on the collected original drug name data. The collected original drug name data mainly refers to the data gathered during the processing of medical documents. Since a considerable portion of the original drug name documents are obtained by taking photos with a mobile phone, there may be problems such as low clarity, inaccurate focus, or complex image environments containing text. Therefore, it is necessary to filter the original drug name data.

[0065] This embodiment first performs preliminary screening based on information such as the frequency and origin of drug names in the original drug name data. A drug name that appears frequently and comes from different sources (e.g., prescriptions from different hospitals) is more likely to be the correct drug name. To determine the lower limit of the screening frequency, a portion of commonly used drug names are pre-collected, and the frequency threshold of these drug names appearing in the original drug name data is used to determine the threshold. The preset frequency threshold mentioned in this embodiment is 5 by default. This preset frequency threshold can be customized and adjusted according to actual conditions, that is, drug names with a collection frequency of at least 5 and different sources are selected as the initial screening drug names.

[0066] The drug names obtained from the initial screening still have some non-compliant cases that need further filtering. Among them, the cases caused by misspellings are the most prominent. These errors will occur repeatedly and even exceed the frequency limit.

[0067] Drug names containing misspellings typically differ from their correct counterparts by 1-2 characters. Therefore, for two drug names of the same length, the number of differing characters can initially identify those potentially containing misspellings. For drug names of the same length in the initial screening database, drug name pairs with a difference of 1-2 characters are obtained. These two drug names are then segmented into words. If the two sets of word counts are inconsistent, it is checked whether one set contains the drug name keyword with a low number of segments, while the other does not contain the keyword but has a high number of segments. In this case, the higher number of segments indicates an error. For example, "Nabutamide capsules" should correctly be segmented as "Nabutamide" and "capsules." If "Nabutamide" is incorrectly collected as "Nabutamide," then "Nabutamide," as a non-existent word, will be broken down into four separate characters, significantly increasing the number of segments. This embodiment also utilizes this technique in subsequent steps to find incorrect word segments.

[0068] The drug name keywords mentioned above refer to the basic or most distinctive components of a drug name. These are usually the basic components of the drug itself. For example, the drug name keyword in "Nabumetone Capsules" is "Nabumetone," and the drug name keyword in "Radius and Ulna Anteroposterior and Lateral Views" is the body part "radius and ulna." These drug name keywords can be collected in advance and added to the word segmenter for subsequent word segmentation processing.

[0069] In this embodiment, step S1 uses drug name keywords. Besides finding incorrect drug names and incorrect word segmentation, this is also because, when correcting erroneous optical character recognition results, overall replacement by word segmentation is significantly more reasonable than replacing individual characters. For example, if "naphthalene-butyrate" is identified as "naphthalene-butyrate," the replacement will be performed where "naphthalene-butyrate" appears, rather than replacing every single character "naphthalene" with "naphthalene." The advantage of this design is that it significantly narrows the scope of replacements and effectively reduces the probability of incorrect replacements.

[0070] In this embodiment, step S1 filters by frequency, number of sources, and misspellings, leaving a correct drug name database. This database not only serves as an evaluation tool after replacing the optical character recognition results, but also provides a reference for correct word segmentation in the expansion and filtering of incorrect word segmentation.

[0071] like Figure 2 As shown, step S2 in this embodiment includes the following sub-steps:

[0072] Step S201: Perform word segmentation processing on the optical character recognition drug name based on drug name keywords;

[0073] Step S202: Select drug name pairs from the optical character recognition drug names whose word segmentation count is greater than the word segmentation count of the entered drug name;

[0074] Step S203: Select drug name pairs with 1 to 2 different characters;

[0075] Step S204: Determine if the number of different characters is 2. If yes, convert the drug name pair with 2 different characters to 1 different character. If no, proceed to step S205.

[0076] Step S205: Based on the corresponding collected drug name, compare the collected drug name and the optical character recognition drug name, remove the same word segments in the same position of the collected drug name and the optical character recognition drug name, and concatenate the remaining string of the optical character recognition drug name as the erroneous word segment.

[0077] Steps S201 to S203 in this embodiment are basically the same as the method for screening incorrect drug names in the drug name library in step S1. The difference is that here, the optically recognized drug name and the corresponding collected drug name are compared. And after finding that the number of word segments is different, incorrect word segments need to be synthesized by referring to the word segmentation positions. Similarly, the comparison between the optically recognized drug name and the collected drug name here only considers the case where the lengths are the same, so that incorrect characters can be quickly found by determining the different characters, facilitating the automatic extraction of incorrect characters. In step S203 of this embodiment, only drug name pairs with the number of different characters being 1 to 2 are selected to improve the efficiency and accuracy of recognition.

[0078] In step S204 of this embodiment, one incorrect character in the optically recognized drug name is replaced with the correct character, and then it is judged whether the number of word segments changes. If it changes, it means that the two incorrect characters are not in the same word segment, and it is determined whether the number of different characters is 2. After replacing the two incorrect characters respectively, jump to step S205; if there is no change, it means that the two incorrect characters are in the same word segment, and directly jump to step S205; so as to first determine whether the two incorrect characters that cause the number of different characters to be 2 are in the same word segment, and then perform different treatments accordingly to improve the accuracy of recognition.

[0079] Step S205 in this embodiment is used to extract incorrect word segments. In this embodiment, the extraction of incorrect word segments is exemplified by the drug name pair "Color Doppler Ultrasound of Peripheral Vessels with Multiple Bitterness" - "Color Doppler Ultrasound of Peripheral Vessels". The left side of the drug name pair is the optically recognized drug name, which contains an incorrect character "bitterness", and the right side of the drug name pair is the collected drug name. The right side of the following arrow respectively represents the word segmentation of the optically recognized drug name and the collected drug name:

[0080] Color Doppler Ultrasound of Peripheral Vessels with Multiple Bitterness → Peripheral, Vessels, Color, Multiple, Bitterness, Doppler, Ultrasound;

[0081] Color Doppler Ultrasound of Peripheral Vessels → Peripheral, Vessels, Color, Doppler Ultrasound.

[0082] Comparing the word segmentation of the two, after removing the same word segments at the same position such as "Peripheral", "Vessels", "Color", etc., what remains is the correspondence between the incorrect and separated word segments and the correct word segments. Combining "Multiple", "Bitterness", "Doppler", "Ultrasound" gives an incorrect word segment "Multiple Bitterness Doppler Ultrasound" corresponding to the drug name keyword in this drug name. It should be added that to achieve the correction effect as much as possible, the extraction of incorrect word segments is not limited to drug name keywords. For example, if "Vessels" is recognized as "皿管" and segmented into "皿" and "管" in the above example, an incorrect word segment "皿管" of "Vessels" will also be extracted.

[0083] To eliminate some occasional erroneous characters and improve the applicability of the error segmentation database, this embodiment also preferably performs statistical analysis on the erroneous characters identified in the above process, comparing them with the number of matches of actual optical character recognition samples, and preferably forming error segments based on the statistical frequency reaching more than 100 times. After the above steps, a preliminary first error segmentation database can be generated.

[0084] like Figure 3 As shown, step S3 in this embodiment includes the following sub-steps:

[0085] Step S301: Extract the erroneous characters from the erroneous word segmentation and filter them using a similar character shape algorithm;

[0086] Step S302: Traverse the drug names in the drug name database and perform word segmentation. Find the correct character corresponding to the erroneous character in step S301, replace the correct character with the corresponding erroneous character, and generate a new erroneous word segmentation to obtain the second erroneous word segmentation database. Therefore, this sub-step can expand the erroneous word segmentation set by using the erroneous character set after filtering the erroneous characters.

[0087] Step S303: Merge the first and second erroneous word segmentation databases to obtain a third erroneous word segmentation database;

[0088] Step S304: Iterate through the drug names in the drug name database again and perform word segmentation. When a word segmentation is found in the third erroneous word segmentation database, remove the word segmentation from the current erroneous word segmentation database to generate the final erroneous word segmentation database.

[0089] It is worth noting that this embodiment performs overall replacement on a word-by-word basis, especially on drug name keywords, which significantly reduces the probability of incorrect replacement compared to replacing individual characters. During replacement, this embodiment determines the correctness of the replacement by checking if the drug name exists in the drug name database and whether multiple matching results exist within the database. Furthermore, it filters out potentially incorrect replacements from generated incorrect word segments, further ensuring the accuracy of the replacement despite a significantly reduced probability of incorrect replacements.

[0090] In practical applications, there are two possible scenarios that could lead to incorrect replacements. One is where one incorrect word segmentation corresponds to multiple correct word segmentations. In this case, the incorrect word segmentation database is marked during its generation and excluded from use during replacement. The other is where an incorrect word segmentation extracted from a drug name using optical character recognition might be a correct word segmentation from another drug name. This scenario is primarily handled in step S304 by comparing the word segmentation data with the drug name database. Furthermore, step S301 uses a similar character shape algorithm to exclude unreasonable incorrect characters, which can also prevent potential incorrect replacements.

[0091] More specifically, in view of the characteristics of optical character recognition in this embodiment, in combination with the existing similar glyph calculation method, the following Figure 4 shown process is adopted to filter out error characters with large differences, that is, the step S301 includes the following sub-steps:

[0092] Step S3011, determine whether the error character and the correct character are both composite structures by querying the Chinese character structure dictionary. If so, jump to step S3012; if not, jump to step S3013;

[0093] Step S3012, calculate the similarity between the error character and the correct character through the four-corner code. If the similarity is greater than the lower limit of the similarity threshold, the error character is retained; otherwise, the error character is excluded;

[0094] Step S3013, determine whether there is the same radical in the error character and the correct character. If so, the error character is retained; if not, jump to step S3014;

[0095] Step S3014, calculate the similarity between the error character and the correct character through the four-corner code. If the similarity is greater than the upper limit of the similarity threshold, the error character is retained; otherwise, the error character is excluded.

[0096] In this embodiment, in the Figure 4 shown process, the error characters and the corresponding correct characters are taken from the error word segmentation mapping, such as "Nadimezone" - "Naproxen" in "Nadimezone" - "Naproxen".

[0097] When making a judgment, first use the Chinese character structure dictionary to determine whether two characters are both of composite structures. Chinese characters are generally divided into single characters and composite characters. Single characters generally refer to characters that cannot be split structurally. These characters have relatively simple glyphs, and most of them are also the basic glyphs that make up other Chinese characters. Composite characters refer to characters with composite structures that can be split into simple glyphs. Composite structures are generally divided into five types: left-right, up-down, inclusive, included, and nested. For cases where the recognition of drug names in optical character recognition is incorrect but the structures are the same, when using existing similar glyph algorithms, the similarity values are often not high. For example, for "胶夔" and "胶囊", the characters "夔" and "囊", and for "血聚" and "血浆", the characters "聚" and "浆", both pairs are of the up-down structure, and the OCR error results have occurred many times. However, when calculated using the four-corner code similarity, with a full score of 1, the similarity values for the two cases are 0.5 and 0.54 respectively, which belong to dissimilar situations. The so-called four-corner code similarity calculation means cutting the character into four parts: up, down, left, and right, and calculating the corresponding similarity respectively. Therefore, for cases with the same structure, a lower similarity threshold lower limit can be set. As long as the threshold lower limit is reached, it can be considered that the optical character recognition result is similar, and the incorrect character is retained. The similarity threshold lower limit can be custom-set and adjusted according to the actual situation.

[0098] As Figure 4 shown, if the structures of two characters are different, then determine whether they have the same radical or whether the four-corner code similarity is greater than the threshold upper limit. Similarly, the similarity threshold upper limit can also be custom-set and adjusted according to the actual situation. When the optical character recognition character has a different structure from the correct character, it is possible that optical character recognition has recognized a certain part of the Chinese character, such as "斗" in "总胆斗酸" and "汁" in "总胆汁酸", or a radical has been added due to fuzzy recognition of a Chinese character, such as "厦" in "厦方" and "复" in "复方". These situations are relatively suitable to be judged by the radical and the four-corner code. If the optical character recognition character can contain the same radical or meet the similarity threshold upper limit from the perspective of the four-corner code, it can be considered that the recognition result of the optical character recognition is similar.

[0099] The four-corner code in the above content can adopt the Chinese character indexing method invented by Wang Yunwu. This method uses the numbers 0 to 9 to represent ten pen shapes at the four corners of a Chinese character, and classifies Chinese characters with up to 5 Arabic numerals. The four-corner code similarity calculated through this method is also used to calculate the glyph similarity in the phonetic shape code. The four-corner code has a certain effect on the calculation of similar Chinese characters, but the incorrect characters in optical character recognition are relatively diverse. Only using this similarity to measure will filter out most cases. Therefore, in this embodiment, it is obviously more reasonable to use different thresholds for judgment according to the known structure in different situations.

[0100] In this embodiment, the filtering of incorrect characters is not very strict. The purpose is only to remove some intuitively unreasonable incorrect characters, such as "jade color" - "color", "round sand" - "borax". In fact, these two word segmentations are not correct words themselves and will not cause incorrect replacements. However, their glyphs differ so much that they cannot be intuitively associated. Therefore, it is logical to remove them. After this step, the second incorrect word segmentation database is generated. This embodiment has such an exclusion design. In addition to implementing the filtering of the incorrect word segmentation database, it can obviously also provide a better basis for the extension of incorrect word segmentation using incorrect characters in step S302.

[0101] Step S303 in this embodiment combines the incorrect word segmentation databases generated in S301 and S302. The incorrect word segmentation database obtained here may contain correct word segmentations. That is, the incorrect word segmentations extracted or generated from one incorrect drug name may be correct word segmentations in other drug names. For this situation, in step S304 of this embodiment, the correct drug names in the drug name library are used again to add the third incorrect word segmentation database in step S303 to the word segmenter to segment the drug names. If it is found that there is a word segmentation in the third incorrect word segmentation database, then this word segmentation is excluded from the incorrect word segmentation database, so as to obtain the final incorrect word segmentation database to avoid incorrect replacement of correct word segmentations.

[0102] Step S5 in this embodiment is used to introduce how to use the incorrect word segmentation database when collecting new optically recognized drug names. When a new optically recognized drug name is not in the drug name library, there may be a situation of optical character recognition error and correction is required. The error correction process is as Figure 5 shown.

[0103] As Figure 5 shown, step S4 in this embodiment includes the following sub-steps:

[0104] Step S401, add the incorrect word segmentations in the incorrect word segmentation database to the word segmenter. After obtaining a new optically recognized drug name, perform word segmentation processing on the new optically recognized drug name according to the incorrect word segmentations;

[0105] Step S402, search for the incorrect word segmentations of the new optically recognized drug name in the incorrect word segmentation database;

[0106] Step S403, perform corresponding replacement on the incorrect word segmentations through the mapping between the incorrect word segmentations and the correct word segmentations;

[0107] Step S404: Search for the corresponding optical character recognition drug name in the drug name database. If not found, return to step S402 to perform a preset number of searches. The preset number of searches is 1 to 3 times by default and can be set and adjusted according to the actual situation. If found, define the replaced optical character recognition drug name as the replacement drug name and jump to step S405. If not found, it is considered that there are too many errors in the optical character recognition drug name itself and it cannot be guaranteed that the correct drug name can be found. Return to the prompt for re-recognition.

[0108] Step S405: Search for the drug name and obtain the drug name in the drug name database that has a difference of less than n characters and the same character length as the replacement drug name, where n is the number of erroneous characters replaced in the replacement drug name; if the search is successful, define the found drug name as a similar drug name and jump to step S406; if the search fails, jump directly to step S407.

[0109] Step S406: Check the similar drug names to confirm whether the similar drug names can replace the replacement drug names;

[0110] Step S407: Confirm that the replacement drug name is a matching optical character recognition drug name, extract the price identified by the optical character from the document, compare it with the price already included in the drug name database, and if a price match is found, then determine that the replacement drug name is used to replace the optical character recognition drug name as the correct drug name.

[0111] It is worth noting that, in this embodiment, step S401, which segments the new optical character recognition drug name, is different from the segmentation in step S1. The segments added to the segmenter here are no longer medical keywords, but come from the final error segmentation database obtained in step S3. After adding the error segments from the error segmentation database to the segmenter, the segmenter can decompose the error segments from the optical character recognition drug name, so that they can be searched and replaced in subsequent steps S402 and S403.

[0112] In step S405 of this embodiment, in order to reduce the time consumed during real-time replacement, this embodiment preferably pre-calculates and generates a dictionary of drug names within the range of different character counts in order to quickly realize drug name lookup.

[0113] In this embodiment, step S406, which confirms whether the similar drug name can replace the replacement drug name, is as follows: the similar drug name is compared with the optical character recognition drug name before replacement. The positions of the incorrect characters in the replacement drug name are compared, and after excluding the characters at these positions, if the other characters are the same, it means that the similar drug name matches the optical character recognition drug name before replacement, and it is confirmed that the similar drug name cannot replace the replacement drug name; if not, it means that there are no other drug names that meet the similarity conditions, and it is determined that the optical character recognition drug name uniquely matches the replacement drug name.

[0114] Compared with character recognition, optical character recognition has better recognition stability in terms of numbers, so the price can generally be recognized. Considering the strict requirements for drug name collection, in step S407 of this embodiment, using this information for final confirmation is more conducive to the implementation of the overall technical solution and ensures the accuracy of the recognition result.

[0115] This embodiment also illustrates the above process through an example. For example, for the drug name "Cefotaxime Sodium for Injection" recognized by optical character recognition, after one round of incorrect word segmentation replacement, the incorrect word segmentation "Doubao" is replaced with "Cefotaxime", forming "Cefotaxime Sodium for Injection", but this drug name is still incorrect and not in the drug name database. After a second round of replacement, the incorrect word segmentation "Cefotaxime Sodium" is replaced with "Cefotaxime Sodium", forming a correct drug name "Cefotaxime Sodium for Injection". Then, after inspection, among the drug names similar to this drug name, after removing the two characters "Cefotaxime" and "Sodium", this drug name is still unique. After confirming this information, this drug name is used as the result for subsequent processing. In this example, "Cefotaxime" and "Cefotaxime Sodium" are drug name keywords, while "Sodium" generally does not appear alone as a drug name keyword, so no separate incorrect word segmentation mapping is formed, resulting in the need for secondary replacement. In such cases, through self-learning word segmentation collection in actual use, it can be improved to complete the replacement in one go.

[0116] This embodiment also provides an error correction system for drug name optical character recognition text, which adopts the above-mentioned error correction method for drug name optical character recognition text and includes:

[0117] A drug name database generation module that establishes and generates a correct drug name database based on the collected original drug name data;

[0118] A preliminary generation module for the incorrect word segmentation database, which obtains the drug name recognized by optical character recognition through optical character recognition, compares and processes the differences between the drug name recognized by optical character recognition and the collected drug name, and generates a first incorrect word segmentation database with preliminary mapping;

[0119] An incorrect word segmentation filtering and expansion module that filters and expands the incorrect word segmentation in units of word segmentation to generate a final incorrect word segmentation database;

[0120] An incorrect word segmentation replacement module that corrects and replaces the drug name with incorrect optical character recognition.

[0121] In summary, this embodiment compares collected correct drug names with those identified by optical character recognition (OCR), and automatically generates incorrect word segments through mapping, filtering, and expansion. In application, when collecting new OCR-recognized drug names, it can automatically correct and replace errors to find the correct names. This invention is simple to operate, convenient to use, and has low processing time. By replacing word segmentation errors in the OCR process on a word-by-word basis, it ensures accuracy and effectively improves drug name collection efficiency. Even when OCR recognition is complex or contains numerous errors, it can still provide correct results and effectively correct errors. Furthermore, this invention combines a character shape similarity algorithm with character shape structure to filter the error character library. This not only avoids the drawback of long real-time calculations during matching but also provides a more stable, reliable, and accurate technical solution for OCR-recognized drug names, requiring no manual annotation and offering fast and efficient processing.

[0122] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.

Claims

1. A method of error correction for optical character recognition text of a drug name, characterized by, The method comprises the following steps: Step S1, establishing and generating a correct drug name library according to collected original drug name data; Step S2, obtaining optical character recognition drug names through optical character recognition, comparing the optical character recognition drug names with the collected drug names and processing differences to generate a first error segmentation database of preliminary mapping; Step S3, filtering and expanding error segmentation in units of segmentation to generate a final error segmentation database; Step S4, correcting and replacing optical character recognition error drug names, The step S1 comprises the following sub-steps: Step S101, preliminarily screening drug names with a frequency greater than a preset frequency threshold and different provenance information from the original drug name data as screened drug names; Step S102, for screened drug names with the same length, obtaining a drug name pair with a difference character number of 1-2, and then segmenting the two drug names in the drug name pair, if the two groups of segmentation numbers are consistent, then performing overall replacement of the drug name containing the wrong character, and if the two groups of segmentation numbers are inconsistent, then selecting the drug name containing the key word of the drug name and having fewer segmentation numbers to retain, and selecting the drug name not containing the key word of the drug name and having more segmentation numbers to filter.

2. The method for correcting optical character recognition text for drug names of claim 1, wherein, The step S2 comprises the following sub-steps: Step S201, performing segmentation processing on the optical character recognition drug names according to the key word of the drug name; Step S202, selecting a drug name pair with a segmentation number greater than the segmentation number of the input drug name from the optical character recognition drug names; Step S203, selecting a drug name pair with a difference character number of 1-2; Step S204, determining whether the difference character number is 2, if yes, converting the drug name pair with a difference character number of 2 into a drug name pair with a difference character number of 1 and then jumping to step S205, if not, directly jumping to step S205; Step S205, comparing the collected drug name and the optical character recognition drug name according to the corresponding collected drug name, removing the same segmentation of the collected drug name and the optical character recognition drug name at the same position, and connecting the remaining string of the optical character recognition drug name as error segmentation.

3. The method for correcting optical character recognition text for drug names of claim 2, wherein, In the step S204, one error character in the optical character recognition drug name is replaced with a correct character, and then it is determined whether the segmentation number changes, if it changes, it indicates that the two error characters are not in one segmentation, it is determined whether the difference character number is 2, and after replacing the two error characters, it jumps to step S205, if it does not change, it indicates that the two error characters are in one segmentation, and it directly jumps to step S205.

4. The method for correcting optical character recognition text for drug names of claim 1, wherein, The step S3 comprises the following sub-steps: Step S301, taking out an error character in error segmentation and screening through a similar shape algorithm; Step S302, traversing drug names in the drug name library and performing segmentation, finding out a correct character corresponding to the error character in step S301, replacing the correct character with its corresponding error character to generate a new error segmentation, and obtaining a second error segmentation database; Step S303, merging the first error segmentation database and the second error segmentation database to obtain a third error segmentation database; Step S304, the drug names in the drug name library are traversed again and segmented, and when the segmentation in the third error segmentation database is found, the segmentation is removed from the current error segmentation database to generate a final error segmentation database.

5. The method for correcting optical character recognition text for drug names of claim 4, wherein, The step S301 includes the following sub-steps: Step S3011, whether the error character and the correct character are both complex structures is judged by querying the Chinese character structure dictionary, if yes, jump to step S3012; if no, jump to step S3013; Step S3012, similarity calculation is performed on the error character and the correct character by four-corner coding, if the similarity is greater than the lower limit of the similarity threshold, the error character is retained; otherwise, the error character is excluded; Step S3013, whether the error character and the correct character have the same component radical is judged, if yes, the error character is retained; if no, jump to step S3014; Step S3014, similarity calculation is performed on the error character and the correct character by four-corner coding, if the similarity is greater than the upper limit of the similarity threshold, the error character is retained; otherwise, the error character is excluded.

6. The method for correcting optical character recognition text for drug names of claim 4, wherein, In the step S304, the correct drug names in the drug name library are used again to add the third error segmentation database in the step S303 to the segmenter for drug name segmentation, if the segmentation existing in the third error segmentation database is found, the segmentation is excluded in the error segmentation database, so that the final error segmentation database is obtained.

7. The method for correcting optical character recognition text for drug names of claim 1, wherein, The step S4 includes the following sub-steps: Step S401, the error segmentation in the error segmentation database is added to the segmenter, and after a new optical character recognition drug name is obtained, the new optical character recognition drug name is segmented according to the error segmentation; Step S402, the error segmentation of the new optical character recognition drug name is searched in the error segmentation database; Step S403, the error segmentation is replaced by corresponding through the mapping between the error segmentation and the correct segmentation; Step S404, the optical character recognition drug name after the corresponding replacement is searched in the drug name library, if not found, return to step S402 for searching for a preset number of times, if found, the optical character recognition drug name after the replacement is defined as a replaced drug name, and jump to step S405; Step S405, the drug name is searched, the replaced drug name in the drug name library is obtained, which has less than n different characters and the same character length, wherein n is the number of error characters replaced in the replaced drug name; if the search is successful, the searched drug name is defined as a similar drug name, and jump to step S406; if the search fails, directly jump to step S407; Step S406, the similar drug name is checked to confirm whether the similar drug name can replace the replaced drug name; Step S407, it is confirmed that the replaced drug name is a matched optical character recognition drug name, the price of the optical character recognition is extracted from the document, and the price is compared with the price already recorded in the drug name library, when the price is consistent, it is determined that the replaced drug name is used to replace the optical character recognition drug name as a correct drug name.

8. The method for correcting optical character recognition text for drug names of claim 7, wherein, The step S406 confirms whether the similar drug name can replace the replacement drug name by comparing the similar drug name with the optical character recognition drug name before replacement, checking the positions of the error characters in the replacement drug name, and excluding the characters at these positions. If the other characters are the same, it indicates that the similar drug name matches the optical character recognition drug name before replacement, and it is confirmed that the similar drug name cannot replace the replacement drug name. If not, it indicates that there is no other drug name meeting the similarity condition, and it is determined that the optical character recognition drug name is uniquely matched with the replacement drug name.

9. A system for error correction of optical character recognition text for a drug name, characterized by, The error correction method for the optical character recognition text of drug names according to any one of claims 1 to 8 is adopted, and comprises: A drug name library generation module establishes and generates a correct drug name library according to collected original drug name data; An error word segmentation database preliminary generation module obtains optical character recognition drug names through optical character recognition, compares the optical character recognition drug names with the collected drug names, and processes differences to generate a first error word segmentation database for preliminary mapping; An error word segmentation filtering and expansion module filters and expands the error word segmentation in units of word segmentation to generate a final error word segmentation database; An error word segmentation replacement module corrects and replaces the optical character recognition error drug names, The processing method of the drug name library generation module comprises the following sub-steps: Step S101, according to the frequency and provenance information of the drug names in the original drug name data, preliminarily screen the drug names with a frequency greater than a preset frequency threshold and different provenance information as the initial screening drug names; Step S102, for the drug names with the same length in the initial screening drug names, obtain a drug name pair with a difference character number of 1-2, and then perform word segmentation on the two drug names in the drug name pair. If the two groups of word segmentation numbers are consistent, the overall replacement of the drug name containing the wrong characters is performed. If the two groups of word segmentation numbers are inconsistent, the drug name containing the key word of the drug name and having fewer word segmentation numbers is selected for reservation, and the drug name not containing the key word of the drug name and having more word segmentation numbers is selected for filtering.

Citation Information

Patent Citations

  • Medical OCR (Optical Character Recognition) error correction method

    CN116306594A