A dual-path text semantic matching method based on deep semantic modeling and knowledge enhancement
By employing a dual-path text semantic matching method that combines deep semantic modeling and knowledge enhancement, and utilizing RoBERTa and HowNet technologies, this method addresses the issues of insufficient semantic understanding and lack of domain knowledge in traditional methods. It achieves high-precision data transaction matching and is adaptable to complex scenarios involving different types of text.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- LIAONING UNIVERSITY
- Filing Date
- 2026-04-01
- Publication Date
- 2026-06-19
AI Technical Summary
Traditional data transaction matching methods struggle to effectively handle complex semantic relationships and diverse expressions, resulting in limited matching accuracy and an inability to meet the demands of high-standard intelligent services.
We adopt a dual-path text semantic matching method based on deep semantic modeling and knowledge enhancement. We extract basic semantic features through the RoBERTa model, perform deep semantic interaction through the Siamese Bi-GRU network, combine the HowNet knowledge base for concept mapping and semantic expansion, use the self-attention mechanism to aggregate semantic primitive information, and realize text feature interaction through the cross-attention mechanism. Finally, we generate matching results through dynamic feature fusion.
It significantly improves the accuracy and robustness of semantic matching between demand and resource texts in data transaction scenarios, solves the problems of insufficient semantic understanding and lack of domain knowledge in traditional methods, achieves disambiguation of professional terms and processing of complex context dependencies, and has broad adaptability and high accuracy.
Smart Images

Figure CN122242522A_ABST
Abstract
Description
Technical Field
[0001] This patent belongs to the field of text matching algorithm technology, specifically involving a dual-path text semantic matching method based on deep semantic modeling and knowledge enhancement. Background Technology
[0002] With the booming development of the data element market, the types and scale of data resources have exploded. How to efficiently and accurately match user needs with massive data resources has become a key challenge in activating data value and driving market efficiency. Traditional data transaction matching methods mostly rely on keyword matching or shallow semantic similarity calculations, which are insufficient to handle the complex semantic relationships and flexible expressions between user needs descriptions and data resource descriptions. These methods generally suffer from insufficient understanding of deep textual semantics and inadequate utilization of domain knowledge. In particular, they cannot effectively handle complex situations such as disambiguation of technical terms, contextual dependencies, and implicit semantic relationships, resulting in limited matching accuracy and difficulty in meeting the high standards of intelligent service requirements.
[0003] Therefore, there is an urgent need for a text matching method that can deeply integrate deep semantic understanding with external domain knowledge and possess accurate semantic disambiguation and interactive capabilities to improve the resource allocation efficiency of the data element market. In this patent, we propose a dual-path text semantic matching method based on deep semantic modeling and knowledge enhancement. Through deep contextual semantic modeling, fine-grained knowledge enhancement, and dynamic feature fusion, this method effectively addresses the core pain points of traditional technologies, such as insufficient depth of semantic understanding and inadequate utilization of domain knowledge. In actual data trading platform matching task verification, this method outperforms existing methods in matching accuracy, demonstrating significant application value and promising prospects for wider application. Summary of the Invention
[0004] The purpose of this invention is to provide a dual-path text semantic matching method based on deep semantic modeling and knowledge enhancement, which improves the structure of traditional text matching models and enhances matching performance.
[0005] To achieve the above objectives, the technical solution adopted in this invention is: a dual-path text semantic matching method based on deep semantic modeling and knowledge enhancement, the steps of which are as follows: 1) Use RoBERTa to encode the requirement text and resource text to obtain basic semantic features.
[0006] First, a RoBERTa pre-trained model is used as the initial encoder for the text to perform preliminary feature extraction on the input text sequence. The original requirement text is then processed. and resource text Add the [CLS] marker at the beginning of each sentence and the [SEP] separator at the end of each sentence to form the input sequence.
[0007]
[0008] Then, the two input sequences and The input sequences are fed into the RoBERTa pre-trained model. This model is based on a multi-layer Transformer encoder structure, which captures long-range dependencies between words within a sequence through a self-attention mechanism and gradually extracts deep semantic features using multi-layer nonlinear transformations. The RoBERTa model processes the input sequences... and The specific encoding process is as follows:
[0009] in , This is the output matrix corresponding to the hidden states of the last layer of the RoBERTa pre-trained model. Each vector in the matrix... These represent the feature vectors of the i-th and j-th characters in the demand text and resource text, respectively.
[0010] 2) Deep semantic interaction is achieved through a Siamese Bi-GRU network, and optimized deep context feature vectors are generated.
[0011] Each GRU unit completes state updates through the reset gate, update gate, and candidate hidden states in a coordinated manner.
[0012]
[0013] in To reset the door, To update the door, The input at time t, This is the hidden state from the previous moment. The sigmoid activation function is used, and ⊙ represents element-wise multiplication. The sequence is encoded using both forward GRU and backward GRU.
[0014]
[0015] in, Output the hidden state to the forward layer that requires it. The hidden state is output from the backward layer of the requirement. The hidden state vectors of the forward and backward layers are concatenated to obtain the requirement text. The entire sequence representation after Bi-GRU encoding.
[0016]
[0017] Similarly, for resource text sequences Perform the same operation to obtain its sequence representation. Finally, respectively... and Average pooling is performed to obtain sentence-level deep semantic representation vectors of the demand text and the resource text. and .
[0018]
[0019] 3) Use HowNet for concept mapping and semantic expansion to obtain the semantic primitive information of each word.
[0020] To overcome the shortcomings of pre-trained models in understanding semantic knowledge and polysemy in specific domains, a parallel fine-grained knowledge enhancement path is introduced. By utilizing the external knowledge base HowNet, rich linguistic knowledge is injected into each word through concept mapping and semantic expansion, constructing a semantic representation with interpretability and discriminativeness.
[0021] Step 3.1) Perform data cleaning and word segmentation on the requirement text P and resource text Q; First, the requirement text P and resource text Q are cleaned and segmented. Specifically, the Jieba word segmentation tool is used to divide the sentences into independent word sequences. For each word obtained after segmentation... First, a pre-trained Word2Vec model is used to convert it into static word vectors. ,in This represents the dimension of the word vectors. Next, the word vector sequence... The input is encoded in a bidirectional GRU network. For each word... The forward and backward hidden states are concatenated to obtain its context-aware representation. ,vector This will serve as the basis for subsequent word representation updates.
[0022] Step 3.2) HowNet semantic primitive extraction and self-attention aggregation
[0023] For each word Query the HowNet knowledge base and obtain a list of all its definitions, denoted as . For each meaning Its original meaning is as follows: Each primitive is mapped to a dense vector representation. ,in The dimension of semantic embedding.
[0024] However, the contributions of multiple semantic primitives within a single sense term to its semantic meaning are not equal. To adaptively aggregate this semantic primitive information, this paper introduces a self-attention mechanism. This mechanism focuses on key semantic primitives by calculating the attention weight of each semantic primitive, thereby constructing a more discriminative sense term representation. The formula for calculating the semantic primitive attention weight is as follows:
[0025] in, This represents the attention weight of the m-th primitive. For the meaning The total number of Shimogihara, Let m be the embedding vector of the m-th primitive. The weight matrix is a learnable matrix. This is a learnable attention vector.
[0026] After obtaining the attention weights of each semantic primitive, sense terms are constructed based on a weighted summation method. The initial representation is calculated as follows:
[0027] 4) A self-attention mechanism is used to aggregate semantic primitive information to form the initial meaning representation of the word; on this basis, contextual information is further integrated, and the word representation is updated sequentially to obtain the enhanced word feature representation.
[0028] Meaning initial representation The general knowledge derived from HowNet has not yet been integrated with the specific context of the current text. Therefore, based on the obtained semantic representations, this paper further introduces contextual information and uses an attention mechanism to dynamically select the semantic combination that best fits the current context, thereby achieving contextualized updates of word representations.
[0029] The core idea is that each word may correspond to multiple meanings, and different meanings have different relevance in different contexts. By using the context word vector as a query, all meanings of the target word are weighted and aggregated, enabling the final word representation to adaptively highlight the semantics that match the context. Context-aware word representation update specifically includes three steps: First, using the target word... context word set Based on this, the average representation of the context word vectors is calculated as the query vector. Secondly, Each meaning of the target word represents Matching is performed, and the weight of each sense is calculated using an attention mechanism. Finally, the senses are weighted and summed according to their weights to obtain a word representation that incorporates contextual information. .
[0030] First, calculate the average representation of the context words as the attention query vector. .
[0031]
[0032] Among them, words The set of context words is ,definition The set consists of L words centered at the center and drawn to the left and right, respectively, where L is the preset size of the context window. (Words) The corresponding context-aware word vectors are .
[0033] For words For each sense, calculate its relationship with the context query vector. The degree of matching is used to obtain its attention weight.
[0034]
[0035] The representations of all senses are summed by weighting them according to their attention weights to obtain the word representations selected by context.
[0036]
[0037] Among them, in the formula Representative words The final word representation after context updating; It is the attention weight of the k-th sense. It is the initial representation of the k-th sense.
[0038] Through the above mechanism, the weight of semantic items can be dynamically adjusted according to the context, so that word representation not only retains the rich semantic information in the knowledge base, but also incorporates the contextual constraints of the current text, thereby obtaining a more accurate semantic representation.
[0039] 5) The interaction between two text features is achieved through a cross-attention mechanism to generate an optimized knowledge feature vector.
[0040] After obtaining the updated representation of each word, a cross-attention mechanism is introduced to achieve semantic alignment and interaction between the requirement text and the resource text. Let the word representation sequence of the requirement text be... Word representation sequence of resource text First, the two sequences are mapped to query, key, and value matrices respectively through linear transformation.
[0041] For text P:
[0042] For text Q:
[0043] in, This is a learnable parameter matrix. Subsequently, queries based on the demand text are performed. Key to resource text Sum Perform cross-attention calculation to obtain the attention output of the demand text relative to the resource text. .
[0044]
[0045] in, is the dimension of the key vector. This operation enables each word in the demand text to focus on semantically relevant words in the resource text, thereby capturing alignment information across texts. To preserve the original semantics and fuse interaction features, the original representation is... With cross-attention output Perform a residual join to obtain the updated requirement text representation. .
[0046]
[0047] This operation enables each word in the requirement text to focus on semantically related words in the resource text, thereby generating an interactive representation containing alignment information. Then, we concatenate the original representation and the cross representation to obtain the final representation. Similarly, we obtain the word representation of the resource text.
[0048] Similarly, queries based on resource text Key to the demand text and By performing cross-attention calculations, the updated representation of the resource text can be obtained. Finally, average pooling is performed on the two updated text sequences to obtain sentence-level fine-grained knowledge feature vectors. and These correspond to the knowledge-enhanced representations of the requirement text and the resource text, respectively.
[0049] 6) A dynamic feature fusion mechanism is proposed, which can adjust the weights between the semantic path and the knowledge path according to the input text features and adaptively weightedly fuse the feature vectors of the two paths.
[0050] To adaptively fuse features extracted from the two paths, a dynamic gating mechanism is introduced. This addresses the text representation requirements of the deep context semantic path output. and resource text representation And the need for text representation of fine-grained knowledge enhancement path output. and resource text representation Calculate the weights of the two paths respectively.
[0051]
[0052] in, 、 For learnable weight matrix, 、 For bias terms, For the sigmoid activation function and weights and This reflects the importance of deep semantic paths and knowledge enhancement paths under the current input.
[0053] Based on the calculated weights, the feature vectors of the two paths are weighted and fused to obtain the final demand text representation and resource text representation.
[0054]
[0055] in, This represents the fused feature vector of the required text. Represents the fused resource text feature vector
[0056] Subsequently, in order to obtain the deep semantic relationship between text pairs, a multi-dimensional interactive feature vector was further constructed.
[0057]
[0058] in, This represents vector concatenation. Represents the absolute value of the difference between feature vectors, capturing the difference information. This indicates that the feature vectors are multiplied element by element to capture interactive information.
[0059] 7) Input the fused features into the classifier, output a binary classification result of 0 / 1, and determine whether the two texts match.
[0060] The interaction features are input into a multilayer perceptron classifier to calculate the matching degree.
[0061]
[0062] in 、 The classifier weight matrix is... 、 ReLU is the bias term, and ReLU is the activation function. This represents the final matching probability.
[0063] The beneficial effects of this invention are as follows: This invention can significantly improve the accuracy and robustness of semantic matching between demand and resource texts in data trading scenarios, effectively solving the problems of mismatch and missed matching caused by superficial semantic understanding and lack of domain knowledge in traditional methods; this invention achieves complementarity and enhancement between general semantic representation and domain knowledge representation by constructing a dual-path fusion architecture of deep contextual semantic modeling and fine-grained knowledge enhancement, effectively addressing challenges such as professional terminology disambiguation and complex contextual dependencies; the dynamic feature fusion mechanism proposed in this invention can adaptively adjust the contribution weights of semantic paths and knowledge paths, enabling the model to have broad adaptability to different types of text; this method demonstrates excellent matching performance in real data trading platform applications, providing more accurate and reliable intelligent matching services for the data element market. Attached Figure Description
[0064] Figure 1 This is a flowchart of the RPK-Match text matching algorithm of the present invention; Figure 2 This is the overall architecture diagram of the RPK-Match model; Figure 3 It is a word meaning update model diagram; Figure 4 This is a comparison chart of experimental results for different recommendation models; Figure 5 This is a comparison chart of the ablation experiment results for each sub-module. Detailed Implementation
[0065] The specific embodiments of the present invention will now be described in detail with reference to examples and accompanying drawings.
[0066] This invention provides a dual-path text semantic matching method based on deep semantic modeling and knowledge enhancement. The flowchart of the RPK-Match text matching algorithm of this invention is shown below. Figure 1 As shown, it includes the following steps: (1) Training process: The dual-path text matching model based on deep semantic modeling and knowledge enhancement mainly consists of three parts: two core paths, deep contextual semantic modeling and fine-grained knowledge enhancement, and a dynamic feature fusion module.
[0067] First, in the deep contextual semantic modeling path, the RoBERTa pre-trained model is used to encode the demand text and resource text to extract basic semantic features. Then, a bidirectional gated recurrent unit network with a Siamese structure is introduced to perform deep semantic interaction modeling and generate optimized deep contextual feature vectors.
[0068] Simultaneously, in the fine-grained knowledge enhancement path, the HowNet knowledge base is used to perform concept mapping and semantic expansion on text vocabulary, obtaining the semantic primitive information of each word. A self-attention mechanism is used to aggregate the semantic primitive information, and a context-aware update mechanism is designed to dynamically adjust the semantic weights using context information to update the word representation. Finally, a cross-attention mechanism is used to realize the interaction of features between two texts, generating a knowledge feature vector.
[0069] A dynamic feature fusion mechanism is designed to dynamically adjust the weights of semantic and knowledge paths based on input features. Multi-dimensional interaction features are constructed and input into an MLP for matching degree calculation, outputting the matching result. The overall architecture of the proposed DSK-Match model is as follows: Figure 2 As shown.
[0070] First, a RoBERTa pre-trained model is used as the initial encoder for the text to perform preliminary feature extraction on the input text sequence. The original requirement text is then processed. and resource text Add the [CLS] marker at the beginning of each sentence and the [SEP] separator at the end of each sentence to form the input sequence.
[0071]
[0072] Then, the two input sequences and The input sequences are fed into the RoBERTa pre-trained model. This model is based on a multi-layer Transformer encoder structure, which captures long-range dependencies between words within a sequence through a self-attention mechanism and gradually extracts deep semantic features using multi-layer nonlinear transformations. The RoBERTa model processes the input sequences... and The encoding process:
[0073] in , This is the output matrix corresponding to the hidden states of the last layer of the RoBERTa pre-trained model. Each vector in the matrix... These represent the feature vectors of the i-th and j-th characters in the demand text and resource text, respectively.
[0074] The output of the RoBERTa encoder and Each parameter-shared Siamese bidirectional gated recurrent unit network is input to perform deep semantic interaction and modeling, generating optimized deep context feature vectors.
[0075] Each GRU unit completes state updates through the coordination of reset gates, update gates, and candidate hidden states.
[0076]
[0077] in To reset the door, To update the door, The input at time t, This is the hidden state from the previous moment. The sigmoid activation function is used, and ⊙ represents element-wise multiplication. The sequence is encoded using both forward GRU and backward GRU.
[0078]
[0079] in, Output the hidden state to the forward layer that requires it. The hidden state is output from the backward layer of the requirement. The hidden state vectors of the forward and backward layers are concatenated to obtain the requirement text. The entire sequence representation after Bi-GRU encoding.
[0080]
[0081] Similarly, for resource text sequences Perform the same operation to obtain its sequence representation. Finally, respectively... and Average pooling is performed to obtain sentence-level deep semantic representation vectors of the demand text and the resource text. and .
[0082]
[0083] To overcome the shortcomings of pre-trained models in understanding semantic knowledge and polysemy in specific domains, a parallel fine-grained knowledge enhancement path is introduced. By utilizing the external knowledge base HowNet, rich linguistic knowledge is injected into each word through concept mapping and semantic expansion, constructing a semantic representation with interpretability and discriminativeness.
[0084] First, the requirement text P and resource text Q are cleaned and segmented. Specifically, the Jieba word segmentation tool is used to divide the sentences into independent word sequences. For each word obtained after segmentation... First, a pre-trained Word2Vec model is used to convert it into static word vectors. ,in This represents the dimension of the word vectors. Next, the word vector sequence... The input is encoded in a bidirectional GRU network. For each word... The forward and backward hidden states are concatenated to obtain its context-aware representation. ,vector This will serve as the basis for subsequent word representation updates.
[0085] For each word Query the HowNet knowledge base and obtain a list of all its definitions, denoted as . For each meaning Its original meaning is as follows: Each primitive is mapped to a dense vector representation. ,in The dimension of semantic embedding.
[0086] However, the contributions of multiple semantic primitives within a single sense term to its semantic meaning are not equal. To adaptively aggregate this semantic primitive information, this paper introduces a self-attention mechanism. This mechanism focuses on key semantic primitives by calculating the attention weight of each semantic primitive, thereby constructing a more discriminative sense term representation. The formula for calculating the semantic primitive attention weight is as follows:
[0087] in, This represents the attention weight of the m-th primitive. For the meaning The total number of Shimogihara, Let m be the embedding vector of the m-th primitive. The weight matrix is a learnable matrix. This is a learnable attention vector.
[0088] After obtaining the attention weights of each semantic primitive, sense terms are constructed based on a weighted summation method. The initial representation is calculated using the following formula:
[0089] Meaning initial representation The general knowledge derived from HowNet has not yet been integrated with the specific context of the current text. Therefore, based on the obtained semantic representations, this paper further introduces contextual information and dynamically selects the semantic combination that best fits the current context through an attention mechanism to achieve contextualized updates of word representations. The working process is as follows: Figure 3 As shown.
[0090] The core idea is that each word may correspond to multiple meanings, and different meanings have different relevance in different contexts. By using the context word vector as a query, all meanings of the target word are weighted and aggregated, enabling the final word representation to adaptively highlight the semantics that match the context. Context-aware word representation update specifically includes three steps: First, using the target word... context word set Based on this, the average representation of the context word vectors is calculated as the query vector. Secondly, Each meaning of the target word represents Matching is performed, and the weight of each sense is calculated using an attention mechanism. Finally, the senses are weighted and summed according to their weights to obtain a word representation that incorporates contextual information. .
[0091] First, calculate the average representation of the context words as the attention query vector. .
[0092]
[0093] Among them, words The set of context words is ,definition The set consists of L words centered at the center and drawn to the left and right, respectively, where L is the preset size of the context window. (Words) The corresponding context-aware word vectors are .
[0094] For words For each sense, calculate its relationship with the context query vector. The degree of matching is used to obtain its attention weight.
[0095]
[0096] The representations of all senses are summed by weighting them according to their attention weights to obtain the word representations selected by context.
[0097]
[0098] Among them, in the formula Representative words The final word representation after context updating; It is the attention weight of the k-th sense. It is the initial representation of the k-th sense.
[0099] Through the above mechanism, the weight of semantic items can be dynamically adjusted according to the context, so that word representation not only retains the rich semantic information in the knowledge base, but also incorporates the contextual constraints of the current text, thereby obtaining a more accurate semantic representation.
[0100] After obtaining the updated representation of each word, a cross-attention mechanism is introduced to achieve semantic alignment and interaction between the requirement text and the resource text. Let the word representation sequence of the requirement text be... Word representation sequence of resource text First, the two sequences are mapped to query, key, and value matrices respectively through linear transformation.
[0101] For text P:
[0102] For text Q:
[0103] in, This is a learnable parameter matrix. Subsequently, queries based on the demand text are performed. Key to resource text Sum Perform cross-attention calculation to obtain the attention output of the demand text relative to the resource text. .
[0104]
[0105] in, is the dimension of the key vector. This operation enables each word in the demand text to focus on semantically relevant words in the resource text, thereby capturing alignment information across texts. To preserve the original semantics and fuse interaction features, the original representation is... With cross-attention output Perform a residual join to obtain the updated requirement text representation. .
[0106]
[0107] This operation enables each word in the requirement text to focus on semantically related words in the resource text, thereby generating an interactive representation containing alignment information. Then, we concatenate the original representation and the cross representation to obtain the final representation. Similarly, we obtain the word representation of the resource text.
[0108] Similarly, queries based on resource text Key to the demand text and By performing cross-attention calculations, the updated representation of the resource text can be obtained. Finally, average pooling is performed on the two updated text sequences to obtain sentence-level fine-grained knowledge feature vectors. and These correspond to the knowledge-enhanced representations of the requirement text and the resource text, respectively.
[0109] To adaptively fuse features extracted from the two paths, a dynamic gating mechanism is introduced. This addresses the text representation requirements of the deep context semantic path output. and resource text representation And the need for text representation of fine-grained knowledge enhancement path output. and resource text representation Calculate the weights of the two paths respectively.
[0110]
[0111] in, 、 For learnable weight matrix, 、 For bias terms, For the sigmoid activation function and weights and This reflects the importance of deep semantic paths and knowledge enhancement paths under the current input.
[0112] Based on the calculated weights, the feature vectors of the two paths are weighted and fused to obtain the final demand text representation and resource text representation.
[0113]
[0114] in, This represents the fused feature vector of the required text. Represents the fused resource text feature vector
[0115] Subsequently, in order to obtain the deep semantic relationship between text pairs, a multi-dimensional interactive feature vector was further constructed.
[0116]
[0117] in, This represents vector concatenation. Represents the absolute value of the difference between feature vectors, capturing the difference information. This indicates that the feature vectors are multiplied element by element to capture interactive information.
[0118] The interaction features are input into a multilayer perceptron classifier to calculate the matching degree.
[0119]
[0120] in 、 The classifier weight matrix is... 、 ReLU is the bias term, and ReLU is the activation function. This represents the final matching probability.
[0121] (2) Verification process
[0122] During the model validation phase, the predicted output is compared with the real labeled data using the matching result generation module, and the model parameters are optimized and adjusted based on the experimental results. Comparative and ablation experiments are conducted to verify the rationality of the model architecture design.
[0123] Ablation test results as follows Figure 4 As shown, by progressively removing various modules from the model, it can be observed that removing the knowledge enhancement path leads to the most significant performance degradation, verifying the crucial role of the knowledge enhancement path in model performance. Secondly, removing the cross-attention mechanism and the Siamese Bi-GRU network also result in significant performance losses, indicating that bidirectional deep semantic interaction and knowledge-based feature interaction enhance the model's discriminative ability from different dimensions. Furthermore, the removal of the dynamic feature fusion mechanism also leads to a certain degree of performance degradation, demonstrating that this mechanism can adaptively balance the contributions of semantic and knowledge paths to achieve better feature fusion.
[0124] The experimental results comparing the RPK-Match model proposed in this invention with traditional text matching are as follows: Figure 5As shown in the figures, experimental results demonstrate that the RPK-Match model outperforms other baseline models in both accuracy and F1 score on the LCQMC dataset. The traditional model Text-CNN has limitations in semantic understanding depth and contextual modeling, with both its ACC and F1 scores below 75%. BiMPM improves performance by introducing bidirectional interaction, but remains insufficient in complex semantic scenarios. LET achieves superior performance by incorporating the HowNet knowledge base and constructing a graph converter. The pre-trained models RoBERTa and GMN-BERT further improve performance due to their powerful contextual representation capabilities, with GMN-BERT being second only to the model presented in this paper.
[0125] In all experiments of this invention, ACC and F1 scores were used for comprehensive evaluation. ACC represents the percentage of correctly predicted samples out of the total number of samples; precision represents the percentage of samples that were actually positive out of the model's predicted positive results; recall represents the percentage of samples that were actually positive out of the model's predicted positive results; and F1 score is a weighted harmonic average of precision and recall.
[0126] The present invention described above is a dual-path text semantic matching method based on deep semantic modeling and knowledge enhancement. However, for those skilled in the art, without departing from the basic concept of the present invention, with the continuous development of technologies such as deep learning and recommendation algorithms, this method can still be further improved and optimized to further enhance the accuracy and practicality of the data transaction matching system and provide more accurate and reliable intelligent matching services for the data element market.
Claims
1. A text semantic matching method integrating deep semantic modeling and knowledge enhancement, characterized in that, The steps are as follows: Step 1) Encode the requirement text and resource text using RoBERTa to obtain basic semantic features; Step 2) Deep semantic interaction is achieved through a Siamese Bi-GRU network, and optimized deep contextual feature vectors are generated; Step 3) Use HowNet for concept mapping and semantic expansion to obtain the semantic primitives of each word; Step 4) Use a self-attention mechanism to aggregate semantic primitive information to form the initial semantic representation of the word; By dynamically adjusting the semantic weights using contextual information, the word representation is updated, resulting in an enhanced word feature representation. Step 5) The two text features interact through a cross-attention mechanism to generate an optimized knowledge feature vector; Step 6) Employ a dynamic feature fusion mechanism to adjust the weights between the semantic path and the knowledge path based on the input text features, and adaptively weight and fuse the feature vectors of the two paths. Step 7) Input the fused features into the classifier, output a binary classification result of 0 / 1, and determine whether the two texts match.
2. The text semantic matching method integrating deep semantic modeling and knowledge enhancement according to claim 1, characterized in that... In step 1), the specific method is as follows: First, a RoBERTa pre-trained model is used as the initial encoder for the text to perform preliminary feature extraction on the input text sequence; then the original requirement text is processed. and resource text Add the [CLS] marker at the beginning of each sentence and the [SEP] separator at the end to form the input sequence; Then, the two input sequences and The input sequences are fed into the RoBERTa pre-trained model. This model is based on a multi-layer Transformer encoder structure, which captures long-range dependencies between words within a sequence through a self-attention mechanism and gradually extracts deep semantic features using multi-layer nonlinear transformations. The RoBERTa model processes the input sequences... and The encoding process: in , This is the output matrix corresponding to the hidden states of the last layer of the RoBERTa pre-trained model. Each vector in the matrix... These represent the feature vectors of the i-th and j-th characters in the demand text and resource text, respectively.
3. The text semantic matching method integrating deep semantic modeling and knowledge enhancement according to claim 1, characterized in that, In step 2), the specific method is as follows: To deepen semantic representation and enhance the modeling of contextual dependencies within sequences, the output of the RoBERTa encoder is used. and Each GRU unit is input into a parameter-shared Siamese bidirectional gated recurrent unit network to perform deep semantic interaction and modeling, generating optimized deep context feature vectors; each GRU unit completes state updates collaboratively through reset gates, update gates, and candidate hidden states. in To reset the door, To update the door, The input at time t, This is the hidden state from the previous moment. The sigmoid activation function is used, and ⊙ represents element-wise multiplication. The sequence is encoded by forward GRU and backward GRU respectively. in, Output the hidden state to the forward layer that requires it. The hidden state is output from the backward layer of the requirement. The hidden state vectors of the forward and backward layers are concatenated to obtain the requirement text. The entire sequence representation after Bi-GRU encoding; Using the same method, the resource text sequence Perform the same operation to obtain its sequence representation. Finally, respectively for and Average pooling is performed to obtain sentence-level deep semantic representation vectors of the demand text and the resource text. and ; Where m is the length of the requirement text sequence and n is the length of the resource text sequence.
4. The text semantic matching method integrating deep semantic modeling and knowledge enhancement according to claim 1, characterized in that, In step 3), the specific method is as follows: We introduce a parallel, fine-grained knowledge enhancement path and utilize the external knowledge base HowNet to inject rich linguistic knowledge into each word through concept mapping and semantic expansion, thereby constructing a semantic representation with interpretability and discriminativeness. Step 3.1) Perform data cleaning and word segmentation on the requirement text P and resource text Q. First, the requirement text P and resource text Q are cleaned and segmented. The Jieba word segmentation tool is used to divide the sentences into independent word sequences. For each word obtained after segmentation... First, a pre-trained Word2Vec model is used to convert it into static word vectors. ,in This refers to the dimension of the word vectors; next, the word vector sequence... Input is encoded into a bidirectional GRU network; for each word The forward and backward hidden states are concatenated to obtain its context-aware representation. ,vector This will serve as the basis for subsequent word representation updates; Step 3.2) HowNet semantic primitive extraction and self-attention aggregation For each word Query the HowNet knowledge base and obtain a list of all its definitions, denoted as . For each meaning Its original meaning is as follows: Each primitive is mapped to a dense vector representation. ,in The dimension of semantic embedding; However, the contributions of multiple semantic primitives under a single sense term to its semantics are not equal. To adaptively aggregate this semantic primitive information, a self-attention mechanism is introduced. By calculating the attention weight of each semantic primitive, the focus on key semantic primitives is achieved, constructing a more discriminative sense representation. The formula for calculating the semantic primitive attention weight is as follows: in, This represents the attention weight of the m-th primitive. For the meaning The total number of Shimogihara, Let m be the embedding vector of the m-th primitive. The weight matrix is a learnable matrix. This is a learnable attention vector; After obtaining the attention weights of each semantic primitive, sense terms are constructed based on a weighted summation method. The initial representation is calculated as follows: in, This represents the attention weight of the m-th primitive. Let be the embedding vector of the m-th primitive.
5. The text semantic matching method integrating deep semantic modeling and knowledge enhancement according to claim 1, characterized in that, In step 4), the specific method is as follows: Meaning initial representation The general knowledge derived from HowNet has not yet been combined with the specific context of the current text; therefore, based on the obtained semantic representation, contextual information is introduced, and the most suitable semantic combination is dynamically selected through an attention mechanism to achieve contextualized updating of word representation. Each word may correspond to multiple meanings, and different meanings have different relevance in different contexts; By using contextual word vectors as queries, all meanings of the target word are weighted and aggregated, enabling the final word representation to adaptively highlight the semantics that match the context. Context-aware word representation updates specifically involve three steps: First, using the target word... context word set Based on this, the average representation of the context word vectors is calculated as the query vector. Secondly, Each meaning of the target word represents Matching is performed, and the weight of each sense is calculated using an attention mechanism. Finally, the senses are weighted and summed according to their weights to obtain a word representation that incorporates contextual information. ; First, calculate the average representation of the context words as the attention query vector. ; Among them, words The set of context words is ,definition The set consists of L words centered at the center and drawn to the left and right, respectively, where L is the preset size of the context window; words The corresponding context-aware word vectors are ; For words For each sense, calculate its relationship with the context query vector. The degree of matching is used to obtain its attention weight; The representations of all senses are summed by weighting them according to their attention weights to obtain the word representations selected by context. Among them, in the formula Representative words The final word representation after context updating; It is the attention weight of the k-th sense. It is the initial representation of the k-th sense; through the above mechanism, the sense weight can be dynamically adjusted according to the context, so that the word representation retains the rich semantic information in the knowledge base and incorporates the contextual constraints of the current text, thereby obtaining a more accurate semantic representation.
6. The text semantic matching method integrating deep semantic modeling and knowledge enhancement according to claim 1, characterized in that, In step 5), the specific method is as follows: After obtaining the updated representation of each word, a cross-attention mechanism is introduced to achieve semantic alignment and interaction between the requirement text and the resource text; let the word representation sequence of the requirement text be... Word representation sequence of resource text First, the two sequences are mapped to query, key, and value matrices respectively through linear transformation; For text P: For text Q: in, This is a learnable parameter matrix; subsequently, queries based on the demand text are performed. Key to resource text Sum Perform cross-attention calculation to obtain the attention output of the demand text relative to the resource text. ; in, The dimension of the key vector; this operation enables each word in the demand text to focus on semantically relevant words in the resource text, thereby capturing alignment information across texts; to preserve the original semantics and fuse interaction features, the original representation is... With cross-attention output Perform a residual join to obtain the updated requirement text representation. ; This allows each word in the requirement text to focus on semantically related words in the resource text, thereby generating an interactive representation containing alignment information. Then, the original representation and the cross representation are concatenated to obtain the final representation; similarly, the resource text word representation is obtained. Using the same method, query the resource text. Key to the demand text and Perform cross-attention calculations to obtain the updated representation of the resource text. Finally, average pooling is performed on the two updated text sequences to obtain sentence-level fine-grained knowledge feature vectors. and These correspond to the knowledge-enhanced representations of the requirement text and the resource text, respectively.
7. The text semantic matching method integrating deep semantic modeling and knowledge enhancement according to claim 1, characterized in that, In step 6), the specific method is as follows: To adaptively fuse the features extracted from the two paths, a dynamic gating mechanism is introduced; and the text representation required for the output of the deep contextual semantic path is also addressed. and resource text representation And the need for text representation of fine-grained knowledge enhancement path output. and resource text representation Calculate the weights of the two paths respectively; in, 、 For learnable weight matrix, 、 For bias terms, For the sigmoid activation function and weights and These respectively reflect the importance of deep semantic paths and knowledge enhancement paths under the current input; Based on the calculated weights, the feature vectors of the two paths are weighted and fused to obtain the final demand text representation and resource text representation; in, This represents the fused feature vector of the required text. This represents the fused resource text feature vector. Subsequently, to obtain the deep semantic relationship between text pairs, a multi-dimensional interaction feature vector is further constructed. in, This represents vector concatenation. Represents the absolute value of the difference between feature vectors, capturing the difference information. This indicates that the feature vectors are multiplied element by element to capture interactive information.
8. The text semantic matching method integrating deep semantic modeling and knowledge enhancement according to claim 1, characterized in that, In step 7), the interaction features are input into a multilayer perceptron classifier to calculate the matching degree; in 、 The classifier weight matrix is... 、 ReLU is the bias term, and ReLU is the activation function. This represents the final matching probability.