Error correction method for OCR medical record text

By calculating the similarity of the stroke order of Chinese characters and image features, combined with the prefix tree and the two-way maximum matching method, the error correction of OCR medical record text is imitated by human vision, which solves the problem of medical order information recognition errors in the existing technology and improves the quality of medical record text. Data accuracy and availability.

CN119337866APending Publication Date: 2025-01-21SHANGHAI EBM MEDICAL INFORMATION SYST
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411360382.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

Existing OCR technology is prone to errors when identifying medical order information, especially inaccurate identification of complex medical terms, which affects the accuracy and usability of medical record text data.

Method used

The correctness of the OCR recognition results is judged by calculating the similarity of the stroke order and image features of Chinese characters. The prefix tree and the two-way maximum matching method are used for term matching. The visual similarity is calculated by combining SIFT features and stroke order similarity to imitate human visual judgment. Correction of Chinese character similarity.

Benefits of technology

It improves the recognition and error correction capabilities of complex characters, reduces the demand for computing resources, is suitable for recognition and error correction of printed and handwritten medical records, expands the application scope of the system, and improves the accuracy and usability of medical record text data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119337866A_ABST
    Figure CN119337866A_ABST
Patent Text Reader

Abstract

The invention relates to an OCR (Optical Character Recognition) medical record text error correction method, which comprises the following steps of: obtaining visual similarity and stroke similarity among characters of a Chinese character set hans to form a visual similarity matrix and a stroke similarity matrix; the method comprises the following steps: acquiring a to-be-recognized text, and setting a sliding window to execute the following steps on a text T of the to-be-recognized text: performing bidirectional maximum matching, recognizing the text T as a term if matching succeeds, otherwise, recognizing alternative terms, calculating a maximum difference rate, calculating a minimum editing distance between the text T and the alternative terms, and calculating a score and an offset rate; judging the text T as an alternative term based on the offset rate, otherwise, judging the text T as an undetected term part; and a forward set FTs and a reverse set BTs are obtained, and error correction is carried out. Compared with the prior art, the method has the advantages of improving the accuracy and availability of the medical record text data and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of medical record texts, and particularly to a method for correcting errors in OCR medical record texts. Background Art

[0002] Optical Character Recognition (OCR) refers to the process in which an electronic device (such as a scanner or a digital camera) examines the characters printed on paper, determines their shapes by detecting dark and bright patterns, and then translates the shapes into computer text using character recognition methods; that is, for printed characters, an optical method is used to convert the text in a paper document into an image file of black and white dot matrices, and the text in the image is converted into a text format by an identification software for further editing and processing by a word processing software.

[0003] Existing open-source OCR projects or OCR services provided by Internet companies such as Baidu have a high recognition rate for general languages in printed form, but there will be errors in medical terms such as doctor's advice information. For example, due to reasons such as fonts, "囊" is recognized as "壶", and "瘘" is recognized as "痿", which affects the accuracy and usability of medical record text data. Summary of the Invention

[0004] The purpose of the present invention is to provide a method for correcting errors in OCR medical record texts in order to improve the accuracy and usability of medical record text data.

[0005] The purpose of the present invention can be achieved through the following technical solutions:

[0006] Compared with the prior art, the present invention has the following beneficial effects:

[0007] A method for correcting errors in OCR medical record texts, the method comprising the following steps:

[0008] Obtain the Chinese character set hans, obtain the stroke order sequence hans_strokes of the Chinese character set hans according to the stroke order of Chinese character writing and save it, calculate the minimum edit distance between each character in the Chinese character set hans and other characters to obtain the stroke similarity between two different characters, input the stroke similarity into a sparse matrix to obtain the stroke order similarity matrix strokes_sim_matrix, and calculate the SIFT feature library hans_sift_features of the Chinese character set hans. Calculate the visual similarity between two different characters based on the SIFT feature library hans_sift_features, input the visual similarity into a sparse matrix to obtain the visual similarity matrix vision_sim_matrix, and then save the prefix tree term_trie and the bag of words term_bow of the term set term_set;

[0009] Get the text to be recognized, set a sliding window to scan the text T to be recognized in the forward and reverse directions, and perform the following steps respectively:

[0010] Perform a bidirectional maximum match. If the match is successful, the text T is recognized as a term, and the moving sliding window continues to recognize it. Otherwise, the text T is vectorized to obtain the word vector Tv of the text T, which is compared with the terms in the word bag term_bow, and the term with the smallest Manhattan distance is obtained as the candidate term. The maximum difference rate is calculated, and the score score is calculated based on the insertion, replacement and deletion of the text T and the candidate term. If the difference diff is less than the maximum difference rate, the text T is judged to include the candidate term. Otherwise, the text T is judged as not detecting the term part, and then the moving sliding window continues to match;

[0011] After the sliding window covers all the texts to be recognized, the parts where the terms are not detected are added to the set Ts as single words, and all the alternative terms included in the text T recognized as including alternative terms are added to the set Ts as whole words to obtain the forward set FTs and the reverse set BTs. The alternative terms in the forward set FTs and the reverse set BTs whose similarity exceeds the threshold are selected to correct the text T corresponding to the alternative terms.

[0012] Furthermore, the minimum edit distance is:

[0013]

[0014] Among them, i and j are the total number of elements in the stroke order sequences s1 and s2 of two different characters respectively.

[0015] Furthermore, the stroke similarity is:

[0016]

[0017] Among them, W1 and W2 represent the words to be compared, w i w j Indicates the strokes of the word to be compared, w equals Indicates the total number of identical consecutive strokes.

[0018] Furthermore, the specific steps of calculating the visual similarity between two different characters based on the SIFT feature library hans_sift_features are as follows:

[0019] A sparse matrix with length and width set to the length of the Chinese character set hans is set. The characters in the Chinese character set hans are compared with other characters in the Chinese character set hans one by one for visual similarity. The SIFT features corresponding to the characters are found from the SIFT feature library hans_sift_features. FLANN is used for matching, and random kd trees are searched in parallel. When the distance of the closest matching point is less than 0.6 times the distance of the second closest matching point, it is determined to be a key point of effective matching. When the number of key points of effective matching is greater than 3 pairs, the difference between x and y of each pair of points is subjected to DBSCAN outlier detection to screen out the actual key points. The circumscribed rectangular area of ​​the actual key points is the visually similar area of ​​the Chinese character image. The ratio between the area of ​​the visually similar area and the area of ​​the Chinese character image is calculated to obtain the visual similarity.

[0020] Furthermore, the visual similarity is:

[0021]

[0022] Among them, W1 and W2 represent, P1 and P2 represent the images of W1 and W2, S match represents the visually similar region, S P1 Represents the area of ​​the Chinese character image.

[0023] Furthermore, the bidirectional maximum matching is specifically:

[0024] Match the text T in the sliding window with the prefix tree term_trie.

[0025] Furthermore, the maximum difference ratio is: the ratio between the minimum Manhattan distance of the candidate terms and the length of the text T.

[0026] Furthermore, the score is calculated based on the minimum edit distance between the text T and the candidate terms and the insertion, replacement and deletion of the text T as follows:

[0027] For each candidate term, the initial score is 0, and the initial score is used as the score;

[0028] If there is an insertion between the text T and the candidate term, the insertion means that there is a part in the text T, which includes all the characters of a term arranged in order, and there are other characters between the two characters of the term, then the score is increased by the length of the other characters;

[0029] If there is a deletion between the text T and the candidate term, the deletion means that there is a part in the text T, which includes some characters of a term arranged in order, and some characters of the term are missing. In this case, the score is increased by the length of the missing characters.

[0030] If there is a replacement between the text T and the alternative term, the replacement means that there is a part in the text T, one or more characters and the arrangement order in the part are the same as a term, and the remaining character in the part is different from the term, then the stroke similarity and visual similarity between the remaining character and the corresponding character in the term are searched from the stroke order similarity matrix strokes_sim_matrix and the visual similarity matrix vision_sim_matrix, and the similarity sim between the two characters is obtained based on the average of the stroke similarity and the visual similarity, and the score score is increased by 1-sim.

[0031] Furthermore, the difference degree diff is:

[0032]

[0033] Among them, L Term Indicates alternative term lengths.

[0034] Furthermore, the forward set FTs is a set of all candidate terms included in the text T in the text to be recognized in the positive order, and the reverse set BTs is a set of all candidate terms included in the text T in the text to be recognized in the reverse order.

[0035] (1) The present invention determines the correctness of the OCR recognition result by calculating the similarity between the stroke sequence of Chinese characters and the image features. This method utilizes the unique writing and ideographic characteristics of Chinese characters and improves the recognition and error correction capabilities of complex characters.

[0036] (2) The present invention uses prefix tree and bidirectional maximum matching method to match terms, reducing the demand for computing resources. At the same time, the use of SIFT features and stroke sequence similarity calculation to determine the correctness of OCR recognition results also reduces the reliance on high-performance computing, allowing the system to run efficiently on lower-configuration hardware, and can quickly and effectively retrieve and match terms, reduce recognition errors, and optimize the system's response speed while improving accuracy.

[0037] (3) The present invention imitates human vision to judge the similarity of Chinese characters and combines the writing method and the ideographic characteristics to perform error correction. This method is not only applicable to printed characters, but also to the recognition and error correction of handwritten medical records, which expands the application scope of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 is a training flow chart of the present invention;

[0039] Figure 2 Figure 1 is a method for calculating image similarity regions;

[0040] Figure 3 is an error correction flow chart of the present invention;

[0041] Figure 4 This is a graph showing the changes in term length, coverage, and query efficiency. DETAILED DESCRIPTION

[0042] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.

[0043] The present invention proposes an error correction method for OCR medical record text, which achieves the purpose of terminology error correction after OCR medical record by imitating human visual judgment of Chinese character similarity and combining Chinese character writing method and characteristics of Chinese ideographic characters.

[0044] Low computing requirements: This method uses prefix trees and bidirectional maximum matching methods to match terms, reducing the demand for computing resources. At the same time, using SIFT features and stroke sequence similarity calculations to determine the correctness of OCR recognition results also reduces the reliance on high-performance computing, allowing the system to run efficiently on lower-configuration hardware.

[0045] Multi-level matching: Combining prefix tree and bidirectional maximum matching method, it can quickly and effectively retrieve and match terms and reduce recognition errors. This method improves accuracy while optimizing the system's response speed.

[0046] Combination of stroke order and image features: The correctness of OCR recognition results is judged by calculating the similarity between the stroke order of Chinese characters and image features. This method utilizes the unique writing and ideographic characteristics of Chinese characters and improves the recognition and error correction capabilities of complex characters.

[0047] Mimicking human vision: Mimicking human vision to judge the similarity of Chinese characters, and combining writing methods and ideographic characteristics to correct errors. This method is not only applicable to printed characters, but also to the recognition and correction of handwritten medical records, which expands the application scope of the system.

[0048] First, in order to quickly retrieve terms, a prefix tree is generated for the terms. The prefix tree is used in scenarios such as Chinese word segmentation, and can be quickly retrieved from the vocabulary based on the prefix. The accurate terms can be queried by matching the terms using the bidirectional maximum matching method.

[0049] You may not find the corresponding term in the prefix tree, but you can find "similar" terms, because OCR terms will not recognize the entire paragraph incorrectly, but only a small part of it, that is, the recognized text has been replaced, deleted, or inserted. The minimum edit distance can be used to calculate which characters have been inserted, deleted, or replaced, and then determine the similarity between these characters and the candidate characters.

[0050] Since OCR is achieved through image recognition, finding the similarity of characters is actually finding the similarity of character images. First, Chinese characters are ideographic characters with the following characteristics:

[0051] 1. Radical composition of characters: Each Chinese character can be composed of objects and abstract things. Occasionally, a Chinese character is composed of only one component character, but usually it is composed of more than two component parts combined. The 869 initial consonants and 265 pictographic and indicative characters with their own meanings are the most basic radical components, called "word origins", usually single characters, such as "sun" and "moon", which can form various composite components (such as "bright", which can be further stacked and combined to form Chinese characters such as meng, meng, and zhao), as well as generally recognized characters ("bright" itself is a character). (Reference: Page 3 of the Font and Coding of Chinese Characters (Archived backup of the page, stored in the Internet Archive))

[0052] 2. Ideographic

[0053] 3. All-inclusive

[0054] 4. Unified writing

[0055] 5. Unique culture

[0056] 6. Arbitrary arrangement: Chinese characters can be arranged from top to bottom, from right to left, or from left to right, unlike most languages that can only be read in a fixed direction.

[0057] 7. Square characters: Generally, regardless of the number of strokes, a Chinese character can be presented in a square grid, so it is possible to create couplets and Spring Festival couplets with equal distances and symmetry in sentence size.

[0058] The following characteristics can be utilized:

[0059] 1. Radical composition of characters: There must be some Chinese characters with the same or similar radicals

[0060] 2. Square characters: The image is rectangular, and the proportion of the area of the same or similar radicals within this rectangle is the visual similarity

[0061] 3. Arbitrary arrangement: The radicals may appear in different positions within the square

[0062] First, to determine whether the radicals are the same, we adopt the method of comparing the stroke order sequences of two characters. If there are consecutive similar strokes, it is very likely that the radicals are similar.

[0063] According to the available feature 3, the radicals may appear in different positions, so the image features are used for further matching. Conventional methods such as histogram comparison cannot be used here, because the histograms of Chinese characters are not very different. SIFT features are used here, and the FLANN method is used for matching, and outliers are removed to obtain the positions of feature points that can be matched. The areas where these points are located are the similar areas of the two character images.

[0064] By calculating the proportion of consecutive identical stroke sequences and the proportion of similar feature area, the average of the two is the similarity of Chinese characters.

[0065] When the Chinese character similarity exceeds 50%, it can be determined that they are very close, and thus it can be determined that the recognized text is wrong and the alternative term is the correct content.

[0066] The present invention proposes an error correction method for OCR medical record text, which includes two parts, training and error correction. The method includes the following steps:

[0067] Training: Get the Chinese character set hans, get the stroke sequence hans_strokes of the Chinese character set hans according to the stroke order of Chinese characters, and save it. Calculate the minimum edit distance between each character in the Chinese character set hans and other characters to get the stroke similarity between two different characters. Input the stroke similarity into the sparse matrix to get the stroke sequence similarity matrix strokes_sim_matrix, and calculate the SIFT feature library hans_sift_features of the Chinese character set hans. Calculate the visual similarity between two different characters based on the SIFT feature library hans_sift_features. Input the visual similarity into the sparse matrix to get the visual similarity matrix vision_sim_matrix, and then save the prefix tree term_trie and bag of words term_bow of the term set term_set.

[0068] Error correction: Get the text to be recognized, set a sliding window and perform the following steps on the text T of the text to be recognized in the positive order and the reverse order respectively:

[0069] Perform bidirectional maximum matching. If the matching is successful, identify the text T as a term, and continue to identify with the moving sliding window. Otherwise, vectorize the text T to obtain the word vector Tv of the text T, compare it with the terms in the term bag term_bow, and take the term with the smallest Manhattan distance as the alternative term. Calculate the maximum difference rate, and calculate the minimum edit distance between the text T and each alternative term. Calculate the score score based on the minimum edit distance between the text T and the alternative term and the insertion, replacement, and deletion situations of the text T. Calculate the offset rate 1 - sim between the text T and each alternative term based on the score score. If the similarity sim is less than the maximum difference rate, determine that the text T includes the alternative term. Otherwise, determine that the text T does not detect the term part, and then move the sliding window to continue the matching;

[0070] After the sliding window covers all the text to be identified, add the parts that do not detect terms to the set Ts one by one as single characters, and add all the alternative terms included in the text T identified as including the alternative terms to the set Ts as whole words to obtain the forward set FTs and the reverse set BTs. Select the alternative term with the largest similarity among the overlapping terms in the forward set FTs and the reverse set BTs to correct the text T corresponding to the alternative term.

[0071] Among them, the flowchart of the training is as Figure 1 shown, and the diagram of the method for calculating the similar region of the image is as Figure 2 shown, and the flowchart of the error correction is as Figure 3 shown.

[0072] The specific steps of the training are as follows:

[0073] 1. Use about 20,600 common Chinese characters as the Chinese character set hans, obtain the stroke order sequence hans_strokes of the Chinese character set hans according to the stroke order of Chinese character writing and save it. The mapping relationship is shown in Table 1. For example, for the Chinese character "A", its stroke order sequence is 5212512, which means "fold, vertical, horizontal, horizontal, fold, horizontal, vertical".

[0074] Table 1 Stroke code mapping relationship table

[0075]

[0076] 2. Set a sparse matrix strokes_sim_matrix with the length and width equal to the length of the Chinese character set hans. Compare the strokes of each character in hans with other characters in hans one by one. Look up their corresponding stroke order code sequences from hans_strokes and compare their minimum edit distances. As shown below, i and j are the lengths of s1 and s2 respectively,

[0077]

[0078] Get the total number of consecutive strokes of the same character, compare it with the maximum number of strokes in the two characters, and get the stroke similarity strokes_sim, as shown below

[0079]

[0080] 3. Generate images of Chinese characters in the commonly used Chinese character set hans one by one. The font uses Microsoft YaHei. Other fonts can also be used, but they should not be too complex. The foreground color is black, the background color is white, the font size is 100, and the image size is 100x100. The larger the font size, the more features there are, and the better the subsequent error correction effect, but the model is also larger. After experiments, the font size of 100 is more balanced between model size and feature quantity. Use the scale-invariant feature transform SIFT algorithm to calculate the features of each Chinese character image, that is, the key points and their descriptions, to form the SIFT feature library hans_sift_features of the commonly used Chinese character set hans and save it.

[0081] 4. Set the sparse matrix vision_sim_matrix with the length and width of the Chinese character set hans. Compare the characters in hans with other characters in hans for visual similarity one by one, find their corresponding SIFT features from hans_sift_features, use FLANN for matching, random kd tree parallel search, trees=2, traversal times 50, k=2. When the distance of the closest matching point is less than 0.6 times the distance of the second closest matching point, it is considered to be a valid matching key point. When there are more than 3 pairs of valid matching key points, perform DBSCAN outlier detection on the difference between each pair of points x and y, with a minimum sample number of 3, to further screen the valid matching key points. The enclosed rectangular area of ​​these valid matching key points is the visual similarity area of ​​the Chinese character image, such as Figure 2 The ratio of the area of ​​this region to the area of ​​the Chinese character image is the visual similarity vision_sim, as shown below:

[0082]

[0083] 5. Use the National Clinical Edition 2.0 diagnostic codes (ICD-10), the National Clinical Edition 2.0 surgical procedure codes (ICD-9-CM3) and the National Clinical Edition 2.0 tumor morphology codes, a total of 50,144 terms as the term set term_set and save it.

[0084] 6. Generate the prefix tree term_trie and word bag term_bow of the term set term_set and save them.

[0085] The specific steps for error correction are:

[0086] 1. Load the model, including the term set term_set, prefix tree term_trie, bag of words term_bow, Chinese character set hans, stroke order similarity matrix strokes_sim_matrix of the Chinese character set hans, and vision similarity matrix vision_sim_matrix of the Chinese character set hans.

[0087] 2. Set a sliding window to perform a bidirectional maximum match on the input text T. Each time a word is taken, it is matched with the term. If the match is unsuccessful, reduce the window size and continue matching until a match is found. Slide to the next character and continue the above operation. In this process, both coverage and execution speed must be considered, and the sliding window size term_max_len is the key parameter that determines the accuracy and execution speed. The larger the term_max_len, the higher the coverage and the slower the execution speed; the smaller the term_max_len, the lower the coverage and the higher the execution speed. By counting term_set, we can know the term length and the number of terms of this length. According to the principle of sliding window matching, we need to calculate the total number of terms less than or equal to this length and the coverage. It is also necessary to know the execution time required for matching (error correction). According to the principle of sliding window matching, it can be known that the size of the sliding window is the maximum number of matches each time. According to the coverage ratio and term length, and then normalized, we can get the term query efficiency curve with the term length. As shown in Table 2 and Figure 4 As shown in the figure, when term_max_len=9, the efficiency reaches the peak, and the term coverage is about 68%; when term_max_len=14, the efficiency is 85.3% of the peak efficiency, and the term coverage is about 90%; when term_max_len=25, the efficiency is 52.37% of the peak efficiency, and the term coverage is about 99%; when term_max_len=53, which is the maximum term length, the efficiency is 52.37% of the peak efficiency, and the term coverage is 100%. The above parameters show that when term_max_len=9, it is the optimal parameter, but we may prefer 14 in our daily use, which has better coverage and acceptable efficiency.

[0088] Table 2: Term length, coverage and query efficiency

[0089]

[0090]

[0091]

[0092] 3. When performing bidirectional maximum matching on T, it will first directly search in the prefix tree. If a matching result is found, it will be directly returned. If not, it will proceed to the next step.

[0093] 4. Vectorize T with reference to term_bow to obtain the word vector Tv of T, compare it with the terms in term_bow, and take the term with the smallest Manhattan distance as the alternative term. For example, if T differs from the alternative term by one character and its Manhattan distance is 2, there can be multiple alternative terms.

[0094] 5. Set the maximum difference rate max_shift_rate = 0.2. This parameter is used to describe the ratio of the Manhattan distance obtained in the previous step to the length of T. That is, if the length of T is 10, the maximum number of different characters is 1.

[0095] 6. Calculate the minimum edit distance between T and the alternative term. If there is a situation of "insertion", such as adding a certain character to a term, the scoring score is increased by the insertion length; if there is a situation of "replacement", then compare the similarity of the replaced characters.

[0096] 7. Compare the characters that have "replaced". First, compare the stroke order, query the stroke similarity strokes_sim from the strokes_sim_matrix, query the visual similarity vision_sim from the vision_sim_matrix. The similarity sim of the two characters is the average of strokes_sim and vision_sim. For example, for "瘘" and "痿", strokes_sim = 0.9286, vision_sim = 0.7568, sim = 0.8427, and score is increased by 1 - sim.

[0097] 8. If there is "deletion" of a character, such as deleting a certain character from a term, then score is increased by the deletion length.

[0098] In the above steps, when calculating the score score, first calculate the sequence indexes of the four situations of insertion, deletion, modification, and identity between the text and the alternative term according to the minimum edit distance, and then calculate the sum of the index lengths of the three types of insertion, deletion, and modification. Among them, the index lengths of insertion and deletion are the lengths of the inserted and deleted characters, and the index length of modification is 1 - sim.

[0099] 9. The degree of difference from the alternative term is as follows. If the degree of difference diff is less than max_shift_rate, then T is determined to be the alternative term.

[0100]

[0101] 10. Set up the text sequence Ts. For the parts where terms are not detected, single characters are added to Ts, and for terms, the whole words are added to Ts. Eventually, the forward FTs and the reverse BTs are formed. Select the longest Ts as the correct error correction result to complete the error correction. For example, the OCR recognition result is "患者此前出现过肛痿". We can see that the last character "痿" is incorrect. When we perform forward matching, the alternative terms found are shown in Table 3 in sequence. If the alternative terms a and b are selected during forward maximum matching and reverse matching, and if term a includes term b and the length of term a is greater than that of term b, then select term a for error correction.

[0102] Table 3 Similarity situation table of different characters during forward maximum matching

[0103]

[0104]

[0105] So FTs is ['患', '者', '此', '前', '出', '现', '过', '肛瘘']

[0106] When we perform reverse matching, the alternative terms found are shown in Table 4 in sequence.

[0107] Table 4 Similarity situation table of different characters during reverse maximum matching

[0108]

[0109] So BTs is ['患', '者', '此', '前', '出', '现', '过', '肛瘘']. FTs is the same as BTs, and the final error correction result is: 患者此前出现过肛瘘。

[0110] The beneficial effects of the present invention are as follows:

[0111] 1. In the case of having error correction, OCR can be boldly used to connect with various in-hospital systems, so as to achieve real-time connection with other manufacturers' systems through OCR without interfaces and ensure the accuracy of medical data.

[0112] 2. Because its judgment principle is the similarity of strokes and graphics, this method can be used for the recognition and error correction of handwritten medical records.

[0113] The preferred specific embodiments of the present invention have been described in detail above. It should be understood that those of ordinary skill in the art can make many modifications and variations according to the concept of the present invention without creative work. Therefore, all technical solutions that can be obtained by those skilled in the art in the technical field based on the concept of the present invention through logical analysis, reasoning or limited experiments on the basis of the existing technology should be within the protection scope determined by the claims.

Claims

1. A method for correcting errors in OCR medical record text, characterized in that: The method comprises the following steps: Get the Chinese character set hans, obtain the stroke sequence hans_strokes of the Chinese character set hans according to the stroke sequence of Chinese characters, and save it. Calculate the minimum edit distance between each character in the Chinese character set hans and other characters to obtain the stroke similarity between two different characters. Input the stroke similarity into the sparse matrix to obtain the stroke sequence similarity matrix strokes_sim_matrix, and calculate the SIFT feature library hans_sift_features of the Chinese character set hans. Calculate the visual similarity between two different characters based on the SIFT feature library hans_sift_features. Input the visual similarity into the sparse matrix to form the visual similarity matrix vision_sim_matrix, and then save the prefix tree term_trie and word bag term_bow of the term set term_set. Get the text to be recognized, set a sliding window to scan the text T to be recognized in the forward and reverse directions, and perform the following steps respectively: Perform a bidirectional maximum match. If the match is successful, the text T is recognized as a term, and the moving sliding window continues to recognize it. Otherwise, the text T is vectorized to obtain the word vector Tv of the text T, which is compared with the terms in the word bag term_bow, and the term with the smallest Manhattan distance is obtained as the candidate term. The maximum difference rate is calculated, and the score score is calculated based on the insertion, replacement and deletion of the text T and the candidate term. If the difference diff is less than the maximum difference rate, the text T is judged to include the candidate term. Otherwise, the text T is judged as not detecting the term part, and then the moving sliding window continues to match; After the sliding window covers all the texts to be recognized, the parts where the terms are not detected are added to the set Ts as single words, and all the alternative terms included in the text T recognized as including alternative terms are added to the set Ts as whole words to obtain the forward set FTs and the reverse set BTs. The alternative terms in the forward set FTs and the reverse set BTs whose similarity exceeds the threshold are selected to correct the text T corresponding to the alternative terms.

2. The error correction method of OCR medical record text according to claim 1, characterized in that: The minimum edit distance is: Among them, i and j are the total number of elements in the stroke order sequences s1 and s2 of two different characters respectively.

3. The error correction method of OCR medical record text according to claim 2, characterized in that: The stroke similarity is: Among them, W1 and W2 represent the words to be compared, w i w j Indicates the strokes of the word to be compared, w equals Indicates the total number of identical consecutive strokes.

4. The method for correcting an OCR medical record text according to claim 3, characterized in that: The specific steps of calculating the visual similarity between two different characters based on the SIFT feature library hans_sift_features are as follows: A sparse matrix with length and width set to the length of the Chinese character set hans is set. The characters in the Chinese character set hans are compared with other characters in the Chinese character set hans one by one for visual similarity. The SIFT features corresponding to the characters are found from the SIFT feature library hans_sift_features. FLANN is used for matching, and random kd trees are searched in parallel. When the distance of the closest matching point is less than 0.6 times the distance of the second closest matching point, it is determined to be a key point of effective matching. When the number of key points of effective matching is greater than 3 pairs, the difference between x and y of each pair of points is subjected to DBSCAN outlier detection to screen out the actual key points. The circumscribed rectangular area of ​​the actual key points is the visually similar area of ​​the Chinese character image. The ratio between the area of ​​the visually similar area and the area of ​​the Chinese character image is calculated to obtain the visual similarity.

5. The method for correcting an OCR medical record text according to claim 4, characterized in that: The visual similarity is: Among them, W1 and W2 represent the text to be compared, P1 and P2 represent the images of W1 and W2, S match represents the visually similar region, S P1 Represents the area of ​​the Chinese character image.

6. The method for correcting an OCR medical record text according to claim 1, characterized in that: The bidirectional maximum matching is specifically as follows: Match the text T in the sliding window with the prefix tree term_trie.

7. The method for correcting an OCR medical record text according to claim 6, characterized in that: The maximum difference ratio is: the ratio between the minimum Manhattan distance of the candidate terms and the length of the text T.

8. The method for correcting an OCR medical record text according to claim 7, characterized in that: The score is calculated based on the minimum edit distance between text T and the candidate terms and the insertion, replacement and deletion of text T: For each candidate term, the initial score is 0, and the initial score is used as the score; If there is an insertion between the text T and the candidate term, the insertion means that there is a part in the text T, which includes all the characters of a term arranged in order, and there are other characters between the two characters of the term, then the score is increased by the length of the other characters; If there is a deletion between the text T and the candidate term, the deletion means that there is a part in the text T, which includes some characters of a term arranged in order, and some characters of the term are missing, then the score is increased by the length of the missing characters; If there is a replacement between the text T and the alternative term, the replacement means that there is a part in the text T, one or more characters and the arrangement order in the part are the same as a term, and the remaining character in the part is different from the term, then the stroke similarity and visual similarity between the remaining character and the corresponding character in the term are searched from the stroke order similarity matrix strokes_sim_matrix and the visual similarity matrix vision_sim_matrix, and the similarity sim between the two characters is obtained based on the average of the stroke similarity and the visual similarity, and the score score is increased by 1-sim.

9. The method for correcting an OCR medical record text according to claim 8, characterized in that: The difference degree diff is: Among them, L Term Indicates alternative term lengths.

10. The method for correcting an OCR medical record text according to claim 1, characterized in that: The forward set FTs is a set of all candidate terms included in the text T in the text to be recognized in the positive order, and the reverse set BTs is a set of all candidate terms included in the text T in the text to be recognized in the reverse order.

Citation Information

Cited By

  • Character string fuzzy matching method and system

    CN120014654A