Multi-stage spelling error correction method and device for medical image report and medium
By employing a multi-stage spelling correction method, combined with a pinyin correction knowledge base and a medical terminology package, the problem of insufficient coverage and ambiguity in medical imaging reports has been solved. This method achieves efficient and accurate correction of homophonous misspellings and miswritten terms, ensuring the uniqueness and reliability of the results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-12
- Publication Date
- 2026-04-07
AI Technical Summary
Existing technologies for medical image reports suffer from insufficient coverage, lack of probabilistic modeling for polyphonic characters, and a simplistic error correction process. This results in an inability to effectively identify and correct errors in medical terminology, and easily leads to ambiguity and conflicting results.
A multi-stage spelling correction method is adopted, including non-terminology correction and terminology correction stages. It combines a pinyin correction knowledge base, a polyphonic character probability database, and a medical terminology package. Through segmented scheduling, two-stage correction, and interval conflict resolution, it achieves targeted processing of homophonous misspellings and terminology errors.
It improves the ability to identify and correct spelling errors in medical imaging reports, reduces ambiguity and conflicting results, ensures the uniqueness and reliability of output results, and enhances the coverage and accuracy of the error correction system.
Smart Images

Figure CN121809463A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a multi-stage spelling correction method, device and medium for medical imaging reports. Background Art
[0002] Medical imaging reports are an important basis for clinical diagnosis and treatment decisions, and the accuracy of their text content is directly related to medical quality and patient safety. In the actual writing process, due to the fast pace of doctors' work, input method limitations, such as voice transcription, handwriting or rapid keyboard entry, and the complexity of medical professional terms, various spelling mistakes often occur in the reports. These mistakes can be mainly classified into two categories: the first is homophone misspelling, that is, Chinese characters misused due to the same or similar pronunciation, such as miswriting "middle artery" as "loyal artery"; the second is term miswriting, that is, the incorrect writing or expression of professional medical terms, such as miswriting "ground-glass nodule" as "ground-glass granule nodule".
[0003] At present, there has been certain development in general spelling correction technologies for Chinese texts. Most methods detect and correct errors based on pinyin mapping, edit distance calculation or statistical language models. However, in the specific field of medical imaging reports, the existing technologies still have obvious deficiencies: First, most error correction systems rely on a single source of corpus, such as general news texts or Internet corpus, to construct a homophone mapping knowledge base, lacking sufficient coverage of medical professional vocabulary and expression habits. This results in a low recall rate of the system when faced with a large number of medical terms, and it is difficult to effectively identify and correct domain-specific spelling mistakes. Second, traditional methods usually focus on correcting single characters or general words, lacking the ability to identify and correct multi-character terms as a whole. The mistakes in medical reports often involve the miswriting of complete terms. If only single-character-level replacement is performed, it is easy to produce semantic deviations or correction results that do not conform to professional habits. Third, there are a large number of polyphonic characters in Chinese, and the same Chinese character has different pronunciations in different contexts. Existing pinyin correction methods usually only provide one or several pinyin mappings for each Chinese character, lacking the modeling of the prior probabilities of different pronunciations. Therefore, it is easy to introduce too much ambiguity when generating candidate corrections, affecting the accuracy of error correction. In addition, the existing error correction processes are mostly single-stage processing, and do not distinguish and hierarchically process general spelling mistakes and professional term mistakes. This easily leads to the situation that in complex texts, term mistakes are mis-corrected by general rules, or general mistakes interfere with term recognition, ultimately affecting the controllability and reliability of the overall error correction effect. Therefore, how to construct a comprehensive and professionally adapted error correction knowledge system according to the characteristics of medical imaging report texts, and design a hierarchical error correction process that can effectively distinguish and process homophone misspellings and term miswritings is a technical problem to be solved. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the existing technology by providing a multi-stage spelling correction method, device, and medium for medical image reports. This method first performs non-terminal spelling correction, then performs medical terminology correction based on set and sequence similarity, and finally resolves conflicts according to multi-level priority rules. This two-stage fusion correction achieves targeted and hierarchical processing of two types of errors in medical image reports: phonetic misspellings and terminology miswriting. It effectively solves the technical problems of traditional single-correction models having incomplete coverage, increased ambiguity, and conflicting results in professional fields.
[0005] The objective of this invention can be achieved through the following technical solutions: According to one aspect of the present invention, a multi-stage spelling correction method for medical image reports is provided, the specific steps of which include: S1. Divide the input report text into several independent text segments according to Chinese punctuation, and record the position offset of each segment in the original text; S2. In the non-terminal error correction stage, for each text segment, the pinyin error correction knowledge base and the polyphonic character probability base are called. Based on the preset thresholds of text similarity and edit distance, the segments are filtered and replaced to generate candidate corrections for common spelling errors. The corrections are then made and replaced to obtain the text segments after non-terminal error correction. S3. In the terminology correction stage, for the text fragments that are not after terminology correction, the medical terminology package is called. By locating candidate intervals, filtering set similarity, and calculating sequence similarity, candidate corrections for terminology spelling errors are generated and filtered, and then modified and replaced to obtain the text fragments after terminology correction. S4. Match the non-terminology-corrected text segments and the terminology-corrected text segments in terms of text position. Eliminate and merge candidate corrections that overlap or conflict according to preset priority rules to obtain the final correction result. Map the position offset of the text segment containing the final correction result back to the global position in the original text and output the correction result containing position information and correction content.
[0006] Furthermore, in the non-terminal error correction stage, based on the pinyin sequence of the text segment, the corresponding candidate word string is retrieved from the pinyin error correction knowledge base, and the candidate word string is weighted and sorted using the probability provided by the polyphonic character probability library; the edit distance and text similarity between the text segment and each candidate word string are calculated; if a candidate word string simultaneously satisfies that the text similarity is greater than or equal to the text similarity threshold and the edit distance is less than or equal to the upper limit of the edit distance, then it is determined as a candidate correction for the current text segment for general spelling errors.
[0007] Further, in the terminology correction stage, the current text segment is compared with terms in the medical terminology package; based on the longest common substring matching result, the matching position of the candidate term in the text segment is determined; according to the different types of matching positions, such as equal-length matching, prefix matching, suffix matching, or intermediate covering matching, different sliding window ranges are used to generate candidate text intervals for comparison in the text segment; for each candidate text interval, the character set and pinyin set are extracted, and the similarity between each character set and pinyin set and the corresponding character set and pinyin set in the medical terminology package are calculated; a comprehensive set matching score is calculated based on the character set similarity and pinyin set similarity; if the comprehensive set matching score is greater than or equal to the matching score threshold, the candidate interval and corresponding term are retained; the normalized edit distance of the character sequence and the normalized edit distance of the pinyin sequence between the term and the candidate text interval are calculated, and converted into perceptual similarity through a nonlinear mapping function, and the final comprehensive similarity score is calculated; if the comprehensive similarity score is greater than or equal to the comprehensive similarity threshold, a candidate correction for terminology-type spelling errors is generated for the current text segment using that term.
[0008] Furthermore, if the character sequence of the candidate correction for the terminology spelling error is exactly the same as the character sequence of the determined term, then an exact match marker is added to the candidate correction.
[0009] Furthermore, in S4, the preset priority rules include: If there are multiple candidate corrections in the same text range, the candidate correction with an exact match tag that is exactly the same as the original substring will be selected first. If no exact match candidate is found, the candidate with the longer term text is selected for correction. If there are no exact matching candidates and the term text lengths are the same, then the candidate with the higher overall similarity score should be selected for correction. If there are no exact matching candidates, the terms have the same text length, and the overall similarity scores are the same, then the candidate with the earlier starting position in the text segment should be selected for correction.
[0010] Furthermore, in S4, for candidate corrections that overlap or conflict, cross-stage fusion is also included: if the candidate correction generated in the terminology correction stage completely covers the candidate correction generated in the non-terminology correction stage in terms of text position, and the corrected text suggested by the two is consistent, then the candidate in the terminology correction stage is removed to avoid duplicate output.
[0011] Furthermore, the pinyin error correction knowledge base, the polyphonic character probability database, and the medical terminology package are pre-built during the training phase.
[0012] The construction of the pinyin error correction knowledge base specifically includes: extracting high-frequency continuous substrings from multi-source medical texts and counting the frequency of each substring in the multi-source medical texts; calculating the point mutual information, t-score, and left and right entropy of each substring to evaluate cohesion, and calculating the cohesion score of the current substring using a comprehensive scoring formula; converting the substrings into pinyin sequences and concatenating them into standardized strings as pinyin keys for the substrings; mapping the pinyin keys to a list including words and weights through a preset initial original sound-character mapping structure; performing a fusion operation on substrings with the same pinyin keys; updating the sound-character mapping structure through the fusion operation to obtain the pinyin error correction knowledge base. The construction of the polyphonic character probability database specifically includes: reading the pinyin dictionary file, parsing the valid data rows, extracting the simplified character field from the valid data rows and splitting it into single characters, extracting the corresponding annotated pinyin for each single character, forming single character pinyin groups, and for each single character pinyin group, recording the pinyin version with tone marks and the version without tone marks after removing the tone marks at the end; traversing all the statistically analyzed single characters, and for each single character, obtaining all the different pinyins that have appeared and their corresponding cumulative frequencies; dividing the cumulative frequency of each pinyin by the total frequency of all pinyins for that single character to obtain the probability that the single character is pronounced with that pinyin; constructing a mapping structure for each single character, with each possible pinyin as the key and the corresponding normalized probability as the value; generating and storing two versions of the probability mapping file, one version retaining the original tone marks of the pinyin and the other version using the pinyin with tone marks removed; The construction of the medical terminology package specifically includes: traversing all subdirectories and text files from the root directory of the specified terminology file, reading empty text lines as candidate medical terms; simultaneously, using the names of second-level and lower-level subdirectories as candidate medical terms, and constructing a terminology set from all collected candidate medical terms; for each term in the terminology set, constructing a data structure, the data structure including the character set of the current term, the deduplicated pinyin set corresponding to the current term, and the complete pinyin sequence of the current term; associating all terms with their corresponding data structures to obtain the terminology package; serializing the terminology package into a file and storing it to obtain the final medical terminology package.
[0013] According to a second aspect of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described thereon.
[0014] According to a third aspect of the present invention, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described thereon.
[0015] Compared with the prior art, the present invention has the following beneficial effects: (1) By integrating multiple medical documents and introducing a weight balancing mechanism to construct an enhanced pinyin error correction knowledge base, the coverage and professionalism of the error correction system are effectively improved. This invention utilizes multiple types of corpora such as hospital reports, medical books and artificial terminology sets, and uses statistical indicators such as point mutual information, t-scores and left and right entropy to evaluate the solidification and comprehensively assign weights to the extracted high-frequency substrings. Then, through a weighted fusion mechanism, it is combined with the original sound-character mapping structure, so that the constructed knowledge base not only covers the common sound-similar character mappings in general language, but also deeply integrates the vocabulary and expressions unique to the medical field, thereby enhancing the system's ability to identify and correct "similar misspellings" in medical texts. Ultimately, the system can handle complex spelling errors in medical image reports more comprehensively and accurately in practical applications.
[0016] (2) By constructing a Pinyin probability library with the probability distribution of polyphonic characters and combining it with context-independent priors for candidate weighting, the ambiguity and misjudgment in the error correction process are reduced. By parsing the standard Pinyin dictionary, the frequency of occurrence of different pronunciations of the same Chinese character is counted. After normalization, a weighted probability mapping is formed, which provides the system with the prior probability of each Chinese character in different pronunciations. This enables the candidate to be sorted or weighted according to the probability when generating candidate words based on Pinyin, effectively constraining the search space, reducing invalid or erroneous candidates caused by the ambiguity of polyphonic characters, and ultimately improving the accuracy and reliability of the error correction results.
[0017] (3) By designing a two-stage processing flow of “non-term error correction - term error correction” and implementing a conflict resolution mechanism based on priority rules, the invention achieves targeted processing and unified results for general errors and professional term errors. The invention first uses the Pinyin knowledge base to process general spelling errors, then calls the medical terminology package based on character set and Pinyin set modeling for terminology-level matching and correction, and finally resolves and merges the overlapping results that may be generated in the two stages according to the multi-level rules of precise matching priority, long term priority and score priority. The invention distinguishes error types and specifies the processing order and conflict adjudication principles, so that the system can take into account both the error correction needs of general language and the integrity protection of medical professional terms, and ultimately ensure the uniqueness and rationality of the output results, and improve the overall error correction efficiency of the system in real complex medical report texts. Attached Figure Description
[0018] Figure 1 A flowchart for a multi-stage spelling correction method used in medical image reports; Figure 2 A flowchart for constructing a pinyin error correction knowledge base; Figure 3 A flowchart illustrating the construction process of a probability database for polyphonic characters; Figure 4 This is a flowchart illustrating the construction process of a medical terminology package. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0020] In existing technologies, spelling correction for medical image reports typically employs a general error correction model built on a single corpus. This model faces several limitations when processing specialized medical texts. First, its coverage is insufficient, making it difficult to effectively identify and correct a large number of medical terms and domain-specific expressions. Second, it lacks probabilistic modeling for polyphonic characters, leading to an increase in candidate ambiguities. Furthermore, the error correction process is simplistic, failing to distinguish between homophonous misspellings and terminological errors, easily causing confusion in error types and conflicting results. To address these issues, this embodiment provides a multi-stage, hierarchical spelling correction scheme. First, it integrates multi-source medical documents to construct an enhanced pinyin correction knowledge base and a polyphonic character probability database to improve the processing capability for specialized vocabulary and polyphonic characters. It adopts a two-stage process: first, non-terminal error correction, then terminological error correction, and introduces a terminology matching mechanism based on set and sequence similarity to achieve targeted correction of both types of errors. Finally, it resolves conflicts between overlapping results through preset multi-level priority rules, ensuring the uniqueness and rationality of the output results. This embodiment has made systematic improvements in three aspects: knowledge base construction, error correction process design, and result fusion, thereby achieving broader coverage, higher accuracy, and better controllability in medical image reports.
[0021] like Figure 1 The image shows a multi-stage spelling correction method for medical image reports, with the following specific steps: S1. Divide the input report text into several independent text segments according to Chinese punctuation, and record the position offset of each segment in the original text; S2. In the non-terminal error correction stage, for each text segment, the pinyin error correction knowledge base and the polyphonic character probability base are called. Based on the preset thresholds of text similarity and edit distance, the segments are filtered and replaced to generate candidate corrections for common spelling errors. The corrections are then made and replaced to obtain the text segments after non-terminal error correction. S3. In the terminology correction stage, for the text fragments that are not after terminology correction, the medical terminology package is called. By locating candidate intervals, filtering set similarity, and calculating sequence similarity, candidate corrections for terminology spelling errors are generated and filtered, and then modified and replaced to obtain the text fragments after terminology correction. S4. Match the non-terminology-corrected text segments and the terminology-corrected text segments in terms of text position. Eliminate and merge candidate corrections that overlap or conflict according to preset priority rules to obtain the final correction result. Map the position offset of the text segment containing the final correction result back to the global position in the original text and output the correction result containing position information and correction content.
[0022] Based on a pinyin error correction knowledge base, a polyphonic character probability database, and a medical terminology package, a comprehensive spelling error correction process for medical image report text is implemented. Through a process of "segmented scheduling—two-stage error correction—interval conflict resolution," common spelling errors and professional terminology mismatches are handled within a unified framework, ensuring semantic independence and result controllability while improving the ability to recognize and repair medical terminology. Specifically, the segmented scheduling mechanism ensures semantic independence and positional rewriteability, avoiding cross-sentence interference; the two-stage error correction process executes general spelling repair and terminology matching step by step, complementing and enhancing each other; and the interval conflict resolution effectively avoids duplicate replacements and error overwriting through multi-level rules such as priority for precise matching, priority for long terms, and priority for scores.
[0023] Specifically, the input complete report text is first segmented according to Chinese punctuation (e.g., 。!?;:), retaining punctuation marks as independent segments to ensure clear and traceable sentence boundaries. During segmentation, the offset of each segment in the original text is recorded so that subsequent error correction results can accurately map back to the original position. Segments containing only punctuation are automatically skipped and do not proceed to the subsequent error correction process. The starting offset of each segment is recorded during segmentation. The final output error correction position is determined by... Perform mapping.
[0024] In the non-terminology correction phase, the focus is primarily on common spelling errors, near-homophone substitutions, and single-word omissions. Specifically, this includes: Based on the pinyin sequence of the text fragment, corresponding candidate word strings are retrieved from the pinyin error correction knowledge base, and the candidate word strings are weighted and sorted using the probabilities provided by the polyphonic character probability database; the edit distance and text similarity between the text fragment and each candidate word string are calculated. The expression is: , in, To edit distance, These represent the string lengths; If the candidate word strings simultaneously satisfy the condition that the text similarity is greater than or equal to the text similarity threshold... And the edit distance is less than or equal to the upper limit of the edit distance. If it is, then it is identified as a candidate correction for common spelling errors in the current text segment, i.e., a candidate acceptance condition. for: .
[0025] In the terminology correction phase, a pre-constructed medical terminology package serves as the core knowledge base, enabling the comparison and candidate retrieval of fragmented texts. Specifically, this includes: The current text segment is compared with terms in the medical terminology package. Based on the longest common substring matching result, the matching position of the candidate term in the text segment is determined. Depending on whether the matching position belongs to the different types of matching (equal length matching, prefix matching, suffix matching, or intermediate covering matching), different sliding window ranges are used to generate candidate text intervals for comparison in the text segment. For each candidate text interval, the character set and pinyin set are extracted, and the similarity between each character set and pinyin set and the corresponding character set and pinyin set in the medical terminology package are calculated. A comprehensive set matching score is calculated based on the character set similarity and pinyin set similarity. If the comprehensive set matching score is greater than or equal to the matching score threshold, the candidate interval and the corresponding term are retained. The normalized edit distance of the character sequence and the normalized edit distance of the pinyin sequence between the term and the candidate text interval are calculated, and converted into perceptual similarity through a non-linear mapping function to calculate the final comprehensive similarity score. If the comprehensive similarity score is greater than or equal to the comprehensive similarity threshold, a candidate correction for the terminology-type spelling error in the current text segment is generated using this term.
[0026] Let the standard terminology be Candidate text is Then the normalized edit distance of the character sequence Normalized edit distance of pinyin sequence They are respectively: , , Among them, The corresponding pinyin sequence is obtained through a non-linear mapping function: , , in, The nonlinear mapping design is used to simulate the human perception of differences. It is insensitive to subtle differences and maintains a high degree of similarity. As the difference increases, the perception changes rapidly, causing the similarity to drop quickly. When the difference is too large, it is directly regarded as dissimilar, making the candidate ranking more consistent with the actual perception of medical experts in terminology judgment.
[0027] The overall similarity score is: , when When the candidate is considered valid, the candidate is deemed valid.
[0028] If the character sequence of a candidate correction for a terminology spelling error is exactly the same as the character sequence of the determined term, then an exact match marker is added to the candidate correction.
[0029] In S4, the preset priority rules include: If there are multiple candidate corrections in the same text range, the candidate correction with an exact match tag that is exactly the same as the original substring will be selected first. If no exact match candidate is found, the candidate with the longer term text is selected for correction. If there are no exact matching candidates and the term text lengths are the same, then the candidate with the higher overall similarity score should be selected for correction. If there are no exact matching candidates, the terms have the same text length, and the overall similarity scores are the same, then the candidate with the earlier starting position in the text segment should be selected for correction.
[0030] The preset priority rules can be expressed as: , in, It is a candidate set within the same interval; This indicates that the best exact match candidate within the group is selected; if no exact match candidate is found, the sorting is performed in the order of "long term priority → score priority → starting point priority", which ensures that a unique, stable and reasonable repair suggestion can be given even in complex sentences.
[0031] When the non-term and terminology correction stages produce results in the same location, cross-stage fusion is further performed. If the terminology candidate completely covers the range of the non-terminology candidate and the text consistency is corrected, the system automatically removes the terminology candidate to avoid duplicate output.
[0032] .
[0033] in, Candidates for terminology correction. Candidates for non-terminology correction. The starting position for term candidates. This is the end position for the term candidate. This is the starting position for non-term candidates. End position of non-term candidate Candidate revised text for terminology, This is a non-terminal candidate correction text. This removes the conditional function. This coverage consistency check ensures the simplicity and consistency of the results.
[0034] All error correction results are finally output in a structured form, including the original interval position, the replaced segment, the repair suggestion, and the similarity score. This output can be used for front-end highlighting and interaction, and can also be used as input data for downstream tasks (such as quality control report generation).
[0035] For example, for the input segment "The middle cerebral artery of the brain, the sella turcica is enlarged, and an abnormal signal similar to a dumbbell shape can be seen in the sellar region...", the error correction result output by the system is as follows: Correct "loyal artery" to "middle artery"; Correct "dumbbell shape" to "dumbbell type".
[0036] In the finally formed structured result, each record contains its start and end indexes in the original text, ensuring the traceability and verifiability of the repair process.
[0037] In S4, for candidate corrections with overlaps or conflicts, it also includes cross-stage fusion: if the candidate correction generated in the term error correction stage completely covers the candidate correction generated in the non-term error correction stage in terms of text position, and the proposed corrected texts are the same, then this candidate in the term error correction stage is eliminated to avoid duplicate output.
[0038] The pinyin error correction knowledge base, the polyphone probability library, and the medical term package are pre-constructed in the training stage. Most existing spelling error corrections rely on a single corpus, with limited coverage. In this embodiment, three types of documents, namely medical reports, books, and manually organized terms, are introduced, and a weight merging mechanism is used for dynamic balancing, effectively avoiding bias.
[0039] In medical reports, there are a large number of homophonic misspelled words, and it is necessary to expand the coverage of the phoneme-word mapping. This embodiment constructs a phoneme-word mapping knowledge base based on medical report corpora to support subsequent pinyin error correction, term restoration, and context matching tasks. Through the co-occurrence statistics of high-frequency phrases and characters in a large number of medical imaging report texts, combined with a phoneme coding model, the phrases or words are converted into pinyin forms and fused with the original phoneme-word mapping structure to form an enhanced error correction word graph, that is, a DAG structure, to improve the relevance and coverage of spelling candidates. In the construction of the pinyin error correction knowledge base, not only medical report corpora are used, but medical books and manually organized terms are also integrated to ensure the coverage and professionalism. By introducing a weight merging mechanism, the contributions from different sources are balanced, avoiding the bias caused by a single corpus.
[0040] Specifically, the construction of the pinyin error correction knowledge base is as Figure 2 shown, and the construction steps include: Extract high-frequency continuous substrings from multi-source medical texts, and count the occurrence frequency of each substring in the multi-source medical texts; the multi-source medical texts are character sequences with a length of and then the set of all substrings is: , Substring length .
[0041] Calculate each substring s Point mutual information (PMI), t-score, and left and right entropy are used to assess cohesion, and a cohesion score for the current substring is calculated using a comprehensive scoring formula; cohesion score The expression is: , in, This is a frequency function, representing the frequency of occurrence of the substring in multi-source medical texts; Point mutual information is used to measure substrings. s The statistical measure of the tightness of the combination between the internal components; the t-score is the t-score used to evaluate whether the occurrence of substring s is significant, that is, whether it is formed by chance. The larger the value, the less likely the occurrence of the substring is by chance, and the more likely it is to be a valid word. is the left neighbor entropy, used to measure the uncertainty of the Chinese characters adjacent to the left of the substring s; is the right-neighbor entropy, used to measure the uncertainty of the Chinese characters adjacent to the right of the substring s.
[0042] The substrings are converted into pinyin sequences and concatenated into a standardized string, which serves as the pinyin key of the substrings. Specifically, for each substring being analyzed, a pinyin conversion engine is used to generate its pinyin sequence, denoted as... And standardize it into the pinyin keys of character substrings: , For example, "liver function" will be converted to the pinyin keys "gan,gong,neng"; Using a pre-defined initial sound-character mapping structure, the pinyin keys are mapped to a list including words and weights. The sound-character mapping structure expression is as follows: , in Represents a character substring. For the corresponding weights; For substrings {(si, scorei)} with the same pinyin key, perform a merging operation: calculate the total score of all new substrings under that pinyin key. Obtain the original weight mean of all words under the corresponding pinyin key K in the original sound-character mapping structure D. And assign weights to substrings with the same pinyin key. : , in, This is the scaling factor; This is the minimum weight lower bound; if the original sound-character mapping structure already contains the substring, then the weight is updated using the substring with the same pinyin key. By updating the sound-character mapping structure through fusion operations, a pinyin error correction knowledge base is obtained in JSON format.
[0043] Therefore, all substrings are sorted by weight from high to low, and the word graph structure under that pinyin key is updated. Through this merging method, statistical results from corpora from different sources, such as reports, books, and artificial terminology, are dynamically integrated with the original knowledge base, avoiding single-source bias. Existing ordinary pinyin mapping cannot handle the ambiguity of polyphonic characters. The polyphonic character probability database constructed in this embodiment provides context-free prior probabilities, significantly reducing ambiguous branches in the DAG decoding process.
[0044] In this embodiment, a polyphonic character probability library is also constructed based on the Chinese character-Pinyin mapping file to support Pinyin error correction and disambiguation tasks. By parsing open-source dictionary data containing Pinyin annotations, all possible Pinyin corresponding to each Chinese character in context-independent cases are counted, and a weighted probability distribution is constructed based on frequency normalization to provide prior support for subsequent phonetic code reasoning and context scoring.
[0045] The construction of the polyphonic character probability database is as follows Figure 3 As shown, the construction steps include: Read the pinyin dictionary file, parse the valid data rows, extract the simplified Chinese character field from the valid data rows and split it into individual characters, extract the corresponding pinyin annotations for each individual character, form pinyin groups for each individual character, and record the pinyin with and without tones for each group. The format of the valid data rows is as follows: Traditional Chinese characters and simplified Chinese characters [Pinyin (space separated)]; The system extracts each Chinese character from the Simplified Chinese field. and its corresponding pinyin The original statistics that constitute the character to pinyin conversion are as follows: , The tones-free version of the pinyin after removing the tone marks from the last digit is as follows: , For example, zhao4 → zhao; to ensure mapping accuracy, anomaly filtering and standardization are also performed during the parsing process, including: Skip comment lines and blank lines that begin with "#"; If the length of the Chinese character sequence does not match the length of the Pinyin sequence, the entry will be discarded to avoid mismatch. Pinyin is uniformly converted to lowercase to ensure consistency of key bindings; Remove the digital tone part at the end of the pinyin to obtain the version without tone, e.g., “zhao4” → “zhao”; Traverse all the single characters that have been counted. For each single character, obtain all the different pinyins that have appeared and their corresponding cumulative frequencies; for each single character Construct a set of possible pronunciations: ; Divide the cumulative frequency of each pinyin by the total frequency of all pinyins of this single character to obtain the probability that this single character is pronounced as this pinyin: , where is the frequency of constructing possible pronunciations for each single character ; For each single character, construct a mapping structure. The mapping structure uses each possible pinyin as the key and the corresponding normalized probability as the value. The expression is: , where is the normalized probability corresponding to the pinyin ; Generate and store two versions of the probability mapping files respectively. One version retains the original tone of the pinyin, and the other version uses the pinyin after removing the tone, which are respectively: char_pinyin_with_tone.pkl: retains the tone; char_pinyin_no_tone.pkl: does not contain the tone; To ensure controllable results, when calculating the probability, retain the probability value of each pinyin to 6 decimal places for refined weighting in subsequent disambiguation tasks.
[0046] This embodiment supports outputting the corresponding pinyin distribution of a specified Chinese character. For example, for the character “着”: Version with tone (original): {"zhe4": 0.6, "zhao2": 0.3, "zhuo2": 0.1}, Version without tone (normalized): {"zhe": 0.6, "zhao": 0.3, "zhuo": 0.1}, The polyphonic character probability library can be linked with the multi-stage spelling correction method to perform probability-weighted selection among polyphonic candidates, improving the accuracy of pinyin→Chinese character reverse lookup.
[0047] Many errors in medical reports are misspellings of terminology, requiring terminology-level correction rather than just single-word correction. Therefore, a medical terminology package based on a medical imaging terminology database is needed to support terminology-level correction and matching. This embodiment extracts a set of medical terms by recursively traversing a directory and text files, and combines a set-based representation of Chinese characters and pinyin to generate a terminology package data structure that can be used for fast matching and similarity calculation. This data is then persistently saved as a model file to support efficient calls from subsequent error correction modules. The medical terminology package in this embodiment uses dual modeling of terminology using both character sets and pinyin sets to ensure fuzzy matching and pinyin retrieval capabilities; it supports fast set operations to improve the efficiency of large-scale text error correction; and it supports a pinyin enhancement mode to improve robustness to homophones and near-homophone errors.
[0048] Construction of medical terminology packages, such as Figure 4 As shown, the construction steps include: Starting from the root directory of the specified terminology file, traverse all subdirectories and text files, read empty text lines as candidate medical terms; traverse all subdirectories and files under the terminology root directory root_dir, read the text line by line, and extract non-empty lines as term candidates. At the same time, the names of subdirectories at the second level and below are used as candidate medical terms, including knowledge in areas such as corresponding anatomical locations and pathological categories. All collected candidate medical terms are combined into a terminology set: , Each of them To indicate an independent medical term; For each term in the terminology set, a Chinese character to Pinyin engine is invoked to generate the complete Pinyin sequence corresponding to the term; based on the complete Pinyin sequence, a deduplicated Pinyin set corresponding to the term is generated. For each term in the term set, construct a data structure that includes the character set of the current term, the deduplicated pinyin set corresponding to the current term, and the complete pinyin sequence of the current term; Associate all terms with their corresponding data structures to obtain a term package; Call the Chinese character to Pinyin engine For each term Generate the corresponding pinyin sequence: , And define a set of pinyin: , The terminology package is serialized into a file and stored to obtain the final medical terminology package; For each term The system builds a terminology package containing the following fields: , where: represents the set of Chinese characters contained in the term; represents the set of pinyin after removing duplicates; - represents the complete pinyin sequence.
[0049] The finally obtained term package dictionary is: .
[0050] Term package is serialized and stored as the term_bag_library.pkl file for subsequent error correction calls. This file is saved in binary format and can support fast loading and querying.
[0051] Define the matching function as: , where is a candidate term in the term package; is the input sentence; and are the set of Chinese characters and the set of pinyin of the sentence respectively. When (such as ), it is determined that and have a term-level matching relationship.
[0052] Traditional methods focus on single character or general word error correction and are difficult to identify medical term errors. The term package structure proposed in this embodiment includes a character set, a pinyin set, and a pinyin sequence, which can accurately identify and correct term errors in the second stage.
[0053] In this embodiment, multi-stage spelling error correction is performed on medical imaging reports. For example, the input content of a medical imaging report is: The patient's bilateral lung markings are thickened and accompanied by thickening of the chest membrane. It is recommended to review. Extract the sub-character set and pinyin set of the sentence and compare them with the term package. Assume that the term library contains the standard term "pleural thickening", then calculate: Score("“pleural thickening”", s)≈0.82≥0.6, Output candidate: {"term": "pleural thickening", "pinyin": ["xiong", "mo", "zeng", "hou"], "score": 0.82}.
[0054] This result will be used as a reference for the subsequent error correction module to assist in identifying and fixing the spelling error of "chest membrane thickening" → "pleural thickening".
[0055] Therefore, this embodiment solves the problem of insufficient coverage of medical professional vocabulary caused by the reliance on a single corpus in existing technologies by constructing a pinyin correction knowledge base that integrates multiple sources of medical documents. Specifically, hospital medical reports, authoritative medical books, and manually compiled terminology sets are used as multi-source training corpora. Solidification assessment and comprehensive weighting are performed based on the statistical characteristics of high-frequency continuous substrings (such as PMI, t-scores, and left and right entropy). A weight merging mechanism dynamically integrates newly discovered terms with the original sound-character mapping structure. This technique ensures that the constructed knowledge base not only includes general phonetic similarity mappings but also fully incorporates medical-specific vocabulary and high-frequency expressions, thereby significantly improving the system's ability to identify and cover phonetic similarity errors in medical texts. Ultimately, in practical applications, it can more comprehensively and accurately discover and correct various phonetic similarity spelling errors in medical imaging reports.
[0056] Furthermore, this embodiment addresses the problem of excessively large candidate search space and low correction accuracy caused by the ambiguity of polyphonic characters in existing pinyin correction methods by constructing a probability database containing the probability distribution of polyphonic characters. Specifically, by analyzing a standard dictionary annotated with pinyin, the frequency of occurrence of different pronunciations of the same Chinese character is statistically analyzed, and a weighted probability distribution is formed after normalization, establishing a context-independent pronunciation prior for each Chinese character. This technique provides a probabilistic basis for subsequent pinyin-based candidate retrieval and ranking, thereby effectively constraining and reducing invalid paths and ambiguous candidates caused by polyphonic characters when generating and filtering candidate words. This design reduces the risk of misjudgment from a mechanism perspective, ultimately improving the overall accuracy and reliability of the system in performing pinyin correction in complex medical texts.
[0057] Meanwhile, by designing a two-stage processing architecture—first non-terminal error correction, then terminological error correction—and combining it with multi-level conflict resolution rules, the system addresses the problems of existing single error correction processes, such as inability to distinguish error types, susceptibility to result conflicts, and poor controllability. Specifically, it first uses a pinyin knowledge base to handle common spelling errors, then calls a medical terminology package based on dual modeling of character and pinyin sets for terminology-level matching and correction, and finally resolves and integrates overlapping candidate criteria that may arise from the two stages, prioritizing precise matching, long terms, and scores. This technique achieves hierarchical and targeted processing of homophonous misspellings and terminological errors, and ensures the uniqueness and rationality of the output results through a clear adjudication mechanism. Ultimately, this enables the system to meet the professional requirements of medical reports, efficiently and stably completing automated error correction of the entire text while ensuring the integrity of terminology.
[0058] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the described module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0059] The electronic device of this invention includes a central processing unit (CPU), which can perform various appropriate actions and processes according to computer program instructions stored in read-only memory (ROM) or loaded from a storage unit into random access memory (RAM). The RAM may also store various programs and data required for device operation. The CPU, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0060] Multiple components in the device are connected to an I / O interface, including: input units such as a keyboard, mouse, etc.; output units such as various types of displays, speakers, etc.; storage units such as disks, optical disks, etc.; and communication units such as network interface cards, modems, wireless transceivers, etc. The communication unit allows the device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks. The processing unit performs the various methods and processes described above, such as the method of the present invention. For example, in some embodiments, the method of the present invention may be implemented as a computer software program tangibly contained in a machine-readable medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on the device via ROM and / or the communication unit. When the computer program is loaded into RAM and executed by the CPU, one or more steps of the method of the present invention described above may be performed. Alternatively, in other embodiments, the CPU may be configured to execute the method of the present invention by any other suitable means (e.g., by means of firmware).
[0061] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0062] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0063] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0064] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A multi-stage spelling correction method for medical image reports, characterized in that, The specific steps include: S1. Divide the input report text into several independent text segments according to Chinese punctuation, and record the position offset of each segment in the original text; S2. In the non-terminal error correction stage, for each text segment, the pinyin error correction knowledge base and the polyphonic character probability base are called. Based on the preset thresholds of text similarity and edit distance, the segments are filtered and replaced to generate candidate corrections for common spelling errors. The corrections are then made and replaced to obtain the text segments after non-terminal error correction. S3. In the terminology correction stage, for the text fragments that are not after terminology correction, the medical terminology package is called. By locating candidate intervals, filtering set similarity, and calculating sequence similarity, candidate corrections for terminology spelling errors are generated and filtered, and then modified and replaced to obtain the text fragments after terminology correction. S4. Match the non-terminology-corrected text segments and the terminology-corrected text segments in terms of text position. Eliminate and merge candidate corrections that overlap or conflict according to preset priority rules to obtain the final correction result. Map the position offset of the text segment containing the final correction result back to the global position in the original text and output the correction result containing position information and correction content.
2. The multi-stage spelling correction method for medical image reports according to claim 1, characterized in that, In the non-term correction stage, based on the pinyin sequence of the text segment, the corresponding candidate word string is retrieved from the pinyin correction knowledge base, and the candidate word string is weighted and sorted using the probability provided by the polyphonic character probability library. Calculate the edit distance and text similarity between the text segment and each candidate word string; if a candidate word string simultaneously satisfies that the text similarity is greater than or equal to the text similarity threshold and the edit distance is less than or equal to the upper limit of the edit distance, then it is determined as a candidate correction for the current text segment for general spelling errors.
3. The multi-stage spelling correction method for medical image reports according to claim 1, characterized in that, In the terminology correction stage, the current text segment is compared with terms in the medical terminology package; based on the longest common substring matching result, the matching position of the candidate term in the text segment is determined; depending on whether the matching position belongs to different types such as equal-length matching, prefix matching, suffix matching, or intermediate covering matching, different sliding window ranges are used to generate candidate text intervals for comparison in the text segment; for each candidate text interval, a character set and a pinyin set are extracted, and the similarity between each character set and pinyin set and the corresponding character set and pinyin set in the medical terminology package are calculated; based on the character set similarity and pinyin set similarity, a comprehensive set matching score is calculated; If the overall set matching score is greater than or equal to the matching score threshold, then the candidate interval and the corresponding term are retained; The normalized edit distance of the character sequence and the normalized edit distance of the pinyin sequence of terms and candidate text intervals are calculated and converted into perceptual similarity through a nonlinear mapping function. The final comprehensive similarity score is then calculated. If the overall similarity score is greater than or equal to the overall similarity threshold, then a candidate correction for the term-class spelling error is generated using that term as the current text segment.
4. The multi-stage spelling correction method for medical image reports according to claim 3, characterized in that, If the character sequence of the candidate correction for a terminology spelling error is exactly the same as the character sequence of the determined term, then an exact match marker is added to the candidate correction.
5. A multi-stage spelling correction method for medical image reports according to claim 1, characterized in that, In step S4, the preset priority rules include: If there are multiple candidate corrections in the same text range, the candidate correction with an exact match tag that is exactly the same as the original substring shall be selected first. If no exact match candidate is found, the candidate with the longer term text is selected for correction. If there are no exact matching candidates and the term text lengths are the same, the candidate with the higher overall similarity score will be selected for correction. If there are no exact matching candidates, the terms have the same text length, and the overall similarity scores are the same, then the candidate with the earlier starting position in the text segment should be selected for correction.
6. The multi-stage spelling correction method for medical image reports according to claim 1, characterized in that, S4 also includes cross-stage fusion for candidate corrections that overlap or conflict: if a candidate correction generated in the terminology correction stage completely covers the candidate correction generated in the non-terminology correction stage in terms of text position, and the corrected text suggested by both is consistent, then the candidate in the terminology correction stage is removed to avoid duplicate output.
7. A multi-stage spelling correction method for medical image reports according to claim 1, characterized in that, The pinyin error correction knowledge base, polyphonic character probability database, and medical terminology package are pre-built during the training phase.
8. A multi-stage spelling correction method for medical image reports according to claim 7, characterized in that, in, The construction of the pinyin error correction knowledge base specifically includes: extracting high-frequency continuous substrings from multi-source medical texts and counting the frequency of each substring in the multi-source medical texts; calculating the point mutual information, t-score, and left and right entropy of each substring to evaluate cohesion, and calculating the cohesion score of the current substring using a comprehensive scoring formula; converting the substrings into pinyin sequences and concatenating them into standardized strings as pinyin keys for the substrings; mapping the pinyin keys to a list including words and weights through a preset initial original sound-character mapping structure; performing a fusion operation on substrings with the same pinyin keys; updating the sound-character mapping structure through the fusion operation to obtain the pinyin error correction knowledge base; The construction of the polyphonic character probability database specifically includes: reading the pinyin dictionary file, parsing the valid data rows, extracting the simplified character field from the valid data rows and splitting it into single characters, extracting the corresponding annotated pinyin for each single character, forming single character pinyin groups, and for each single character pinyin group, recording the pinyin version with tone marks and the version without tone marks after removing the tone marks at the end; traversing all the statistically analyzed single characters, and for each single character, obtaining all the different pinyins that have appeared and their corresponding cumulative frequencies; dividing the cumulative frequency of each pinyin by the total frequency of all pinyins for that single character to obtain the probability that the single character is pronounced with that pinyin; constructing a mapping structure for each single character, with each possible pinyin as the key and the corresponding normalized probability as the value; generating and storing two versions of the probability mapping file, one version retaining the original tone marks of the pinyin and the other version using the pinyin with tone marks removed; The construction of the medical terminology package specifically includes: traversing all subdirectories and text files from the root directory of the specified terminology file, reading empty text lines as candidate medical terms; simultaneously, using the names of second-level and lower-level subdirectories as candidate medical terms, and constructing a terminology set from all collected candidate medical terms; for each term in the terminology set, constructing a data structure, the data structure including the character set of the current term, the deduplicated pinyin set corresponding to the current term, and the complete pinyin sequence of the current term; associating all terms with their corresponding data structures to obtain the terminology package; serializing the terminology package into a file and storing it to obtain the final medical terminology package.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the program, it implements the method as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 8.