A corpus construction method and system

By employing a multi-dimensional annotation system and differentiated annotation strategies, the problem of low information extraction accuracy in epilepsy medical records was solved, generating a high-quality structured corpus that adapts to diverse application scenarios and improves data processing efficiency and accuracy.

CN121122547BActive Publication Date: 2026-03-03WEST CHINA HOSPITAL SICHUAN UNIV
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511643002.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-03-03
Estimated Expiration
2045-11-11

AI Technical Summary

Technical Problem

Existing technologies suffer from low information extraction accuracy, coarse granularity, and poor adaptability in epilepsy medical record texts. They struggle to handle diverse epilepsy symptom descriptions and non-standardized expressions, leading to difficulties in structured data extraction.

Method used

A multi-dimensional annotation system and differentiated annotation strategy are adopted, including assigning priority weights to different categories of tags, setting recognition intervals and nesting allowances, and accuracy levels. A structured corpus is generated through an entity recognition model to process paraphrasing and ellipsis in epilepsy clinical texts, thereby achieving the construction of high-quality labeled corpora.

Benefits of technology

It improves the recognition accuracy of epilepsy medical record text, ensures the continuity and integrity of disease information, adapts to diverse application scenarios, reduces manual processing time, and improves data processing efficiency and sustainability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121122547B_ABST
    Figure CN121122547B_ABST
Patent Text Reader

Abstract

The application relates to a corpus construction method and system, which comprises the following steps: establishing a multi-dimensional marking system according to clinical characteristics of epilepsy, and assigning different marking strategies to different types of labels; obtaining original clinical text data related to epilepsy, marking the original clinical text data by using the differential marking strategy, and forming labeled marking corpus; performing consistency evaluation on the obtained labeled marking corpus, and iteratively revising the marking rules when the consistency is lower than a preset threshold until the consistency meets the standard; using the labeled marking corpus as a supervision signal to train and verify an entity recognition model, and obtaining an entity recognition model for epilepsy clinical text; and applying the trained entity recognition model to unmarked epilepsy clinical text to generate a structured corpus. The application can solve the problems of low extraction accuracy, coarse granularity and poor adaptability of the current method, and the method can output high-quality labeled corpus with high precision and recall.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of medical data processing, and in particular to a corpus construction method and system. Background Technology

[0002] The pathological feature of this disease is recurrent, paroxysmal symptoms caused by abnormal neuronal discharges in the brain, and its clinical manifestations are highly heterogeneous. Accurate descriptions of seizure symptoms (including symptom characteristics and frequency) and environmental information (such as time and location) are crucial for epilepsy diagnosis and classification. Electronic health records contain a vast amount of clinical medical records from epilepsy patients, providing valuable data resources for epilepsy research.

[0003] Previous studies have relied heavily on traditional methods for extracting information from Chinese epilepsy clinical texts, such as dictionary matching, rule templates, and medical ontology. While these methods offer some engineering feasibility, they often depend on manually defined rules, making it difficult to capture the diversity and complexity of language expressions in the epilepsy field. For example, patients might describe seizure frequency as "occasionally occurring in the past two months" or "an unpredictable seizure at night," or medication usage as "consistent with the previous treatment plan." Such ambiguous and cross-sentence information is difficult to accurately identify and structure using dictionary- or rule-based methods. Furthermore, the lack of a high-quality, domain-specific Chinese epilepsy corpus makes it difficult for traditional methods to adapt to semantic variations in real-world clinical scenarios, severely limiting the accuracy and scalability of information extraction systems.

[0004] In existing technologies, CN106934220B generates candidate entities through a dual-channel approach of "CRF sequence annotation + disease ontology term segmentation," determines the final disease entities through end-character filtering and rule-based judgment, and can continuously expand the corpus using a semi-supervised method. However, CRF relies on manual features, has weak modeling for semantic embedding and out-of-vocabulary words, its multi-level segmentation rules are domain-dependent and have high maintenance costs, its dual-channel merging strategy is simple, and its generalization ability is significantly lower than that of deep learning models. CN115270713A first establishes a basic corpus through two rounds of annotation, then automatically annotates it using a BERT-CRF / GCN model, and performs consistency verification with manual results. If the consistency reaches 80%, it is output; otherwise, it is repeatedly expanded and retrained. Its disadvantages are low subject transferability, shallow handling of nested cross-sentences, and the fixed threshold is prone to overkill or underfitting. CN117194604B first constructs a "word-symptom-sentence-symptom" association index using inter-point mutual information, then calculates a bi-word correction index using a noun / verb co-occurrence matrix and an adjective co-occurrence matrix. The two are multiplied to obtain a corrected sentence-symptom index, which is then input into the BERT+FC model to achieve disease classification of consultation sentences, thereby constructing and continuously updating a smart medical consultation corpus. Its disadvantages are: the correction index depends on co-occurrence statistics, which has low robustness to out-of-vocabulary words, rare diseases, or cross-sentence context-sensitive scenarios, and the BERT input needs to be additionally spliced ​​with manual features, increasing complexity and the risk of overfitting. CN119166817A uses BioClinicalBERT as its core, constructing a breast MRI corpus through a closed-loop iterative process of "human double-layer annotation, model self-training, machine annotation, and comparison with humans." It then extracts structured labels from free text and standardizes terminology to achieve case text standardization. Its disadvantages are: the threshold is fixed and relatively low, making it easy to miss incorrect labels; the multi-level similarity matrix and report-image alignment strategy are complex; cross-modal errors can cascade; the number of parameters is large; and it is prone to overfitting to rare lesions with small samples. Summary of the Invention

[0005] The purpose of this invention is to provide a corpus construction method and system that partially solves or alleviates the above-mentioned shortcomings in the prior art (for example, due to differences in the expression habits and clinical experience of different physicians, there are significant inconsistencies in the terminology and non-standardization of expression in the symptom descriptions in epilepsy medical records, which pose a great challenge to the structured extraction of data). It can solve the problems of low extraction accuracy, coarse granularity and poor adaptability of current methods, and balance accuracy and recall to output high-quality labeled corpora.

[0006] To solve the aforementioned technical problems, the present invention specifically adopts the following technical solution:

[0007] Firstly, this application discloses a corpus construction method, including the following steps:

[0008] S1: Establish a multidimensional annotation system based on the clinical characteristics of epilepsy, and assign differentiated annotation strategies to different categories of labels; the multidimensional annotation system includes at least two primary label categories: disease, disease stage time, clinical manifestations, medical examinations, treatments, drugs, and influencing factors, and sets secondary or tertiary label categories with clinical semantics under the primary label categories; the differentiated annotation strategies include: presetting priority weights for each label category to ensure that high clinical value labels are retained first in case of conflict; setting corresponding recognition intervals and nesting allowances for each label category to control the scanning window and context fusion range; and for each label category... S1: Do not set an accuracy level to limit the annotation granularity in the text; S2: Obtain the original clinical text data related to epilepsy, and use the differentiated annotation strategy in step S1 to annotate the original clinical text data to form a labeled annotation corpus; S3: Perform a consistency evaluation on the labeled annotation corpus obtained in step S2, and iteratively revise the annotation rules when the consistency is lower than the preset threshold until the consistency is achieved; S4: Use the labeled annotation corpus as a supervision signal to train and validate the entity recognition model to obtain an entity recognition model for epilepsy clinical text; S5: Apply the trained entity recognition model to unlabeled epilepsy clinical text to generate a structured corpus.

[0009] Furthermore, the step of pre-setting priority weights for each label category to ensure that high clinical value labels are retained in case of conflict includes: dividing clinical value label categories into three levels: high, medium, and low, and assigning high, medium, and low weights accordingly; in case of label conflict, making an immediate decision based on the weight, with high-weight labels being retained first, and low-weight labels being suppressed or downgraded to candidates.

[0010] Furthermore, it also includes the step of: obtaining the confidence score for each label category through a pre-trained confidence model;

[0011] A tiered confidence management strategy is set based on the priority level of the label category, including: setting a first confidence threshold for mandatory retention of high-priority labels to ensure that core clinical information is output first; setting a second confidence threshold for candidate or retention of medium-priority labels; and setting a third confidence threshold for suppressing output of low-priority labels.

[0012] Furthermore, the process includes the following steps: dynamically switching between precise priority mode and comprehensive priority mode for the same text stream based on the differences in the clinical use of the labels; in precise priority mode, using high confidence and semantic consistency as criteria, only high-value labels that can directly support clinical decision-making are output, while labels with insufficient confidence or polysemous conflicts are suppressed; in comprehensive priority mode, the confidence threshold is relaxed and the label range is allowed to be extended, maximizing the recall of auxiliary or ambiguous labels in the form of candidates for manual review or secondary rule screening.

[0013] Furthermore, the steps include: setting reference weights for recognition intervals based on label categories and labeling habits; labeling habits include doctors' personal medical record filling habits, medical team's preferred filling habits, and hospital group's preferred filling habits.

[0014] Furthermore, the steps include: presetting a maximum recognition interval length and nesting allowance for each type of label, wherein the maximum recognition interval length is determined according to the number of sentences of this type of label in the medical record, and the nesting allowance is set according to clinical value and nesting needs; dynamically segmenting the text window with the maximum recognition interval length as the upper limit, and controlling the number of cross-class nesting levels within the current window according to the nesting allowance; when the number of sentences in the window exceeds the maximum recognition interval length or the number of nesting levels exceeds the nesting allowance, forcibly segmenting a new interval and reverting conflicting labels.

[0015] Furthermore, the setting of precision levels for each label category to limit the granularity of annotation in the text includes:

[0016] Based on the complexity of clinical semantics, the tag categories are divided into high precision level, medium precision level and low precision level; the high precision level corresponds to word level or phrase level, the medium precision level corresponds to short sentence level, and the low precision level corresponds to whole sentence or whole paragraph level annotation granularity.

[0017] Furthermore, the method also includes the step of semantically refining the multidimensional annotation system, including:

[0018] Add disease progression stage tags to the symptom descriptions in the text, and bind the disease progression stage tags to the corresponding symptom entities;

[0019] Quantifiable frequency expressions in the text are labeled as precise frequency labels, while non-quantifiable subjective frequency expressions are labeled as fuzzy frequency labels.

[0020] External behaviors, environment, and physiological factors are labeled as triggering factor tags, and the patient's state during an attack is labeled as a state tag. Structured data is generated based on the triggering factor tags and state tags.

[0021] The text detects paraphrased or omitted expressions and labels them as context reference tags. It establishes the referential relationship between the context reference tags and the target entities that have been labeled in the preceding text. Based on the referential relationship, it generates a complete medication timeline and symptom timeline across time points.

[0022] Furthermore, if a label category belongs to multiple easily confused label categories, disambiguation judgment is performed according to preset semantic rules, including: if it is described as a fever-related trigger and related to the onset, it is classified as a clear trigger; if it is described as an infection-related event and mentions a triggering relationship, it is classified as medical history rather than a trigger; if it is described as a drug-related adverse reaction, it is preferentially classified as a drug adverse reaction; if it is described as external trauma or imaging terminology, it is classified as medical history rather than disease classification; if it is described as a patient's subjective judgment and there is no formal diagnostic support, no medical history or comorbidity label is generated.

[0023] Secondly, this application also discloses a corpus construction method system, the system comprising:

[0024] The annotation rule construction module is configured to establish a multidimensional annotation system based on the clinical characteristics of epilepsy and assign differentiated annotation strategies to different categories of labels. The multidimensional annotation system includes at least first-level label categories such as disease, disease course stage time, clinical manifestations, medical examinations, treatments, drugs and influencing factors, and sets second-level or third-level label categories with clinical semantics under the first-level label categories.

[0025] The differential annotation strategy includes:

[0026] Pre-set priority weights for each label category to ensure that labels with high clinical value are retained in case of conflicts;

[0027] Set corresponding recognition range and nesting allowance for each label category to control the range of scanning window and context fusion;

[0028] Set a precision level for each label category to limit the granularity of annotations in the text;

[0029] The raw clinical text data acquisition module is configured to acquire raw clinical text data related to epilepsy. It uses the differentiated annotation strategy in the annotation rule construction module to annotate the raw clinical text data, forming a labeled corpus.

[0030] The consistency assessment module is configured to perform consistency assessment on the labeled corpus obtained by the original clinical text data acquisition module, and iteratively revise the labeling rules when the consistency is lower than the preset threshold until the consistency is met.

[0031] The model training module is configured to train and validate the entity recognition model using labeled corpus as a supervision signal, thereby obtaining an entity recognition model for epilepsy clinical texts.

[0032] The structured corpus generation module is configured to apply the trained entity recognition model to unlabeled epilepsy clinical texts to generate a structured corpus.

[0033] Beneficial effects:

[0034] 1. This application significantly improves the model's accuracy in identifying key fields through a designed multi-dimensional annotation system and differentiated annotation strategy. This improvement directly provides more reliable data for clinical decision-making, reduces diagnostic bias caused by misidentification, and enhances the scientific rigor and accuracy of medical decisions.

[0035] 2. Through mechanisms such as contextual reference tags, the system can handle omitted expressions and restated information in clinical records, ensuring the continuity and integrity of disease progression information. This not only improves data usability but also enhances the interpretability of model output.

[0036] 3. Through switchable "precision-first" and "comprehensive-first" modes, the same model can support both clinical report output and the needs of scientific research and data mining, without the need for repeated training. This flexibility allows the model to adapt to diverse application scenarios, improving its applicability and efficiency, and reducing the additional costs associated with scenario switching.

[0037] 4. The generated structured corpus can be directly used for statistical analysis, predictive models, or knowledge graph construction, significantly reducing the time and workload of manual data processing. This improvement not only enhances the efficiency of data processing but also provides a continuously updated data foundation for subsequent clinical research and personalized treatment, reducing overall modeling costs and improving the sustainability of research and applications. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. The elements or parts in the drawings are not necessarily drawn to scale. Obviously, the drawings described below are some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.

[0039] Figure 1 This is a flowchart of a corpus construction method proposed in this application.

[0040] Figure 2 This is a schematic diagram of a specific embodiment of the corpus construction method applicable to this application.

[0041] Figure 3 This is a schematic diagram illustrating a labeled example in one embodiment of this application.

[0042] Figure 4 This is a schematic diagram comparing the recognition performance of named entity tags under multiple models in one embodiment of this application.

[0043] Figure 5 This is a schematic diagram of the module structure of a corpus construction method system in one embodiment of this application. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0045] In this document, suffixes such as "module," "part," or "unit" used to denote elements are used only for the purpose of illustrative purposes and have no specific meaning in themselves. Therefore, "module," "part," or "unit" may be used interchangeably.

[0046] In this document, the terms "upper," "lower," "inner," "outer," "front," "rear," "one end," and "the other end," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the present invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the present invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0047] In this document, unless otherwise explicitly specified and limited, the terms "installed," "equipped with," "connected," etc., should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, a direct connection, or an indirect connection through an intermediate medium; it can be a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0048] It should be noted that medical records come from various sources, such as different hospitals, different departments within hospitals, and community health registries, making it difficult to standardize their format. Furthermore, medical records may originate from doctors' notes, diagnoses, or patient or family accounts, resulting in significant variations in reliability. Additionally, since medical record identification is typically used for entering standardized disease data, the accuracy of identification is extremely crucial. Incorrect interpretation of information can pose a significant risk and interfere with subsequent diagnosis and treatment. Therefore, this places extremely high demands on the standardized identification of medical records.

[0049] Especially in the field of epilepsy medical records, these records often involve multiple pieces of information, including the patient's current seizure status, seizure history, medication history, and medical examinations. Furthermore, they present the following challenges in quantification:

[0050] 1) Due to the lack of standardization in medical record filling and the unreliability of patient or family members' self-reports (such as subjective or incorrect descriptions), information extraction is difficult.

[0051] 2) Epilepsy can have comorbidities, so there is information about comorbidities. However, comorbidities may be different from common diseases (e.g., metabolic diseases may be caused by epilepsy (i.e., comorbidities) or may not be related to epilepsy). Furthermore, information about comorbidities or other diseases may be questionable in classification due to different sources.

[0052] 3) Because epilepsy medical records involve the entry of information from multiple sources, there may be overlap in the descriptions of different categories of information. For example, hypoglycemia can be both a trigger for epilepsy and an abnormal state caused by epilepsy. In other words, label recognition is very prone to misalignment.

[0053] In summary, due to the numerous types of information, significant overlap, and non-standardization of epilepsy medical records, extracting and classifying information comprehensively and effectively from these records is extremely difficult. Furthermore, the inability to extract complete information from medical records can lead to the loss of a large amount of data, affecting the accuracy of statistical analysis.

[0054] In response to the contradiction between information accuracy and extraction completeness, this invention provides a differentiated annotation strategy to improve recognition accuracy while maximizing recognition completeness.

[0055] Figure 1 A flowchart of a corpus construction method according to this application is shown. (Refer to...) Figure 1 The method specifically includes the following steps:

[0056] S1: Establish a multidimensional annotation system based on the clinical characteristics of epilepsy, and assign differentiated annotation strategies to different categories of labels;

[0057] S2: Obtain raw clinical text data related to epilepsy, and use the differential annotation strategy in step S1 to annotate the raw clinical text data to form labeled corpus;

[0058] S3: Perform a consistency evaluation on the labeled corpus obtained in step S2, and iteratively revise the labeling rules when the consistency is lower than the preset threshold until the consistency is met;

[0059] Consistency can be evaluated by comparing and contrasting pre-annotated corpora (as verification data) with annotated corpora identified based on the annotation strategy of this invention.

[0060] S4: Using labeled corpora as supervisory signals, the entity recognition model is trained and validated to obtain an entity recognition model for epilepsy clinical texts.

[0061] S5: Apply the trained entity recognition model to unlabeled epilepsy clinical texts to generate a structured corpus.

[0062] In this paper, the entity recognition model is a specialized natural language processing model whose core task is to automatically identify, extract, classify, and name entities (such as keywords) from unstructured text (such as medical records) and categorize them into predefined categories. For example, the entity recognition model can be a Large Language Model (LLM).

[0063] Figure 2 The diagram illustrates a specific embodiment of the corpus construction method applicable to this application. The corpus construction method in this embodiment specifically includes the following steps:

[0064] Step 101: Establish the annotation system and rules:

[0065] Based on the clinical characteristics of epilepsy, this study systematically constructed entity categories and annotation specifications for the corpus, considering seven dimensions: disease, time, symptoms, examination, treatment, medication, and influencing factors. The system was primarily developed based on epilepsy clinical treatment guidelines, while also referencing publicly available datasets (such as Semio2Brain) and relevant research literature to ensure its scientific rigor and completeness, comprehensively covering all clinical information related to epilepsy.

[0066] This application addresses the need for structured information extraction from clinical texts on epilepsy by constructing a task-oriented named entity annotation system, which includes 30 categories of tags covering core medical information in the epilepsy diagnosis and treatment process. The annotation system mainly includes the following seven categories: ① Disease diagnostic information, including epilepsy classification (dis-ept) and comorbidities and medical history (dis-his), which can support the detailed expression of complex diagnoses; ② Time information (tim) used to uniformly annotate time-related descriptions at key nodes such as the occurrence of comorbidities, seizure time, medication adjustment or treatment intervention in epilepsy patients, in order to clarify the disease development process, the trend of disease changes and the overall treatment progress; ③ Seizure-related information (clm), which distinguishes in detail the seizure frequency (clm-frq, clm-frq-amb, clm-frq-num), duration (clm-dur), pre- and post-seizure cues (clm-sta-bef, clm-sta-aft), seizure symptoms (clm-sym) and their restatement (clm-sym-cpy), which facilitates the accurate depiction of the patient's seizure symptoms and the details of their evolution; ④ Drug information (dru) covering drug name (dru-nam), dosage (dru-do) and other relevant information. 5) Usage (dru-mtd), adverse reactions (dru-adv), and medication adherence (dru-com), with a special "dosage reference" label (dru-dos-cpy) for handling cases where previous drug information is cited in the text; 6) Treatment information (trt) is used to label non-drug treatment methods, including surgery, traditional Chinese medicine, etc.; 7) Examination-related information is divided into examination items (exa-itm) and examination findings (exa-fnd) to facilitate the identification of key examinations such as EEG and imaging and their results; 8) Triggering factors and state information (fac) refines the triggering factor label (fac-inc) and adds three subcategories: definite trigger (fac-inc-def), indefinite trigger (fac-inc-amb), and no trigger (fac-inc-spo). Additionally, considering the high incidence of epilepsy and special periods, two environmental state labels are set up: sleep state (fac-con-slp) and pregnancy / partum state (fac-con-preg). Detailed labeling is shown in Table 1.

[0067] Table 1

[0068]

[0069] In one specific embodiment, this application addresses the problem of ambiguous temporal expression in epilepsy clinical texts by introducing disease course stage labels (such as "before seizure" and "after seizure") to decouple symptom descriptions from temporal relationships, enabling explicit temporal modeling. Even with disordered text order, symptom stages can be accurately categorized, improving the model's ability to identify seizure evolution and supporting seizure prediction and prognostic analysis.

[0070] To address the existing problems of traditional medical text annotation systems treating symptoms as isolated events, and the frequent disruption of the descriptive order and the scattering of symptoms across different paragraphs in medical records, which highlight the distinct temporal process of epileptic seizures (premonitory symptoms - seizure manifestations - post-seizure recovery), this system introduces stage-specific labels such as "pre-seizure" and "post-seizure" to achieve temporal annotation of symptoms. Even with missing text order or confusing context, it can model "headache 1 hour after seizure" as a complete "symptom + stage," transforming the previously reasoned sequential information into structured temporal annotations, maintaining the accuracy and consistency of information classification. An application example shows that, given the original text "The patient experienced blurred vision 5 minutes before the seizure, followed by loss of consciousness, tonic-clonic convulsions of the limbs, which gradually stopped after 3 minutes, and regained consciousness after about 10 minutes, with headache persisting 3 hours after the seizure," this system can output a fixed data structure: Premonitory symptoms (if present): Visual disturbance (5 min); Seizure: Loss of consciousness - tonic-clonic convulsions of the limbs (3 min); Post-seizure: Time to regain consciousness (if there was loss of consciousness): 10 min; Headache (3 h). This brings three major application values: ① Attack prediction - the system identifies and organizes "pre-attack" symptoms, providing reliable data for prodromal feature extraction and predictive model training; ② Prognostic analysis - clearly distinguishes "post-attack" symptoms, facilitating the study of complications and recovery patterns; ③ Disease course modeling - reconstructing the complete attack process based on unified temporal labels, improving the interpretability and computability of clinical data. Compared with the traditional approach that "only relies on sequence," the model training stage no longer relies solely on contextual word order to learn temporal relationships, but directly obtains explicit temporal labels, avoiding difficulties in integrating information across sentences and paragraphs and erroneous attribution when expressions are ambiguous; in the clinical application stage, due to the high degree of data structuring, it can be directly used for attack prediction (focusing on pre-attack symptoms), prognostic assessment (analyzing post-attack symptoms), and disease course modeling (reconstructing the entire attack process), significantly enhancing data usability and clinical decision support capabilities.

[0071] In one specific implementation, to balance the subjectivity and objectivity of frequency expression, a dual-channel frequency label is constructed: clm-frq is used for quantifying frequency (e.g., "twice a week"), and clm-frq-amb is used for fuzzy expression (e.g., "occasional seizures"). This mechanism preserves the original semantic diversity, avoids information distortion caused by forced quantification, and enhances the model's ability to realistically characterize seizure burden.

[0072] This paper proposes a dual-channel annotation innovation to distinguish between precise and fuzzy frequencies, addressing the pain point that clinical records contain diverse expressions of epileptic seizure frequency, and that traditional systems using only a single label cannot distinguish between objective quantification and subjective fuzzy information. The background is that medical records contain both quantifiable data such as "3 times a day, 2 times a week" (e.g., data containing time and seizure frequency) and a large amount of subjective descriptions reflecting patient memory or doctor habits, such as "occasional seizures, frequent seizures." Unifying these into a single label would discard uncertain semantics and force the calculation of fuzzy terms into frequencies, leading to subsequent model distortion and decreased clinical interpretability. The improved solution introduces two parallel labels: clm-frq (precise frequency) and clm-frq-amb (fuzzy frequency). The former locks in definitive expressions such as "3 times a day, 1 time a month," while the latter specifically captures non-quantifiable descriptions (e.g., data without time or seizure frequency) such as "occasional," "sometimes," and "frequent." This completely separates objective data from subjective perception at the annotation layer, providing a clear boundary for the NER model without the need for forced quantification. The application value is reflected in three aspects: ① Modeling layer - precise frequencies can be directly used for attack risk stratification, statistical analysis, and predictive training, while fuzzy frequencies serve as a patient subjective burden indicator, complementing objective frequencies and enhancing the input dimension of the model; ② Clinical layer - doctors can simultaneously view "quantified frequencies" and "patient perceptions," enhancing the credibility of results and communication efficiency; ③ Information dimension - the dual channels preserve uncertainty and cognitive differences, making the corpus more practical and computable in follow-up assessment, individualized intervention, and patient management.

[0073] In one specific embodiment, in modeling triggering factors, structured triggers and state labels (such as fac-inc-def for specific triggers and fac-con-slp for sleep states) are designed to transform scattered descriptions such as "attacks after staying up late" and "attacks during sleep" into computable features. This mechanism supports attack pattern recognition and individualized risk intervention, enhancing clinical decision support capabilities.

[0074] This paper proposes a systematic innovation in "structured modeling of triggering factors and states," directly addressing the pain point that epileptic seizures are easily influenced by external environment, behavior, and physiological state, yet these factors have long been recorded in a scattered manner and lack quantitative methods. Traditional medical records only vaguely mention "presence / absence of triggers," resulting in high-value information such as "after staying up late," "during deep sleep," and "pregnancy" remaining outside of structured data. This makes it difficult to extract information in batches clinically, difficult to quantify risks in scientific research, and the model cannot capture the potential correlation between seizures and environment-behavior-physiology. The improved solution is to construct a dual-channel labeling system: ① Triggering factors fac-inc, which uniformly defines the entity boundaries of three types of triggers: behavior (staying up late, strenuous exercise), environment (high temperature, strong light, stress events), and physiology (menstrual cycle, pregnancy), achieving one label for each word; ② State fac-con, which specifically records the immediate state at the time of seizure, such as sleep stage, awake stage, pregnancy, etc., separating "state" and "trigger" at the semantic level, and transforming the previously scattered natural language descriptions in sentences into structured fields. The application value is reflected in four aspects: 1) Seizure pattern recognition - by large-scale statistical analysis of fac-inc / fac-con distribution, high-risk scenarios (such as the combination of "staying up late + sleeping") can be quickly identified; 2) Personalized prediction and intervention - by combining the patient's historical fac-inc / fac-con sequences, personalized risk scores are generated, providing quantitative basis for doctors to formulate lifestyle interventions such as work and rest, contraception, and light exposure; 3) Clinical decision support - the follow-up system can directly call structured trigger fields to dynamically adjust drug dosage or trigger non-drug interventions (such as avoiding high-risk exercise); 4) Enhanced research value - unified standards make trigger-state data from multiple centers and cross-cohorts comparable, helping to explore seizure mechanisms and develop high-precision prediction models. Therefore, this invention upgrades "scattered text" to "computable features," filling the gap in the system modeling of environmental-behavioral-physiological variables in the field of epilepsy.

[0075] In one specific implementation, for omitted expressions such as "symptoms as before" and "continue original dosage" in clinical texts, contextual reference tags (such as clm-sym-cpy and dru-dos-cpy) are introduced to establish cross-sentence referential relationships and complete the disease progression information chain. This mechanism solves the problem of information breaks, ensures the continuity of the disease progression, and improves the robustness and data integrity of the NER model in inpatient course and follow-up records.

[0076] The "Context Reuse and Reference Tags" section directly addresses the pain point of omitted expressions such as "symptoms as before," "continue original dosage," and "continue medication according to the previous regimen" in inpatient medical records and follow-up texts, which are directly ignored by ordinary NER models, leading to gaps in medical record information and incomplete medication timelines. The improved solution is to introduce context reference tags such as clm-sym-cpy and drug-dos-cpy to specifically mark these restatement fragments and establish explicit referential relationships with preceding entities. For example, when the text first records "5 years ago, sodium valproate 0.5g bid" and then three years later "levetiracetam added to the original medication," the system automatically labels "sodium valproate" in the latter sentence as drug-dos-cpy and links it to the dosage record from 5 years ago, thus merging the two narratives into a continuous medication history [5 years ago] VPA0.5g bid - [3 years ago] VPA0.5g bid + LEV0.5g bid, avoiding duplicate entries and ensuring the integrity of the timeline. This mechanism brings four benefits: ① The NER model can trace entities across sentences and paragraphs, significantly improving the depth of analysis; ② Information gaps caused by omissions in inpatient course and high-frequency follow-up are automatically filled in, and the entire process of symptom evolution, treatment plan adjustment, and compliance changes can be continuously tracked; ③ It provides a standardized, calculable, and traceable data foundation for automatic medical record summarization, full-cycle patient management, medication compliance assessment, and flare-up risk models; ④ By replacing "repetition" with "citation," redundant annotations are reduced, the data utilization rate of clinical texts with high repetition rates is improved, and previously discarded ellipsis sentences become valuable structured information.

[0077] In one specific embodiment, this application assigns differentiated labeling strategies to different categories of labels, including:

[0078] Pre-set priority weights for each label category to ensure that labels with high clinical value are retained in case of conflicts:

[0079] First, determine the clinical value of the tag categories. Analyze clinical needs: Collaborate with clinical experts to analyze the clinical importance of different tag categories in epilepsy clinical texts. For example, tags such as epilepsy subtype (dis-ept), seizure symptoms (clm-sym), and drug dosage (dru-dos) directly influence diagnostic and treatment decisions and have high clinical value. Assess the impact of tags on clinical decisions: Based on their role in clinical decision-making, tags are categorized into high-priority, medium-priority, and low-priority categories. High-priority tags are key information that directly affects epilepsy diagnosis, seizure risk assessment, and treatment plans; medium-priority tags have a supporting role in clinical decision-making; and low-priority tags provide supplementary information. Then, assign priority weights to each tag category:

[0080] 1. High-priority tags

[0081] (1) High priority - easy to identify

[0082] Epilepsy subtypes (dis-ept) are fixed and easily identifiable, typically appearing in the "Diagnosis" field or at the beginning or end of sentences, often accompanied by keywords such as "diagnosed as," "considered," and "epilepsy." A precision-priority strategy is employed, setting a high confidence threshold, and automatic confirmation is only performed when semantic consistency is high; otherwise, it is marked "pending verification." Drug names (dru-nam), as stable and easily identifiable medical terms, are often accompanied by verbs such as "prescribe," "orally," and "intravenously," appearing in the same sentence as dosage / usage. Recognition is achieved through pharmacopoeia / knowledge base matching combined with contextual information, with automatic confirmation when confidence is high. Drug dosages (dru-dos) are semantically closely linked, with clear structure and location of occurrence, often containing numerical and frequency terms in the same sentence, such as "0.5g orally three times daily." Contextual analysis and separation models are used to assist in identification, classifying numerical units as dru-dos and frequency / administration methods as dru-mtd. Examination items (exa-itm), such as "electroencephalogram" and "cranial MRI," usually appear independently as examination names, with standardized formats, and are directly labeled through medical examination dictionary matching.

[0083] (2) High priority - difficult to identify

[0084] Among the high-priority, more difficult-to-identify tags, comorbidity (dis-his) tags directly correspond to clinical diagnostic information, usually located in the "Diagnosis" field or at the end of a paragraph, often accompanied by keywords such as "diagnosed as," "considered," and "confirmed." However, due to the wide variety of expressions, omissions are common. Therefore, a dictionary was created to ensure the identification rate of key comorbidities. A precision-priority strategy was adopted, setting a high confidence threshold, automatically confirming only when semantic consistency is high; otherwise, it was marked "awaiting verification." Seizure symptoms (clm-sym) and seizure symptom repetitions (clm-sym-cpy) exhibit significant natural language variation, such as "hand twitching," "eye rolling," and "loss of consciousness." Although the overall identification accuracy is high, low-frequency symptoms are prone to misidentification. Therefore, a deep contextual model was used for identification; if semantically ambiguous, it was listed as a candidate and required verification. Seizure frequency (clm-frq), seizure duration (clm-dur), and seizure frequency-number (clm-frq-num) often include time / number expressions, such as "once daily" or "approximately 5 minutes." High-confidence results are automatically confirmed using regular expression templates and temporal context. Examination findings (exa-fnd) co-occur with the examination items, such as "EEG showed discharge in the left temporal region." These are segmented using trigger words (such as "show" or "hint") to extract the examination results.

[0085] 2. Medium priority tags

[0086] (1) Medium priority - easy to identify

[0087] In the easily identifiable tags of medium priority, the time expression (tim) is standardized in form, such as "3 days ago" or "2023-04-02," and is processed through rule extraction and standardized formatting. Pre-, during-, and post-seizure status information (clm-sta-bef, clm-sta-aft) is usually accompanied by cue words such as "before seizure," "during seizure," or "after seizure," and is identified using a trigger word template-based method. The descriptions of no triggering factors (fac-inc-spo) are basically consistent and standardized, such as "no trigger" or "no obvious trigger," and can also be identified based on trigger word templates. The identification characteristics of these tags are relatively clear, and the processing strategy is relatively direct, which can effectively improve the efficiency and accuracy of annotation.

[0088] (2) Medium priority - difficult to identify

[0089] Several categories of tags that are more difficult to identify in the medium priority category, while having high clinical value, are subjectively or sporadically described and require additional strategies as backup. Medication adherence (dru-com) is often described verbally as "not taking medication regularly" or "taking medication on time." The model first makes an initial judgment, then filters using semantic rules, and manually confirms low-confidence samples. Adverse drug reactions (dru-adv) have the broadest scope, possibly including phrases like "rash appeared" or "abnormal liver function." The system calculates the co-occurrence relationship and semantic similarity between the drug name and the abnormal symptoms to infer potential adverse reactions and mark them as candidates. Treatment measures (trt) cover surgery, traditional Chinese medicine, etc., and are described briefly, often triggered by verbs like "performed ×× procedure" or "acupuncture." A medium confidence threshold is set, and the output is based on a treatment vocabulary and semantic aggregation disambiguation. Clearly defined triggering factors (fac-inc-def), such as "frequent attacks after fatigue" or "often attacks during menstruation," rely on the causal direction of the context. The system relaxes the threshold to capture a wide range of triggers, marks their confidence levels, and keeps them as candidates. Subsequent decisions on whether to adopt these can be made manually or by task configuration.

[0090] 3. Low to medium priority / candidate tags

[0091] Although low- and medium-priority candidate labels receive slightly less clinical attention, they are still retained by the system to supplement information. Drug usage (dru-mtd) is inherently simple to identify; in the same sentence, "0.5g orally three times daily" can be broken down into numbers and frequency. The model assigns dosage to drug-dos and frequency / method of administration to drug-mtd, automatically completing fine-grained segmentation. Indefinite triggers (fac-inc-amb) are the most challenging; patients might write "first attack after playing basketball" or "sudden fall and loss of consciousness while cleaning," with semantics highly dependent on context. The system lowers the trigger threshold, first broadly capturing and providing confidence levels, then retaining them as candidates for manual or subsequent task confirmation. Seizure state (fac-con-slp / fac-con-preg) often overlaps with trigger descriptions, such as "attack during sleep" versus "attack after staying up late." The model uses time-causality to determine that the former is the state and the latter is the trigger, also outputting it as a candidate. The fuzzy frequency (clm-frq-amb) contains only indefinite quantitative terms such as "occasionally" and "sometimes". The system allows for lenient recognition, only marks low confidence, and does not use it directly for statistics, but retains the original semantic clues for subsequent episodic burden assessment.

[0092] The system sets different confidence thresholds and automatic confirmation strategies based on priority levels:

[0093] First, obtain the confidence score for each label category using a pre-trained confidence model (e.g., a pre-trained model of MC-BERT+Softmax);

[0094] High priority (easily identifiable): Confidence level ≥ 0.85, automatic confirmation;

[0095] High priority (difficult to identify) and medium priority: Confidence ≥ 0.70, automatically confirmed; otherwise, candidate.

[0096] Medium to low priority: Confidence scores ≥ 0.50 are retained as candidates, and those below the threshold are not output.

[0097] In one specific embodiment, during the tag recognition process, when the system detects that the same text fragment may be identified as multiple tags, a conflict handling mechanism is triggered. Based on preset priority weights, the system prioritizes retaining tags with higher weights. For example, if "loss of consciousness" is identified as both a seizure symptom (clm-sym, weight 0.9) and an adverse drug reaction (dru-adv, weight 0.3), the system will retain clm-sym.

[0098] In one specific embodiment, the system employs a hierarchical balance strategy of "finding all" and "finding the most accurate" in epilepsy medical record annotation, switching between the two modes as needed:

[0099] The Precision Priority mode requires labels to be output only when they have high confidence and semantic consistency. It is specifically used for high-risk fields that directly affect clinical decisions, such as diagnosis, frequency of attacks, and drug dosage. It can suppress ambiguity and cross-label conflicts and ensure that the results can be directly used for medical record writing or medication verification.

[0100] The precision-priority mode means that in the process of multi-label recognition, the system uses the confidence level and semantic certainty of the label judgment as the main judgment criteria, and only outputs the label result when a high semantic consistency or confidence threshold is met. When the semantics are ambiguous or there is ambiguity, the system chooses not to automatically confirm the label, but marks it as "pending review" or "candidate status".

[0101] Semantic consistency refers to whether an object (such as extracted keywords or tags) is relevant in the current context (such as the corresponding recognition interval or the entire medical record text). In other words, after automatically extracting several keywords from a medical record file, an LLM model can be used to verify whether these keywords point to the same reasonable clinical scenario or medical concept in the medical context, thereby determining whether they can constitute a logically consistent and contradictory medical information summary.

[0102] This mode is mainly used for high-risk, decision-dependent tags, such as diagnosis (DI), seizure type and frequency (CLM), and drug dosage and usage (Dru-Dos / Dru-MTD), to ensure that the system output results can directly support clinical judgment or subsequent analysis.

[0103] In precision-first mode, the system improves the reliability of tag output through the following strategies:

[0104] Confidence threshold control: When there are multiple label candidates for the same entity, the system only retains the result with the highest confidence and semantic consistency;

[0105] Contextual consistency verification: Labels must be consistent with the semantic context (such as time point, symptoms, and examination results) before being output;

[0106] Cross-label conflict suppression: If the same phrase can be identified as multiple labels (e.g., "insomnia" in "insomnia after medication" may trigger dru-adv, clm-sym, fac-con-slp), the system only retains the label that is more consistent with the semantics of the disease course in the main logical path (in this case, dru-adv is retained).

[0107] In precise priority mode, when faced with semantically clear and highly confident statements such as "diagnosed as focal epilepsy with status epilepticus," the system directly confirms and outputs dis-ept. However, when encountering "suspected focal seizure," due to the uncertain modifier "suspected" and the fact that it only describes a seizure rather than epilepsy, the system marks dis-ept as a candidate and suggests that further clarification is needed. For sentences with multiple co-occurrences and semantically clear meanings, such as "regular oral administration of sodium valproate twice daily," the system simultaneously confirms dru-nam, dru-mtd, and dru-dos. When encountering "first seizure after injection," in the semantic conflict of whether "injection" belongs to the method of medication or the inducing factor, the system retains fac-inc-def and suppresses dru-mtd according to priority, thereby significantly reducing the mislabeling rate caused by polysemous expressions and improving the semantic purity and usability of high-priority labels.

[0108] By adopting the precise priority mode, the system can significantly reduce the mislabeling rate caused by polysemous expressions or ambiguous statements, reduce inter-label conflicts, and improve the semantic purity and usability of high-priority labels (such as disease diagnosis, attack frequency, and drug dosage).

[0109] The comprehensive priority mode relaxes the threshold, retaining vague or low-confidence descriptions such as "occasional occurrence" and "considered to be related to emotions" as candidates. This is mainly used in scenarios requiring high recall, such as scientific research and knowledge graph expansion. Subsequent manual review and filtering significantly reduce false negatives. The system dynamically selects the mode based on the label category and task scenario: precise priority is enabled by default for labels with clear boundaries and critical decision-making; comprehensive priority is preferred for diverse and only auxiliary trigger or state labels, thus achieving a flexible balance between clinical safety and data integrity.

[0110] The comprehensive priority mode refers to the system prioritizing information coverage and recall during the label recognition process, allowing candidate labels to be output even when the confidence level is low or the semantics are somewhat ambiguous.

[0111] This model is mainly applicable to auxiliary, exploratory, or context-dependent labels, such as triggering factors (fac series), state labels (fac-con series), and labels with unclear expression of seizure duration / frequency (clm-frq-amb, clm-dur), etc.

[0112] Its goal is to find as much potential information as possible in the early extraction or automatic summarization tasks, so that subsequent manual or rule-based modules can perform secondary screening.

[0113] In the comprehensive priority mode, the system adopts the following strategies to ensure broad information coverage:

[0114] The confidence threshold is relaxed: even if the high confidence threshold is not reached, candidate results can still be output and assigned the low confidence label "pending confirmation".

[0115] Contextual extension capture: When the context boundaries are unclear, the system allows the label range to be extended (e.g., "several episodes in the last six months" - tim+clm-frq).

[0116] In the comprehensive priority mode, the system prioritizes coverage: for vague frequency statements such as "the patient has had occasional attacks in the past six months", it still outputs the clm-frq label (corresponding to the vague label); for low confidence sentences such as "irregular medication", it retains dru-com as a candidate for subsequent review; even when encountering "considering is related to emotions" containing vague related words such as "considering" and "related", it will also output fac-inc-amb as a candidate, thereby maximizing the capture of potential clinical clues, reducing missed labels, and improving the completeness and discoverability of the corpus.

[0117] By adopting a comprehensive priority mode, the system can maximize the coverage of all potential clinical clues in the early stages of information extraction, helping to reduce missed labels. Especially in the exploratory modeling, knowledge graph expansion, or data mining stages, it can improve data discoverability. Combined with the later manual review and confidence re-screening mechanism, it can balance recall and precision, ensuring overall semantic integrity and analytical flexibility.

[0118] On the other hand, the present invention actually provides a tag recognition mode switching mechanism, which includes the following steps:

[0119] Identify the entered information in clinical text data;

[0120] Select the corresponding recognition mode for the clinical text data based on the entered information. The recognition modes include: Precision Priority Mode and / or Comprehensive Priority Mode.

[0121] Correspondingly, in the precision priority mode, high confidence and semantic consistency are used as criteria (that is, confidence and semantic consistency are used as the dominant judgment mechanism), only high-value labels that can directly support clinical decision-making are output, and labels with insufficient confidence or polysemous conflicts (that is, labels may be classified into two or more categories) are suppressed.

[0122] In the comprehensive priority mode, the confidence threshold is relaxed and the label range is allowed to be extended to maximize the recall of auxiliary labels (such as in some embodiments, auxiliary labels refer to inducing factors (fac series), state labels (fac-con series), labels with unclear expression of duration / frequency of attacks (clm-frq-amb, clm-dur) etc.) or vague labels (such as "considering is related to emotion" containing vague related words such as "considering" and "related"), and also fac-inc-amb as a candidate output, that is, as a vague label) for manual review or secondary rule screening.

[0123] From another perspective, the confidence threshold in the full-priority mode is lower than that in the precise-priority mode, and the label extension range in the full-priority mode is greater than that in the precise-priority mode. Furthermore, the semantic consistency requirement in the full-priority mode is lower than that in the precise-priority mode.

[0124] In some embodiments, the label extension range may refer to the text length used to generate the label, i.e., the extended recognition boundary.

[0125] Specifically, the input information includes: the source of input, and selecting the corresponding recognition mode for the clinical text data based on the input information includes:

[0126] (1) When the input source belongs to a type of source, the identification mode is selected as the comprehensive priority mode, wherein the type of source includes: hospital input;

[0127] (2) When the source of the data entry belongs to the second category, the identification mode is selected as the precise priority mode. The second category includes: community data entry, disease control center data entry or clinical trial data entry from research institutions.

[0128] Furthermore, in some embodiments, the input information includes: the source of input and the text precision; correspondingly, selecting the appropriate recognition mode for the clinical text data based on the input information includes:

[0129] 1. Determine the data entry level based on the category of the data entry source;

[0130] Specifically, when the source of data is of type 1, the corresponding data entry level is level 2; when the source of data is of type 2, the corresponding data entry level is level 1.

[0131] 2. Determine the text level based on text precision; this includes:

[0132] 2.1 Identify pre-identification information related to the time stage of the disease in clinical text data, wherein the pre-identification information includes: symptoms, and / or time;

[0133] 2.2 Generate text levels based on pre-identified information, including:

[0134] When the pre-identification information only includes symptoms or time, the text level is set to level one;

[0135] When the pre-identification information includes symptoms and time, if the text interval (e.g., the number of characters in the interval) between the symptoms and time in the text is greater than the preset text interval, the text level is set to level two. If the text interval is less than or equal to the preset text interval, the text level is set to level three (that is, at this time, it can be preliminarily considered that the text accuracy is relatively high, that is, the information is filled in relatively standardly and meets the conventional standards in the field of epilepsy).

[0136] 3. Determine the data level based on the entry level and text level;

[0137] 4. When the data level is greater than the preset data level, the recognition mode is selected as the comprehensive priority mode; when the data level is less than or equal to the preset data level, the recognition mode is selected as the precise priority mode.

[0138] In other words, this embodiment proposes label recognition modes based on different judgment mechanisms for different text data, such as the precision-first mode and the comprehensive-first mode. Furthermore, it comprehensively considers both the source of the text input and the accuracy of the text to ensure the reliability of the recognition mode selection.

[0139] It should be noted that epilepsy information often comes from various types of medical records, such as those collected through community health screenings or through different departments of a hospital (such as internal medicine, psychiatry, etc.). The filling standards and reliability of these numerous types of medical records vary significantly.

[0140] To address this, the present invention can pre-identify medical record files (i.e., classify data into levels based on the source of data entry and text accuracy) before formal label recognition, and assign corresponding switching modes to different medical record files, thereby achieving a balance between data entry completeness and data entry accuracy. In this embodiment, the focus is on performing local pre-identification of medical record files based on information about the stage of epilepsy, so as to quickly select a suitable recognition mode through local pre-identification.

[0141] For example, for medical records with high data levels, a comprehensive priority mode is adopted, which means that the identification scale can be appropriately relaxed to improve the comprehensiveness of data entry and reduce the omission of key data; for medical records with low data levels, a precision priority mode is adopted, which means that the identification and attention of enhanced core tags are appropriately increased to collect as accurate information as possible and avoid excessive introduction of errors in the data entry stage (such as problems such as non-standard filling or inaccurate information).

[0142] In other words, by flexibly switching between precise priority mode and comprehensive priority mode, it is possible to control the introduction of errors while maximizing the integrity of data entry. This coordinated control of data integrity and errors has significant advantages in the standardized identification of epilepsy medical records.

[0143] For example, in some embodiments, the data level is determined as follows:

[0144] When the input level is level 1 and the text level is level 1, then the data level is level 1;

[0145] When the entry level is level one and the text level is level two, then the data level is level two.

[0146] When the entry level is level 1 and the text level is level 3, then the data level is level 3.

[0147] When the input level is level two and the text level is level one, then the data level is level two.

[0148] When the input level is level 2 and the text level is level 2, then the data level is level 3;

[0149] If the entry level is level two and the text level is level three, then the data level is level four.

[0150] It can be understood that the higher the input level and the higher the text level, the higher the accuracy or reliability of the text can be considered, and therefore its data level can be appropriately increased. Of course, the specific level generation rules can be flexibly set by the user based on the actual situation.

[0151] In a specific implementation, for easily confused labels, the system executes a "differentiated decision + contextual constraint" rule. For example, fever-related descriptions such as "high fever" or "fever" are usually identified as explicit triggering factors (fac-inc-def) because fever is a known trigger for epileptic seizures. However, for infectious descriptions such as "cold," even if the word "trigger" appears in the text, it should be classified as a comorbidity or medical history (dis-his) rather than a triggering factor (fac-inc-def). Furthermore, allergies to epilepsy medications should be labeled as adverse drug reactions (dru-adv), not comorbidities (dis-his). Clearly related external events such as car accidents or injuries should be labeled as medical history information (dis-his or dis-hism), not epilepsy phenotype labels. "Metabolic diseases" suggested by imaging examinations should be labeled according to the comorbidity rule (dis-his), not epilepsy subtypes (dis-ept). Finally, descriptions made by patients or their families based on subjective judgment, such as "hypoglycemia" or "loss of consciousness," should not be marked as comorbidities or medical history (dis-his) without formal diagnosis from the hospital, in order to prevent misinterpreting the symptoms as the cause.

[0152] In one specific embodiment, the differential labeling strategy further includes: setting a corresponding recognition range and nesting allowance for each label category to control the fusion range of the scanning window and the context.

[0153] 1. Analyze the semantic complexity and contextual dependencies of tag categories.

[0154] Semantic complexity assessment: The semantic complexity of each tag category is analyzed, including its diversity of expression in clinical texts, semantic ambiguity, and relevance to other tags. For example, onset symptoms (clm-sym) and adverse drug reactions (dru-adv) typically have high semantic complexity because their expressions are diverse and may overlap with other information.

[0155] Context-dependent analysis: assesses the degree to which labels depend on contextual information. Some labels (such as time information tim and attack frequency clm-frq) may require a wider range of context for accurate identification, while other labels (such as drug name dru-nam) may only require local context for accurate identification.

[0156] 2. Determine the recognition interval length for each label category.

[0157] Set a base interval length: Based on the semantic complexity and contextual dependency of the tags, set a base recognition interval length for each tag category. For example:

[0158] Time information (tim): The basic interval length is 1-2 sentences, because time information usually appears at the beginning or end of a sentence.

[0159] Seizure symptoms (clm-sym): The basic interval length is 3-5 sentences, because the symptom description may involve multiple symptoms and durations.

[0160] Drug name (dru-nam): The basic interval length is one sentence, because the drug name usually appears in the same sentence as the dosage and usage.

[0161] Adjusting the interval length: The base interval length is adjusted based on the actual writing habits and annotation rules of clinical texts. For example, if a certain type of label frequently appears with long descriptions in a specific type of text, its recognition interval length is appropriately increased.

[0162] 3. Set nesting allowance

[0163] Define nesting allowance: Nesting allowance refers to whether the model allows the recognition of other labels to be nested within the recognition range of the current label during the recognition process. For example, the inspection discovery (exa-fnd) may be nested within the description of the inspection item (exa-itm).

[0164] Set nesting rules:

[0165] High nesting allowance: For semantically complex and context-dependent labels (such as seizure symptoms clm-sym and examination findings exa-fnd), nesting of other related labels within a broader context is allowed. For example, nesting of seizure duration (clm-dur) and seizure frequency (clm-frq) within the description of seizure symptoms is permitted.

[0166] Low nesting allowance: For tags with simple semantics and low context dependence (such as drug names (dru-nam) and time information (tim), nesting recognition is restricted to reduce the possibility of misidentification. For example, drug names are generally not allowed to be nested with other tags unless they are explicitly related to dosage and usage.

[0167] Special Case Handling: For certain tags, such as comorbidities (dis-his), the nesting allowance may need to be dynamically adjusted based on the specific context. For example, if the comorbidity description includes detailed symptoms or test results, the nesting allowance should be increased appropriately.

[0168] 4. Implement a dynamic adjustment mechanism

[0169] Model scanning window adjustment: During model recognition, the scanning window is dynamically adjusted according to the set recognition interval length. For example, for time information (tim), the model scanning window is 1-2 sentences; for epileptic symptoms (clm-sym), the scanning window is 3-5 sentences.

[0170] Context fusion scope control: The scope of context fusion is controlled based on the nesting allowance. For example, for labels with high nesting allowance, the model will fuse broader contextual information during recognition; for labels with low nesting allowance, the model limits the scope of context fusion and only performs recognition within a local context.

[0171] Conflict handling: During the recognition process, if the recognition ranges of multiple labels overlap, conflict handling is performed based on nesting allowance and priority weights. Labels with high nesting allowance and high priority are retained first, and the recognition ranges of other labels are adjusted appropriately.

[0172] This application restricts the nested recognition range for different categories of tags: for example, nested annotations are not allowed for comorbidity information in a disease, meaning the limited recognition area is small; for tags such as examination findings and attack frequency, nested annotations are allowed. Nested annotation refers to the information between the contexts of keywords that need to be identified; for example, the same type of information (such as the description of attack frequency) may appear in different positions in the case, and when forming standardized annotation information, it should be generated comprehensively according to the context; for example, for more important factors such as typical symptoms, attack frequency, and influencing factors, the scale of nested annotation can be appropriately expanded. For example, text areas that are merged vertically (such as length and position) are allowed, meaning the recognition area is larger. For a whole case, when the description of the disease time (such as admission [13 years before]) is identified, a time tag will be generated, the text between two time tags will be cut into a paragraph, and the symptom information identified under this paragraph will be marked under the first time tag.

[0173] In one specific embodiment, by analyzing medical record text, a maximum recognition interval length and nesting allowance are preset for each tag category. The maximum recognition interval length is determined based on the number of sentences in the medical record where the tag is located, while the nesting allowance is set hierarchically according to clinical value and nesting requirements. When processing text, the system dynamically segments the text window with these preset parameters as upper limits, and controls the number of cross-category nesting levels within the current window based on the nesting allowance. When the number of sentences in the text window exceeds the preset maximum recognition interval length or the number of nesting levels exceeds the allowance, the system automatically segments a new interval and backtracks to handle conflicting tags, ensuring the accuracy and efficiency of information extraction. For example, when processing text containing treatment plans and symptom descriptions, the system accurately extracts relevant information from the text based on the preset recognition interval length and nesting allowance, while avoiding erroneous labeling caused by excessive nesting.

[0174] For labels with the highest clinical value and stable descriptive structure, such as epilepsy subtypes, drug names, and examination items, the system strictly limits the scanning window to a single sentence and prohibits any nesting to ensure high confidence hits. Symptom-related labels (clm-sym, clm-sta-bef / aft, clm-dur, etc.) and trigger-related labels (fac-inc-def, fac-inc-amb, fac-con-slp, etc.) need to be presented in a continuous context to fully present a multi-factor chain such as "dizziness before the attack - blurred vision - limb convulsions" or "after staying up late + emotional tension + drinking alcohol," so they are given a loose interval of 3-5 sentences and allow nesting across sentences. New intervals can be automatically segmented according to time anchors or diagnostic fields to avoid interference from distant irrelevant text.

[0175] In one specific implementation, a recognition interval (or a reference weight for the recognition interval) is set based on the label category and annotation habits. When processing clinical text, a specific scanning range (recognition interval) is set for each label based on different types of medical information (label categories) and doctors' writing habits (annotation habits), or a priority (reference weight) is assigned to this range. This helps the model more accurately locate and recognize key information in the text, improving the efficiency and accuracy of information extraction, while adapting to different doctors' writing styles and ensuring the consistency and reliability of annotation. Annotation habits may be the individual case-filling habits of a doctor, or the preferred filling habits of a medical team or hospital group. Under different habits, the same type of disease information may be filled in different areas of the case. For example, regarding comorbidities, some doctors directly write at the beginning that they had childhood seizures, while others write it at the end of the passage. For example, the comorbidity module might be more accurate by focusing on the beginning and end. Similarly, when processing medical text to recognize the label categories of "drug name" and "symptom description," different doctor groups may have different writing habits. Some doctors tend to record detailed medication information at the beginning of a patient's medical record, while others may summarize symptoms and medications at the end. To address this, the system assigns a higher reference weight to the "Drug Name" tag category at the beginning of the text and a higher reference weight to the "Symptom Description" tag category at the end of the text. Specifically, the system first analyzes a large amount of labeled medical text and finds that "Drug Name" typically appears in the first 20% of the text, while "Symptom Description" appears more frequently in the last 30%. Based on this data, the system assigns a reference weight of 0.7 to the "Drug Name" recognition interval, applicable to the first 20% of the text; and a reference weight of 0.6 to the "Symptom Description," applicable to the last 30%. In the actual tag recognition process, the system will prioritize searching for corresponding tags in these high-weight areas, thereby improving the accuracy and efficiency of the recognition.

[0176] In one specific embodiment, the sentence length of each type of label and the doctor's writing position habits are sampled in the labeled medical records. The maximum recognition interval length of each type of label is extracted based on the quantile, and a corresponding nesting allowance is assigned. In a large batch of labeled medical records, the system first samples the sentence length of each type of label: it finds that "epilepsy classification" almost always falls at the beginning of the paragraph and spans only 1 sentence, "seizure symptoms" are mostly expanded after diagnosis and often span 3-5 sentences, and "triggering factors" are mostly at the end of the paragraph and often span 2-4 sentences. Based on this, the maximum recognition interval length is extracted at the 95% quantile -dis-ept1 sentence, clm-sym5 sentences, and fac-inc4 sentences, and nesting allowances of 0, 2, and 1 are assigned accordingly. During inference, the doctor's habitual position (diagnosis at the beginning of the paragraph, triggering factors at the end of the paragraph) is used as the anchor point, and windows are dynamically cut according to the above length and nesting degree, which both preserves the maximum interval and respects writing habits, achieving accurate recognition of "one type, one window; one window, one granularity".

[0177] The text window is dynamically segmented according to the maximum recognition interval length and nesting allowance, and further segmented and rolled back using the doctor's writing position habits as anchor points. During the inference phase, the system dynamically segments the text window based on the preset maximum recognition interval length and nesting allowance. For example, for a new medical record text:

[0178] Admission diagnosis: Focal epilepsy. Levetiracetam 0.5g twice daily was administered. The patient experienced a seizure the following morning, with loss of consciousness lasting approximately two minutes, followed by drowsiness. Electroencephalography (EEG) showed left temporal sharp waves.

[0179] The system identifies "Admission Diagnosis: Focal Epilepsy" as dis-ept, using the beginning of the paragraph as the anchor point to segment the first sentence into an independent window. For "One seizure occurred the following morning, with loss of consciousness lasting approximately two minutes, followed by drowsiness," the system identifies it as clm-sym. The system scans from "the following morning" to "drowsiness after the seizure," a total of four sentences, forming a complete symptom window. The system detects the "two minutes" time information, allowing nested clm-dur tag generation, but not further segmentation of dis-ept tags, ensuring that the granularity of high-value tags is not compromised. If a sentence exceeds the maximum recognition interval length during the scan, the system will fall back to the nearest anchor point (such as a time stamp or diagnostic field) and re-segment the window.

[0180] In one specific embodiment, the differentiated annotation strategy further includes: setting a precision level for each label category to limit the granularity of annotations in the text.

[0181] 1. Analyze the semantic characteristics and clinical needs of label categories.

[0182] Semantic feature analysis: This involves analyzing the semantic complexity, expressive diversity, and relevance to other tags for each tag category. For example, "clm-sym" (symptom of an attack) and "dru-adv" (adverse drug reaction) typically have high semantic complexity because their expressions are diverse and may overlap with other information.

[0183] Clinical Needs Assessment: Collaborate with clinical experts to assess the importance of each label category in clinical decision-making. For example, epilepsy subtype (dis-ept) and drug dosage (dru-dos) are key information that directly affects diagnostic and treatment decisions and require high-precision labeling; while drug administration method (dru-mtd) and precipitating factors (fac-inc), although important, have a relatively smaller impact on clinical decisions and can be labeled with more relaxed granularity.

[0184] 2. Define accuracy levels

[0185] High precision level: Suitable for label categories with clear semantics and high clinical value. Labeling requires precision down to the word or phrase level to ensure completeness and accuracy of information. For example:

[0186] Epilepsy classification (dis-ept): requires precision down to the specific epilepsy type, such as "focal epilepsy". Seizure symptoms (clm-sym): requires precision down to the specific symptom presentation, such as "loss of consciousness" or "limb convulsions". Drug dosage (dru-dos): requires precision down to the specific dosage value, such as "0.5g".

[0187] Medium precision level: Suitable for label categories with relatively clear semantics but diverse expressions. Labeling can be relaxed to the sentence level, but the accuracy of key information must be ensured. For example: Seizure frequency (clm-frq): can be labeled as "twice a week" or "occasional seizures". Examination findings (exa-fnd): can be labeled as "EEG indicates abnormal discharge in the left temporal region".

[0188] Low precision level: Applicable to label categories with ambiguous semantics or low clinical value. Labeling can be relaxed to the paragraph level, but the completeness of the information must be ensured. For example: Drug usage (dru-mtd): can be labeled as "oral" or "twice daily". Triggering factors (fac-inc): can be labeled as "frequent attacks after staying up late" or "no obvious trigger".

[0189] 3. Set accuracy levels for each label category.

[0190] High Precision Level (Granularity: Word / Phrase Level): Epilepsy Classification (dis-ept): Precise to the specific epilepsy type. Seizure Symptoms (clm-sym): Precise to the specific symptom presentation. Drug Name (dru-nam): Precise to the specific drug name. Drug Dosage (dru-dos): Precise to the specific dosage value. Examination Item (exa-itm): Precise to the specific examination item name. Medium Precision Level (Granularity: Sentence Level): Seizure Frequency (clm-frq): Precise to the specific frequency description. Examination Findings (exa-fnd): Precise to the specific examination result description. Treatment Measures (trt): Precise to the specific treatment measure description. Low Precision Level (Granularity: Paragraph Level): Drug Usage (dru-mtd): Precise to the specific usage description. Triggering Factors (fac-inc): Precise to the specific triggering factor description. Status Information (fac-con): Precise to the specific status description.

[0191] 4. Implement the annotation process

[0192] Annotation Guidelines: Develop detailed annotation guidelines based on the set accuracy level, clearly defining the annotation granularity requirements for each tag category. For example, for high-accuracy tags, annotators need to be precise to the word or phrase level; for low-accuracy tags, annotators can relax the requirements to the paragraph level. Annotation Tool Configuration: Configure corresponding annotation templates in annotation tools (such as LabelStudio) to ensure that annotators can annotate according to the set accuracy level. For example, for high-accuracy tags, the annotation tool can provide more granular annotation options. Annotation Quality Control: Through multiple rounds of annotation and consistency evaluation, ensure that the annotation results meet the set accuracy level. For high-accuracy tags, strict consistency requirements are enforced; for low-accuracy tags, consistency requirements are appropriately relaxed.

[0193] Taking comorbidities as an example, comorbidities need to be labeled. Comorbidities fall into two categories: the first category can be clearly identified as comorbidities, and the second category may be either comorbidities or symptoms caused by epilepsy itself. The labeling of comorbidities will employ the following methods:

[0194] 1) When comorbidities are described in terms of subtype or modifier, they should be marked as “disease + subtype” or “subtype (modifier) ​​+ disease”. If “subtype” appears alone or is unclear, it should not be marked.

[0195] 2) Most general terms are labeled, such as nutritional diseases, metabolic diseases, suppurative and non-suppurative syndromes, etc. Although these are general terms, they have corresponding disease categories, so they should be labeled. Special cases: When common diseases, frequently occurring diseases, or diseases appear alone, they are not labeled.

[0196] 3) For the second type of comorbidity, identify the source of the comorbidity information in the case, and determine whether the comorbidity information should be marked as a comorbidity or as an epileptic phenotype based on the source:

[0197] If imaging results indicate "metabolic disease," it is unclear whether the patient has metabolic epilepsy or other causes of epilepsy with a comorbid metabolic disease. Such cases should be labeled according to the "comorbidity" entity rule, rather than the "epilepsy phenotype" entity rule.

[0198] Step 102: Labeling and Consistency Assessment

[0199] We acquired raw clinical text data related to epilepsy and used the aforementioned differential annotation strategy to annotate the raw clinical text data, forming a labeled corpus. Figure 3 An example of annotation for a real text is shown, with annotation granularity covering phrases and sentences, demonstrating the application effect of the annotation system designed in this application.

[0200] In one specific embodiment, raw clinical text data undergoes data preprocessing. Raw data, such as admission records and present medical history, is extracted from the Hospital Information System (HIS). This is followed by regularization matching to identify and extract ICD codes, de-identification to protect patient privacy, standardization to ensure consistency of medical terminology and drug names, segmentation of excessively long text segments for easier processing, and data cleaning to remove irrelevant information. Furthermore, the data is converted to a format suitable for analysis, data validation ensures accuracy and completeness, and finally, the preprocessed data is stored in a secure data warehouse, laying a solid foundation for subsequent analysis and modeling.

[0201] This application selects LabelStudio as the primary annotation tool and adapts it to meet the annotation needs of epilepsy clinical texts. Based on this, 100 medical records were randomly selected for trial annotation. After annotation, the Inconsistency Index (IAA) was calculated to evaluate the feasibility and accuracy of the rules. For any inconsistencies in the annotation, the annotation rules were continuously revised and refined to ensure the stability and applicability of the annotation system. For example, for the labeled corpus obtained by using the above-mentioned differentiated annotation strategy, the system immediately initiates a closed-loop consistency assessment: First, at least two sets of independent annotation results of the same text are randomly selected, and "the start and end boundaries of entities completely coincide with the type labels" is used as the hard matching standard. Precision and Recall are automatically calculated, and IAA-F1 is obtained. If the value is lower than the preset threshold of 0.85, the platform automatically clusters the differential entities to generate three categories: "boundary deviation, type confusion, and priority failure," and pushes them back to the rule engine. For those with unclear boundaries, the span constraints are immediately refined; for those with type conflicts, contextual keywords are added or the priority is increased; for those with cross-ambiguity, a mutual exclusion judgment table is added. The revised annotation specifications are then fed back to the automatic annotation module, driving the machine to re-annotate and supplemented by manual review, and the IAA is calculated again. This process is iterated until IAA ≥ 0.85 for two consecutive rounds and the proportion of differential entities is < 1%, at which point the calibration is terminated, and a fully disambiguated and highly consistent reliable corpus is output, providing a solid data foundation for subsequent model training.

[0202] This application is based on established labeling rules, and the system ensures data reliability through standardized processes and automated quality assessment. First, machine-aided independent labeling is completed using LabelStudio. Then, an entity-level IAA (Inter-Annotator Agreement) mechanism is introduced, treating multiple rounds of output as prediction-reference pairs, automatically calculating Precision, Recall, and F1-score, and using complete consistency between entity boundaries and types as the matching criterion to achieve consistency quantification for multi-class NER tasks. Ultimately, after three iterations, the IAA reached 0.86–0.88, validating the highly reliable labeling results. This task covers 25 classes of epilepsy entity labels, totaling 804 instances and 28,354 entities.

[0203] Overall, the label distribution in the test data exhibits a significant imbalance, reflecting the importance and frequency of various types of information in clinical records. Among these, seizure symptom labels (clm-sym) are the most numerous, indicating that seizure manifestations are a core component of the records. Drug-related information (including dru-nam, dru-dos, dru-mtd, etc.) also has a high total quantity, highlighting the crucial role of drug treatment in epilepsy management. Time information ranks third among all entities, indicating a high frequency of recording the time location of events such as treatment and seizures in clinical texts. Examination-related labels (exa-fnd and exa-itm) are also numerous, showing that examination items and results are indispensable sources of information in the diagnostic and treatment process. Given the high frequency and clinical attention these entities receive in clinical texts, their recognition performance will be prioritized in subsequent Named Entity Recognition (NER) tasks to aid in evaluating the effectiveness of the corpus construction.

[0204] In contrast, the distribution of trigger and state information (fac-inc and fac-con) tags is relatively low. Among them, fac-con-preg (pregnancy / partum period), although fewer in number, often involves key triggers or background states for seizures and has high clinical significance. For example, fac-con-slp (sleep state) is closely related to nocturnal or early morning seizures and helps identify sleep-related epilepsy subtypes; fac-con-preg may indicate changes in the risk of epilepsy management during pregnancy, affecting the formulation of treatment strategies. Therefore, although this type of information appears infrequently in the text, it has important clinical significance, and the preservation and refinement of such entities has significant practical value. Considering its low frequency, high recognition performance is not required in NER validation, but it can serve as an auxiliary indicator for observing model coverage.

[0205] Overall, the labeling system in this dataset is comprehensive and its fine-grained design is reasonable. It can fully support the structured modeling and automatic extraction of epilepsy clinical texts, and provide a data foundation for subsequent model training and task evaluation.

[0206] Step 103: NER Model Training and Performance Evaluation

[0207] During the model validation phase, the study adopted an 8:1:1 ratio to divide the training, validation, and test sets to ensure the reliability of the model evaluation. Ten combinations of five types of pre-trained language models (Chinese-BERT, Chinese-RoBERTa, MCBERT, Base-BERT, and MedBERT) with two sequence labeling frameworks (BiLSTM-CRF and GlobalPointer) were systematically evaluated. The BiLSTM-CRF model captures contextual features through a bidirectional LSTM network and combines it with a CRF layer to optimize label sequence prediction; GlobalPointer utilizes a global pointer network to effectively handle nested entity recognition. For all models, key parameters such as learning rate, dropout, batch size, and weight decay were adjusted.

[0208] During the evaluation process, in addition to standard entity-level precision, recall, and F1 score, the study paid special attention to the overall performance indicators across three dimensions: macroavg, microavg, and weightedavg, to comprehensively assess the model's performance balance across different categories. Finally, neurology experts conducted a blinded clinical review of the model's predictions, focusing on verifying the accuracy of identifying key medical entities in the "clinical manifestations" subclass, ensuring that the model output met both technical requirements and clinical diagnostic logic.

[0209] In terms of overall performance, the five validation models combined with BiLSTM-CRF achieved mean Micro-F1 scores of 0.865, Macro-F1 scores of 0.635, and Weighted-F1 scores of 0.865 on the validation set. The validation model combined with GlobalPointer achieved better performance on the same BERT model, with Micro-F1 scores of 0.906, Macro-F1 scores of 0.760, and Weighted-F1 scores of 0.904, demonstrating better entity boundary modeling ability and inter-class balance.

[0210] Reference Figure 4From a label-level analysis, the GlobalPointer (GP) framework, which performs well, was used in combination with different BERT models for evaluation. The results showed high F1 scores (all exceeding 0.90) on high-frequency labels (such as clm-sym, dru-nam, tim, etc.), indicating that entities with clear structures and standardized expressions in the corpus have good recognizability. The F1 scores for some low-frequency labels (such as fac-inc-amb, trt, dru-adv) were relatively low (0.31, 0.57, 0.47 respectively), mainly due to the limited sample size and significant differences in language expression. Simple sample supplementation can also improve model performance to some extent. For example, the initial F1 score for the dru-adv label was 0.000, but after supplementing with 13 targeted samples, the model's recognition performance significantly improved to 0.47. Therefore, the NER model based on the BERT+GlobalPointer framework exhibits good performance in entity extraction from epilepsy clinical texts, especially with stable recognition results on mainstream labels rich in structured information, initially demonstrating the strong feasibility of the corpus design.

[0211] Step 104: Automated annotation and structured data construction:

[0212] After the model's performance largely met expectations, the optimized NER model was further applied to a large amount of unlabeled epilepsy clinical texts to achieve automated annotation of named entities. Leveraging the generalization capabilities of deep learning models, the system can automatically identify key medical entities in the text, such as seizure information, medication usage, symptom presentation, and examination results, significantly improving data processing efficiency. Based on this, the identified entities are further structured to construct standardized data tables, providing high-quality input data for downstream tasks such as clinical statistical analysis and decision support systems. Specifically, the structuring process addresses common issues of redundant expressions and inconsistent terminology in clinical texts. For example, the system can automatically identify "levetiracetam," "keppra," and "levetiracetam" as belonging to the same drug and unify them under the standard name "levetiracetam," ensuring data consistency and comparability. Furthermore, for different expressions such as "levetiracetam 0.5g twice daily" and "levetiracetam 0.25g twice daily," the system can perform standardized parsing and conversion, achieving standardized extraction and normalized statistics of dosage information. Automated annotation and structured mapping can significantly improve the processing efficiency of large-scale clinical data, and also lay a solid data foundation for subsequent clinical research such as drug use frequency analysis and correlation mining between attack types and triggers.

[0213] Further reference Figure 5As an implementation of the above-described method, this application provides an embodiment of a corpus construction system, which is similar to... Figure 1 Corresponding to the method embodiments shown, the system can be specifically applied to various electronic devices.

[0214] refer to Figure 5 A corpus construction system, comprising:

[0215] The annotation rule construction module 201 is configured to establish a multidimensional annotation system based on the clinical characteristics of epilepsy and assign differentiated annotation strategies to different categories of labels. The multidimensional annotation system includes at least two primary label categories: disease, disease course stage time, clinical manifestations, medical examination, treatment, drugs and influencing factors, etc., and sets secondary or tertiary label categories with clinical semantics under the primary label categories.

[0216] The differential annotation strategy includes:

[0217] Pre-set priority weights for each label category to ensure that labels with high clinical value are retained in case of conflicts;

[0218] Set corresponding recognition range and nesting allowance for each label category to control the range of scanning window and context fusion;

[0219] Set a precision level for each label category to limit the granularity of annotations in the text;

[0220] The original clinical text data acquisition module 202 is configured to acquire epilepsy-related original clinical text data, and to annotate the original clinical text data using the differentiated annotation strategy in the annotation rule construction module to form a labeled corpus;

[0221] The consistency assessment module 203 is configured to perform consistency assessment on the labeled corpus obtained by the original clinical text data acquisition module, and iteratively revise the labeling rules when the consistency is lower than the preset threshold until the consistency is met.

[0222] The model training module 204 is configured to train and validate the entity recognition model using labeled corpus as a supervision signal, thereby obtaining an entity recognition model for epilepsy clinical texts.

[0223] The structured corpus generation module 205 is configured to apply the trained entity recognition model to unlabeled epilepsy clinical texts to generate a structured corpus.

[0224] In another aspect, this application also provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable storage medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the following... Figure 1 The method shown.

[0225] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0226] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a computer terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0227] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims. All of these forms are within the protection scope of the present invention.

Claims

1. A corpus construction method characterized by, Comprising the following steps: S1: Establish a multi-dimensional labeling system according to the clinical characteristics of epilepsy, and assign different labeling strategies to different categories of labels; the multi-dimensional labeling system includes at least two first-level label categories: disease, disease course stage time, clinical manifestations, medical examination, treatment, drugs and influencing factors, and sets secondary label categories or tertiary label categories with clinical semantics under the first-level label categories; The differential labeling strategy includes: preset priority weight for each label category, so that high clinical value labels are preferentially retained in conflicts, including: dividing label categories into high, medium and low levels according to clinical value, and corresponding high, medium and low weights are assigned; In the case of label conflict, the weight is immediately ruled according to the high and low, the high weight label is preferentially retained, and the low weight label is suppressed or downgraded as a candidate, including: obtain the confidence of each label category through a pre-trained confidence model; According to the priority level of the label category, set a hierarchical confidence management strategy, including: set a first confidence threshold for high-priority labels to ensure that clinical core information is preferentially output; set a second confidence threshold for medium-priority labels, and set a third confidence threshold for low-priority labels to suppress output; set the corresponding recognition interval and nesting allowance for each label category to control the scanning window and context fusion range; set the accuracy level for each label category to limit the labeling granularity in the text; S2: Obtain original clinical text data related to epilepsy, and label the original clinical text data using the differential labeling strategy in step S1 to form labeled annotated corpus; S3: Perform consistency evaluation on the labeled annotated corpus obtained in step S2, and iteratively revise the labeling rules when the consistency is lower than the preset threshold until the consistency meets the standard; S4: Use the labeled annotated corpus as a supervision signal to train and verify the entity recognition model, and obtain an entity recognition model for epilepsy clinical text; S5: Apply the trained entity recognition model to unannotated epilepsy clinical text to generate a structured corpus.

2. The corpus construction method of claim 1, wherein, Further comprising the steps of: According to the difference of label clinical use, dynamically switch the accurate priority mode and the comprehensive priority mode for the same text; In the accurate priority mode, high confidence and semantic consistency are used as criteria to output only high-value labels that can directly support clinical decision-making, and labels with insufficient confidence or ambiguity conflicts are suppressed; In the comprehensive priority mode, the confidence threshold is relaxed and the label range is extended to maximize the recall of auxiliary or ambiguous labels in the form of candidates for manual review or secondary rule screening.

3. The corpus construction method of claim 1, wherein, Further comprising the steps of: According to the label category and labeling habit, set the reference weight of the recognition interval; The labeling habit includes the personal case filling habit of the doctor, the preferred filling habit of the medical team, and the preferred filling habit of the hospital group.

4. The corpus construction method of claim 1, wherein, Further comprising the steps of: preset the maximum recognition interval length and nesting allowance for each type of label, wherein the maximum recognition interval length is determined according to the quantile sentence number of this type of label in the medical record, and the nesting allowance is set according to the clinical value and nesting demand; The text window is dynamically divided with the maximum recognition interval length as the upper limit, and the cross-class nesting layer number is controlled according to the nesting allowance within the current window; When the number of window sentences exceeds the maximum recognition interval length or the nesting layer number exceeds the nesting allowance, a new interval is forced to be divided and the conflict label is rolled back.

5. The corpus construction method of claim 1, wherein, The precision level is set for each label category to limit the annotation granularity in the text, including: According to the clinical semantic complexity, the label categories are divided into high precision level, medium precision level and low precision level; The high precision level corresponds to the word level or phrase level, the medium precision level corresponds to the short sentence level, and the low precision level corresponds to the whole sentence or whole paragraph level.

6. The corpus construction method according to any one of claims 1-5, wherein, It also includes the following steps: Semantic refinement is performed on the multi-dimensional annotation system, including: Adding a disease course stage label to the symptom description in the text, and binding the disease course stage label to the corresponding symptom entity; The quantifiable frequency expression in the text is annotated as an accurate frequency label, and the unquantifiable subjective frequency expression is annotated as a fuzzy frequency label; External behaviors, environment and physiological factors are annotated as inducing factor labels, and the state of the patient at the onset is annotated as a state label, and structured data is generated based on the inducing factor label and the state label; Detecting the repetition or omission expression in the text and annotating it as a context reference class label, establishing a reference relationship between the context reference class label and the target entity annotated in the previous text, and generating a complete medication time sequence and a symptom time sequence across time points based on the reference relationship.

7. The corpus construction method of any one of claims 1-5, wherein: If the label category belongs to multiple easily confused label categories, a disambiguation judgment is made according to a preset semantic rule, including: If the description is a fever-related cause and is related to the onset, it is classified as an explicit cause; if the description is an infection-related event and mentions an inducing relationship, it is classified as a medical history rather than a cause; if the description is a drug-related adverse reaction, it is preferentially classified as a drug adverse reaction; if the description is an external trauma or an imaging term, it is classified as a medical history rather than a disease classification; if the description is a patient's subjective judgment and there is no formal diagnosis support, no medical history or comorbidity label is generated.

8. A corpus construction method system characterized by, The system comprises: An annotation rule construction module configured to establish a multi-dimensional annotation system according to the clinical characteristics of epilepsy, and assign different annotation strategies to different categories of labels; the multi-dimensional annotation system comprises at least two first-level label categories: disease, disease course stage time, clinical manifestation, medical examination, treatment, drug and influencing factor, and sets secondary label categories or tertiary label categories with clinical semantics under the first-level label categories; The differential annotation strategy includes: A priority weight is preset for each label category, so that high clinical value labels are preferentially retained in conflicts, including: The label categories are divided into high, medium and low levels according to clinical value, and high, medium and low weights are assigned accordingly; In the label conflict, the high and low weights are immediately ruled, the high weight label is preferentially retained, and the low weight label is suppressed or downgraded to a candidate, including: The confidence of each label category is obtained through a pre-trained confidence model; A hierarchical confidence management strategy is set according to the priority level of the label category, including: A first confidence threshold of mandatory reservation is set for high-priority labels to ensure that clinical core information is outputted in priority; A second confidence threshold of candidate or reservation is set for medium-priority labels, and a third confidence threshold of output inhibition is set for low-priority labels; A corresponding recognition interval and nesting allowance are set for each label category to control the scanning window and context fusion range; An accuracy level is set for each label category to limit the labeling granularity in the text; An original clinical text data acquisition module is configured to acquire original clinical text data related to epilepsy, and to label the original clinical text data using the differential labeling strategy in the labeling rule construction module to form labeled annotated corpus; A consistency evaluation module is configured to evaluate the consistency of the labeled annotated corpus obtained by the original clinical text data acquisition module, and to iteratively revise the labeling rules when the consistency is lower than a preset threshold until the consistency meets the standard; A model training module is configured to train and verify an entity recognition model using the labeled annotated corpus as a supervision signal to obtain an entity recognition model for epilepsy clinical text; A structured corpus generation module is configured to apply the trained entity recognition model to unlabeled epilepsy clinical text to generate a structured corpus.

Citation Information

Patent Citations

  • Method and apparatus for disease entity recognition based on multiple data sources

    CN106934220B

  • Man-machine collaborative corpus construction method and system

    CN115270713A

  • A method for constructing a corpus of patient consultations in smart medical care

    CN117194604B

  • Breast disease corpus construction and case text standardization method based on BioClinicalBERT model

    CN119166817A

  • Dynamic data statistics method and system based on multi-dimensional data annotation

    CN110069575A