Standard detection method, device and equipment, storage medium and program product
By introducing the determination of the importance of target words and the processing of prediction results of large language models in the traditional position detection model, combining self-consistency scores and position confidence, a weighted undirected binary graph and graph convolutional network detection is solved, the traditional The model ignores the issues of important vocabulary and context, improving the accuracy and generalization ability of position detection.
Patent Information
- Application Number
- CN202411654562.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-02-18
AI Technical Summary
The traditional position detection model is too single because the target word is difficult to cover all key information in the text, resulting in ignoring other important words and contexts related to the position, misjudging the user's position, and lacking generalization capabilities.
The target prediction results are obtained by determining the target word set based on the importance of words in the text published by the user in the context, and inputting the text and target words into the large language model. Then, the self-consistency score and position confidence of the thinking chain are calculated, the position weight is obtained, the weighted undirected binary graph is constructed, and the signed graph convolutional network is input for position category detection.
This method can capture key information in the text more comprehensively, improve the accuracy of position detection, and perform position detection in unseen fields or topics, enhancing the generalization ability and versatility of the model.
Smart Images

Figure CN119474378A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to a stance detection method, apparatus, computer device, storage medium, and computer program product. Background Art
[0002] Stance detection is a natural language processing task. The main goal of stance detection is to analyze whether the user who posted a text tends to support or oppose a certain goal.
[0003] In traditional stance detection schemes, the target words used are too single and cannot cover all the key information in the text. As a result, the stance detection model ignores other important stance-related words and contexts, which may lead to the stance detection model misjudging the user's stance. In addition, it is difficult to perform stance detection in fields or topics that the stance detection model has never seen, and the model's generalization ability is insufficient. Summary of the Invention
[0004] Based on this, it is necessary to provide a stance detection method, apparatus, computer device, storage medium and computer program product to address the above technical issues.
[0005] The present application provides a stance detection method, the method comprising:
[0006] Determining target words from the words in the text posted by the user based on the importance of the words in the corresponding context to form a target word set;
[0007] Inputting the text and each target word in the target word set into a large language model to obtain a target prediction result for each target word; the target prediction result for each target word includes: the user's thought chain for the target word, and the user's stance category and stance confidence for the target word;
[0008] For any target word, obtain the self-consistency score of the user's thought chain for the target word, and obtain the user's stance weight for the target word based on the self-consistency score and the user's stance confidence for the target word;
[0009] A weighted undirected bipartite graph is obtained by using the target word as a target node, the user as a user node, the user's stance weight on the target word as an edge weight between the target node and the user node, and the user's stance category on the target word as an edge weight symbol between the target node and the user node;
[0010] The weighted undirected bipartite graph is input into a signed graph convolutional network to obtain a detection result of the user's stance category.
[0011] In one embodiment, determining a target word from the words in the text posted by the user based on the importance of the words in the corresponding context includes:
[0012] Sort the words in the text posted by the user according to their importance in the corresponding context to obtain a word sequence;
[0013] If the importance is greater and the ranking is higher, then the word ranked higher in the word sequence is determined as the target word;
[0014] If the smaller the importance, the higher the ranking, then the word ranked later in the word sequence is determined as the target word.
[0015] In one embodiment, obtaining the importance of a word in a text posted by a user in a corresponding context includes:
[0016] Get the word vector of each word in the text posted by the user;
[0017] For any word, determine the words covered by the context window centered on the word, obtain the context word set of the word, and obtain the context vector of the word based on the word vector of the word and the word vectors of each context word in the context word set;
[0018] The importance of each word in the corresponding context is obtained based on the dot product value of the word vector of each word and the corresponding context vector; the larger the dot product value, the higher the importance.
[0019] In one embodiment, the context vector of the word is obtained based on the word vector of the word and the word vectors of each context word in the context word set, including:
[0020] The word vector of the word and the word vectors of each context word in the context word set are averaged;
[0021] The average result is determined as the context vector for the word.
[0022] In one embodiment, obtaining the user's stance weight on the target word based on the self-consistency score and the user's stance confidence on the target word includes:
[0023] multiplying the self-consistency score by the user's stance confidence with respect to the target word;
[0024] The multiplication result is determined as the user's stance weight on the target word.
[0025] In one embodiment, for any target word, obtaining a target prediction result for the target word includes:
[0026] Obtaining multiple prediction results corresponding to the target word output by the large language model according to different reasoning paths; each prediction result includes the thought chain, the stance category, and the stance confidence;
[0027] According to the consistency between the prediction results, multiple prediction results are divided into corresponding sets to obtain several prediction result sets;
[0028] Among several prediction result sets, determine the prediction result set with the largest number of prediction results to obtain the target prediction result set;
[0029] Determining one of the prediction results in the target prediction result set as the target prediction result of the target word;
[0030] Obtaining a self-consistency score of the user's thought chain for the target word, including:
[0031] A self-consistency score of the user's thought chain for the target word is obtained based on the ratio of the number of prediction results in the target prediction result set to the number of prediction results output by the large language model.
[0032] The present application provides a stance detection device, comprising:
[0033] A target word determination module is used to determine target words from the words in the text posted by the user according to the importance of the words in the corresponding context, so as to form a target word set;
[0034] a prediction module, configured to input the text and each target word in the target word set into a large language model to obtain a target prediction result for each target word; the target prediction result for each target word includes: the user's thought chain for the target word, and the user's stance category and stance confidence for the target word;
[0035] A stance weight acquisition module is configured to acquire, for any target word, a self-consistency score of the user's thought chain regarding the target word, and obtain the user's stance weight for the target word based on the self-consistency score and the user's stance confidence level regarding the target word;
[0036] a graph acquisition module, configured to obtain a weighted undirected bipartite graph using the target word as a target node, the user as a user node, the user's stance weight on the target word as an edge weight between the target node and the user node, and the user's stance category on the target word as an edge weight symbol between the target node and the user node;
[0037] The stance category acquisition module is used to input the weighted undirected bipartite graph into a signed graph convolutional network to obtain a stance category detection result of the user.
[0038] The present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the above method.
[0039] The present application provides a computer-readable storage medium having a computer program stored thereon, and the computer program is used by a processor to execute the above method.
[0040] The present application provides a computer program product having a computer program stored thereon, wherein the computer program is used by a processor to execute the above method.
[0041] The above-mentioned stance detection method, apparatus, computer device, storage medium and computer program product determine target words from the words in the text posted by the user according to the importance of the words in the corresponding context to form a target word set, which can cover as many words as possible that are important to the context in the text, pay attention to important vocabulary and context related to the stance in the text, and improve the accuracy of stance detection; input the text and each target word in the target word set into the large language model to obtain the target prediction result of each target word; the target prediction result of the target word includes: the user's thought chain for the target word and the user's stance category for the target word The method is to obtain the self-consistency score of the user's thought chain for the target word and the confidence of the stance of the user for the target word for any target word, and obtain the user's stance weight for the target word according to the self-consistency score and the user's stance confidence for the target word; the method uses the target word as the target node, the user as the user node, the user's stance weight for the target word as the edge weight between the target node and the user node, and the user's stance category for the target word as the edge weight symbol between the target node and the user node to obtain a weighted undirected bipartite graph; the weighted undirected bipartite graph is input into the signed graph convolutional network to obtain the user's stance category detection result. Since the determination of the target word is related to the text, if the text changes, the determined target word may also change. Therefore, the thought chain determined in this application belongs to the soft target thought chain; stance classification is performed based on the soft target thought chain and the signed graph convolutional network, and stance detection can be performed on fields or topics that the model has not seen, thereby improving the generalization ability of the model and improving the versatility and practicality of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1 1 is a flow chart of a stance detection method according to an embodiment;
[0044] Figure 2 FIG1 is a diagram illustrating a visualization of a weighted undirected bipartite graph in one embodiment;
[0045] Figure 3 A schematic diagram of a process for determining the importance of a word in one embodiment;
[0046] Figure 4 is a structural block diagram of a position detection device in one embodiment;
[0047] Figure 5 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0049] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0050] The stance detection method provided in this application can be executed by a computer device, including: Figure 1 The steps shown are:
[0051] Step S101 : determining target words from the words in the text posted by the user according to the importance of the words in the corresponding context, so as to form a target word set.
[0052] For a specific user, we can obtain the text posted by that user, which consists of several words. For each word, we determine whether to use it as a target word based on its importance in the context of the word, thus forming a target word set. Each target word corresponds to a target. The target word can be a person, place, organization, event, or any other object that can be clearly identified in the text.
[0053] Standard target words can be pre-set for each field. The above target word set can also include standard target words for the field to which the text published by the user belongs.
[0054] Step S102 : Input the text and each target word in the target word set into a large language model to obtain a target prediction result for each target word.
[0055] The target prediction result of the target word includes: the user's thought chain for the target word, and the user's stance category and stance confidence for the target word.
[0056] Among them, the thinking chain refers to a series of logically interconnected steps or reasoning processes, showing the step-by-step thinking and reasoning process from question to answer.
[0057] After obtaining the target word set, each target word in the target word set and the text can be input into the large language model to obtain the target prediction result of each target word.
[0058] To guide the large language model to focus on key parts of the text and improve its reasoning ability, predictions can be made based on thought chains. A thought chain is a series of logically interconnected steps that starts from the premise of the text and guides the large language model to gradually deduce the position conclusion.
[0059] Specifically, we can insert some prompt words into questions to guide the large language model to think and reason step by step. For example, "Please explain your thinking step by step," "First analyze... then... and finally derive the position category and position confidence."
[0060] By incorporating the target word into the thought chain derivation process and generating a thought chain for each target word, and considering multiple reasoning paths, the large language model can better generalize to new or unseen stance detection tasks. An example of a thought chain after the large language model is as follows:
[0061] {Question: Considering this text as it is being entered into a conversation about a goal, what might this text's stance on the goal be?
[0062] The options are: A. Oppose B. Support
[0063] Input: <There are no shortcuts to success, only hard work and dedication #success #secretstosuccess>
[0064] Target: Laziness
[0065] Reasoning: The user who posted this text favors hard work and dedication -> The user who posted this text is against laziness
[0066] Output: Objection 0.96}
[0067] In one embodiment, for any target word, obtaining a target prediction result for the target word includes:
[0068] Obtain multiple prediction results corresponding to the target word output by the large language model according to different reasoning paths; each prediction result includes a thought chain, a stance category, and a stance confidence; based on the consistency between the prediction results, the multiple prediction results are divided into corresponding sets to obtain several prediction result sets; among the several prediction result sets, determine the prediction result set with the largest number of prediction results to obtain the target prediction result set; determine one of the prediction results in the target prediction result set as the target prediction result of the target word.
[0069] For any target word, the large language model can make predictions based on multiple reasoning paths, reducing the risk of incorrect predictions. As a result, the large language model can output multiple predictions for the target word; each prediction includes the user's thought chain for the target word, as predicted by the large language model, and the user's stance category and stance confidence level for the target word, derived from this thought chain.
[0070] The consistency of thought chains, position category, and position confidence between each two prediction results can be obtained, resulting in the consistency between each two prediction results. Based on the consistency between each two prediction results, multiple prediction results are divided into corresponding sets to obtain several prediction result sets. If two prediction results are in the same prediction result set, the consistency between the two prediction results is high; if the two prediction results are in different prediction result sets, the consistency between the two prediction results is low.
[0071] Among the obtained prediction result sets, a prediction result set with the largest number of prediction results is determined, and the prediction result set is used as the target prediction result set.
[0072] Select one of the prediction results in the target prediction result set as the target prediction result for the target word.
[0073] Step S103: For any target word, obtain the self-consistency score of the user's thought chain for the target word, and obtain the user's stance weight for the target word based on the self-consistency score and the user's stance confidence for the target word.
[0074] In one embodiment, obtaining the self-consistency score of the user's thought chain for the target word includes: obtaining the self-consistency score of the user's thought chain for the target word based on the ratio of the number of prediction results in the target prediction result set to the number of prediction results output by the large language model.
[0075] For any target word, when the large language model predicts based on multiple reasoning paths, as described above, multiple prediction results can be obtained for the target word, each corresponding to a different reasoning path. Based on the consistency between the prediction results, the multiple prediction results are divided into corresponding sets to obtain several prediction result sets. Among these prediction result sets, the prediction result set with the largest number of prediction results is determined to obtain the target prediction result set. The target prediction result is determined in the target prediction result set. The ratio of the number of prediction results in the target prediction result set to the number of prediction results output by the large language model can be obtained, and this ratio is used as the self-consistency score of the thought chain in the target detection result.
[0076] Self-consistency is important in zero-shot learning. Self-consistency refers to the ability of a large language model to produce consistent outputs when processing the same or similar inputs.
[0077] After obtaining the self-consistency score, the user's stance weight on the target word can be obtained based on the self-consistency score and the user's stance confidence on the target word.
[0078] In step S104, a weighted undirected bipartite graph is obtained, with the target word as the target node, the user as the user node, the user's stance weight on the target word as the edge weight between the target node and the user node, and the user's stance category on the target word as the edge weight symbol between the target node and the user node.
[0079] A weighted undirected bipartite graph consists of two types of nodes: target nodes and user nodes. Target nodes represent target words, while user nodes represent users. User nodes contain user-related characteristics and behavioral information, such as number of posts and interaction patterns. This allows for a deeper and more comprehensive understanding of user perspectives, providing more accurate and valuable analysis results.
[0080] If a user node is connected to a target node via an edge, it indicates that the user has a stance on the target corresponding to the target node. Edges are assigned weights, which can be called edge weights. The edge weight is the weight of the user's stance on the target word corresponding to the target node. The sign of the edge weight is determined by the user's stance category on the target word corresponding to the target node; since each target word corresponds to a target, the user's stance category on the target word is also the user's stance category on the target. If the user holds a positive stance on the target corresponding to the target node, the edge weight sign is positive; the larger the edge weight, the stronger the user's positive stance on the corresponding target. If the user holds a negative stance on the target corresponding to the target node, the edge weight sign is negative; the larger the edge weight, the stronger the user's negative stance on the corresponding target. Figure 2 This is the visualization result of the weighted undirected bipartite graph.
[0081] Step S105: Input the weighted undirected bipartite graph into a signed graph convolutional network to obtain the user's stance category detection result.
[0082] The full name of the signed graph convolutional network is Signed Graph Convolutional Network, abbreviated as SGCN.
[0083] Signed graph convolutional networks (GCNs) can process graph neural networks on weighted undirected bipartite graphs with positive and negative edge weights. In the context of stance detection, signed GCNs are able to understand and distinguish between positive and negative stances held by users towards a specific target. Signed GCNs aggregate information about neighboring nodes by performing convolution operations on a weighted undirected bipartite graph. This involves a weighted summation of node features, where the weights used in this weighted summation are determined by edge weights.
[0084] Signed graph convolutional networks handle positive and negative edge weights in this way: during aggregation, neighbor nodes with positively signed edge weights are considered positive influences, while those with negatively signed edge weights are considered negative influences. This distinction enables signed graph convolutional networks to capture the complex attitudes of users towards a target.
[0085] The signed graph convolutional network includes multiple layers of convolutional networks to implement multi-layer graph convolution. Through multiple layers of graph convolution, the signed graph convolutional network can capture graph structure information at different levels, thereby gaining a deeper understanding of the context of the user's position. After each layer of graph convolution, the representation of the node will be updated; the updated representation will comprehensively consider the positions of directly connected neighboring nodes, as well as the influence of possible neighbors at more distant layers. After multiple layers of graph convolution, the user node has a comprehensive representation vector. By applying a classifier (such as a softmax layer) to this representation vector, the user's position category on each target (such as support, opposition, or neutrality) can be inferred, forming the user's position category detection result. The corresponding calculation formula for the signed graph convolutional network is as follows:
[0086]
[0087] in represents the weighted aggregation representation based on positive edges of node i in layer l. is the weight matrix of the positive edge features of the lth layer. is the set of positive edge neighbor nodes of node i. is the influence weight of neighbor node j on node i, through Normalization was performed. Represents the feature representation of node i at the l-1 layer. Represents the feature representation of neighbor node j at the l-1 layer. is a non-linear activation function.
[0088] represents the weighted aggregation representation based on negative edges of node i in layer l. is the weight matrix of the negative edge features of the lth layer, is the set of negative edge neighbor nodes of node i.
[0089] During the training phase of the signed graph convolutional network, the parameters of the signed graph convolutional network can be adjusted through optimization algorithms such as backpropagation and gradient descent to minimize the difference between the predicted position and the true position. F1 can be used to evaluate the performance of the signed graph convolutional network.
[0090] Through the above method, the signed graph convolutional network can effectively extract stance information from the weighted undirected bipartite graph and accurately infer the user's stance category, effectively improving the generalization of the model.
[0091] In the above stance detection method, target words are determined from the words in the text posted by the user according to the importance of the words in the corresponding context to form a target word set, which can cover as many words in the text as possible that are important to the context to improve the accuracy of stance detection; each target word in the text and the target word set is input into the large language model to obtain the target prediction result of each target word; the target prediction result of the target word includes: the user's thought chain for the target word and the user's stance category and stance confidence for the target word; for any target word, the self-consistency score of the user's thought chain for the target word is obtained, and the user's stance weight for the target word is obtained based on the self-consistency score and the user's stance confidence for the target word; a weighted undirected bipartite graph is obtained with the target word as the target node, the user as the user node, the user's stance weight for the target word as the edge weight between the target node and the user node, and the user's stance category for the target word as the edge weight symbol between the target node and the user node; the weighted undirected bipartite graph is input into the signed graph convolutional network to obtain the user's stance category detection result. Since the determination of target words is related to the text, if the text changes, the determined target words may also change. Therefore, the thinking chain determined in this application is a soft target thinking chain; based on the soft target thinking chain and the signed graph convolutional network for stance classification, stance detection can be performed on fields or topics that the model has not seen, thereby improving the generalization ability of the model and improving the versatility and practicality of the model.
[0092] In one embodiment, the step S101 of determining a target word from the words in the text posted by the user according to the importance of the words in the corresponding context includes:
[0093] According to the importance of the words in the corresponding context of the text posted by the user, each word is sorted to obtain a word sequence; if the importance is greater and the ranking is higher, the word ranked earlier in the word sequence is determined as the target word; if the importance is smaller and the ranking is higher, the word ranked later in the word sequence is determined as the target word.
[0094] In this embodiment, words are ranked according to their importance in the corresponding context to obtain a word sequence. If the importance is higher, the words are ranked higher, and the first N words in the word sequence are determined as target words; if the importance is lower, the words are ranked higher, and the last N words in the word sequence are determined as target words. Where N is a positive integer greater than or equal to 1.
[0095] In one embodiment, the importance of words in the text posted by the user in the corresponding context is obtained, including Figure 3 The steps shown are: step S301, obtaining the word vector of each word in the text posted by the user; step S302, for any word, determining the words covered by the context window centered on the word, obtaining the context word set of the word, and obtaining the context vector of the word based on the word vector of the word and the word vectors of each context word in the context word set; step S303, obtaining the importance of each word in the corresponding context based on the dot product value of the word vector of each word and the corresponding context vector; the larger the dot product value, the higher the importance.
[0096] First, perform preprocessing on user-posted text, including deduplication, stop word removal, and text normalization. After preprocessing, perform word segmentation on the text to obtain multiple words. Using the bge-large-zh vector model (the bge-large-zh vector model belongs to the Chinese version of the text representation model), calculate the word vector for each word.
[0097] The coverage length of the context window can be set to 5 words.
[0098] For any word, we can determine the words covered by the context window centered on the word, and use the words other than the word as the context words of the word to form a context word set; based on the word vector of the word and the word vector of each context word in the context word set, we can get the context vector of the word.
[0099] In the above way, the context vector of each word can be obtained.
[0100] For any word, the importance of each word in the corresponding context is obtained based on the dot product value of the word vector and the context vector of the word; the larger the dot product value, the higher the importance.
[0101] In one embodiment, the context vector of the word is obtained based on the word vector of the word and the word vectors of each context word in the context word set, including: averaging the word vector of the word and the word vectors of each context word in the context word set; and determining the average result as the context vector of the word.
[0102] For any word, we can determine the context word set of the word, average the word vectors of the context words in the context word set and the word vector of the word, and determine the average result as the context vector of the word.
[0103] In one embodiment, the user's stance weight for the target word is obtained based on the self-consistency score and the user's stance confidence for the target word, including: multiplying the self-consistency score by the user's stance confidence for the target word; and determining the multiplication result as the user's stance weight for the target word.
[0104] For any target word, according to the above method, the self-consistency score of the user's thought chain for the target word can be obtained, and the self-consistency score is multiplied by the user's position confidence for the target word; the multiplication result is determined as the user's position weight for the target word.
[0105] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0106] Based on the same inventive concept, embodiments of the present application also provide a stance detection device for implementing the aforementioned stance detection method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more stance detection device embodiments provided below can be found in the aforementioned limitations of the stance detection method and will not be further elaborated here.
[0107] In one embodiment, Figure 4 As shown, a position detection device is provided, comprising:
[0108] A target word determination module 401 is configured to determine target words from the words in the text posted by the user according to the importance of the words in the corresponding context, so as to form a target word set;
[0109] Prediction module 402, configured to input the text and each target word in the target word set into a large language model to obtain a target prediction result for each target word; the target prediction result for each target word includes: the user's thought chain with respect to the target word, and the user's stance category and stance confidence with respect to the target word;
[0110] The stance weight acquisition module 403 is configured to acquire, for any target word, a self-consistency score of the user's thought chain regarding the target word, and obtain the user's stance weight for the target word based on the self-consistency score and the user's stance confidence level regarding the target word.
[0111] A graph acquisition module 404 is configured to obtain a weighted undirected bipartite graph using the target word as a target node, the user as a user node, the user's stance weight on the target word as an edge weight between the target node and the user node, and the user's stance category on the target word as an edge weight symbol between the target node and the user node;
[0112] The stance category acquisition module 405 is configured to input the weighted undirected bipartite graph into a signed graph convolutional network to obtain a stance category detection result of the user.
[0113] In one embodiment, the target word determination module 401 is also used to: sort each word in the text posted by the user according to the importance of the words in the corresponding context to obtain a word sequence; if the greater the importance, the higher the ranking, the word ranked first in the word sequence is determined as the target word; if the smaller the importance, the higher the ranking, the word ranked last in the word sequence is determined as the target word.
[0114] In one embodiment, the target word determination module 401 is further used to: obtain the word vector of each word in the text posted by the user; for any word, determine the words covered by the context window centered on the word, obtain the context word set of the word, and obtain the context vector of the word based on the word vector of the word and the word vectors of each context word in the context word set; obtain the importance of each word in the corresponding context based on the dot product value of the word vector of each word and the corresponding context vector; the larger the dot product value, the higher the importance.
[0115] In one embodiment, the target word determination module 401 is further configured to: average the word vector of the word and the word vectors of each context word in the context word set; and determine the average result as the context vector of the word.
[0116] In one embodiment, the stance weight acquisition module 403 is further configured to: multiply the self-consistency score by the user's stance confidence for the target word; and determine the multiplication result as the user's stance weight for the target word.
[0117] In one embodiment, the prediction module 402 is further configured to: obtain multiple prediction results corresponding to the target word output by the large language model according to different reasoning paths; each prediction result includes the thought chain, the stance category, and the stance confidence; divide the multiple prediction results into corresponding sets based on the consistency between the prediction results to obtain multiple prediction result sets; determine the prediction result set with the largest number of prediction results among the multiple prediction result sets to obtain a target prediction result set; and determine one of the prediction results in the target prediction result set as the target prediction result for the target word;
[0118] The stance weight acquisition module 403 is further configured to obtain a self-consistency score of the user's thought chain for the target word based on a ratio between the number of prediction results in the target prediction result set and the number of prediction results output by the large language model.
[0119] Each module in the aforementioned stance detection device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a computer device memory in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0120] In an exemplary embodiment, a computer device is provided, the internal structure of which can be as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data involved in the above method. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a position detection method is implemented.
[0121] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0122] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0123] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0124] In one embodiment, a computer program product is provided, on which a computer program is stored. The computer program is used by a processor to execute the steps in the above-mentioned various method embodiments.
[0125] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0126] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0127] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A stance detection method, characterized in that: The method comprises: According to the importance of words in the text posted by the user in the corresponding context, target words are determined from the words in the text to form a target word set; Inputting the text and each target word in the target word set into a large language model to obtain a target prediction result for each target word; the target prediction result for the target word includes: the user's thought chain for the target word and the user's stance category and stance confidence for the target word; For any target word, obtain the self-consistency score of the user's thought chain for the target word, and obtain the user's stance weight for the target word according to the self-consistency score and the user's stance confidence for the target word; A weighted undirected bipartite graph is obtained by using the target word as a target node, the user as a user node, the user's stance weight on the target word as an edge weight between the target node and the user node, and the user's stance category on the target word as an edge weight symbol between the target node and the user node; The weighted undirected bipartite graph is input into a signed graph convolutional network to obtain a stance category detection result of the user.
2. The method according to claim 1, characterized in that According to the importance of words in the text posted by the user in the corresponding context, a target word is determined from the words in the text, including: According to the importance of the words in the text posted by the user in the corresponding context, the words are sorted to obtain a word sequence; If the importance is higher and the ranking is higher, then the word ranked higher in the word sequence is determined as the target word; If the smaller the importance, the higher the ranking, then the word ranked later in the word sequence is determined as the target word.
3. The method according to claim 2, characterized in that Get the importance of words in the text posted by the user in the corresponding context, including: Get the word vector of each word in the text posted by the user; For any word, determine the words covered by the context window centered on the word, obtain the context word set of the word, and obtain the context vector of the word based on the word vector of the word and the word vectors of each context word in the context word set; According to the dot product value of each word's word vector and the corresponding context vector, the importance of each word in the corresponding context is obtained; the larger the dot product value, the higher the importance.
4. The method according to claim 3, characterized in that According to the word vector of the word and the word vectors of each context word in the context word set, the context vector of the word is obtained, including: The word vector of the word and the word vectors of each context word in the context word set are averaged; The average result is determined as the context vector for the word.
5. The method according to claim 1, characterized in that: According to the self-consistency score and the user's stance confidence for the target word, the stance weight of the user for the target word is obtained, including: multiplying the self-consistency score by the user's stance confidence with respect to the target word; The multiplication result is determined as the user's stance weight on the target word.
6. The method according to any one of claims 1 to 5, characterized in that: For any target word, the target prediction result of the target word is obtained, including: Acquire multiple prediction results corresponding to the target word output by the large language model according to different reasoning paths; each prediction result includes the thought chain, the stance category and the stance confidence; According to the consistency between the prediction results, multiple prediction results are divided into corresponding sets to obtain several prediction result sets; Among several prediction result sets, determine the prediction result set with the largest number of prediction results to obtain a target prediction result set; Determine one of the prediction results in the target prediction result set as the target prediction result of the target word; Obtaining a self-consistency score of the user's thought chain for the target word, including: According to the ratio of the number of prediction results of the target prediction result set to the number of prediction results output by the large language model, a self-consistency score of the thought chain of the user for the target word is obtained.
7. A position detection device, characterized in that: The device comprises: A target word determination module, used to determine target words from the words in the text posted by the user according to the importance of the words in the corresponding context, so as to form a target word set; A prediction module, used for inputting the text and each target word in the target word set into a large language model to obtain a target prediction result of each target word; the target prediction result of the target word includes: the thought chain of the user for the target word and the position category and position confidence of the user for the target word; A stance weight acquisition module, for acquiring, for any target word, a self-consistency score of the user's thought chain for the target word, and obtaining the user's stance weight for the target word according to the self-consistency score and the user's stance confidence for the target word; A graph acquisition module, configured to obtain a weighted undirected bipartite graph by using the target word as a target node, the user as a user node, the user's stance weight on the target word as an edge weight between the target node and the user node, and the user's stance category on the target word as an edge weight symbol between the target node and the user node; The stance category acquisition module is used to input the weighted undirected bipartite graph into a signed graph convolutional network to obtain a stance category detection result of the user.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.