User standing site detection method and system for target topic, electronic equipment and storage medium
By obtaining multimodal data from social media platforms and using knowledge graphs to expand background knowledge of target topics, the problem of low accuracy of position detection in the prior art is solved, and more comprehensive and accurate user position detection is achieved.
Patent Information
- Application Number
- CN202510017554.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-04-25
AI Technical Summary
When the existing user position detection method analyzes the user's position on the target topic, it is difficult to effectively explore the implicit relationship between the text and the target topic, and ignores data from other modalities such as pictures, resulting in poor detection accuracy.
By obtaining user text, dialogue and image speech data from social media platforms, using knowledge graphs to expand the background knowledge of the target topic, obtain relevant word sets and image sets, and perform position detection based on these data, and finally comprehensive analysis determines the user's position.
Comprehensive position detection is realized, the ability to mine topic-related semantics in the text is improved, the accuracy of position detection is enhanced, and multimodal data can be processed more effectively.
Smart Images

Figure CN119885078A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a method and system for detecting a user's stance on a target topic, an electronic device, and a computer-readable storage medium. Background Art
[0002] The development of the Internet has made users accustomed to expressing their opinions on social media platforms. Analyzing users' positions on various topics through their speeches on social media platforms, user position detection has important social, management and economic value.
[0003] At present, the commonly used user stance detection methods only analyze the semantic relationship between the user's text data and the target topic when analyzing the user's stance tendency on the target topic, which makes it difficult to effectively mine the implicit relationship between the text and the target topic, resulting in poor detection accuracy. For example, patent CN117828081A discloses a speech stance detection method, which determines the final stance based on the target similarity between the semantic representation vector of the character's speech and the semantic representation vector of the stance label. When analyzing the user's stance on the target topic, the prior art generally only analyzes the user's text data, while ignoring data from other modalities such as pictures, which also affects the accuracy of stance detection. In addition, when classifying stances, the existing user stance detection methods often use classifiers trained based on relevant data of a limited number of topics, and have poor applicability to other new topics. Summary of the invention
[0004] The present invention provides a user stance detection method and system for a target topic, an electronic device, and a computer-readable storage medium, which can realize comprehensive stance detection and improve the ability to mine topic-related semantics in a text, thereby improving the accuracy of stance detection.
[0005] According to one aspect of the present invention, a method for detecting a user's stance on a target topic is provided, comprising the following contents:
[0006] Acquire user speech data from social media platforms, where the speech data includes text speech data, dialogue speech data, and image speech data;
[0007] Get the target topic and use the knowledge graph to expand the background knowledge of the target topic to obtain a set of topic-related words and a set of topic-related images;
[0008] Based on the topic-related word set and the topic-related image set, stance detection is performed on the user's text speech data, dialogue speech data, and image speech data to obtain their corresponding stance label sets;
[0009] A comprehensive analysis is performed on the three stance tag sets to determine the user's stance detection results on the target topic.
[0010] Furthermore, the process of using the knowledge graph to expand the background knowledge of the target topic to obtain a topic-related word set and a topic-related image set includes the following:
[0011] Search the knowledge graph using the target topic as a keyword to obtain multiple initial knowledge;
[0012] Taking each initial knowledge as a root node and a relationship edge as a hop, a secondary search is performed on the knowledge graph to obtain multiple related knowledge of the initial knowledge, and a first knowledge set is constructed based on all related knowledge and its corresponding relationship chain;
[0013] Filtering the first knowledge set based on the relationship chain to obtain a second knowledge set, and adding the target topic and the plurality of initial knowledge to the second knowledge set;
[0014] The second knowledge set is deduplicated, and the knowledge in the second knowledge set is classified according to the knowledge data type to obtain a topic-related word set and a topic-related image set.
[0015] Furthermore, in the process of filtering and selecting the first knowledge set based on the relationship chain, if all the relationships in the relationship chain of a certain relevant knowledge are positive correlations, the relevant knowledge is retained and its relationship consistency type is set to positive correlation; if there is only one negative correlation relationship in the relationship chain of a certain relevant knowledge and the rest are positive correlations, the relevant knowledge is retained and its relationship consistency type is set to negative correlation; otherwise, the relevant knowledge is eliminated from the first knowledge set.
[0016] Furthermore, the process of detecting the stance of the user's text speech data includes the following:
[0017] Perform word segmentation on any text speech in the text speech data to obtain a text word set;
[0018] Filter and screen the topic-related word set to obtain a subset of topic-related words that have a semantic relationship with the text word set;
[0019] Use prompt learning and LLM large model to predict each topic-related word in the topic-related word subset and obtain the stance label corresponding to each topic-related word;
[0020] Calculate the stance score based on the stance labels corresponding to all topic-related words to obtain the stance label corresponding to the text statement;
[0021] The above process is repeated for each text speech in the text speech data in turn to obtain a set of stance labels corresponding to the user's text speech data.
[0022] Furthermore, the process of performing stance detection on the user's conversation speech data includes the following:
[0023] For any text pair in the conversation speech data, where the text pair includes: text speech of other users and conversation text made by users in response to text speech of other users; the stance label of the conversation text is predicted by using the text speech stance detection algorithm. If the predicted stance label is any one of support, opposition and neutrality, the stance label of the conversation text is used as the stance label of the text pair;
[0024] Use the text speech stance detection algorithm to predict the stance label corresponding to other users' text speech. If it is irrelevant or neutral, use the stance label corresponding to other users' text speech as the stance label of the text pair.
[0025] The dialogue stance consistency classification model is used to judge the stance consistency between the dialogue text and the text speech of other users. If the stances of the two are consistent, the stance label of the text pair is consistent with the stance label corresponding to the text speech of other users. Otherwise, the stance label of the text pair is opposite to the stance label corresponding to the text speech of other users.
[0026] The above process is performed on all text pairs in the conversation speech data in turn to obtain a set of stance labels corresponding to the user's conversation speech data.
[0027] Furthermore, the process of detecting the stance of the user's image speech data includes the following:
[0028] The image representation model is used to represent any input image in the image speech data and all related images in the topic-related image set, and the corresponding image representation vector is obtained;
[0029] Calculate the cosine similarity between the image representation vector of the input image and the image representation vectors of all related images. If the maximum similarity is greater than a preset threshold, the image is determined to be related to the target topic. Otherwise, the position label of the image is determined to be irrelevant.
[0030] The image classification model is used to predict the emotional tendency of the image, and the output result of the image classification model is mapped according to the consistency relationship type corresponding to the related image with the maximum similarity to determine the stance label of the image;
[0031] The above process is performed on all input images in the image speech data in turn to obtain a set of stance labels corresponding to the user's image speech data.
[0032] Furthermore, the text speech data includes a set of text speeches corresponding to the user's speech behavior, like behavior and forwarding behavior, the image speech data includes a set of image speeches corresponding to the user's speech behavior, like behavior and forwarding behavior, and the dialogue speech data includes a set of text pairs corresponding to the user's comment behavior and quoting behavior, wherein each text pair includes the text speeches of other users and the dialogue text made by the user in response to the text speeches of other users.
[0033] In addition, the present invention also provides a user stance detection system for a target topic, comprising:
[0034] A data collection module is used to obtain and collect user speech data from social media platforms, wherein the speech data includes text speech data, dialogue speech data and image speech data;
[0035] The knowledge expansion module is used to obtain the target topic and expand the background knowledge of the target topic using the knowledge graph to obtain a set of topic-related words and a set of topic-related images;
[0036] A stance detection module is used to perform stance detection on the user's text speech data, dialogue speech data and image speech data based on the topic-related word set and the topic-related image set, and obtain the corresponding stance label set;
[0037] The stance identification module is used to comprehensively analyze the three stance tag sets and determine the user's stance detection results on the target topic.
[0038] In addition, the present invention also provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor executes the steps of the above method by calling the computer program stored in the memory.
[0039] In addition, the present invention also provides a computer-readable storage medium for storing a computer program for detecting user stances on a target topic, wherein the computer program executes the steps of the above-mentioned method when running on a computer.
[0040] The present invention has the following beneficial effects:
[0041] The user stance detection method for the target topic of the present invention first collects the text speech data, dialogue speech data and image speech data published by the user, and after inputting the target topic, uses the knowledge graph to expand the background knowledge of the target topic, and then performs stance detection on the text speech, dialogue speech and image speech separately based on the expanded background knowledge, and finally determines the user's final stance by combining the three stance detection results. The present invention comprehensively considers the three modal data of text, dialogue and image, and can detect the user's stance on the target topic from data of different modalities, realizes comprehensive stance detection, and greatly improves the accuracy of stance detection. In addition, the knowledge graph is also used to expand the background knowledge of the target topic, which can more effectively mine the implicit information related to the target topic in the text, improve the mining ability of topic-related semantics in the text and the accuracy of text speech stance detection, thereby improving the accuracy of comprehensive stance detection.
[0042] In addition, the user stance detection system for a target topic of the present invention also has the above advantages.
[0043] In addition to the above-described purposes, features and advantages, the present invention has other purposes, features and advantages. The present invention will be further described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The drawings constituting a part of this application are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0045] Figure 1 It is a flowchart of a method for detecting a user's stance on a target topic according to a preferred embodiment of the present application;
[0046] Figure 2 yes Figure 1 Schematic diagram of the sub-process of step S2;
[0047] Figure 3 yes Figure 1 Schematic diagram of the sub-process of step S3;
[0048] Figure 4 yes Figure 1 Another sub-process diagram of step S3;
[0049] Figure 5 yes Figure 1 Another sub-process diagram of step S3;
[0050] Figure 6 It is a schematic diagram of the module structure of a user stance detection system for a target topic according to another embodiment of the present application. DETAILED DESCRIPTION
[0051] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0052] Reference Figure 1 As shown, the preferred embodiment of the present application provides a method for detecting a user's stance on a target topic, comprising the following contents:
[0053] Step S1: Acquire and collect user speech data from the social media platform, wherein the speech data includes text speech data, dialogue speech data and image speech data;
[0054] It can be understood that in step S1, the collected text speech data includes a set of text speeches corresponding to the user's speech behavior, like behavior and forwarding behavior, the image speech data includes a set of image speeches corresponding to the user's speech behavior, like behavior and forwarding behavior, and the dialogue speech data includes a set of text pairs corresponding to the user's comment behavior and citation behavior, wherein each text pair includes the text speeches of other users and the dialogue text made by the user in response to the text speeches of other users.
[0055] Specifically, the speech data of users is obtained from social media platforms through manual collection, crawler technology and other methods. The user's behavior on the social media platform includes speaking, liking, forwarding, commenting and quoting, and these behaviors can indicate their position. For example, speaking refers to the speech posted by users on their own social homepage; liking refers to the user's like of other users' speeches; forwarding refers to the user directly posting other users' speeches on their own social homepage; commenting refers to the user's comment on other users' speeches; quoting refers to the user posting other users' speeches on his or her own social homepage with his or her own speech; among them, the speech of users speaking, liking and forwarding can directly indicate the user's position, while the position of the speech published by users when commenting and quoting needs to be analyzed with the help of the original speech. Therefore, the user's speech data includes the text speech set D corresponding to the speech behavior, liking behavior and forwarding behavior. text , the image speech set D corresponding to the speaking behavior, liking behavior and forwarding behavior image , and the text pair set D corresponding to the comment behavior and the citation behavior dialogue , for example, a text pair can be represented as<d1,d2> , where d1 represents the textual speech of other users, and d2 represents the textual speech of the user regarding d1 (i.e., the conversation text).
[0056] Step S2: Obtain the target topic, and use the knowledge graph to expand the background knowledge of the target topic to obtain a topic-related word set and a topic-related image set;
[0057] It can be understood that in step S2, after the user inputs the target topic, the system uses the existing knowledge graph to expand the background knowledge of the target topic, enrich the background knowledge of the target topic, and obtain a topic-related word set and a topic-related image set, wherein the knowledge graph includes a common sense knowledge graph, a professional field knowledge graph, etc. Figure 2 As shown, the process of using the knowledge graph to expand the background knowledge of the target topic to obtain a topic-related word set and a topic-related image set includes the following:
[0058] Step S21: Search the knowledge graph using the target topic as a keyword to obtain multiple initial knowledge;
[0059] Step S22: Taking each initial knowledge as a root node and one relationship edge as a hop, a secondary search is performed on the knowledge graph to obtain multiple related knowledge of the initial knowledge, and a first knowledge set is constructed based on all related knowledge and their corresponding relationship chains;
[0060] Step S23: filtering the first knowledge set based on the relationship chain to obtain a second knowledge set, and adding the target topic and the plurality of initial knowledge to the second knowledge set;
[0061] Step S24: performing deduplication processing on the second knowledge set, and classifying the knowledge in the second knowledge set according to the knowledge data type, to obtain a topic-related word set and a topic-related image set.
[0062] Specifically, step S2 is the process of expanding the background knowledge of the topic through the knowledge graph, with the input being the target topic and the output being the topic-related word set T word = (e, r, htop) and topic-related image set T image = (f, r, htop), where e represents textual knowledge such as entity names and concept names, f represents image knowledge, r represents the relationship consistency type, which is divided into positive correlation and negative correlation, and htop represents the number of graph retrieval hops, that is, the number of relationship edges between two knowledge nodes in the graph. In addition, based on whether the relationship can express consistency, the relationships defined in the knowledge graph ontology are reclassified into three categories: positive correlation, negative correlation, and other relationships. Among them, the relationship type that can clearly express knowledge consistency is a positive correlation relationship, such as synonyms and nicknames; the relationship type that can clearly express knowledge inconsistency is a negative correlation relationship, such as antonyms and competitive relationships; and the relationship that cannot clearly express whether the knowledge is consistent is other relationships. Among them, the process of expanding the background knowledge of the target topic includes the following:
[0063] First, the knowledge graph is searched with the target topic as a keyword to retrieve multiple initial knowledge. Specifically, the target topic is used as a keyword to search in the existing knowledge graph to obtain multiple related initial knowledge, which are sorted according to similarity, and the top n with the highest similarity are selected as the initial knowledge of the target topic.
[0064] Then, take these n initial knowledge as root nodes and one relationship edge as one hop, expand the number of entries from 1 to m, and retrieve the knowledge graph to obtain i-hop related knowledge of each initial knowledge, where i represents the number of query hops, 1≤i≤m. In this way, the first knowledge set can be constructed based on all related knowledge and its corresponding relationship chains, which can be expressed as T1=(k, start→end), where k is the related knowledge, and start→end represents the relationship chain, which records the query path from the initial knowledge to the knowledge k. The values of m and n are both greater than or equal to 1 and are set manually.
[0065] Next, according to the relationship chain corresponding to each relevant knowledge, the first knowledge is combined with T1 to filter and screen, and the second knowledge set T2=(k, r, htop) is obtained. The purpose of this is to find out the knowledge that is positively correlated and negatively correlated with the target topic for subsequent position detection. If it is positively correlated, the position is considered to be consistent in the position detection, and if it is negatively correlated, the position is considered to be opposite in the position detection. In the process of filtering and screening the first knowledge set based on the relationship chain, according to the division rules of the relationship in the above-mentioned knowledge graph, each relationship in the relationship chain is mapped to a positive correlation, a negative correlation or other relationship. If all the relationships in the relationship chain of a certain relevant knowledge are positive correlations, the relevant knowledge is retained, and its relationship consistency type r is set to positive correlation; if there is only one negative correlation in the relationship chain of a certain relevant knowledge, and the rest are positive correlations, the relevant knowledge is retained, and its relationship consistency type r is set to negative correlation; otherwise, the relevant knowledge is eliminated from the first knowledge set, thereby obtaining the second knowledge set T2=(k, r, htop). In addition, the target topic and n initial knowledge also need to be added to the second knowledge set T2, where the r corresponding to the target topic is positively correlated and htop is 0, while the r corresponding to the initial knowledge is positively correlated and htop is 1. It should be noted that the reason for adopting the above-mentioned relationship division rule in the knowledge graph is that if the relationship chain of a certain related knowledge is all positively correlated, it must be positively correlated; if a relationship chain of a certain related knowledge has a negative correlation, it must be negatively correlated; in addition, considering that if there are two or more negative correlations in the relationship chain, the judgment will be more complicated, so when this happens, this piece of knowledge will be eliminated.
[0066] Finally, the duplicate knowledge in the second knowledge set T2 is removed, and the knowledge in the second knowledge set T2 is classified according to the data type of the knowledge, so as to obtain the topic-related word set T word And the topic related image set T image .
[0067] In addition, if it is necessary to expand the background knowledge of the target topic based on multiple knowledge graphs, perform the above operation on each knowledge graph in turn, and then merge multiple topic-related word sets and topic-related image sets respectively.
[0068] It can be understood that the present invention uses the existing knowledge graph to expand the background knowledge of the target topic, which can more effectively mine the implicit information related to the target topic in the text, greatly improves the ability to mine topic-related semantics in the text, and is conducive to improving the accuracy of text speech stance detection.
[0069] Step S3: Based on the topic-related word set and the topic-related image set, stance detection is performed on the user's text speech data, dialogue speech data, and image speech data to obtain the stance label sets corresponding to each of them;
[0070] It can be understood that in step S3, based on the topic-related word set and topic-related image set obtained by background knowledge expansion in step S2 and the text speech data, dialogue speech data and image speech data collected in step S1, the stance labels of the user text speech data, user dialogue speech data and user image speech data for the target topic are detected respectively. Among them, the types of stance labels include support, opposition, neutrality and irrelevant. Support means that the user pays attention to the target topic and presents a supportive attitude, opposition means that the user pays attention to the target topic and presents an opposing attitude, neutrality means that the user pays attention to the target topic but does not express a supportive or opposing attitude, and irrelevant means that the user does not pay attention to the topic, that is, does not mention the topic.
[0071] Among them, Figure 3 As shown in FIG. 1 , the process of detecting the stance of a user's text speech data includes the following:
[0072] Step S31a: performing word segmentation processing on any text speech in the text speech data to obtain a text word set;
[0073] Step S32a: filtering and screening the topic-related word set to obtain a subset of topic-related words that have a semantic relationship with the text word set;
[0074] Step S33a: using prompt learning and the LLM large model to predict each topic-related word in the topic-related word subset, and obtaining a stance label corresponding to each topic-related word;
[0075] Step S34a: Calculate the stance score based on the stance labels corresponding to all topic-related words to obtain the stance label corresponding to the text speech;
[0076] Step S35a: Repeat the above process for each text speech in the text speech data in turn to obtain a set of stance labels corresponding to the user's text speech data.
[0077] Specifically, the input of the text speech stance detection algorithm is the user's text speech set D text and topic related words set T word , the output is the position label set L corresponding to the text speech data text .
[0078] First, use the word segmentation tool to perform word segmentation on any text speech in the text speech set Dtext, remove stop words, and obtain the text word set W corresponding to the text speech. In addition, in order to prevent the loss of entity information in the text speech, the named entity recognition model can also be used to identify the entities in the text speech, and the entity names are added to the text word set W. It should be noted that "stop words" are professional terms in the field of natural language processing, which refer to words that are considered to have no practical meaning or have little effect on the analysis results in text processing, and are usually removed in the text preprocessing stage. Generally speaking, stop words can be prepositions, conjunctions, auxiliary words, etc. that do not contain information for related tasks.
[0079] Then, the topic-related word set Tword is filtered and screened to obtain a topic-related word subset Tin that has a semantic relationship with the text word set. The specific filtering and screening process is as follows: for the topic-related word set Tword, word The i-th topic-related word e in i , calculate e respectively i The similarity between the topic-related word and each word in the text word set W is calculated, and the maximum similarity is taken. If the maximum similarity is greater than the preset threshold, it indicates that the topic-related word has a semantic relationship with the text speech, and it is added to T in . The preset threshold is set manually. The specific similarity calculation can be performed by using the word2vec text representation model to represent the word to obtain the word vector, and then calculating the cosine similarity between the word vectors to obtain the similarity between the words. The Pearson correlation coefficient, Hamming distance, Euclidean distance and other similarity calculation methods can also be used. In addition, if all topic-related words have no semantic relationship with the text speech, then the topic-related word subset T in Include only target topics.
[0080] Next, we use the hint learning and LLM (Large Language Model) model to learn the topic-related word subset T inWe predict each topic-related word in the text, and obtain the position label corresponding to each topic-related word, so as to construct the position label set {label1,…,label n}, n represents the topic-related word subset T in The number of topic-related words included. Among them, prompt learning is a technology that provides clear and explicit prompts to the large language model in the hope of obtaining specific outputs. It is an existing technology and will not be described here. For example, for the i-th topic-related word, the task information description, text, and topic words are integrated into the natural language question, and the question is input into the LLM model. The LLM model analyzes the semantics of the question and outputs the model position label label model ; Get the stance label label output by the model model Then, according to the relationship consistency type r corresponding to the topic-related words i Label the model position label model Mapping is performed to obtain the final position label label i , where the mapping rule is: when r i When it is positively correlated, label i =label model ; When r i When the correlation is negative, if label model = support, then label i = Oppose, if label model = Oppose, then label i = Support, in other cases, label i =label model . It can be understood that, as an example, the prompt question can be constructed as: Please judge whether the position of the input text on {topic_word} is support, opposition, neutral, or irrelevant, and output one of these four labels, replace {topic_word} with topic-related words, and replace the input text {input_text} with text speech. It can be understood that the present invention uses the LLM model to detect the position label of the text on the target topic, and utilizes the rich semantic knowledge and powerful semantic understanding ability contained in the LLM model, which can comprehensively and accurately analyze the semantic relationship between the target topic and the text, and improve the recognition effect and field applicability.
[0081] In addition, in order to enhance the LLM model's ability to understand such problems and improve the model's prediction effect, you can also increase the information in the prompt question, such as adding role prompts or input examples; collect a small amount of training data, and fine-tune the instructions of the large model.
[0082] Finally, the scores corresponding to each stance type are calculated based on the stance labels of the topic-related words, and the stance type with the largest score is taken as the stance label of the text speech. The score calculation formula is:
[0083]
[0084] Among them, S L represents the score of the stance type L, and n represents the subset of topic-related words T in The number of topic-related words in label i represents the stance label corresponding to the i-th topic-related word, Indicates that if label i If it is equal to L, the value is 1, otherwise the value is 0. i represents the number of graph search hops corresponding to the i-th topic-related word, and k represents the attenuation coefficient, whose value can be set manually or learned through a neural network. It can be understood that the above operations are performed on each text speech in turn to obtain the position label set corresponding to the user's text speech data.
[0085] In addition, if Figure 4 As shown in FIG. 1 , the process of detecting the stance of the user's conversation speech data includes the following:
[0086] Step S31b: for any text pair in the conversation speech data, where the text pair includes: text speech of other users, and conversation text made by users in response to text speech of other users; using a text speech stance detection algorithm to predict the stance label of the conversation text, if the predicted stance label is any one of support, opposition and neutral, then using the stance label of the conversation text as the stance label of the text pair;
[0087] Step S32b: using a text speech stance detection algorithm to predict stance labels corresponding to other users' text speeches; if the stance labels are irrelevant or neutral, using stance labels corresponding to other users' text speeches as stance labels for the text pair;
[0088] Step S33b: using the dialogue stance consistency classification model to determine the stance consistency between the dialogue text and the text speech of other users; if the stances of the two are consistent, the stance label of the text pair is consistent with the stance label corresponding to the text speech of other users; otherwise, the stance label of the text pair is opposite to the stance label corresponding to the text speech of other users;
[0089] Step S34b: Execute the above process for all text pairs in the conversation speech data in turn to obtain a set of stance labels corresponding to the user's conversation speech data.
[0090] Specifically, the input of the dialogue speech stance detection algorithm is the text pair set Ddialogue and topic related words set T word The output is the position label set L corresponding to the dialogue speech data dialogue Based on the definition of the conversation speech data in step S1, d1 represents the text speech of other users, and d2 represents the conversation text of the user regarding d1. The process of the conversation speech stance detection algorithm is as follows: First, for any text pair in the conversation speech data,<d1,d2> First, a text speech stance detection algorithm is used to predict the stance label of the dialogue text d2 for the target topic. If it is any one of support, opposition and neutral, the stance label of the dialogue text d2 is used as the stance label of the text pair, otherwise, the next step is executed; a text speech stance detection algorithm is used to predict the stance label of other users' text speech d1 for the target topic. If it is irrelevant or neutral, the stance label of d1 is used as the stance label of the text pair, otherwise, the next step is executed; a dialogue stance consistency classification model is used to determine whether the stances of d1 and d2 are consistent. If they are consistent, the stance label of the text pair is consistent with the stance label of d1, otherwise, the stance label of the text pair is opposite to the stance label of d1, that is, if the stance label of d1 is support, the stance label of the text pair is opposition, and if the stance label of d1 is opposition, the stance label of the text pair is support. The process of using the dialogue stance consistency classification model to determine whether the stances of d1 and d2 are consistent is as follows: using the pre-trained language model Bert (Bidirectional Encoder Representations from Transformers) for encoding, the input of the model is [CLS]d1[SEP]d2[SEP], [CLS] and [SEP] are special words defined by Bert, representing the input start marker word and sentence interval, and the end marker word, respectively. Bert generates a representation vector containing semantic information for each input word, and inputs the corresponding representation vector of [CLS] into a binary classifier to determine whether the stances of d1 and d2 are consistent. Finally, the above process is performed on all text pairs in the dialogue speech data in turn to obtain the stance label set corresponding to the user's dialogue speech data. The specific text speech stance detection algorithm is as described in the above steps S31a to S33a, which will not be repeated here.
[0091] In addition, if Figure 5 As shown in FIG. 1 , the process of detecting the stance of the user's image speech data includes the following:
[0092] Step S31c: using the image representation model to represent any input image in the image speech data and all related images in the topic-related image set, respectively, to obtain corresponding image representation vectors;
[0093] Step S32c: Calculate the cosine similarity between the image representation vector of the input image and the image representation vectors of all related images. If the maximum similarity is greater than a preset threshold, the image is determined to be related to the target topic. Otherwise, the position label of the image is determined to be irrelevant.
[0094] Step S33c: using the image classification model to predict the emotional tendency of the image, and mapping the output result of the image classification model according to the consistency relationship type corresponding to the related image with the maximum similarity, to determine the stance label of the image;
[0095] Step S34c: Execute the above process on all input images in the image comment data in turn to obtain a set of stance labels corresponding to the user's image comment data.
[0096] Specifically, the input of the image speech stance detection algorithm is the user image speech data D image And the topic related image set T image , the output is the position label set L corresponding to the image speech data image First, use an image representation model (such as the CLIP model) to represent any input image I in the image speech data. input And the topic related image set T image All relevant images in are represented to obtain the corresponding image representation vector; then, I is calculated in sequence input The cosine similarity between the image representation vectors of all related images, taking the maximum similarity and the relationship consistency type r corresponding to the related image max , if the maximum similarity is greater than the preset threshold, the image is judged to be related to the target topic, otherwise the position label of the image is judged to be irrelevant; then the image classification model is used to predict I input The emotional tendency of the image is positive, negative and neutral, respectively, for the support, opposition and neutrality in the stance label, the output result of the image classification model is obtained. input Model position label label model Then, according to the consistency relationship type r corresponding to the related image with the maximum similarity max Map the output results of the image classification model. The mapping rule is: when r max When it is positively correlated, label=label model ; When r max When the correlation is negative, if label model = support, then label = oppose, if label model = oppose, label=support; in other cases, label=label modelFinally, the above process is performed on all input images in the image speech data in turn to obtain the stance label set corresponding to the user's image speech data. It should be noted that the preset threshold is manually set; the image representation model and the image classification model are existing technologies, and their specific model structures are not described here.
[0097] Step S4: Comprehensively analyze the three stance tag sets to determine the user's stance detection result on the target topic.
[0098] It can be understood that in step S4, the three stance label sets are comprehensively analyzed to determine the user's stance detection result on the target topic, and the input is the stance label set L corresponding to the text speech data. text , the position label set L corresponding to the dialogue speech data dialogue The position label set L corresponding to the image speech data image , the output is the user's stance label. The specific comprehensive analysis process is as follows: Summarize the statistics L text , L dialogue and L image The number of labels of support, opposition, neutrality, and irrelevant is calculated. If the number of labels of support, opposition, and neutrality is 0, the user's position label is irrelevant; otherwise, the total number of labels of support, opposition, and neutrality is called the number of valid labels. The category with the largest number of valid labels is taken as the user label category, and the user's final position label can be determined.
[0099] It can be understood that the user stance detection method for the target topic of this embodiment first collects the text speech data, dialogue speech data and image speech data published by the user, and after inputting the target topic, uses the knowledge graph to expand the background knowledge of the target topic, and then performs stance detection on the text speech, dialogue speech and image speech separately based on the expanded background knowledge, and finally determines the user's final stance by combining the three stance detection results. The present invention comprehensively considers the three modal data of text, dialogue and image, and can detect the user's stance on the target topic from data of different modalities, realizes comprehensive stance detection, and greatly improves the accuracy of stance detection. In addition, the knowledge graph is also used to expand the background knowledge of the target topic, which can more effectively mine the implicit information related to the target topic in the text, improve the mining ability of topic-related semantics in the text and the accuracy of text speech stance detection, thereby improving the accuracy of comprehensive stance detection.
[0100] In addition, if Figure 6 As shown, another embodiment of the present invention further provides a user stance detection system for a target topic, preferably using the user stance detection method for a target topic as described above, including:
[0101] A data collection module is used to obtain and collect user speech data from social media platforms, wherein the speech data includes text speech data, dialogue speech data and image speech data;
[0102] The knowledge expansion module is used to obtain the target topic and expand the background knowledge of the target topic using the knowledge graph to obtain a set of topic-related words and a set of topic-related images;
[0103] A stance detection module is used to perform stance detection on the user's text speech data, dialogue speech data and image speech data based on the topic-related word set and the topic-related image set, and obtain the corresponding stance label set;
[0104] The stance identification module is used to comprehensively analyze the three stance tag sets and determine the user's stance detection results on the target topic.
[0105] It can be understood that the user stance detection system for the target topic of this embodiment first collects the text speech data, dialogue speech data and image speech data published by the user, and after inputting the target topic, uses the knowledge graph to expand the background knowledge of the target topic, and then performs stance detection on the text speech, dialogue speech and image speech separately based on the expanded background knowledge, and finally determines the user's final stance by combining the three stance detection results. The present invention comprehensively considers the three modal data of text, dialogue and image, and can detect the user's stance on the target topic from data of different modalities, realizes comprehensive stance detection, and greatly improves the accuracy of stance detection. In addition, the knowledge graph is also used to expand the background knowledge of the target topic, which can more effectively mine the implicit information related to the target topic in the text, improve the ability to mine topic-related semantics in the text and the accuracy of text speech stance detection, thereby improving the accuracy of comprehensive stance detection.
[0106] It can be understood that the various modules of the system embodiment correspond to the various steps of the above method embodiment, so the specific working principles of each module are not repeated here, and the corresponding references can be made to the various steps of the above method embodiment.
[0107] In addition, another embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and the processor executes the steps of the above method by calling the computer program stored in the memory.
[0108] In addition, another embodiment of the present invention further provides a computer-readable storage medium for storing a computer program for detecting user stances for a target topic, wherein the computer program executes the steps of the above method when running on a computer.
[0109] Common computer-readable storage media include: floppy disks, flexible disks, hard disks, magnetic tapes, any other magnetic media, CD-ROMs, any other optical media, punch cards, paper tapes, any other physical media with patterns of holes, random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), flash-erasable programmable read-only memory (FLASH-EPROM), any other memory chip or cartridge, or any other medium that can be read by a computer. Instructions can further be transmitted or received by a transmission medium. The term transmission medium may include any tangible or intangible medium that can be used to store, encode or carry instructions for execution by a machine, and includes digital or analog communication signals or intangible media that facilitate communication of the above instructions. Transmission media include coaxial cables, copper wire, and optical fiber, including the wires of a bus used to transmit a computer data signal.
[0110] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product 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 codes. The schemes in the embodiments of the present application may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0111] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0112] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0113] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0114] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0115] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0116] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for detecting user stance on a target topic, characterized in that: Includes the following: Acquire user speech data from social media platforms, where the speech data includes text speech data, dialogue speech data, and image speech data; Get the target topic and use the knowledge graph to expand the background knowledge of the target topic to obtain a set of topic-related words and a set of topic-related images; Based on the topic-related word set and the topic-related image set, stance detection is performed on the user's text speech data, dialogue speech data, and image speech data to obtain their corresponding stance label sets; A comprehensive analysis is performed on the three stance tag sets to determine the user's stance detection results on the target topic.
2. The method for detecting user stance on a target topic according to claim 1, characterized in that: The process of using the knowledge graph to expand the background knowledge of the target topic to obtain a topic-related word set and a topic-related image set includes the following: Search the knowledge graph using the target topic as a keyword to obtain multiple initial knowledge; Taking each initial knowledge as a root node and a relationship edge as a hop, a secondary search is performed on the knowledge graph to obtain multiple related knowledge of the initial knowledge, and a first knowledge set is constructed based on all related knowledge and its corresponding relationship chain; Filtering the first knowledge set based on the relationship chain to obtain a second knowledge set, and adding the target topic and the plurality of initial knowledge to the second knowledge set; The second knowledge set is deduplicated, and the knowledge in the second knowledge set is classified according to the knowledge data type to obtain a topic-related word set and a topic-related image set.
3. The method for detecting user stance on a target topic according to claim 2, characterized in that: In the process of filtering and selecting the first knowledge set based on the relationship chain, if all the relationships in the relationship chain of a certain relevant knowledge are positive correlations, the relevant knowledge is retained, and its relationship consistency type is set to positive correlation; If there is only one negative correlation in the relationship chain of a certain related knowledge and the rest are positive correlations, the related knowledge is retained and its relationship consistency type is set to negative correlation; otherwise, the related knowledge is removed from the first knowledge set.
4. The method for detecting user stance on a target topic according to claim 1, characterized in that: The process of stance detection for user's text speech data includes the following: Perform word segmentation on any text speech in the text speech data to obtain a text word set; Filter and screen the topic-related word set to obtain a subset of topic-related words that have a semantic relationship with the text word set; Use prompt learning and LLM large model to predict each topic-related word in the topic-related word subset and obtain the stance label corresponding to each topic-related word; Calculate the stance score based on the stance labels corresponding to all topic-related words to obtain the stance label corresponding to the text statement; The above process is repeated for each text speech in the text speech data in turn to obtain a set of stance labels corresponding to the user's text speech data.
5. The method for detecting user stance on a target topic according to claim 1, characterized in that: The process of stance detection for user conversation speech data includes the following: For any text pair in the conversation speech data, where the text pair includes: text speech of other users and conversation text made by users in response to text speech of other users; the stance label of the conversation text is predicted by using the text speech stance detection algorithm. If the predicted stance label is any one of support, opposition and neutrality, the stance label of the conversation text is used as the stance label of the text pair; Use the text speech stance detection algorithm to predict the stance label corresponding to other users' text speech. If it is irrelevant or neutral, use the stance label corresponding to other users' text speech as the stance label of the text pair. The dialogue stance consistency classification model is used to judge the stance consistency between the dialogue text and the text speech of other users. If the stances of the two are consistent, the stance label of the text pair is consistent with the stance label corresponding to the text speech of other users. Otherwise, the stance label of the text pair is opposite to the stance label corresponding to the text speech of other users. The above process is performed on all text pairs in the conversation speech data in turn to obtain a set of stance labels corresponding to the user's conversation speech data.
6. The method for detecting user stance on a target topic according to claim 1, characterized in that: The process of detecting the stance of a user's image speech data includes the following: The image representation model is used to represent any input image in the image speech data and all related images in the topic-related image set, and the corresponding image representation vector is obtained; Calculate the cosine similarity between the image representation vector of the input image and the image representation vectors of all related images. If the maximum similarity is greater than a preset threshold, the image is determined to be related to the target topic. Otherwise, the position label of the image is determined to be irrelevant. The image classification model is used to predict the emotional tendency of the image, and the output result of the image classification model is mapped according to the consistency relationship type corresponding to the related image with the maximum similarity to determine the stance label of the image; The above process is performed on all input images in the image speech data in turn to obtain a set of stance labels corresponding to the user's image speech data.
7. The method for detecting user stance on a target topic according to claim 1, characterized in that: The text speech data includes the set of text speeches corresponding to the user's speech behavior, like behavior and forwarding behavior; the image speech data includes the set of image speeches corresponding to the user's speech behavior, like behavior and forwarding behavior; the dialogue speech data includes the set of text pairs corresponding to the user's comment behavior and quoting behavior, wherein each text pair includes the text speeches of other users and the dialogue text of the user in response to the text speeches of other users.
8. A user stance detection system for a target topic, characterized in that: include: A data collection module is used to obtain and collect user speech data from social media platforms, wherein the speech data includes text speech data, dialogue speech data and image speech data; The knowledge expansion module is used to obtain the target topic and expand the background knowledge of the target topic using the knowledge graph to obtain a set of topic-related words and a set of topic-related images; A stance detection module is used to perform stance detection on the user's text speech data, dialogue speech data and image speech data based on the topic-related word set and the topic-related image set, and obtain the corresponding stance label set; The stance identification module is used to comprehensively analyze the three stance tag sets and determine the user's stance detection results on the target topic.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and the processor executes the steps of the method according to any one of claims 1 to 7 by calling the computer program stored in the memory.
10. A computer-readable storage medium for storing a computer program for detecting user stances on a target topic, characterized in that: When the computer program is run on a computer, the steps of the method according to any one of claims 1 to 7 are executed.
Citation Information
Cited By
Multi-mode vertical field detection method based on multi-agent cooperation
CN121256690A
A multi-modal stance detection method based on multi-agent collaboration
CN121256690B