A text data matching optimization method and system based on a large language model

CN122366462BActive Publication Date: 2026-08-07NANJING YILIAN SUNSHINE INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING YILIAN SUNSHINE INFORMATION TECH CO LTD
Filing Date
2026-06-09
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

当前文本数据补全与匹配技术多聚焦于单条文本碎片的孤立处理,未针对时序文本碎片的语义传导特性构建关联模型,仅通过大语言模型对碎片进行独立语义填充,无法挖掘碎片间的因果依赖关系,导致补全内容脱离时序上下文逻辑,文本语义连贯性大幅降低

Benefits of technology

所述补全特征修正模块用于基于全局补全与匹配优化规则对初始补全文本与初始匹配特征进行修正,得到补全文本序列与融合匹配特征;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122366462B_ABST
    Figure CN122366462B_ABST
Patent Text Reader

Abstract

The application discloses a text data matching optimization method and system based on a large language model, relates to the technical field of text data optimization, constructs a time sequence semantic cause-effect chain for a fragmented time sequence text scene, acquires semantic cause-effect dependence and a conduction path between text fragments, generates an initial fragmented semantic analysis completion model, constructs a local semantic compliance constraint condition, detects the semantic drift conduction accumulation degree of the initial completed text in the time sequence semantic cause-effect chain, determines a drift overflow position and a drift accumulation intensity to inhibit semantic drift conduction accumulation, establishes global completion and matching optimization rules, and corrects the initial completed text and initial matching characteristics based on the global completion and matching optimization rules. Through the construction of a comprehensive utility completion model that fuses the positive returns of completeness, the completion bias cost and the semantic distortion loss, the application solves the technical pain points of traditional technology completion distortion and global semantic confusion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of text data optimization technology, specifically to a text data matching optimization method and system based on a large language model. Background Technology

[0002] In the context of text data management during the diagnosis and treatment process, due to limitations in acquisition equipment, segmented storage of content, and processing steps such as speech-to-text and OCR recognition, a large amount of text data easily forms fragmented text arranged in a time sequence. These time-series text fragments have the characteristic that the semantics of preceding content forms logical constraints and causal relationships with subsequent content. Their semantic completion and data matching need to take into account both temporal correlation and semantic integrity. Current text data completion and matching technologies mostly focus on the isolated processing of single text fragments, without building a correlation model for the semantic transmission characteristics of time-series text fragments. They only use large language models to independently fill in the fragments semantically, failing to explore the causal dependencies between fragments. This results in the completed content deviating from the temporal context logic, and the semantic coherence of the text is greatly reduced. Existing completion models only use semantic integrity as the single optimization objective, without setting multi-dimensional local constraints such as core semantic boundaries, text state specifications, and interference suppression. The completion process is easily affected by non-semantic noise such as character truncation and recognition errors, resulting in problems such as the completed content deviating from the original semantics and tampering with the inherent attributes of the text, causing completion deviations and semantic distortion. More importantly, the unreasonable completion of local fragments can easily lead to semantic drift. This drift will continue to propagate and accumulate along the temporal chain, causing the semantics of subsequent text fragments to continue to deviate, and ultimately leading to global text semantic chaos. Summary of the Invention

[0003] The purpose of this invention is to provide a text data matching optimization method and system based on a large language model to solve the problems mentioned in the background art.

[0004] To address the aforementioned technical problems, this invention provides the following technical solution: a text data matching optimization method based on a large language model, comprising the following steps: S1: Construct temporal semantic causal chains for fragmented temporal text scenarios to obtain semantic causal dependencies and transmission paths between text fragments; S2: With the goal of maximizing the semantic completeness of any fragment, generate an initial fragment semantic analysis and completion model, construct local semantic compliance constraints, and generate initial completed text and initial matching features based on the initial fragment semantic analysis and completion model and local semantic compliance constraints. S3: Detect the degree of semantic drift propagation and accumulation of the initial completed text in the temporal semantic causal chain, and determine the drift overflow position and drift accumulation intensity; S4: Establish global completion and matching optimization rules with the constraints of suppressing semantic drift propagation and ensuring global semantic consistency throughout the entire time sequence; S5: Based on the global completion and matching optimization rules, the initial completed text and initial matching features are corrected to obtain the completed text sequence and fused matching features; S6: Based on the iteration cycle, the text fragment completion results and matching features are corrected, and the completed text sequence and matching results are updated iteratively.

[0005] By constructing a weighted temporal semantic causal chain to characterize the semantic causal transmission relationship between text fragments, and combining multi-dimensional local semantic compliance constraints to establish a semantic completion utility optimization model, after quantitatively identifying the source of temporal semantic drift overflow, the completion result and matching feature are corrected by drift accumulation suppression as a global constraint.

[0006] Furthermore, step S1 includes the following: The fragmented temporal text scenario is a chain-like text scenario in which several fragmented texts are generated sequentially in chronological order, and the preceding text fragments causally influence the following text fragments through core semantics. The method for constructing the temporal semantic causal chain is as follows: the fragmented temporal text is divided into several text fragment nodes according to the text generation sequence; the core semantic element variables, text state variables, and external interference variables of each text fragment node are extracted; a causal discovery algorithm adapted to temporal text is used to perform causal mining on each text fragment node and its variables arranged in the generation sequence; the directed semantic causal edges from the preceding node to the following node are retained; pseudo-causal associations are eliminated; the semantic transmission weights of the directed semantic causal edges between each node are determined; and a weighted temporal semantic causal topology is formed. Specifically, this includes: denoting the text fragment nodes arranged in the generation sequence as F1, F2, ..., Fn; extracting the core semantic element variable Ei, text state variable Si, and external interference variable Ii of each node; encoding them to obtain a comprehensive semantic feature vector Vi=[Ei;Si;Ii]; and using a temporal constraint-type causal discovery algorithm to perform semantic causal verification based on conditional mutual information, the formula is: I(Vi,Vj∣VK)=H(Vi∣VK)+H(Vj∣VK)-H(Vi,Vj∣VK); Where Vj represents the comprehensive semantic feature vector of the subsequent text fragment node relative to Vi, VK represents the set of comprehensive semantic feature vectors of all text fragment nodes between Fi and Fj, I(Vi,Vj|VK) represents the conditional mutual information about Vi and Vj when VK is known, H(Vi|VK) represents the conditional entropy about Vi when VK is known, H(Vj|VK) represents the conditional entropy about Vj when VK is known, and H(Vi,Vj|VK) represents the joint conditional entropy about Vi and Vj when VK is known. If I(Vi,Vj|VK)≤independence threshold, it is judged as conditionally independent and the associated edge is removed; the directed semantic causal edge Fi→Fj from the preceding node to the following node is determined according to the text generation time sequence, and the semantic causal confidence is calculated: ; Where Si→j represents the semantic causal confidence of Fi pointing to Fj, ω1, ω2, and ω3 are the preset weights of the corresponding semantic similarity term, mutual information term, and temporal distance term, respectively. cos (Vi,Vj) represents the cosine similarity between the comprehensive semantic feature vectors Vi and Vj of the text fragment nodes; I(Vi,Vj) represents the conditional mutual information about Vi and Vj under unconditional conditions; η is a preset temporal decay coefficient; Δt is the generation time interval between Fi and Fj; edges with confidence levels lower than the pseudo-causal threshold are judged as pseudo-causal associations and removed; for the retained valid directed edges, the semantic transmission weight is calculated. ; Wherein, minS is the minimum value of the semantic causal confidence Si→j of the effective directed edge, and maxS is the maximum value of the semantic causal confidence Si→j of the effective directed edge. With text fragment nodes as vertices and directed semantic causal edges with semantic transmission weights as edges, a weighted temporal semantic causal topology is formed. The core semantic element variables are the core semantic subjects, actions, limiting conditions, and logical relationships of the current text fragments, which can be completed and calibrated using a large language model. The text state variables are a set of objective parameters representing the original semantic features, sentence structure, and domain-specific terminology of the text fragments. The external interference variables are non-semantic interference factors generated during the text fragmentation process, including character truncation, OCR recognition errors, speech-to-text errors, missing word order, and meaningless redundant characters. By constructing a weighted temporal semantic causal topology, the core semantic causal relationships and transmission logic between medical temporal text fragments can be deeply explored, abandoning the traditional method of processing text fragments in isolation and fully restoring the temporal semantic context of medical documents. By extracting the core semantics, text state, and interference-related features of the text, combined with a temporally constrained causal discovery algorithm to identify invalid semantic relationships, determine the true semantic transmission weights, and accurately sort out the internal logic between medical texts. This method effectively avoids the problem of medical text completion deviating from clinical diagnosis and treatment logic, ensures the semantic coherence and consistency of medical documents, and filters out various non-semantic interference factors, laying a solid foundation for subsequent accurate text completion and data matching, and improving the professionalism, rigor and semantic credibility of medical text organization.

[0007] Furthermore, step S2 includes the following: For the i-th text fragment node Fi in the temporal semantic causal chain, with the core objective of maximizing the comprehensive utility of semantic completion for the i-th text fragment node, and combining the node's own semantic boundary constraints, text state constraints, and external interference constraints, an initial fragment semantic analysis and completion model based on a large language model is established: ; Where xi represents the core completion semantic variable of the i-th text fragment node, U i (xi, Si, Ii) represents the comprehensive completion utility of the i-th text fragment node. The goal of the initial fragment semantic analysis completion model is to obtain the result that U is solved by the large language model. i (xi,Si,Ii) represents the value of xi when it reaches its maximum value; Si represents the text state variable of the i-th text fragment node, and Ii represents the external interference variable of the i-th text fragment node; R(xi,Si) represents the positive gain in the semantic completeness of the text fragment after performing the completion of the semantic variable xi. The positive gain in completeness means that after performing completion on the i-th text fragment, combined with its text state Si, the improvement of the coverage of core semantic elements, logical coherence, and domain specification matching degree are weighted and summed according to preset weights (summing to 1) to obtain a score in the range of 0 to 1, which is used to quantify the positive contribution of the completion operation to the semantic completeness of the text; C(xi,Ii) represents the output of the external interference variable Ii when performing the completion of the semantic variable xi. The completion bias cost represents the degree to which the completed semantics xi deviates from the original true semantics due to external interference variables Ii (such as character truncation, OCR error, etc.) when performing completion on the i-th text fragment. It is quantified as a score in the range of 0 to 1, with higher values ​​indicating greater completion bias and higher costs. L(xi,Si) represents the semantic distortion loss caused by deviation from the core semantics of the original text fragment when performing completion on the semantic variable xi. The semantic distortion loss represents the degree of deviation between the completed semantics xi and the core semantics of the original fragment after performing completion on the i-th text fragment, combined with its text state Si (original semantic features, sentence structure, domain specifications). It takes a value in the range of 0 to 1, with higher values ​​indicating more severe semantic distortion. α i β i γ i These are the weighting coefficients for the positive benefit of completeness, the cost of completion bias, and the loss of semantic distortion, respectively, and α i +β i +γ i =1; The local semantic compliance constraints include core semantic element boundary constraints, text state constraints, and external interference variable constraints. The core semantic element boundary constraint states that the completed semantic variable xi must not exceed the inherent category and semantic boundary of the original core semantic elements (subject, action, limiting condition, logical relationship) of the i-th text fragment, ensuring that the completed content only fills in the missing elements in a closed loop, without adding or altering the original core semantic ontology. The text state constraint states that the completed content must be consistent with the original sentence structure, semantic features, and domain terminology of the text fragment, and must not change the inherent state attributes of the text. The external interference variable constraint states that the completion process must... The system suppresses the influence of external interference such as character truncation, OCR recognition errors, and speech-to-text errors, ensuring that the completion results are not misled by non-semantic noise. Through the aforementioned local semantic compliance constraints and the initial fragment semantic analysis completion model, the initial completed text and initial matching features of the i-th text fragment node are obtained, leading to the initial completed text sequence and initial matching feature set for all text fragment nodes. A medical text fragment completion model aiming for optimal comprehensive semantic completion utility is constructed, which can balance semantic integrity improvement, completion deviation control, and original semantic fidelity during the completion process. Combined with multiple local semantic compliance constraints, the completion behavior of medical texts is further standardized. Relying on core semantic boundary constraints, the system firmly adheres to the original diagnostic and treatment semantic scope of the text, only performing closed-loop filling of missing content, preventing the addition or alteration of core medical information. Through text state constraints, the system ensures that the completed content conforms to the sentence structure characteristics and professional terminology norms of medical documents, maintaining the consistency of the text's inherent attributes. With the help of external interference constraints, the system effectively filters out non-semantic noise interference such as recognition errors and character truncation. This solution can accurately complete the semantic completion of medical text fragments, avoid the completed content deviating from the original semantics, and generate more standardized and reliable initial completed text and matching features, greatly improving the rigor and professionalism of medical text completion.

[0008] Furthermore, step S3 includes the following: For the i-th text fragment node Fi, i=1,2,...,n, and for the downstream text fragment node Fj of Fi, j=i+1,i+2,...,n, construct a semantic transmission path set qi→j from Fi to Fj, wherein the path direction in the semantic transmission path set is consistent with the text generation time sequence; For any semantic transmission path Pi→j in the set of semantic transmission paths, the method for analyzing the degree of semantic drift spillover is as follows: First, obtain the semantic distortion difference ΔDi→j of path Pi→j. The semantic distortion difference is the difference between the baseline semantic utility of Fj without the influence of Fi completion behavior and the actual semantic utility of Fj in the transmission state after Fi performs completion of semantic variable xi. The baseline semantic utility represents the comprehensive quantitative score of the original semantic completeness, logical rationality and standardization of the text fragment node when it is not affected by the completion behavior of the preceding node. The actual semantic utility represents the comprehensive quantitative score of the semantic completeness, logical rationality and standardization of the text fragment node after the preceding node performs completion and is affected by semantic transmission. When the semantic distortion difference is less than 0, it is determined that Fi has a negative semantic drift transmission to Fj. Obtain the effective semantic transmission weight Wi→j of the semantic transmission path Pi→j, where the effective semantic transmission weight is the maximum value of the semantic transmission weights of all paths between two points in the semantic transmission path Pi→j. Finally, the semantic drift overflow degree φi→j of the semantic transmission path Pi→j is calculated, where φi→j = Wi→j × ΔDi→j. A preset drift overflow threshold is set. If φi→j is greater than the threshold, the transmission path Pi→j is determined to be a drift overflow path, the text fragment node Fi is the drift source node, and the location of Fi is the drift overflow position. Otherwise, it is determined to be a non-drift overflow path, and the initial completion semantic variable of the drift source node is recorded as a variable to be adjusted. A complete semantic transmission path is constructed according to the generation order of the medical time-series text. By comparing the difference in semantic utility before and after the text fragment is affected by completion, the transmission phenomenon of negative semantic drift is accurately identified. Combining semantic transmission weights to quantify the drift overflow degree can accurately locate the drift source and overflow position that causes semantic anomalies and promptly mark the completion content that needs to be corrected. This method can quickly capture the risk of the spread of local completion deviations in the time sequence of medical text, avoid the continuous transmission and accumulation of diagnosis and treatment-related semantic errors, effectively ensure the accuracy and coherence of the overall semantics of medical documents, provide a clear target direction for subsequent global optimization and adjustment, and greatly improve the accuracy and effectiveness of semantic control of medical text.

[0009] Furthermore, step S4 includes the following: When a text fragment node Fi is identified as a drift source node, the global completion and matching optimization rules established for Fi are as follows: Based on the initial fragment semantic analysis completion model and local semantic compliance constraints, a drift accumulation suppression constraint is added. This drift accumulation suppression constraint is as follows: For all semantic transmission paths that originate from the text fragment node Fi and are identified as drift overflow paths, the degree of semantic drift overflow in each semantic transmission path is less than or equal to a preset drift overflow threshold. After identifying the semantic drift source node, a drift accumulation suppression constraint is added to construct global completion and matching optimization rules, achieving integrated control from local text completion to global temporal semantics. This constraint can effectively limit the transmission of semantic deviations caused by the drift source, prevent the continuous spread of negative semantic errors in medical temporal documents, and avoid the continuous accumulation of diagnosis-related semantic distortions along the text chain. While retaining the original local semantic compliance constraints and completion model, this approach takes into account both the semantic standardization of individual texts and the semantic consistency of the entire medical document, ensuring that the drift of each semantic transmission path remains within a reasonable range. This effectively guarantees the rigor and consistency of the global semantics of the medical document, laying a standardized rule foundation for subsequent accurate correction and completion of content and optimization of text matching effects.

[0010] Furthermore, step S5 includes the following: Solving the global completion and matching optimization rules yields the global collaborative completion semantic variable Yi for the drift source node Fi; The initial completion semantic variables of all drift source nodes are corrected one by one, and the initial completion semantic variable set {X1,X2,...,Xn} is corrected into the global collaborative completion semantic variable set {Y1,Y2,...,Yn}; Based on the aforementioned global collaborative completion semantic variables, the initial matching features are synchronously corrected. Local features of the original text fragments are fused with global semantic features from the global collaborative completion, generating normalized fused matching features and simultaneously obtaining a globally semantically consistent completed text sequence. By solving the global optimization rules, the completed content at the source of drift can be specifically corrected, shifting the completion scheme from local independent optimization to global collaborative adaptation, effectively eliminating the diagnostic information bias caused by semantic drift. While correcting the completed content, the text matching features are simultaneously adjusted, fusing the local features of the original text with globally unified semantic features to form standardized and unified fused matching features. This preserves the original core information of the medical text while ensuring the semantic coherence and consistency of the entire document. The final generated completed text sequence is semantically unified, logically rigorous, and has more accurate and reliable matching features, significantly improving the standardization and accuracy of medical document organization and providing solid support for efficient retrieval and compliant management of medical text data.

[0011] Furthermore, step S6 includes the following: The preset iteration period is a time period or iteration number threshold set according to the semantic update frequency of the text fragment scenario. After a preset iteration cycle, the global collaborative completion semantic variable set {Y1,Y2,...,Yn} is used as the core completion variable. The updated drift overflow coefficients of each semantic transmission path are recalculated, and the drift source nodes are iteratively corrected. The text matching result set is updated synchronously based on the corrected completed text sequence and fused matching features until the drift overflow degree of all semantic transmission paths is less than or equal to the drift overflow threshold, or the number of iterations reaches the preset number of iterations threshold. Then the iteration is terminated and the final completed text sequence and text matching result are output.

[0012] A text data matching optimization system based on a large language model includes: a temporal causal chain construction module, an initial completion feature generation module, a semantic drift detection module, a global optimization rule establishment module, a completion feature correction module, and a result iterative update module; The temporal causal chain construction module is used to construct temporal semantic causal chains for fragmented temporal text scenarios and obtain semantic causal dependencies and transmission paths between text fragments. The initial completion feature generation module is used to generate an initial fragment semantic analysis and completion model with the goal of maximizing the completeness of semantic completion of any fragment, construct local semantic compliance constraints, and generate initial completion text and initial matching features based on the initial fragment semantic analysis and completion model and local semantic compliance constraints. The semantic drift detection module is used to detect the degree of semantic drift propagation and accumulation in the temporal semantic causal chain of the initial completed text, and to determine the drift overflow position and drift accumulation intensity. The global optimization rule establishment module is used to establish global completion and matching optimization rules with the constraints of suppressing semantic drift propagation and ensuring global semantic consistency throughout the time sequence. The completion feature correction module is used to correct the initial completed text and initial matching features based on global completion and matching optimization rules, so as to obtain the completed text sequence and fused matching features; The result iteration update module is used to correct the text fragment completion results and matching features based on the iteration cycle, and to update and iterate the completed text sequence and matching results.

[0013] Compared with existing technologies, the beneficial effects achieved by this invention are as follows: On the one hand, by constructing a weighted temporal semantic causal topology, it accurately depicts the semantic causal dependencies and transmission paths between temporal text fragments, breaking the limitations of traditional technologies in processing text fragments in isolation, fully exploring the semantic constraint relationship between preceding fragments and subsequent fragments, fundamentally solving the problem of the supplementary content being detached from the temporal context logic, greatly improving the semantic coherence and logical rationality of temporal text fragments, making the supplementary content fit the temporal semantic context of the whole text, and adapting to the semantic association needs of temporal text data management scenarios such as government archives and financial contracts.

[0014] On the one hand, a comprehensive utility completion model is constructed that integrates the positive benefits of completeness, the cost of completion deviation, and the loss of semantic distortion. Combined with triple local constraints of core semantic boundaries, text state, and external interference, it not only ensures the integrity of text fragment completion but also effectively suppresses the interference of non-semantic noise such as OCR errors and character truncation, avoiding the completion content from deviating from the original semantics or tampering with the inherent attributes of the text, and significantly reducing completion deviation and semantic distortion problems. On the other hand, by quantitatively detecting the intensity of semantic drift propagation, locating the source of drift overflow, and establishing drift accumulation suppression constraints, the propagation and diffusion of semantic drift along the temporal chain are blocked, realizing the consistency control of global text semantics and solving the technical pain points of traditional technology completion distortion and global semantic chaos.

[0015] On the other hand, based on global optimization rules, the completed content and matching features are corrected, and an iterative update mechanism is set in conjunction with the semantic update frequency. By cyclically correcting the source of drift and iteratively optimizing the completed results and matching features, the credibility and accuracy of text matching features are continuously improved. Standardized and accurate completed text sequences and matching results can be output without manual secondary verification. This iterative optimization method can dynamically adapt to the semantic update requirements of time-series text, greatly improve the automation of text data completion and matching, effectively reduce the manual cost of text data management, and fully ensure the accuracy, standardization and efficiency of time-series text data processing in complex scenarios. Attached Figure Description

[0016] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a structural diagram of a text data matching optimization system based on a large language model according to the present invention; Figure 2 This is a flowchart of a text data matching optimization method based on a large language model according to the present invention. Detailed Implementation

[0017] 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 embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] Please see Figure 1 and Figure 2 This invention provides a technical solution: a text data matching optimization method based on a large language model, comprising the following steps: S1: Construct temporal semantic causal chains for fragmented temporal text scenarios to obtain semantic causal dependencies and transmission paths between text fragments; S2: With the goal of maximizing the semantic completeness of any fragment, generate an initial fragment semantic analysis and completion model, construct local semantic compliance constraints, and generate initial completed text and initial matching features based on the initial fragment semantic analysis and completion model and local semantic compliance constraints. S3: Detect the degree of semantic drift propagation and accumulation of the initial completed text in the temporal semantic causal chain, and determine the drift overflow position and drift accumulation intensity; S4: Establish global completion and matching optimization rules with the constraints of suppressing semantic drift propagation and ensuring global semantic consistency throughout the entire time sequence; S5: Based on the global completion and matching optimization rules, the initial completed text and initial matching features are corrected to obtain the completed text sequence and fused matching features; S6: Based on the iteration cycle, the text fragment completion results and matching features are corrected, and the completed text sequence and matching results are updated iteratively.

[0019] By constructing a weighted temporal semantic causal chain to characterize the semantic causal transmission relationship between text fragments, and combining multi-dimensional local semantic compliance constraints to establish a semantic completion utility optimization model, after quantitatively identifying the source of temporal semantic drift overflow, the completion result and matching feature are corrected by drift accumulation suppression as a global constraint.

[0020] Step S1 includes the following: The fragmented temporal text scenario is a chain-like text scenario in which several fragmented texts are generated sequentially in chronological order, and the preceding text fragments causally influence the following text fragments through core semantics. The method for constructing the temporal semantic causal chain is as follows: the fragmented temporal text is divided into several text fragment nodes according to the text generation sequence; the core semantic element variables, text state variables, and external interference variables of each text fragment node are extracted; a causal discovery algorithm adapted to temporal text is used to perform causal mining on each text fragment node and its variables arranged in the generation sequence; the directed semantic causal edges from the preceding node to the following node are retained; pseudo-causal associations are eliminated; the semantic transmission weights of the directed semantic causal edges between each node are determined; and a weighted temporal semantic causal topology is formed. Specifically, this includes: denoting the text fragment nodes arranged in the generation sequence as F1, F2, ..., Fn; extracting the core semantic element variable Ei, text state variable Si, and external interference variable Ii of each node; encoding them to obtain a comprehensive semantic feature vector Vi=[Ei;Si;Ii]; and using a temporal constraint-type causal discovery algorithm to perform semantic causal verification based on conditional mutual information, the formula is: I(Vi,Vj∣VK)=H(Vi∣VK)+H(Vj∣VK)-H(Vi,Vj∣VK); If I(Vi,Vj|VK)≤independence threshold, it is determined to be conditionally independent and related edges are removed; the directed semantic causal edge Fi→Fj from the predecessor node to the successor node is determined according to the text generation time sequence, and the semantic causal confidence is calculated: ; Edges with confidence scores below the pseudo-causal threshold are identified as pseudo-causal associations and removed; for the retained valid directed edges, semantic propagation weights are calculated. ; Using text fragment nodes as vertices and directed semantic causal edges with semantic transmission weights as edges, a weighted temporal semantic causal topology is formed. The core semantic element variables are the core semantic subjects, actions, limiting conditions, and logical relationships of the current text fragments that can be completed and calibrated by a large language model; the text state variables are a set of objective parameters that characterize the original semantic features, sentence structure, and domain terminology of the text fragments; the external interference variables are non-semantic interference factors generated during the fragmentation process of the text, including character truncation, OCR recognition errors, speech transcription errors, missing word order, and meaningless redundant characters.

[0021] Step S2 includes the following: For the i-th text fragment node Fi in the temporal semantic causal chain, with the core objective of maximizing the comprehensive utility of semantic completion for the i-th text fragment node, and combining the node's own semantic boundary constraints, text state constraints, and external interference constraints, an initial fragment semantic analysis and completion model based on a large language model is established: ; Where xi represents the core completion semantic variable of the i-th text fragment node, U i (xi, Si, Ii) represents the comprehensive completion utility of the i-th text fragment node. The goal of the initial fragment semantic analysis completion model is to obtain the result that U is solved by the large language model. i (xi,Si,Ii) represents the value of xi when it reaches its maximum value; Si represents the text state variable of the i-th text fragment node, and Ii represents the external interference variable of the i-th text fragment node; R(xi,Si) represents the positive gain in the semantic completeness of the text fragment after performing the completion of the semantic variable xi. The positive gain in completeness means that after performing completion on the i-th text fragment, combined with its text state Si, the improvement of the coverage of core semantic elements, logical coherence, and domain specification matching degree are weighted and summed according to preset weights (summing to 1) to obtain a score in the range of 0 to 1, which is used to quantify the positive contribution of the completion operation to the semantic completeness of the text; C(xi,Ii) represents the output of the external interference variable Ii when performing the completion of the semantic variable xi. The completion bias cost represents the degree to which the completed semantics xi deviates from the original true semantics due to external interference variables Ii (such as character truncation, OCR error, etc.) when performing completion on the i-th text fragment. It is quantified as a score in the range of 0 to 1, with higher values ​​indicating greater completion bias and higher costs. L(xi,Si) represents the semantic distortion loss caused by deviation from the core semantics of the original text fragment when performing completion on the semantic variable xi. The semantic distortion loss represents the degree of deviation between the completed semantics xi and the core semantics of the original fragment after performing completion on the i-th text fragment, combined with its text state Si (original semantic features, sentence structure, domain specifications). It takes a value in the range of 0 to 1, with higher values ​​indicating more severe semantic distortion. α i β i γ i These are the weighting coefficients for the positive benefit of completeness, the cost of completion bias, and the loss of semantic distortion, respectively, and α i +β i +γ i =1; The local semantic compliance constraints include core semantic element boundary constraints, text state constraints, and external interference variable constraints. The core semantic element boundary constraints state that the completed semantic variable xi must not exceed the inherent category and semantic boundary of the original core semantic elements (subject, action, limiting condition, logical relationship) of the i-th text fragment, ensuring that the completed content only fills in the missing elements in a closed loop, without adding or altering the original core semantic ontology. The text state constraints state that the completed content must be consistent with the original sentence structure, semantic features, and domain terminology of the text fragment, and must not change the inherent state attributes of the text. The external interference variable constraints state that the completion process must suppress the influence of external interference such as character truncation, OCR recognition errors, and speech-to-text errors, so that the completion result is not misled by non-semantic noise. Through the local semantic compliance constraints and the initial fragment semantic analysis completion model, the initial completed text and initial matching features of the i-th text fragment node are obtained, and then the initial completed text sequence and initial matching feature set of all text fragment nodes are obtained.

[0022] Step S3 includes the following: For the i-th text fragment node Fi, i=1,2,...,n, and for the downstream text fragment node Fj of Fi, j=i+1,i+2,...,n, construct a semantic transmission path set qi→j from Fi to Fj, wherein the path direction in the semantic transmission path set is consistent with the text generation time sequence; For any semantic transmission path Pi→j in the set of semantic transmission paths, the method for analyzing the degree of semantic drift spillover is as follows: First, obtain the semantic distortion difference ΔDi→j of path Pi→j. The semantic distortion difference is the difference between the baseline semantic utility of Fj without the influence of Fi completion behavior and the actual semantic utility of Fj in the transmission state after Fi performs completion of semantic variable xi. The baseline semantic utility represents the comprehensive quantitative score of the original semantic completeness, logical rationality and standardization of the text fragment node when it is not affected by the completion behavior of the preceding node. The actual semantic utility represents the comprehensive quantitative score of the semantic completeness, logical rationality and standardization of the text fragment node after the preceding node performs completion and is affected by semantic transmission. When the semantic distortion difference is less than 0, it is determined that Fi has a negative semantic drift transmission to Fj. Obtain the effective semantic transmission weight Wi→j of the semantic transmission path Pi→j, where the effective semantic transmission weight is the maximum value of the semantic transmission weights of all paths between two points in the semantic transmission path Pi→j. Finally, the semantic drift overflow degree φi→j of the semantic transmission path Pi→j is calculated, φi→j=Wi→j×ΔDi→j; a preset drift overflow threshold is set. If φi→j is greater than the drift overflow threshold, the transmission path Pi→j is determined to be a drift overflow path, the text fragment node Fi is the drift source node, and the position of Fi is the drift overflow position; otherwise, it is determined to be a non-drift overflow path, and the initial completion semantic variable of the drift source node is recorded as a variable to be adjusted.

[0023] Step S4 includes the following: When a text fragment node Fi is determined to be a drift source node, the global completion and matching optimization rules established for Fi are as follows: based on the initial fragment semantic analysis completion model and local semantic compliance constraints, a drift accumulation suppression constraint is added. The drift accumulation suppression constraint is as follows: for all semantic transmission paths that take text fragment node Fi as the starting point of the transmission path and are determined to be drift overflow paths, the degree of semantic drift overflow of the semantic transmission path is less than or equal to the preset drift overflow threshold.

[0024] Step S5 includes the following: Solving the global completion and matching optimization rules yields the global collaborative completion semantic variable Yi for the drift source node Fi; The initial completion semantic variables of all drift source nodes are corrected one by one, and the initial completion semantic variable set {X1,X2,...,Xn} is corrected into the global collaborative completion semantic variable set {Y1,Y2,...,Yn}; Based on the global collaborative completion semantic variables, the initial matching features are synchronously corrected, and the local features of the original text fragments are fused with the global semantic features of global collaborative completion to generate normalized fused matching features, while obtaining a globally semantically consistent completed text sequence.

[0025] Step S6 includes the following: The preset iteration period is a time period or iteration number threshold set according to the semantic update frequency of the text fragment scenario. After a preset iteration cycle, the global collaborative completion semantic variable set {Y1,Y2,...,Yn} is used as the core completion variable. The updated drift overflow coefficients of each semantic transmission path are recalculated, and the drift source nodes are iteratively corrected. The text matching result set is updated synchronously based on the corrected completed text sequence and fused matching features until the drift overflow degree of all semantic transmission paths is less than or equal to the drift overflow threshold, or the number of iterations reaches the preset number of iterations threshold. Then the iteration is terminated and the final completed text sequence and text matching result are output.

[0026] A text data matching optimization system based on a large language model, the system comprising: a temporal causal chain construction module, an initial completion feature generation module, a semantic drift detection module, a global optimization rule establishment module, a completion feature correction module, and a result iterative update module; The temporal causal chain construction module is used to construct temporal semantic causal chains for fragmented temporal text scenarios, and to obtain semantic causal dependencies and transmission paths between text fragments; The initial completion feature generation module is used to generate an initial fragment semantic analysis and completion model with the goal of maximizing the semantic completion of any fragment, construct local semantic compliance constraints, and generate initial completion text and initial matching features based on the initial fragment semantic analysis and completion model and local semantic compliance constraints. The semantic drift detection module is used to detect the degree of semantic drift propagation and accumulation in the temporal semantic causal chain of the initial completed text, and to determine the drift overflow position and drift accumulation intensity; The global optimization rule establishment module is used to establish global completion and matching optimization rules with the constraints of suppressing the accumulation of semantic drift propagation and ensuring global consistency of semantics throughout the entire time sequence. The completion feature correction module is used to correct the initial completed text and initial matching features based on global completion and matching optimization rules, so as to obtain the completed text sequence and fused matching features; The result iteration update module is used to correct the text fragment completion results and matching features based on the iteration cycle, and to update and iterate the completed text sequence and matching results.

[0027] Example 1: In medical text data management scenarios, this method can be used for semantic completion and matching optimization of fragmented texts generated according to the chronological order of diagnosis and treatment, such as electronic medical records, medical records, and test reports. A temporal semantic causal topology is constructed for the chronologically arranged medical text fragments. Various types of medical texts are divided into independent text fragment nodes according to the chronological order of diagnosis and treatment. Core semantic elements such as disease descriptions and treatment operations contained in each node are extracted, and text state features such as sentence structure and professional terminology are recorded. Simultaneously, external interference information such as character truncation and recognition errors are identified. A temporally constrained causal discovery algorithm is used to perform semantic causal mining on each node, filtering out semantic associations where preceding treatment content has a real impact on subsequent records, eliminating pseudo-causal associations without actual logic, determining the semantic transmission strength between different nodes, and forming a complete temporal semantic causal topology that reflects the diagnosis and treatment logic. With the goal of optimizing the overall utility of semantic completion for a single text fragment, an initial semantic completion model is built, while setting three local constraints: core semantic boundaries, text state, and external interference. The completion process only fills in the missing parts of the diagnosis and treatment information, without altering the original core medical semantics, maintaining the sentence structure and terminology standardization of medical documents, filtering out non-semantic noise such as recognition errors, and generating initial completed medical text and corresponding initial matching features based on the model and constraints. Semantic transmission paths between text fragments are constructed according to the diagnosis and treatment timeline. The semantic utility changes of fragments before and after being affected by previous completions are compared to determine the transmission of negative semantic drift. The degree of drift overflow is calculated based on the semantic transmission strength, accurately locating the drift source nodes that cause semantic deviations and marking the completion content that needs adjustment. For the identified drift source nodes, drift accumulation suppression constraints are added to the original completion model and local constraints to construct global completion and matching optimization rules, limiting the continuous spread of semantic deviations along the diagnosis and treatment timeline chain and ensuring that the drift degree of all semantic transmission paths is within a reasonable range. The global optimization rules are solved to obtain complete content adapted to global semantics. The initial complete information of each drift source is corrected, and text matching features are adjusted synchronously. Local original text features are fused with globally unified semantic features to generate standardized fused matching features, resulting in a semantically coherent and unified completed medical text sequence. An iteration cycle is set according to the semantic update pattern of medical text. Based on the corrected complete content, the drift overflow of each transmission path is recalculated, and the drift source is continuously iteratively corrected, with text matching results updated synchronously. The iteration process terminates when the drift overflow degree of all semantic transmission paths meets the requirements, outputting the final completed medical text sequence and matching results, achieving standardized and precise management of medical time-series text.

[0028] Example 2: For fragmented text (including chief complaint, physical examination, laboratory test, preliminary diagnosis, treatment orders, etc.) generated during the diagnosis and treatment of a type 2 diabetic patient, accurate completion is achieved through steps S1-S2 to ensure the semantic coherence and professional rigor of the medical records. The specific implementation is as follows: The patient is a 58-year-old male, and there are a total of 8 fragments related to diagnosis and treatment, which are generated in the order of diagnosis and treatment. The complete diagnosis and treatment context needs to be restored by completion.

[0029] A temporal semantic causal chain for medical record fragments is constructed. The fragmented temporal text scenario is a chain-like text scenario generated according to the order of diagnosis and treatment time. The preceding text fragment (such as the chief complaint of "polydipsia and polyuria for more than 1 month" and the laboratory test result of "fasting blood glucose 8.7 mmol / L") has a causal influence on the subsequent fragment (such as the preliminary diagnosis of "type 2 diabetes" and the medical order of "metformin to lower blood sugar") through core semantics. The construction method is as follows: the 8 medical text fragments are divided into 8 nodes F1-F8 according to the diagnosis and treatment time. The core semantic element variables of each node are extracted (such as the core element of F1 is "patient is 58 years old male, polydipsia and polyuria for more than 1 month", which is completed and calibrated by a large language model), text state variables (standard sentence structure of outpatient medical records, objective parameters such as endocrinology medical terminology), and external interference variables (OCR recognition error rate of about 3.2%, 2 character truncations, and 1 speech transcription error). The resulting variables are encoded to obtain 8 sets of comprehensive semantic feature vectors.

[0030] A temporally constrained causal discovery algorithm is adopted, which performs semantic causal testing based on conditional mutual information. The independence threshold is set to 0.05 and the pseudo-causal threshold is set to 0.7. Two conditionally independent pseudo-causal associations with confidence scores below 0.7 are eliminated. Seven directed causal edges from predecessor nodes to successor nodes are identified, with semantic transmission weights ranging from 0.68 to 0.92 (where the weight of F3 "fasting blood glucose 8.7 mmol / L" to F4 "type 2 diabetes" is 0.92). This forms a weighted temporally constrained semantic causal topology, which deeply mines the diagnostic and treatment logic connections between fragments of medical text, abandons the isolated processing mode, fully restores the temporal semantic context of patient diagnosis and treatment, and effectively filters out non-semantic interference.

[0031] An initial semantic completion model for medical text fragments is established. For the eight text fragment nodes Fi (i=1-8) in the temporal semantic causal chain, aiming to maximize the overall completion utility, and combined with local semantic compliance constraints, an initial completion model based on a large language model is constructed. A weight coefficient α is set. i =0.5, β i =0.3、γ i =0.2 (α) i +β i +γ i=1), the model takes into account the positive benefits of completeness (the core semantic coverage is improved by 28% after completion, the logical coherence is improved by 35%, and the terminology standard matching is improved by 32%), the cost of completion deviation (affected by external interference, the average completion deviation is 0.12) and the loss of semantic distortion (the average degree of semantic deviation is 0.08), and balances the relationship between the three through weight coefficients.

[0032] The local constraints are clearly defined: the completed content does not exceed the original core semantic scope, conforms to the status attributes of outpatient medical records, and suppresses external interference. For example, the character truncation of F2 "Physical examination: Height 175cm, Weight 78kg, BP 135 / 85mmHg, No obvious positive signs" is completed as "Physical examination: Height 175cm, Weight 78kg, BMI 25.4kg / m², BP 135 / 85mmHg, No obvious positive signs in the heart, lungs, and abdomen," ensuring that only closed-loop filling of missing elements is achieved without altering the original medical information. Through this model and constraints, eight nodes of initial completed text and matching features are obtained, forming a standardized initial completed text sequence.

[0033] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary sensing device embodiments described above, and that the invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. A text data matching optimization method based on a large language model, characterized in that: The method includes the following steps: S1: Construct a temporal semantic causal chain for fragmented temporal text scenarios to obtain semantic causal dependencies and transmission paths between text fragments. The fragmented temporal text scenarios are several chained text scenarios generated sequentially in chronological order. The method for constructing the temporal semantic causal chain is as follows: Divide the fragmented temporal text into several text fragment nodes according to the text generation time order, extract the core semantic element variables, text state variables, and external interference variables of each text fragment node, and perform causal mining on each text fragment node and its variables arranged in the generation time order through a causal discovery algorithm adapted to temporal text. Retain the directed semantic causal edges from the preceding node to the following node, eliminate pseudo-causal associations, determine the semantic transmission weight of the directed semantic causal edges between each node, and form a weighted temporal semantic causal topology. S2: With the goal of maximizing the semantic completeness of any fragment, generate an initial fragment semantic analysis and completion model, construct local semantic compliance constraints, and generate initial completed text and initial matching features based on the initial fragment semantic analysis and completion model and local semantic compliance constraints. S3: Detect the degree of semantic drift propagation accumulation of the initial completed text in the temporal semantic causal chain, determine the drift overflow position and drift accumulation intensity. For the i-th text fragment node Fi, i=1,2,...,n, and for the downstream text fragment node Fj of Fi, j=i+1,i+2,...,n, construct the semantic propagation path set qi→j from Fi to Fj. The path direction in the semantic propagation path set is consistent with the text generation time sequence. For any semantic transmission path Pi→j in the set of semantic transmission paths, the method for analyzing the degree of semantic drift spillover is as follows: First, obtain the semantic distortion difference ΔDi→j of path Pi→j. The semantic distortion difference is the difference between the baseline semantic utility of Fj without the influence of Fi completion behavior and the actual semantic utility of Fj in the transmission state after Fi completes the semantic variable xi. When the semantic distortion difference is less than 0, it is determined that Fi has a negative semantic drift transmission to Fj. Obtain the effective semantic transmission weight Wi→j of the semantic transmission path Pi→j, where the effective semantic transmission weight is the maximum value of the semantic transmission weights of all paths between two points in the semantic transmission path Pi→j. Finally, the semantic drift overflow degree φi→j of the semantic transmission path Pi→j is calculated, φi→j=Wi→j×ΔDi→j; a preset drift overflow threshold is set. If φi→j is greater than the drift overflow threshold, the transmission path Pi→j is determined to be a drift overflow path, the text fragment node Fi is the drift source node, and the location of Fi is the drift overflow position; otherwise, it is determined to be a non-drift overflow path, and the initial completion semantic variable of the drift source node is recorded as a variable to be adjusted. S4: Establish global completion and matching optimization rules with the constraints of suppressing semantic drift propagation and ensuring global semantic consistency throughout the entire time sequence; S5: Based on the global completion and matching optimization rules, the initial completed text and initial matching features are corrected to obtain the completed text sequence and fused matching features; S6: Based on the iteration cycle, the text fragment completion results and matching features are corrected, and the completed text sequence and matching results are updated iteratively.

2. The text data matching optimization method based on a large language model according to claim 1, characterized in that: By constructing a weighted temporal semantic causal chain to characterize the semantic causal transmission relationship between text fragments, and combining multi-dimensional local semantic compliance constraints to establish a semantic completion utility optimization model, after quantitatively identifying the source of temporal semantic drift overflow, the completion result and matching feature are corrected by drift accumulation suppression as a global constraint.

3. The text data matching optimization method based on a large language model according to claim 2, characterized in that: Step S2 includes the following: For the i-th text fragment node Fi in the temporal semantic causal chain, with the core objective of maximizing the comprehensive utility of semantic completion for the i-th text fragment node, and combining the node's own semantic boundary constraints, text state constraints, and external interference constraints, an initial fragment semantic analysis and completion model based on a large language model is established: ; Where xi represents the core completion semantic variable of the i-th text fragment node, U i (xi, Si, Ii) represents the comprehensive completion utility of the i-th text fragment node. The goal of the initial fragment semantic analysis completion model is to obtain the result that U is solved by the large language model. i (xi,Si,Ii) represents the value of xi when it reaches its maximum value; Si represents the text state variable of the i-th text fragment node, and Ii represents the external interference variable of the i-th text fragment node; R(xi,Si) represents the positive gain in the semantic completeness of the text fragment after completing the semantic variable xi; C(xi,Ii) represents the completion deviation cost caused by the external interference variable Ii when completing the semantic variable xi; L(xi,Si) represents the semantic distortion loss caused by deviating from the core semantics of the original text fragment when completing the semantic variable xi; α i β i γ i These are the weighting coefficients for the positive benefit of completeness, the cost of completion bias, and the loss of semantic distortion, respectively, and α i +β i +γ i =1; The local semantic compliance constraints include core semantic element boundary constraints, text state constraints, and external interference variable constraints. Through the local semantic compliance constraints and the initial fragment semantic analysis and completion model, the initial completed text and initial matching features of the i-th text fragment node are obtained, and then the initial completed text sequence and initial matching feature set of all text fragment nodes are obtained.

4. The text data matching optimization method based on a large language model according to claim 3, characterized in that: In step S4, Includes the following: When a text fragment node Fi is determined to be a drift source node, the global completion and matching optimization rules established for Fi are as follows: based on the initial fragment semantic analysis completion model and local semantic compliance constraints, a drift accumulation suppression constraint is added. The drift accumulation suppression constraint is as follows: for all semantic transmission paths that take text fragment node Fi as the starting point of the transmission path and are determined to be drift overflow paths, the degree of semantic drift overflow of the semantic transmission path is less than or equal to the preset drift overflow threshold.

5. The text data matching optimization method based on a large language model according to claim 4, characterized in that: Step S5 includes the following: Solving the global completion and matching optimization rules yields the global collaborative completion semantic variable Yi for the drift source node Fi; The initial completion semantic variables of all drift source nodes are corrected one by one, and the initial completion semantic variable set {X1,X2,...,Xn} is corrected into the global collaborative completion semantic variable set {Y1,Y2,...,Yn}; Based on the global collaborative completion semantic variables, the initial matching features are synchronously corrected, and the local features of the original text fragments are fused with the global semantic features of global collaborative completion to generate normalized fused matching features, while obtaining a globally semantically consistent completed text sequence.

6. The text data matching optimization method based on a large language model according to claim 5, characterized in that: In step S6, Includes the following: The preset iteration cycle is a time period or a threshold number of iterations set according to the semantic update frequency of the text fragment scenario; After a preset iteration cycle, the global collaborative completion semantic variable set {Y1,Y2,...,Yn} is used as the core completion variable. The updated drift overflow coefficients of each semantic transmission path are recalculated, and the drift source nodes are iteratively corrected. The text matching result set is updated synchronously based on the corrected completed text sequence and fused matching features until the drift overflow degree of all semantic transmission paths is less than or equal to the drift overflow threshold. Then the iteration is terminated and the final completed text sequence and text matching result are output.

7. A text data matching optimization system based on a large language model, wherein the system is applied to the text data matching optimization method based on a large language model as described in any one of claims 1-6, characterized in that: The system includes: a temporal causal chain construction module, an initial completion feature generation module, a semantic drift detection module, a global optimization rule establishment module, a completion feature correction module, and a result iterative update module; The temporal causal chain construction module is used to construct temporal semantic causal chains for fragmented temporal text scenarios and obtain semantic causal dependencies and transmission paths between text fragments. The initial completion feature generation module is used to generate an initial fragment semantic analysis and completion model with the goal of maximizing the completeness of semantic completion of any fragment, construct local semantic compliance constraints, and generate initial completion text and initial matching features based on the initial fragment semantic analysis and completion model and local semantic compliance constraints. The semantic drift detection module is used to detect the degree of semantic drift propagation and accumulation in the temporal semantic causal chain of the initial completed text, and to determine the drift overflow position and drift accumulation intensity. The global optimization rule establishment module is used to establish global completion and matching optimization rules with the constraints of suppressing semantic drift propagation and ensuring global semantic consistency throughout the time sequence. The completion feature correction module is used to correct the initial completed text and initial matching features based on global completion and matching optimization rules, so as to obtain the completed text sequence and fused matching features; The result iteration update module is used to correct the text fragment completion results and matching features based on the iteration cycle, and to update and iterate the completed text sequence and matching results.

Citation Information

Patent Citations

  • Text content generation method based on artificial intelligence

    CN120633672A

  • System and method for estimating confidence and implementing metacognitive abilities in a artificial intelligence systems

    GB202509759D0