A method and apparatus for detecting the position of unknown targets based on graph comparison learning.

By employing a graph-based contrastive learning approach, leveraging social network data augmentation and graph convolutional neural networks, the accuracy and generalization issues of unknown target text stance detection are addressed, achieving more efficient unknown target stance prediction.

CN116257632BActive Publication Date: 2025-10-31NAT UNIV OF DEFENSE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310191177.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-02
Publication Date
2025-10-31
Estimated Expiration
2043-03-02

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively handle text stance detection for unknown targets, especially in social networks targeting emerging topics. Obtaining high-quality labels is expensive and data collection is incomplete, resulting in limited effectiveness of traditional methods for detecting unknown targets.

Method used

We employ a graph-based contrastive learning approach, which involves collecting text data from social networks for data augmentation, constructing a training set, and building an unknown target stance detection model. By utilizing syntactic and semantic representation extraction modules, combined with graph convolutional neural networks and contrastive learning, we predict the stance probability of comment texts on topic texts.

Benefits of technology

It improves the accuracy and generalization ability of unknown target position detection. By constructing a dual-view feature map and graph contrast learning method, it enhances the quality of semantic feature representation and can better handle the position prediction task of unknown targets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257632B_ABST
    Figure CN116257632B_ABST
Patent Text Reader

Abstract

This invention provides a method and apparatus for detecting unknown target positions based on graph contrastive learning. The method includes the following steps: 1) collecting text data from social networks; 2) performing data augmentation on the collected data to form augmented auxiliary text; each topic text, comment text, position tag, and its constructed augmented auxiliary text constitute a training sample, and all texts are organized in this manner to construct a training set; 3) establishing an unknown target position detection model, outputting the predicted probability of the comment text's position on the topic text; 4) training the unknown target position detection model using the training set until convergence to obtain an unknown target position prediction model; 5) inputting the topic text to be predicted, the comment text, and the obtained augmented auxiliary text into the trained unknown target position prediction model, and outputting the probability of the comment text's position on the topic text. This invention can effectively handle the task of predicting unknown target positions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data mining and analysis technology, specifically to a method and apparatus for detecting the position of an unknown target based on graph contrastive learning. Background Technology

[0002] Text stance detection, also known as stance classification or stance recognition, refers to automatically determining a user's stance on a pre-given target from the text they post. Text stance detection and text sentiment analysis are important research directions in the field of text opinion mining. Unlike text sentiment analysis, text stance detection needs to identify stances expressed in more complex ways, such as "support, opposition, or neutrality," rather than simply the positive or negative emotional polarity towards a specified object.

[0003] Traditional target-specific stance detection primarily focuses on single-target stance detection. This means that given a single text (Twitter, Weibo, news article, debate text, etc.) and the target, the goal is to determine whether the text supports, opposes, or is neutral towards that target. This assumes that the training and test sets contain data on the same target. However, collecting data on all target topics for training is impractical in reality. There is always a large amount of data on targets that have never appeared before, and obtaining high-quality labels for a new target topic is often very expensive. Therefore, researching adaptive unknown target stance detection is crucial. Summary of the Invention

[0004] The technical problem to be solved by this invention is to provide an unknown target stance detection method based on graph contrast learning, which obtains the probability of the stance held by the comment text on the topic text by collecting social network text data.

[0005] The technical solution adopted by this invention to solve the above-mentioned technical problems is: an unknown target position detection method based on graph contrast learning, comprising the following steps:

[0006] 1) Data collection: Collect social network text data, which includes the topic text of the discussion and the text of users' comments on the topic.

[0007] 2) Data augmentation is performed on the collected data to create augmented auxiliary text; each topic text, comment text, stance tag, and its constructed augmented auxiliary text constitute a training sample, and all texts are organized in this way to construct a training set;

[0008] 3) Establish an unknown target stance detection model and output the predicted probability of the comment text's stance on the topic text;

[0009] 4) Train the unknown target position detection model using the training set until the unknown target position detection model converges to obtain the unknown target position prediction model;

[0010] 5) After forming a sample triplet consisting of the topic text to be predicted, the comment text, and the obtained enhanced auxiliary text, input it into the trained unknown target stance prediction model, and output the probability of the comment text's stance on the topic text.

[0011] Preferably, the enhanced auxiliary text includes a first auxiliary text and a second auxiliary text; the first auxiliary text is constructed by masking the keywords in the content of each comment text, and the second auxiliary text is constructed by masking the non-keywords in the content of each comment text.

[0012] The known target data set with stance labels is The training set; a collection of unknown target data without positional labels. That is, the test set; where It is a known topic target Position labels with marked examples, and These are the first auxiliary text that masks the keywords in the content, and the second auxiliary text that masks the non-keywords in the content, N. s and N d The number of samples for known targets and unknown targets are respectively, using the known topic target dataset. Regarding known topic objectives Every sentence Train an unknown target position detection model so that it can generalize to newly emerging datasets of unknown targets. Above, predicting about unknown targets Sentences That is the position.

[0013] Preferably, the unknown target stance detection model is based on graph contrastive learning, and the unknown target stance detection model includes a feature encoding module and a syntactic representation and semantic representation extraction module;

[0014] Feature encoding module: Takes the topic text, comment text, and / or enhanced auxiliary text as input, and outputs feature and syntactic structure diagrams of the topic text, comment text, and / or enhanced auxiliary text;

[0015] The syntactic and semantic representation extraction module includes a syntactic representation extraction module and a semantic representation extraction module.

[0016] For each comment text mask, the keywords in its content are used to construct the first auxiliary text. The obtained first auxiliary text masking the keywords and the syntactic structure graph are used as input to the syntactic representation extraction module. The syntactic representation extraction module outputs syntactic pattern features.

[0017] For each comment text, a second auxiliary text is constructed by masking the non-keywords in its content; the obtained second auxiliary text masking the non-keywords and the syntactic structure graph are used as input to the semantic representation extraction module, and the semantic representation extraction module outputs semantic representation features.

[0018] Preferably, the unknown target position detection model further includes a global semantic reconstruction module and a position detection module;

[0019] Global semantic reconstruction module: takes the obtained syntactic pattern features and semantic representation features as input, and outputs the fusion features of syntax and semantics;

[0020] Stance detection module: It takes the obtained syntactic and semantic fusion features as input and outputs the predicted probability of the comment text's stance on the topic text.

[0021] Preferably, the feature encoding module learns the vectorized feature representation of the text; if it is a single text r, it is constructed as "[CLS]r[SEP]" and input to the feature encoding module; if it is a comment x targeting topic t, it constructs each example as "[CLS]t[SEP]x[SEP]" and inputs it to the feature encoding module to obtain the [CLS] labeled hidden layer d. m dimensional vector The input feature representation, and the feature matrix of all words in the input sentence x in the last hidden layer.

[0022] z, Z = f θ (x) = BERT base ([CLS]t[SEP]r[SEP]

[0023] In a training batch, the feature representation of all examples can be defined as N b This is the size of the training batch.

[0024] Preferably, in the syntactic representation and semantic representation extraction module, the syntactic representation extraction module and the semantic representation extraction module decompose the text structure into a syntactic representation structure diagram and a semantic representation structure diagram, respectively, and represent the text semantics from the perspectives of target-independent features and target-dependent features, respectively.

[0025] Preferably, in the syntactic representation and semantic representation extraction module, a graph is constructed for each sentence based on the syntactic dependency tree to capture the dependencies between words in the sentence; the adjacency matrix of each sentence... It can be represented as:

[0026]

[0027] Among them, A i,jLet x(w) be the state of the i-th row and j-th column of the adjacency matrix. i w j ) represents the word w in the syntactic dependency tree of sentence x. i With the word w j They are connected by edges.

[0028] Preferably, in the syntactic representation and semantic representation extraction module, the sentence with masked keywords... Together with the adjacency matrix A, they form a "syntactic representation structure graph"; sentences that mask non-keywords. Together with the adjacency matrix A, they form a "semantic representation structure graph";

[0029]

[0030]

[0031] in, These are the initial feature matrices for the "syntactic representation structure graph" and the "semantic representation structure graph," respectively. These correspond to the feature vectors of nodes in the syntactic representation structure graph and the feature vectors of nodes in the semantic representation structure graph, respectively.

[0032] Preferably, in the syntactic representation and semantic representation extraction module, the feature matrix of the "syntactic representation structure diagram" is... and normalized adjacency matrix Input the GCN module (Graph Convolutional Neural Network module) to obtain the target-independent syntactic feature matrix in the context;

[0033]

[0034] in, Let L be the feature matrix of the l-th convolutional layer of the syntactic structure. D is the degree matrix. This is a trainable weight matrix;

[0035] The feature matrix of the "semantic representation structure graph" and normalized adjacency matrix Input the GCN module to obtain the semantic feature matrix of the topic target's dependency in the context;

[0036]

[0037] in, Let be the feature matrix of the l-th convolutional layer of the semantic structure.

[0038] Given the characteristics of the subject target t are: A retrieval-based attention mechanism is used to learn the relationship between the syntactic feature matrix and a specific target.

[0039]

[0040]

[0041] Where, α j for The j-th feature pair The attention, where T represents the transpose operation of the vector. These are learnable parameters. Furthermore, we calculate the fusion features representing the syntactic expression patterns:

[0042]

[0043] in, For learnable parameters,

[0044] Preferably, in the syntactic representation and semantic representation extraction module, a neural network projection head h = g is defined. ψ (f)=W (2) σ(W (1) f), mapping the feature vectors to the space for calculating the contrastive loss, where σ(·) is a ReLU nonlinear activation function; for the i-th sample, the feature representation of the projected positive sample pair is as follows: The training objective of its contrastive learning is:

[0045]

[0046] Where, sim(u, v) = u T v / ||u||||v|| represents the cosine similarity between vectors u and v after L2 normalization. τ is the temperature parameter;

[0047] In the syntactic and semantic representation extraction module, the contrastive learning loss for each training batch is:

[0048]

[0049] in, The augmented dataset for the training batch is of size 2N. b .

[0050] Preferably, in the global semantic reconstruction module, the encoding of the original comment text z = f θ (x) is used as a global semantic feature, and the fusion feature is defined as follows:

[0051]

[0052]

[0053]

[0054]

[0055] Among them, GCN s GCN t These are graph convolutional modules for the "syntactic representation structure graph" and the "semantic representation structure graph," respectively. This is a feature that actively integrates syntactic patterns into semantic representations. This refers to the features that are actively fused from semantic representations to syntactic patterns; the two fused features are converted into one-dimensional vector features through average pooling, which are defined as follows:

[0056]

[0057] Furthermore, KL divergence is used to maintain the distribution consistency between the original global semantic features and the reconstructed semantic features.

[0058]

[0059] Therefore, the learning objective for global semantic preservation is:

[0060]

[0061] Preferably, in the position detection module, a fully connected layer with softmax normalization is used to predict the probability distribution:

[0062]

[0063] in, For input sample x i Predicted position probability distribution, d p As a dimension of stance labeling, and d is a learnable parameter. m The dimension is represented by the hidden layer.

[0064] Furthermore, by predicting the labels of the samples The classifier is trained using the cross-entropy loss with the true label y.

[0065]

[0066] Preferably, in the unknown target stance prediction model, the learning objective is... Losses categorized by position Between-group contrastive learning loss and global semantic preservation loss To train the model;

[0067]

[0068] Where α and β are adjustable hyperparameters, Θ represents all trainable parameters in the model, and λ represents the L2 regularization coefficient.

[0069] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the unknown target position detection method based on graph contrast learning as described above.

[0070] A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the unknown target position detection method based on graph contrastive learning as described above.

[0071] The beneficial effects of this invention are as follows: The unknown target stance detection method based on graph contrast learning of this invention collects data from social network media, and performs data augmentation on the collected data to form enhanced auxiliary text; each topic text, comment text, stance tag and its constructed enhanced auxiliary text constitute a training sample, and all texts are organized in this way to construct a training set; an unknown target stance detection model is established, outputting the predicted probability of the comment text's stance on the topic text, and converges to obtain an unknown target stance prediction model; the topic text to be predicted, the comment text, and the obtained enhanced auxiliary text are combined into a sample triplet and input into the trained unknown target stance prediction model, which outputs the probability of the comment text's stance on the topic text.

[0072] The syntactic representation extraction module and the semantic representation extraction module decompose the text structure into syntactic representation structure graphs and semantic representation structure graphs, respectively, representing the text semantics from the perspectives of target-independent features and target-dependent features. The unknown target stance detection method of this invention constructs dual-view feature graphs focusing on "syntactic representation" and "semantic representation" respectively, and uses graph contrastive learning to learn target-independent syntactic structural features, thus serving as a bridge for cross-target feature sharing. Through graph contrastive learning, the quality of pragmatic feature representation is enhanced, and this invention can effectively handle unknown target stance prediction tasks. Attached Figure Description

[0073] Figure 1 This is a schematic diagram illustrating the steps of an unknown target position detection method based on graph contrast learning in one embodiment of the present invention;

[0074] Figure 2 This is a flowchart illustrating the steps of an unknown target position detection method based on graph contrast learning in one embodiment of the present invention.

[0075] Figure 3 This is an internal structural diagram of a computer device in one embodiment;

[0076] Figure 4 The figure shows the experimental results of the detection method of the present invention compared with other detection methods;

[0077] Figure 5 The figure shows the experimental results of the detection method with contrast learning of the present invention compared with other detection methods without contrast learning; Detailed Implementation

[0078] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples, so that the process of how the present invention uses technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that, as long as there is no conflict, the various embodiments and features in the various embodiments of the present invention can be combined with each other, and the resulting technical solutions are all within the protection scope of the present invention.

[0079] Furthermore, the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0080] See Figure 1 , Figure 2 The unknown target position detection method based on graph contrast learning of the present invention includes the following steps:

[0081] 1) Data collection: Collect social network text data, which includes the topic text of the discussion and the text of users' comments on the topic.

[0082] 2) Data augmentation is performed on the collected data to create augmented auxiliary text; each topic text, comment text, stance tag, and its constructed augmented auxiliary text constitute a training sample, and all texts are organized in this way to construct a training set;

[0083] 3) Establish an unknown target stance detection model and output the predicted probability of the comment text's stance on the topic text;

[0084] 4) Train the unknown target position detection model using the training set until the unknown target position detection model converges to obtain the unknown target position prediction model;

[0085] 5) After forming a sample triplet consisting of the topic text to be predicted, the comment text, and the obtained enhanced auxiliary text, input it into the trained unknown target stance prediction model, and output the probability of the comment text's stance on the topic text.

[0086] Specifically, in one embodiment of the present invention, in step 2, the enhanced auxiliary text includes a first auxiliary text and a second auxiliary text; the first auxiliary text is constructed by masking the keywords in the content of each comment text, and the second auxiliary text is constructed by masking the non-keywords in the content of each comment text.

[0087] In one specific embodiment of the present invention, in step 2, the KeyBert algorithm is used to obtain the keywords of each comment text, and the top 30% of keywords with the highest probability are selected as the keyword candidate set.

[0088] Specifically, in one embodiment of the present invention, in step 2, each topic target text, comment text, stance tag, and its constructed enhanced auxiliary text constitute a training sample, and each topic text, comment text, and its constructed enhanced auxiliary text that does not overlap with the topic text of the training sample constitutes a test sample. All texts are organized in this manner to construct a training set and a test set; wherein, the set of known topic target data with stance tags is... The training set; a collection of unknown target data without positional labels. That is, the test set; where It is a known topic target Position labels with marked examples, and These are the first auxiliary text that masks the content keywords and the second auxiliary text that masks the content non-keywords, N. s and N d These represent the number of samples for known targets and unknown targets, respectively. The task of detecting the stance of unknown targets is to use the known topic target dataset. Regarding known topic objectives Every sentence Train an unknown target position detection model so that it can generalize to newly emerging datasets of unknown targets. Above, predicting about unknown targets Sentences The position;

[0089] In one specific embodiment of the present invention, in step 3, the unknown target position detection model is based on graph contrastive learning, and the unknown target position detection model includes a feature encoding module, a syntactic representation and semantic representation extraction module, a global semantic reconstruction module, and a position detection module.

[0090] Feature encoding module: Takes the topic text, comment text, and / or enhanced auxiliary text as input, and outputs feature and syntactic structure diagrams of the topic text, comment text, and / or enhanced auxiliary text;

[0091] The syntactic and semantic representation extraction module includes a syntactic representation extraction module and a semantic representation extraction module.

[0092] For each comment text mask, the keywords in its content are used to construct the first auxiliary text. The obtained first auxiliary text masking the keywords and the syntactic structure graph are used as input to the syntactic representation extraction module. The syntactic representation extraction module outputs syntactic pattern features.

[0093] For each comment text, a second auxiliary text is constructed by masking the non-keywords in its content; the obtained second auxiliary text masking the non-keywords and the syntactic structure graph are used as input to the semantic representation extraction module, and the semantic representation extraction module outputs semantic representation features.

[0094] Global semantic reconstruction module: takes the obtained syntactic pattern features and semantic representation features as input, and outputs the fusion features of syntax and semantics;

[0095] Stance detection module: It takes the obtained syntactic and semantic fusion features as input and outputs the predicted probability of the comment text's stance on the topic text.

[0096] In one specific embodiment of the present invention, in the unknown target position detection model, the feature encoding module learns the vectorized feature representation of the text. If it is a single text r (topic target text or comment text), it is constructed as "[CLS]r[SEP]" format and input to the feature encoder; if it is a comment x targeting topic t, each sample is constructed as "[CLS]t[SEP]x[SEP]" format and input to the encoder module to obtain the d of the [CLS]-tagged hidden layer. m dimensional vector The input feature representation, and the feature matrix of all words in the input sentence x in the last hidden layer.

[0097] z, Z = f θ (x) = BERT base ([CLS]t[SEP]r[SEP])

[0098] In a training batch, the feature representation of all examples can be defined as N b N represents the size of the training batch. In this embodiment, N... b Set to 32, d m Set it to 768.

[0099] In one specific embodiment of the present invention, in the unknown target position detection model, the syntactic representation and semantic representation extraction module decomposes the text structure into two views, a syntactic representation structure diagram and a semantic representation structure diagram, based on the syntactic dependency tree, and represents the text semantics from the perspectives of target-independent features and target-dependent features, respectively.

[0100] In one specific embodiment of the present invention, in the unknown target position detection model, the syntactic representation and semantic representation extraction module constructs a graph for each sentence based on a syntactic dependency tree to capture the dependencies between words in the sentence. The adjacency matrix of each sentence... It can be represented as:

[0101]

[0102] Among them, A i,j Let x(w) be the state of the i-th row and j-th column of the adjacency matrix. i w j ) represents the word w in the syntactic dependency tree of sentence x. i With the word w j There are edges connecting them. Since the effects of words in a sentence are mutual, the adjacency matrix is ​​defined as a symmetric matrix, i.e., A i,j =A j,i And set each word node to have a self-looping edge, i.e., A i,i =1.

[0103] Specifically, in one embodiment of the present invention, the sentence with masked keywords is extracted from the syntactic and semantic representation modules. Together with the adjacency matrix A, they form a "syntactic representation structure graph"; sentences that mask non-keywords. Together with the adjacency matrix A, they form a "semantic representation structure graph". In this graph, each word in the sentence corresponds to a node, and the features of the nodes are obtained by the word features of the last layer after encoding by the feature encoder. In particular, the [MASK] marker generated during the masking process replaces the original word at the corresponding position.

[0104]

[0105]

[0106] in, These are the initial feature matrices for the "syntactic representation structure graph" and the "semantic representation structure graph," respectively. These correspond to the feature vectors of nodes in the syntactic representation structure graph and the feature vectors of nodes in the semantic representation structure graph, respectively.

[0107] In one specific embodiment of the present invention, the syntactic and semantic representation extraction module employs a dropout-based data augmentation method. The comment text with keywords masked is input twice into the BERT encoder. The resulting two text feature representations have the same meaning and can be considered a pair of positive samples, while other samples in the same batch are considered negative samples. Specifically, v = f is defined. φ (v, m) is an encoder using a dropout mask of m, which transforms the node vector... By encoding twice using different dropout masks m and m′, we obtain the two feature representations representing positive samples at the node level. The corresponding sentence-level feature matrix positive sample pairs are The feature matrix of the "syntactic representation structure diagram" and normalized adjacency matrix Feed the GCN module to obtain a target-independent syntactic feature matrix in the context.

[0108]

[0109] in, Let L be the feature matrix of the l-th convolutional layer of the syntactic structure. D is the degree matrix. is a trainable weight matrix.

[0110] The feature matrix of the "semantic representation structure graph" and normalized adjacency matrix Feed the GCN module to obtain the semantic feature matrix that the topic target depends on in the context.

[0111]

[0112] in, Let be the feature matrix of the l-th convolutional layer of the syntactic structure. In this embodiment, l is set to a maximum of 2. The features of the known topic target t are... A retrieval-based attention mechanism is used to learn the relationship between the syntactic feature matrix and a specific target.

[0113]

[0114]

[0115] Where, α j for The j-th feature pair The attention, where T represents the transpose operation of the vector. These are learnable parameters. In this embodiment, d sThe value is set to 283. Furthermore, we calculate the fusion features representing the syntactic expression patterns:

[0116]

[0117] in, For learnable parameters,

[0118] Specifically, in one embodiment of the present invention, the syntactic representation and semantic representation extraction module defines a neural network projection head h = g. ψ (f)=W (2) σ(W (1) f), mapping the feature vectors to the space for calculating the contrastive loss, where σ(·) is a ReLU nonlinear activation function. For the i-th sample, the feature representation of the projected positive sample pair is: The training objective of its contrastive learning is:

[0119]

[0120] Where, sim(u, v) = u T v / ||u||||v|| represents the cosine similarity between vectors u and v after L2 normalization. τ is a temperature parameter. In this embodiment, τ is set to 0.07. The contrastive learning loss for each training batch is:

[0121]

[0122] in, The augmented dataset for the training batch is of size 2N. b .

[0123] Specifically, in one embodiment of the present invention, the global semantic reconstruction module emphasizes that the obtained syntactic and semantic representations can be reconstructed back into fused features consistent with the original feature distribution. Here, the encoding of the original comment text z = f θ (x) is defined as a global semantic feature, and the interactive fusion feature is defined as follows:

[0124]

[0125]

[0126]

[0127]

[0128] Among them, GCN s GCN tThese are graph convolutional modules for the "syntactic representation structure graph" and the "semantic representation structure graph," respectively. This is a feature that actively integrates syntactic patterns into semantic representations. Features that actively fuse semantic representations into syntactic patterns. The two fused features are transformed into one-dimensional vector features through average pooling, defined as follows:

[0129]

[0130] Furthermore, KL divergence is used to maintain the distribution consistency between the original global semantic features and the reconstructed semantic features.

[0131]

[0132] Therefore, the learning objective for global semantic preservation is:

[0133]

[0134] Specifically, in one embodiment of the present invention, the stance detection module incorporates syntactic expression pattern features. The result of concatenating the original semantic feature z with the position detection module outputs the predicted probability of the comment text's position on the topic text.

[0135] The probability distribution for position prediction is predicted using a fully connected layer with softmax normalization:

[0136]

[0137] in, For input sample x i Predicted position probability distribution, d p As a dimension of stance labeling, and d is a learnable parameter. m Let d represent the dimension of the hidden layer. In this embodiment, d p A value of 3 indicates that there are three types of positions: support, neutral, and opposition.

[0138] Furthermore, by predicting the labels of the samples The classifier is trained using the cross-entropy loss with the true label y.

[0139]

[0140] In one specific embodiment of the present invention, in step 4, an unknown target position detection model is trained using a training set until an unknown target position prediction model is obtained through convergence.

[0141] The predicted probabilities output by the unknown target position detection model are compared with the true labels. Gradient descent is used to optimize the log-likelihood loss function. The model's learning objective is... Loss classification through joint optimization of supervised position classification Self-supervised between-group comparison learning loss and global semantic preservation loss To train the model.

[0142]

[0143] Where α and β are adjustable hyperparameters, Θ represents all trainable parameters in the model, and λ represents the L2 regularization coefficient. The parameters of the unknown target position detection model are trained using the backpropagation algorithm. The model is trained iteratively using the training set until it converges, resulting in the unknown target position prediction model. In this embodiment, α is set to 0.3, β to 0.1, and λ to 1e-5.

[0144] In one specific embodiment of the present invention, in step 5, the topic text to be predicted, the comment text, and the obtained enhanced auxiliary text are combined into a sample triplet and then input into the trained unknown target stance prediction model to output the probability of the comment text's stance on the topic text. In this embodiment, the aspect with the highest probability is finally selected as the user's comment text's stance on the relevant topic.

[0145] For the task of detecting stances of unknown targets, some existing methods attempt to generalize the model to unknown targets by using attention mechanisms and introducing external knowledge. However, this approach of directly transferring from known topics to unknown topics often has limited predictive performance because specific topic-specific features may still exist. While adversarial learning methods guide the model to learn target-independent features through a discriminator, this can lead to decreased predictive performance when the target data distribution is imbalanced. Therefore, effectively distinguishing between target-dependent and target-independent features in stance text is crucial. Graph-structured syntactic features are target-independent and have not been effectively utilized in existing methods. Based on this, this embodiment constructs a unified stance detection framework that utilizes graph contrastive learning for feature enhancement. It comprehensively utilizes unsupervised contrastive learning and graph structure modeling to obtain the syntactic structural features of the text, and uses these syntactic structural features to enhance the abstract semantics obtained through supervised learning, thereby effectively predicting the stance of comment texts in social media.

[0146] This architecture has two advantages:

[0147] (1) More efficient feature sharing capability: The unknown target position detection method of this invention constructs dual-view feature maps that focus on "syntactic representation" and "semantic representation" respectively, and uses graph contrastive learning to learn target-independent syntactic structural features, thus serving as a bridge for cross-target feature sharing. Experiments on public datasets, such as... Figure 4 As shown, the detection method of the present invention has an 8.3% F1 score compared to the cross-target position detection method TPDG. macro The improvement, wherein curve FE is the present invention.

[0148] (2) More accurate textual stance feature modeling: Through graph contrastive learning, the quality of pragmatic feature representation is enhanced, enabling the model to better handle unknown target stance prediction tasks. This is achieved through ablation experiments on real data, such as... Figure 5 As shown, it is verified that there is a performance difference of +3.3% between the result without contrastive learning and the result with contrastive learning in this embodiment, which verifies that the pragmatic feature contrastive learning in this embodiment obtains a stronger feature representation capability.

[0149] This embodiment has the following advantages over the prior art:

[0150] 1. This invention extends the traditional deep learning method for stance detection by analyzing the underlying pragmatics of text stance expression and capturing the common features of social network text.

[0151] 2. This invention obtains the influence features of syntactic structure on the expression of textual stance, expands the aspects of text feature representation, further enhances the high-level semantic features of the original text expression, and predicts the stance of user comment text.

[0152] This embodiment utilizes the pragmatic features of textual stance expression, which has more reliable predictive performance for the problem of detecting stances of unknown targets. Therefore, for different Internet topics, more general deep learning model basic parameters can be obtained through training, which can better solve problems within the semantic scope, such as social issues and online public opinion issues.

[0153] The method provided in this embodiment can be used in online public opinion event analysis and data mining, especially for monitoring and judging user positions with relatively concentrated semantics, such as social issues, legal issues, and livelihood issues. It can also be used for enterprise network information supervision, predicting product feedback that enterprises are concerned about, and improving product lines and related services.

[0154] In an embodiment of the present invention, a computer device is also provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the unknown target position detection method based on graph contrast learning as described above.

[0155] The computer device can be a terminal, and its internal structure diagram can be as follows: Figure 3 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a bus. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When executed by the processor, the computer program implements an unknown target position detection method based on graph contrast learning. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0156] Memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), and Electrically Erasable Programmable Read-Only Memory (EEPROM). Memory stores programs, and the processor executes these programs after receiving execution instructions.

[0157] A processor can be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc. The processor can also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor can be a microprocessor or any conventional processor.

[0158] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0159] In an embodiment of the present invention, a computer-readable storage medium is also provided, on which a program is stored, which, when executed by a processor, implements the unknown target position detection method based on graph contrast learning as described above.

[0160] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, computer devices, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0161] The embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, computer apparatuses, or computer program products according to embodiments of the invention. These computer program instructions may be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams.

[0162] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in the flowchart.

[0163] The above provides a detailed description of the unknown target position detection method, computer device, and computer-readable storage medium based on graph contrast learning provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A method for detecting the position of an unknown target based on graph contrastive learning, characterized in that: Includes the following steps: 1) Data collection: Collect text data from social networks, including the text of the topics discussed and users' comments on those topics; 2) Data augmentation is performed on the collected data to create augmented auxiliary text; each topic text, comment text, stance tag, and its constructed augmented auxiliary text constitute a training sample, and all texts are organized in this way to construct a training set; 3) Establish an unknown target stance detection model and output the predicted probability of the comment text's stance on the topic text; 4) Train the unknown target position detection model using the training set until the unknown target position detection model converges to obtain the unknown target position prediction model; 5) After forming a sample triplet consisting of the topic text to be predicted, the comment text, and the obtained enhanced auxiliary text, input it into the trained unknown target stance prediction model, and output the probability of the comment text's stance on the topic text; The enhanced auxiliary text includes a first auxiliary text and a second auxiliary text; the first auxiliary text is constructed by masking the keywords in the content of each comment text, and the second auxiliary text is constructed by masking the non-keywords in the content of each comment text. The known target data set with stance labels is The training set is a collection of unlabeled target data. That is, the test set; where It is a known topic target Position labels with marked examples, and These are the first auxiliary text that masks the keywords in the content, and the second auxiliary text that masks the non-keywords in the content. and The number of samples for known targets and unknown targets are respectively, using the known topic target dataset. Regarding known topic objectives Every sentence Train an unknown target position detection model so that it can generalize to newly emerging datasets of unknown targets. Above, predicting about unknown targets Sentences The position; The unknown target stance detection model is based on graph contrastive learning and includes a feature encoding module and a syntactic and semantic representation extraction module. Feature encoding module: Takes the topic text, comment text, and / or enhanced auxiliary text as input, and outputs feature and syntactic structure diagrams of the topic text, comment text, and / or enhanced auxiliary text; The syntactic and semantic representation extraction module includes a syntactic representation extraction module and a semantic representation extraction module. For each comment text mask, the keywords in its content are used to construct the first auxiliary text. The obtained first auxiliary text masking the keywords and the syntactic structure graph are used as input to the syntactic representation extraction module. The syntactic representation extraction module outputs syntactic pattern features. For each comment text, a second auxiliary text is constructed by masking the non-keywords in its content; the obtained second auxiliary text masking the non-keywords and the syntactic structure graph are used as input to the semantic representation extraction module, and the semantic representation extraction module outputs semantic representation features.

2. The unknown target position detection method based on graph contrast learning according to claim 1, characterized in that: The unknown target position detection model also includes a global semantic reconstruction module and a position detection module; Global semantic reconstruction module: takes the obtained syntactic pattern features and semantic representation features as input, and outputs the fusion features of syntax and semantics; Stance detection module: It takes the obtained syntactic and semantic fusion features as input and outputs the predicted probability of the comment text's stance on the topic text.

3. The unknown target position detection method based on graph contrast learning according to claim 1, characterized in that: The feature encoding module learns the vectorized feature representation of the text; if it is a single text r, it is constructed as "[CLS]r[SEP]" and input to the feature encoding module; If the comment x is for a topic target t, then each sample is constructed as "[CLS]t[SEP]x[SEP]" and input to the feature encoding module to obtain the [CLS] labeled hidden layer. dimensional vector The input feature representation, and the feature matrix of all words in the input sentence x in the last hidden layer. : ; In a training batch, the feature representation of all examples can be defined as , This is the size of the training batch.

4. The unknown target position detection method based on graph contrast learning according to claim 1, characterized in that: In the syntactic representation and semantic representation extraction module, the syntactic representation extraction module and the semantic representation extraction module decompose the text structure into a syntactic representation structure diagram and a semantic representation structure diagram, respectively, and represent the text semantics from the perspectives of target-independent features and target-dependent features, respectively.

5. The unknown target position detection method based on graph contrast learning according to claim 1, characterized in that: In the syntactic representation and semantic representation extraction module, a graph is constructed for each sentence based on the syntactic dependency tree to capture the dependencies between words in the sentence; the adjacency matrix of each sentence... It can be represented as: ; in, Let i be the state of the i-th row and j-th column of the adjacency matrix. Sentence words in the syntactic dependency tree With words They are connected by edges.

6. The unknown target position detection method based on graph contrast learning according to claim 4, characterized in that: In the syntactic and semantic representation extraction module, the sentence with masked keywords Adjacency Matrix This constitutes a "syntactic representation structure diagram"; sentences that mask non-keywords. Adjacency Matrix This constitutes a "semantic representation structure diagram"; ; ; in, These are the initial feature matrices for the "syntactic representation structure graph" and the "semantic representation structure graph," respectively. These correspond to the feature vectors of nodes in the syntactic representation structure graph and the feature vectors of nodes in the semantic representation structure graph, respectively.

7. The unknown target position detection method based on graph contrast learning according to claim 4, characterized in that: In the syntactic representation and semantic representation extraction module, the feature matrix of the "syntactic representation structure graph" is... and normalized adjacency matrix Input the GCN module to obtain the target-independent syntactic feature matrix in the context; ; in, For the first syntactic structure The feature matrix of a convolutional layer, For degree matrix, This is a trainable weight matrix; The feature matrix of the "semantic representation structure graph" and normalized adjacency matrix Input the GCN module to obtain the semantic feature matrix of the topic target's dependency in the context; ; in, For semantic structure Feature matrix of layer convolution; Given the characteristics of the subject target t are: A retrieval-based attention mechanism is used to learn the relationship between the syntactic feature matrix and a specific target. ; in, for The j-th feature pair attention, This represents the transpose operation of a vector. These are learnable parameters; furthermore, we calculate the fusion features representing the syntactic expression patterns: ; in, For learnable parameters, .

8. The unknown target position detection method based on graph contrastive learning according to claim 1, characterized in that: In the syntactic representation and semantic representation extraction module, a neural network projection head is defined. The feature vectors are mapped to the space where the contrastive loss is computed, where It is a ReLU non-linear activation function; for the i-th sample, the feature representation of the projected positive sample pair is: The training objective of its comparative learning is: ; in, Representing vectors and exist Standardized cosine similarity; For temperature parameters; In the syntactic and semantic representation extraction module, the contrastive learning loss for each training batch is: ; in, The augmented dataset for the training batch is of size . .

9. The unknown target position detection method based on graph contrast learning according to claim 2, characterized in that: In the global semantic reconstruction module, the encoding of the original comment text is... As a global semantic feature, the fusion feature is defined as: ; ; in, These are graph convolutional modules for the "syntactic representation structure graph" and the "semantic representation structure graph," respectively. This is a feature that actively integrates syntactic patterns into semantic representations. This refers to the features that are actively fused from semantic representations to syntactic patterns; the two fused features are converted into one-dimensional vector features through average pooling, which are defined as follows: ; Furthermore, KL divergence is used to maintain the distribution consistency between the original global semantic features and the reconstructed semantic features; ; Therefore, the learning objective for global semantic preservation is: 。 10. The unknown target position detection method based on graph contrast learning according to claim 2, characterized in that: In the position detection module, a fully connected layer with softmax normalization is used to predict the probability distribution: ; in, Input Sample Predicted position probability distribution As a dimension of stance labeling, and For learnable parameters, The hidden layer represents the dimension; Furthermore, by predicting the labels of the samples With real labels The cross-entropy loss is used to train the classifier. 。 11. The unknown target position detection method based on graph contrast learning according to claim 1, characterized in that: In the unknown target stance prediction model, the learning objective is... Losses categorized by position Between-group comparative learning loss and global semantic preservation loss To train the model; ; in, It is an adjustable hyperparameter. This represents all trainable parameters in the model. This represents the L2 regularization coefficient.

12. A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the unknown target position detection method based on graph contrast learning as described in any one of claims 1-11.

13. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by the processor, it implements the unknown target position detection method based on graph contrastive learning as described in any one of claims 1-11.

Citation Information

Patent Citations

  • Emotion mining fused rumor detection method and system

    CN115422945A

  • Scoring method and apparatus based on semantic analysis, terminal device, and storage medium

    WO2021114840A1