A prompt word logic configuration method based on context semantic enhancement

By combining dynamic generation of semantic anchors and semantic field strength modeling, a comprehensive prompt word logic configuration method is developed, which solves the problems of prompt word selection relying on static rules and inaccurate selection of semantic anchors. This method realizes the priority ranking and logical dependency relationship of prompt words in the global semantic network, thereby improving the accuracy and consistency of generated content.

CN120725027BActive Publication Date: 2025-11-11LIAONING NETLINK DIGITAL TECH IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, prompt word selection relies on static rules, which cannot dynamically reflect the strength and timeliness of semantic relationships, resulting in a lack of context sensitivity and logical consistency in prompt word configuration results. Semantic anchor point selection relies too much on word frequency or static keyword libraries, making it difficult to distinguish between important terms and ordinary terms. The evaluation of semantic weight is based on a single dimension, lacking a comprehensive consideration of emotional polarity and knowledge credibility, which leads to distortion or deviation in prompt word configuration results in complex scenarios.

Method used

A comprehensive suggestion word logic configuration method combining dynamic generation of semantic anchors and semantic field strength modeling is adopted. By calculating the contribution of semantic network structure and time decay, semantic anchors are dynamically generated, and semantic field strength quantification modeling with multi-dimensional decay weighting and credibility improvement is performed to construct the priority ranking and logical dependency relationship of suggestion words in the global semantic network.

Benefits of technology

It achieves logical rigor and context sensitivity in prompt word configuration, adapts to dynamic changes in dialogue context, ensures the accuracy and logical consistency of prompt words, and improves the relevance and completeness of generated content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120725027B_ABST
    Figure CN120725027B_ABST
Patent Text Reader

Abstract

The application discloses a prompt word logic configuration method based on context semantic enhancement, and belongs to the technical field of artificial intelligence and natural language processing; the method comprises the following steps: data acquisition, data preprocessing, dynamic semantic anchor point generation, semantic field strength quantitative modeling and prompt word logic configuration. Based on the contribution degree calculation and time decay mechanism of the semantic network structure, a semantic anchor point set capable of representing core semantics is dynamically generated; further, a three-dimensional semantic field model is constructed, the timeliness intensity, the emotional intensity and the credibility intensity of each semantic anchor point are quantified, and the comprehensive semantic field strength data are obtained by combining the multi-dimensional decay weighting and the credibility correction method; the application can significantly improve the context adaptability, the logic consistency and the dynamic adjustability of the prompt word configuration, and has good application value and popularization prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and natural language processing technology, specifically to a method for configuring prompt word logic based on contextual semantic enhancement. Background Technology

[0002] The context-based semantic enhancement-based prompt logic configuration method is an advanced strategy aimed at improving the interaction with generative artificial intelligence (such as large language models). Its core definition lies in the fact that instead of directly sending the user's short prompt to the model, this method employs a systematic process to first perform deep semantic analysis and expansion on the original instruction, its dialogue history, and relevant background information. This results in the construction of an enhanced prompt that is rich in meaning, clearly structured, and full of contextual information. Its main function is to address the pain points of traditional simple prompts, such as deviations from expected content, unstable quality, and lack of depth due to the lack of context. It can significantly improve the accuracy, relevance, and completeness of AI-generated content, ultimately enabling users to obtain higher-quality output results with lower communication costs.

[0003] However, existing intelligent configuration methods for prompt words have technical problems such as relying on static rules for prompt word selection, failing to dynamically reflect the strength of semantic relationships and changes in timeliness, resulting in prompt word configuration results lacking context sensitivity and logical consistency.

[0004] Existing methods for dynamically generating semantic anchors suffer from technical problems such as over-reliance on word frequency or static keyword libraries for anchor selection, difficulty in distinguishing between important and ordinary terms, and neglect of the dynamic contribution of terms at different points in time.

[0005] Existing semantic modeling methods suffer from technical problems such as evaluating semantic weights in a single dimension and lacking comprehensive consideration of multiple factors such as sentiment polarity and knowledge credibility, leading to distortion or deviation in prompt word configuration results in complex scenarios. Summary of the Invention

[0006] To address the above issues and overcome the shortcomings of existing technologies, this invention provides a context-based semantic enhancement-based prompt word logic configuration method. Addressing the technical problems of existing intelligent prompt word logic configuration methods, such as prompt word selection relying on static rules and failing to dynamically reflect changes in semantic strength and timeliness, resulting in a lack of context sensitivity and logical consistency in the prompt word configuration results, this solution creatively adopts a comprehensive prompt word logic configuration approach combining dynamic generation of semantic anchors and semantic field strength modeling. This achieves priority ranking and logical dependency construction of prompt words in the global semantic network. By setting high-priority anchors as core nodes and low-priority anchors as supplementary nodes, and combining them with time-weighted components based on timeliness intensity, this approach not only ensures the logical rigor of the prompt word configuration but also adapts to the dynamic changes in the dialogue context over time. Addressing the technical issues of existing dynamic semantic anchor generation methods, which rely too heavily on word frequency or static keyword libraries, struggle to distinguish between important and ordinary terms, and ignore the dynamic contribution of terms at different points in time, this solution creatively employs a dynamic anchor extraction method based on semantic network structure contribution calculation and timeliness decay to generate dynamic semantic anchors, achieving accurate coverage of the core semantics by the anchor set. Specifically, this solution comprehensively considers node degree, semantic similarity, and relationship strength through a structural contribution formula, and introduces a time decay factor to correct historical occurrence frequency, enabling recently high-value terms to stand out while automatically weakening noisy terms that have not appeared for a long time. Addressing the technical problem in existing semantic modeling methods that rely on a single dimension to evaluate semantic weights and lack comprehensive consideration of multiple factors such as sentiment polarity and knowledge credibility, leading to distortion or deviation in prompt word configuration results in complex scenarios, this solution creatively adopts a semantic field strength quantification model that integrates multi-dimensional decay weighting and credibility improvement. This achieves a comprehensive evaluation of timeliness, sentiment weight, and knowledge credibility. The method uses a three-dimensional field strength vector and a comprehensive field strength formula for quantification modeling, ensuring that prompt words not only reflect semantic strength but also sentiment orientation and source credibility.

[0007] The technical solution adopted by this invention is as follows: This invention provides a method for configuring prompt word logic based on contextual semantic enhancement, which includes the following steps:

[0008] Step S1: Data Acquisition;

[0009] Step S2: Data preprocessing;

[0010] Step S3: Dynamic semantic anchor point generation;

[0011] Step S4: Semantic field strength quantization modeling;

[0012] Step S5: Configure the prompt logic.

[0013] Furthermore, in step S1, the data acquisition is used to collect raw information related to the construction of prompt words, specifically by constructing a data acquisition module to perform multi-dimensional data acquisition and obtain a raw data set;

[0014] The original data set specifically includes user input text data, contextual history data, and text semantic tags;

[0015] The multidimensional data collection specifically includes user interaction data collection, corpus data collection, and tag data collection.

[0016] Further, in step S2, the data preprocessing is used to clean and unify the original data format, specifically by sequentially performing data cleaning, context alignment and semantic annotation on the original data set to obtain the prompt word configuration enhancement dataset;

[0017] The enhanced dataset for prompt word configuration specifically includes optimized text data, entity term annotation data, and semantic relationship structure data.

[0018] Further, in step S3, the dynamic semantic anchor point generation is used to extract keywords or phrases that can represent the core meaning. Specifically, based on the enhanced dataset configured by the prompt words, a dynamic anchor point extraction method based on semantic network structure contribution calculation and time decay is used to generate dynamic semantic anchor points, resulting in a semantic anchor point set, including the following steps:

[0019] Step S31: Temporal semantic network construction, specifically, based on the entity term annotation data and semantic relationship structure data in the enhanced dataset of the prompt words, a contextual temporal semantic network is constructed through node modeling, edge modeling and node attribute definition;

[0020] The node modeling specifically involves defining each labeled entity term as a node;

[0021] The edge modeling specifically refers to defining the relationship between two arbitrary terms defined in the semantic relation structure data as an edge.

[0022] The node attribute definition specifically involves attaching a list of timestamps to each node to record all occurrences of the term in the context history;

[0023] Step S32: Structural contribution modeling, specifically by constructing a basic structural contribution calculation equation, calculating the structural contribution of each candidate term corresponding to each node, and obtaining basic structural contribution data;

[0024] Step S33: Calculation of structural contribution attenuation over time. Specifically, based on the timestamp list in the node attributes, the candidate terms corresponding to each node are modeled with an attenuation coefficient, and the attenuation coefficient model is introduced to improve the calculation of the basic calculation equation of structural contribution, so as to obtain the attenuation structural contribution data.

[0025] Step S34: Semantic anchor set generation, specifically by constructing the context temporal semantic network, taking all nodes in the context temporal semantic network as a candidate term set, calculating the corresponding time decay structure contribution data for each candidate term, and obtaining the semantic anchor set through dynamic threshold filtering and structure contribution sorting.

[0026] Further, in step S4, the semantic field strength quantification modeling is used to quantify the influence of each semantic anchor point in the context based on the concept of physical field strength. It comprehensively evaluates the timeliness, sentiment weight, and knowledge credibility through a three-dimensional semantic field model. Specifically, based on the enhanced dataset configured by the prompt words and the set of semantic anchor points, a semantic field strength quantification model that integrates multi-dimensional attenuation weighting and credibility improvement is used to perform semantic field strength quantification modeling, obtaining semantic field quantification modeling data. This includes the following steps:

[0027] Step S41: Initialize the three-dimensional semantic field strength vector, specifically by defining the initial structure of the three-dimensional semantic field model to obtain the three-dimensional semantic field initialization vector; the initial structure includes a timeliness intensity component, an emotion intensity component, and a credibility intensity component;

[0028] Step S42: Construction of timeliness intensity component, specifically by performing exponential time decay calculation based on the time distance between the occurrence times of terms in the semantic anchor set in the historical context, to construct the timeliness intensity component;

[0029] Step S43: Construction of sentiment intensity component, specifically, by using a pre-trained sentiment analysis model, performing sentiment polarity analysis based on the optimized text data corresponding to the semantic anchor set, calculating the sentiment intensity value based on the probability distribution entropy output by the pre-trained sentiment analysis model, performing separate calculations of sentiment polarity and intensity, and constructing the sentiment intensity component by merging the sentiment polarity and the sentiment intensity.

[0030] Step S44: Construction of credibility improvement intensity component, specifically, constructing a fixed scoring table for data sources, optimizing the credibility rating of the basic source of text data, and constructing credibility improvement intensity component by constructing a time span weighted correction method based on the credibility of the basic source, thus obtaining credibility intensity component;

[0031] Step S45: Comprehensive field strength calculation, specifically, by constructing the timeliness intensity component, the emotion intensity component, and the credibility improvement intensity component, a comprehensive semantic field strength calculation is performed to obtain comprehensive semantic field strength data;

[0032] Step S46: Semantic field strength quantization modeling, specifically, based on the comprehensive semantic field strength data, semantic field quantization modeling is performed to obtain semantic field quantization modeling data;

[0033] The semantic field quantization modeling data is in the form of a list of triples, including semantic anchors, three-dimensional field strength vectors, and comprehensive field strength values;

[0034] The semantic anchor point specifically refers to the semantic anchor point of the corresponding node in the semantic anchor point set; the three-dimensional field strength vector specifically refers to the timeliness intensity component, the sentiment intensity component, and the credibility intensity component; the comprehensive field strength value specifically refers to the comprehensive semantic field strength data.

[0035] Further, in step S5, the prompt word logic configuration is used to generate the final prompt word configuration scheme. Specifically, based on the semantic field quantization modeling data and the semantic anchor point set, the semantic anchor points in the semantic field quantization modeling data are prioritized according to the comprehensive field strength value. Based on the semantic relationship between the semantic anchor points and the corresponding three-dimensional field strength vector, a prompt word logical dependency relationship is established. High-priority semantic anchor points are used as core prompt word nodes, and low-priority semantic anchor points are used as supplementary prompt word nodes. The scheme is then combined with the timeliness intensity component for time weighting, and outputs a prompt word configuration scheme that includes a prompt word sequence, prompt word logical dependency relationship, and prompt word priority weight.

[0036] The beneficial effects achieved by the present invention using the above solution are as follows:

[0037] (1) In view of the technical problems in the existing intelligent configuration method of prompt words, which relies on static rules for prompt word selection and cannot dynamically reflect the strength of semantic relationships and changes in timeliness, resulting in a lack of context sensitivity and logical consistency in the prompt word configuration results, this solution creatively adopts a comprehensive prompt word logical configuration approach that combines dynamic generation of semantic anchors and semantic field strength modeling, and realizes the priority ranking and logical dependency construction of prompt words in the global semantic network. By setting high-priority anchors as core nodes and low-priority anchors as supplementary nodes, and combining time weighting with timeliness intensity components, not only is the logical rigor of prompt word configuration guaranteed, but it can also adapt to the dynamic changes of dialogue context over time;

[0038] (2) To address the technical problems of existing dynamic semantic anchor generation methods, which rely too heavily on word frequency or static keyword databases for anchor selection, making it difficult to distinguish between important and ordinary terms, and ignoring the dynamic contribution of terms at different time points, this solution creatively adopts a dynamic anchor extraction method based on semantic network structure contribution calculation and time decay to generate dynamic semantic anchors, achieving accurate coverage of the core semantics by the anchor set. Specifically, the structural contribution formula comprehensively considers node degree, semantic similarity, and relationship strength, and introduces a time decay factor to correct the historical frequency of occurrence, so that recently high-value terms can be highlighted, while noisy terms that have not appeared for a long time are automatically weakened;

[0039] (3) In view of the technical problems in existing semantic modeling methods, such as evaluating semantic weight in a single dimension and lacking comprehensive consideration of multiple factors such as sentiment polarity and knowledge credibility, the result of prompt word configuration is distorted or biased in complex scenarios. This solution creatively adopts a semantic field strength quantification model that integrates multi-dimensional attenuation weighting and credibility improvement to perform semantic field strength quantification modeling, and realizes the comprehensive evaluation of timeliness, sentiment weight and knowledge credibility. This method uses three-dimensional field strength vector and comprehensive field strength formula to perform quantification modeling, ensuring that prompt words not only reflect semantic strength, but also reflect sentiment orientation and source credibility. Attached Figure Description

[0040] Figure 1 A flowchart illustrating a prompt word logic configuration method based on contextual semantic enhancement provided by the present invention;

[0041] Figure 2 A flowchart illustrating the process of generating dynamic semantic anchors in step S3;

[0042] Figure 3 A flowchart illustrating the process of semantic field strength quantization modeling in step S4.

[0043] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof. Detailed Implementation

[0044] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. 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 the description of this invention, it should be understood that the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and 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 this invention.

[0046] Example 1, see Figure 1 This invention provides a method for configuring prompt word logic based on contextual semantic enhancement, which includes the following steps:

[0047] Step S1: Data Acquisition;

[0048] Step S2: Data preprocessing;

[0049] Step S3: Dynamic semantic anchor point generation;

[0050] Step S4: Semantic field strength quantization modeling;

[0051] Step S5: Configure the prompt logic.

[0052] By performing the above operations, this solution addresses the technical problems inherent in existing intelligent prompt word configuration methods. These problems include prompt word selection relying on static rules and an inability to dynamically reflect the strength and timeliness of semantic relationships, resulting in a lack of context sensitivity and logical consistency in the prompt word configuration results. This solution creatively adopts a comprehensive prompt word configuration approach that combines dynamic generation of semantic anchors and semantic field strength modeling. This achieves priority ranking and logical dependency construction of prompt words in the global semantic network. By setting high-priority anchors as core nodes and low-priority anchors as supplementary nodes, and by combining time-weighted calculations with timeliness intensity components, not only is the logical rigor of the prompt word configuration guaranteed, but it can also adapt to the dynamic changes in the dialogue context over time.

[0053] Specifically, for example, in long conversation scenarios, core concepts that have appeared frequently recently (such as "model") can be automatically given higher weights, while secondary concepts that have not appeared for a long time (such as "optimization") are weakened, ensuring that the prompt output closely matches the user's context.

[0054] Example 2, see Figure 1 This embodiment is based on the above embodiment. In step S1, the data acquisition is used to collect original information related to the construction of prompt words. Specifically, it is to collect original data by constructing a data acquisition module and performing multi-dimensional data acquisition to obtain the original data set.

[0055] The original data set specifically includes user input text data, contextual history data, and text semantic tags;

[0056] The multidimensional data collection specifically includes user interaction data collection, corpus data collection, and tag data collection.

[0057] Preferably, the user interaction data collection specifically involves collecting log data from the question-and-answer system of the natural language interaction platform. During the user interaction data collection process, the data collection module automatically captures the log data of the question-and-answer system through the collection components deployed on the natural language interaction platform, including the user's original input text, response content, timestamp, and session number.

[0058] The corpus data collection specifically involves collecting general and domain-specific corpus datasets. During the corpus data collection process, the data collection module acquires data from two levels: general corpus and domain-specific corpus. The general corpus can come from open-source natural language corpora, such as encyclopedia corpora or news corpora, while the domain-specific corpus comes from professional industry documents, frequently asked questions, and industry standard texts.

[0059] The tag data collection specifically involves collecting existing terminology databases, entity relationships, term definitions, hierarchical and synonymous tag data from the tag system.

[0060] Example 3, see Figure 1 This embodiment is based on the above embodiment. In step S2, the data preprocessing is used to clean and unify the original data format. Specifically, the original data set is subjected to data cleaning, context alignment and semantic annotation in sequence to obtain the prompt word configuration enhancement dataset.

[0061] The enhanced dataset for the prompt word configuration specifically includes optimized text data, entity term annotation data, and semantic relationship structure data.

[0062] Preferably, the data cleaning specifically includes noise text removal, sensitive word desensitization, and duplicate data merging operations;

[0063] The context alignment is specifically achieved through dialogue turn alignment and input / output alignment operations to perform dialogue semantic alignment; in long dialogue scenarios, topic lines can also be aggregated through keyword extraction or clustering methods.

[0064] The semantic annotation specifically uses word segmentation, part-of-speech tagging, and entity recognition to perform semantic feature annotation. By using word segmentation technology to segment the text, combining part-of-speech tagging models to assign grammatical attributes to words, and using named entity recognition methods to identify personal names, organization names, place names, or professional terms.

[0065] Example 4, see Figure 1 , Figure 2This embodiment is based on the above embodiment. In step S3, the dynamic semantic anchor point generation is used to extract keywords or phrases that can represent the core meaning. Specifically, it involves configuring an enhanced dataset based on the prompt words, and using a dynamic anchor point extraction method based on semantic network structure contribution calculation and time decay to generate a set of semantic anchor points. This includes the following steps:

[0066] Step S31: Temporal semantic network construction, specifically, based on the entity term annotation data and semantic relationship structure data in the enhanced dataset of the prompt words, a contextual temporal semantic network is constructed through node modeling, edge modeling and node attribute definition;

[0067] The node modeling specifically involves defining each labeled entity term as a node;

[0068] The edge modeling specifically refers to defining the relationship between two arbitrary terms defined in the semantic relation structure data as an edge.

[0069] The node attribute definition specifically involves attaching a list of timestamps to each node to record all occurrences of the term in the context history;

[0070] Step S32: Structural contribution modeling, specifically by constructing a basic structural contribution calculation equation, calculating the structural contribution of each candidate term corresponding to each node, and obtaining basic structural contribution data;

[0071] The calculation formula for the basic equation for the structural contribution is as follows:

[0072] ;

[0073] In the formula, SCD(v i ) represents the contribution data of the infrastructure, v i It is the i-th node, used to represent candidate terms, where i is the node index and Degree is the node value. i The degree, E(v) i ) is related to node v i The set of all connected edges, e ij It is the edge connecting the i-th node and the j-th node, j is the neighbor node index, Sim is the semantic similarity calculation function, which is specifically calculated using the cosine similarity of word vectors, and RelStrength is the preset strength weight data, which is specifically calculated and set by statistical co-occurrence frequency;

[0074] Step S33: Calculation of structural contribution attenuation over time. Specifically, based on the timestamp list in the node attributes, the candidate terms corresponding to each node are modeled with an attenuation coefficient, and the attenuation coefficient model is introduced to improve the calculation of the basic calculation equation of structural contribution, so as to obtain the attenuation structural contribution data.

[0075] The formula for calculating the contribution data of the time-degradation structure is as follows:

[0076] ;

[0077] In the formula, This is the contribution data of the time-deterioration structure, where t is the time interval index, T i It is node v i A list of timestamps It is a time decay factor, used to control the degree to which the appearance of a term in the context history affects the contribution of the structure;

[0078] Step S34: Semantic anchor set generation, specifically by constructing the context temporal semantic network, taking all nodes in the context temporal semantic network as a candidate term set, calculating the corresponding time decay structure contribution data for each candidate term, and obtaining the semantic anchor set through dynamic threshold filtering and structure contribution sorting;

[0079] Preferably, the dynamic threshold filtering adopts a quantile-based dynamic threshold filtering method to calculate the mean and standard deviation of the time-related decay structure contribution of all candidate term nodes, and to calculate the dynamic threshold based on the sum of half of the mean and standard deviation.

[0080] By performing the above operations, this solution addresses the technical problems of existing dynamic semantic anchor generation methods, which rely too heavily on word frequency or static keyword libraries for anchor selection, making it difficult to distinguish between important and ordinary terms, and ignoring the dynamic contribution of terms at different times. This solution creatively adopts a dynamic anchor extraction method based on semantic network structure contribution calculation and time decay to generate dynamic semantic anchors, achieving accurate coverage of the core semantics by the anchor set. Specifically, the structural contribution formula comprehensively considers node degree, semantic similarity, and relationship strength, and introduces a time decay factor to correct historical frequency of occurrence, allowing recently high-value terms to stand out while automatically weakening noisy terms that have not appeared for a long time.

[0081] Specifically, for example, in technical document analysis, "data" and "model" can be selected as semantic anchors due to their high connectivity and recent frequent occurrence, while "one-off test" can be automatically removed because it is old and has no important relational edges, thus improving the accuracy and timeliness of the anchor set.

[0082] Example 5, see Figure 1 , Figure 3 This embodiment is based on the above embodiment. In step S4, the semantic field strength quantification modeling is used to quantify the influence of each semantic anchor point in the context based on the concept of physical field strength. It comprehensively evaluates the timeliness, sentiment weight, and knowledge credibility through a three-dimensional semantic field model. Specifically, based on the enhanced dataset configured by the prompt words and the set of semantic anchor points, a semantic field strength quantification model that integrates multi-dimensional attenuation weighting and credibility improvement is used to perform semantic field strength quantification modeling, obtaining semantic field quantification modeling data. This includes the following steps:

[0083] Step S41: Initialize the three-dimensional semantic field strength vector, specifically by defining the initial structure of the three-dimensional semantic field model to obtain the three-dimensional semantic field initialization vector; the initial structure includes a timeliness intensity component, an emotion intensity component, and a credibility intensity component;

[0084] The formula for calculating the initialization vector of the three-dimensional semantic field is as follows:

[0085] ;

[0086] In the formula, It is the initialization vector of the three-dimensional semantic field, a i It is an anchor point in the set of semantic anchor points corresponding to the i-th node, a i The whole is an anchor index, F t It is the time-dependent intensity component, F s It is the emotional intensity component, F c It is a confidence strength component;

[0087] Step S42: Construction of timeliness intensity component, specifically by performing exponential time decay calculation based on the time distance between the occurrence times of terms in the semantic anchor set in the historical context, to construct the timeliness intensity component;

[0088] The formula for calculating the time-related intensity component is as follows:

[0089] ;

[0090] In the formula, N i It is the ath i The total number of times the term corresponding to each anchor point appears in the context, where k is the term occurrence index. It is the time-degradation factor. It is the time difference between the time of the kth occurrence and the current time.

[0091] Step S43: Construction of sentiment intensity component, specifically, by using a pre-trained sentiment analysis model, performing sentiment polarity analysis based on the optimized text data corresponding to the semantic anchor set, calculating the sentiment intensity value based on the probability distribution entropy output by the pre-trained sentiment analysis model, performing separate calculations of sentiment polarity and intensity, and constructing the sentiment intensity component by merging the sentiment polarity and the sentiment intensity.

[0092] The separation calculation of emotional polarity and intensity is performed to optimize the distinguishability of emotional polarity details. The calculation formula for the emotional intensity component is as follows:

[0093] ;

[0094] In the formula, Polarity is the sentiment polarity value, which is obtained through analysis by a pre-trained sentiment analysis model, and Intensity is the sentiment intensity.

[0095] Preferably, Table 1 is an example table of model parameters for the pre-trained sentiment analysis model. The pre-trained sentiment analysis model specifically adopts the SKEP (Sentiment Knowledge Enhanced Pre-training) model. In specific implementation, the skep_ernie_1.0_large_ch model disclosed by the PaddleNLP platform can be used. This model has been fine-tuned on the Chinese sentiment classification task and can output multiple sentiment polarity probability distributions for information entropy calculation and sentiment intensity component construction.

[0096] Table 1. Example of model parameters for pre-trained sentiment analysis models.

[0097]

[0098] The formula for calculating the intensity of the emotion is:

[0099] ;

[0100] In the formula, H is the information entropy function, ProbDist is the probability distribution entropy output by the pre-trained sentiment analysis model, and NumClasses is the total number of sentiment categories.

[0101] Step S44: Construction of credibility improvement intensity component, specifically, constructing a fixed scoring table for data sources, optimizing the credibility rating of the basic source of text data, and constructing credibility improvement intensity component by constructing a time span weighted correction method based on the credibility of the basic source, thus obtaining credibility intensity component;

[0102] The formula for calculating the credibility strength component is as follows:

[0103] ;

[0104] In the formula, M is the total number of sources of anchor terms in the semantic relation structure data, m is the source index of the anchor terms, Source is the source basic credibility function, which is specifically defined through the data source fixed scoring table, and e m It is the ath i The source of the term corresponding to each anchor point, Credibility is a credibility mapping function constructed based on the time span weighted correction method of the credibility of the underlying source;

[0105] Preferably, Table 2 is a reference example table for the fixed score of the data source. As shown in the table, the basic source category and credibility value of the optimized text data are manually evaluated and assigned.

[0106] Table 2: Reference Example Table of Data Sources for Fixed Scores

[0107]

[0108] The calculation formula for constructing the credibility improvement intensity component using the time-span weighted correction method based on the credibility of the underlying source is as follows:

[0109] ;

[0110] In the formula, This is the credibility decay coefficient, used to adjust the effect of time decay on the overall credibility. Its value range is set to [0,1]. It is a time scale parameter used to control the rate of decay over time. Age is the time scale parameter used to control the rate of decay over time. i The time span between the source of the term corresponding to each anchor point and the current moment;

[0111] Step S45: Comprehensive field strength calculation, specifically, by constructing the timeliness intensity component, the emotion intensity component, and the credibility improvement intensity component, a comprehensive semantic field strength calculation is performed to obtain comprehensive semantic field strength data;

[0112] The formula for calculating the comprehensive semantic field strength data is as follows:

[0113] ;

[0114] In the formula, FieldStrength is the comprehensive semantic field strength data. Overall, it is an emotion enhancement factor, which is used to numerically amplify the field strength of the emotion intensity component regardless of whether the emotion polarity is positive or negative. Sign is a sign function, which is used to preserve the polarity information of the emotion.

[0115] Step S46: Semantic field strength quantization modeling, specifically, based on the comprehensive semantic field strength data, semantic field quantization modeling is performed to obtain semantic field quantization modeling data;

[0116] The semantic field quantization modeling data is in the form of a list of triples, including semantic anchors, three-dimensional field strength vectors, and comprehensive field strength values;

[0117] The semantic anchor point specifically refers to the semantic anchor point of the corresponding node in the semantic anchor point set; the three-dimensional field strength vector specifically refers to the timeliness intensity component, the sentiment intensity component, and the credibility intensity component; the comprehensive field strength value specifically refers to the comprehensive semantic field strength data.

[0118] By performing the above operations, this solution addresses the technical problem in existing semantic modeling methods that suffer from distortion or deviation in prompt word configuration results in complex scenarios due to the single-dimensional evaluation of semantic weights and the lack of comprehensive consideration of multi-dimensional factors such as sentiment polarity and knowledge credibility. This solution creatively adopts a semantic field strength quantification model that integrates multi-dimensional attenuation weighting and credibility improvement to perform semantic field strength quantification modeling, achieving a comprehensive evaluation of timeliness, sentiment weight, and knowledge credibility. This method uses a three-dimensional field strength vector and a comprehensive field strength formula for quantification modeling, ensuring that prompt words not only reflect semantic strength but also sentiment orientation and source credibility.

[0119] Specifically, for example, in a medical consultation scenario, the anchor point "diagnosis" is amplified because it comes from authoritative guidelines (high credibility) and carries negative emotions (such as "serious"), thus giving it priority in the prompt word configuration scheme and improving the matching degree of the prompt word logic configuration with the user's true intention.

[0120] Example 6, see Figure 1 and Figure 2 This embodiment is based on the above embodiment. In step S5, the prompt word logic configuration is used to generate the final prompt word configuration scheme. Specifically, based on the semantic field quantization modeling data and the semantic anchor point set, the semantic anchor points in the semantic field quantization modeling data are prioritized according to the comprehensive field strength value. Based on the semantic relationship between the semantic anchor points and the corresponding three-dimensional field strength vector, a prompt word logical dependency relationship is established. High-priority semantic anchor points are used as core prompt word nodes, and low-priority semantic anchor points are used as supplementary prompt word nodes. The time-weighted algorithm is combined with the timeliness intensity component to output a prompt word configuration scheme that includes a prompt word sequence, a prompt word logical dependency relationship, and a prompt word priority weight.

[0121] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, 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 process, method, article, or apparatus.

[0122] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention.

[0123] The present invention and its embodiments have been described above. This description is not restrictive, and the accompanying drawings are only one embodiment of the present invention; the actual structure is not limited thereto. In conclusion, if those skilled in the art are inspired by this description and design similar structures and embodiments without departing from the spirit of the invention, such designs should fall within the protection scope of the present invention.

Claims

1. A method for configuring prompt word logic based on contextual semantic enhancement, characterized in that: The method includes the following steps: Step S1: Data acquisition, perform multi-dimensional data acquisition to obtain the original data set; Step S2: Data preprocessing, the original dataset is sequentially cleaned, context aligned and semantically labeled to obtain the prompt word configuration enhancement dataset; Step S3: Dynamic semantic anchor generation. Based on the enhanced dataset configured by the prompt words, a dynamic anchor extraction method based on semantic network structure contribution calculation and time decay is used to generate dynamic semantic anchors and obtain a set of semantic anchors. This includes the following steps: temporal semantic network construction; structural contribution modeling; structural contribution time decay calculation; and semantic anchor set generation. Step S4: Semantic field strength quantization modeling. Based on the enhanced dataset configured by the prompt words and the set of semantic anchors, a semantic field strength quantization model that integrates multi-dimensional attenuation weighting and credibility improvement is used to perform semantic field strength quantization modeling to obtain semantic field strength quantization modeling data. This includes the following steps: initialization of three-dimensional semantic field strength vector; construction of timeliness intensity component; construction of sentiment intensity component; construction of credibility-improved intensity component; comprehensive field strength calculation; semantic field strength quantization modeling. Step S5: Prompt word logic configuration. Based on the semantic field quantization modeling data and the semantic anchor point set, output a prompt word configuration scheme including prompt word sequence, prompt word logical dependency relationship and prompt word priority weight.

2. The method for configuring prompt word logic based on contextual semantic enhancement according to claim 1, characterized in that: In step S1, the original data set specifically includes user input text data, contextual history data, and text semantic tags; The multidimensional data collection specifically includes user interaction data collection, corpus data collection, and tag data collection.

3. The prompt word logic configuration method based on contextual semantic enhancement according to claim 2, characterized in that: In step S2, the data preprocessing is used to clean and unify the original data format. Specifically, the original data set is subjected to data cleaning, context alignment and semantic annotation in sequence to obtain the prompt word configuration enhancement dataset. The enhanced dataset for prompt word configuration specifically includes optimized text data, entity term annotation data, and semantic relationship structure data.

4. The prompt word logic configuration method based on contextual semantic enhancement according to claim 3, characterized in that: In step S3, the dynamic semantic anchor generation is used to extract keywords or phrases that can represent the core meaning. Specifically, based on the enhanced dataset configured by the prompt words, a dynamic anchor extraction method based on semantic network structure contribution calculation and time decay is used to generate dynamic semantic anchors, resulting in a set of semantic anchors. This includes the following steps: Step S31: Temporal semantic network construction, specifically, based on the entity term annotation data and semantic relationship structure data in the enhanced dataset of the prompt words, a contextual temporal semantic network is constructed through node modeling, edge modeling and node attribute definition; Step S32: Structural contribution modeling, specifically by constructing a basic structural contribution calculation equation, calculating the structural contribution of each candidate term corresponding to each node, and obtaining basic structural contribution data; Step S33: Calculation of structural contribution attenuation over time. Specifically, based on the timestamp list in the node attributes, the candidate terms corresponding to each node are modeled with an attenuation coefficient, and the attenuation coefficient model is introduced to improve the calculation of the basic calculation equation of structural contribution, so as to obtain the attenuation structural contribution data. Step S34: Semantic anchor set generation, specifically by constructing the context temporal semantic network, taking all nodes in the context temporal semantic network as a candidate term set, calculating the corresponding time decay structure contribution data for each candidate term, and obtaining the semantic anchor set through dynamic threshold filtering and structure contribution sorting.

5. The prompt word logic configuration method based on contextual semantic enhancement according to claim 4, characterized in that: In step S31, the node modeling specifically involves defining each labeled entity term as a node; The edge modeling specifically refers to defining the relationship between two arbitrary terms defined in the semantic relation structure data as an edge. The node attribute definition specifically involves attaching a list of timestamps to each node to record all occurrences of the term in the context history.

6. The prompt word logic configuration method based on contextual semantic enhancement according to claim 5, characterized in that: In step S4, the semantic field strength quantification modeling is used to quantify the influence of each semantic anchor point in the context based on the concept of physical field strength. The timeliness, sentiment weight, and knowledge credibility are comprehensively evaluated through a three-dimensional semantic field model. Specifically, this includes the following steps: Step S41: Initialize the three-dimensional semantic field strength vector, specifically by defining the initial structure of the three-dimensional semantic field model to obtain the three-dimensional semantic field initialization vector; the initial structure includes a timeliness intensity component, an emotion intensity component, and a credibility intensity component; Step S42: Construction of timeliness intensity component, specifically by performing exponential time decay calculation based on the time distance between the occurrence times of terms in the semantic anchor set in the historical context, to construct the timeliness intensity component; Step S43: Construction of sentiment intensity component, specifically, by using a pre-trained sentiment analysis model, performing sentiment polarity analysis based on the optimized text data corresponding to the semantic anchor set, calculating the sentiment intensity value based on the probability distribution entropy output by the pre-trained sentiment analysis model, performing separate calculations of sentiment polarity and intensity, and constructing the sentiment intensity component by merging the sentiment polarity and the sentiment intensity. Step S44: Construction of credibility improvement intensity component, specifically, constructing a fixed scoring table for data sources, optimizing the credibility rating of the basic source of text data, and constructing credibility improvement intensity component by constructing a time span weighted correction method based on the credibility of the basic source, thus obtaining credibility intensity component; Step S45: Comprehensive field strength calculation, specifically, by constructing the timeliness intensity component, the emotion intensity component, and the credibility improvement intensity component, a comprehensive semantic field strength calculation is performed to obtain comprehensive semantic field strength data; Step S46: Semantic field strength quantization modeling, specifically, based on the comprehensive semantic field strength data, semantic field quantization modeling is performed to obtain semantic field quantization modeling data.

7. The prompt word logic configuration method based on contextual semantic enhancement according to claim 6, characterized in that: In step S46, the semantic field quantization modeling data is in the form of a list of triples, including semantic anchors, three-dimensional field strength vectors, and comprehensive field strength values; the semantic anchors specifically refer to the semantic anchors of the corresponding nodes in the semantic anchor set; the three-dimensional field strength vectors specifically refer to the timeliness intensity component, the sentiment intensity component, and the credibility intensity component; the comprehensive field strength value specifically refers to the comprehensive semantic field strength data.

8. The prompt word logic configuration method based on contextual semantic enhancement according to claim 7, characterized in that: In step S5, the prompt word logic configuration is used to generate the final prompt word configuration scheme. Specifically, based on the semantic field quantization modeling data and the semantic anchor point set, the semantic anchor points in the semantic field quantization modeling data are prioritized according to their comprehensive field strength values. Based on the semantic relationships between the semantic anchor points and their corresponding three-dimensional field strength vectors, a prompt word logical dependency relationship is established. High-priority semantic anchor points are used as core prompt word nodes, and low-priority semantic anchor points are used as supplementary prompt word nodes. The scheme is then combined with the timeliness intensity component for time weighting, and outputs a prompt word configuration scheme that includes a prompt word sequence, a prompt word logical dependency relationship, and a prompt word priority weight.

Citation Information

Patent Citations

  • Intelligent operation and maintenance report generation system based on hybrid expert language model

    CN118709677A

  • Prompt word optimization method in combination with expert evaluation rule and large language model

    CN118886427A