Position analysis model training method, position analysis method, device and equipment
By converting the text data in network public opinion analysis into coding vectors, integrating emotional word vectors, and adjusting the position analysis model parameters, the problem of difficulty in accurately judging the position tendency of text content in the prior art is solved, and the analysis accuracy and consideration of topic relationships are improved.
Patent Information
- Application Number
- CN202210401783.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2042-04-18
AI Technical Summary
When conducting online public opinion analysis, it is difficult to accurately judge the positional tendency of text content to specific target topics, especially when the relationship between emotional words and text topics is insufficient.
By obtaining the training text data list, converting it into an encoded vector, and obtaining the emotional word vector in the text content, fusing the two and entering the position analysis model, adjusting the model parameters to improve the analysis accuracy.
The performance of the position analysis model is improved, the position on text topics can be more accurately analyzed, and the consideration of the relationship between text topics and content is enhanced.
Smart Images

Figure CN114970556B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of deep learning and artificial intelligence technology, and more specifically to a stance analysis model training method, a stance analysis method, a stance analysis model training device, a stance analysis device, equipment, medium, and program product. Background Art
[0002] With the rapid development of the Internet, public opinion on social networks can reflect the trend of public opinion in the whole society to a certain extent. With the explosive growth of the number of users and information on social networks, how to mine and analyze these massive data has become very critical. Therefore, in recent years, the use of machine learning technology to automatically analyze online public opinion has attracted the attention of many companies and scholars, and has also promoted the rise and development of stance detection research. Stance detection can be regarded as an improvement on the sentiment analysis task for a specific target topic.
[0003] The stance detection task uses natural language processing technology to analyze the stance of the current text content on the target topic, such as "support", "oppose" or "neutral". It seems similar to sentiment analysis, but sentiment analysis focuses on the polarity of sentimental features in a text, while stance detection is to judge the stance of the text based on a given target topic. In many cases, it is impossible to judge the stance classification based solely on the sentiment polarity of the text. Summary of the invention
[0004] In view of the above problems, the present disclosure provides a stance analysis model training method, a stance analysis method, a stance analysis model training device, a stance analysis device, an apparatus, a medium and a program product.
[0005] According to a first aspect of the present disclosure, a stance analysis model training method is provided, comprising:
[0006] Obtaining a training text data list, wherein the training text data list includes at least: text identifier, position label, text topic, and text content;
[0007] Convert the training text data list into an encoded vector;
[0008] When the text content contains sentiment words, obtain the sentiment word vector of the sentiment word;
[0009] Fuse the encoding vector and the sentiment word vector to obtain a fused vector;
[0010] Input the fused vector into the stance analysis model to be trained, and output the training analysis result; and
[0011] The model parameters of the stance analysis model are adjusted based on the training analysis results and the stance labels to obtain a trained stance analysis model.
[0012] According to an embodiment of the present disclosure, the stance analysis model training method further includes:
[0013] Evaluate the trained stance analysis model and obtain evaluation results;
[0014] If the evaluation results do not meet the preset results, adjust the model parameters of the trained stance analysis model again; or
[0015] When the evaluation results meet the preset results, the trained stance analysis model is determined as the final stance analysis model.
[0016] According to an embodiment of the present disclosure, the trained stance analysis model is evaluated, and the evaluation results obtained include:
[0017] Based on the test text, use the trained stance analysis model to obtain the test stance label;
[0018] Annotating the test text to obtain a predicted span of the stance evidence representing the test text, wherein the predicted span of the stance evidence includes: a start position of the stance evidence and an end position of the stance evidence;
[0019] Determine the predicted stance label of the test text according to the prediction span of the stance evidence;
[0020] The evaluation results are obtained based on the predicted stance labels and the test stance labels.
[0021] According to an embodiment of the present disclosure, converting a training text data list into an encoding vector includes:
[0022] Use question-answering systems to convert text data lists into question and answer formats;
[0023] Encode the converted text data list to obtain the encoded vector.
[0024] A second aspect of the present disclosure provides a stance analysis method, comprising:
[0025] Obtaining a list of text data to be analyzed, wherein the list of text data to be analyzed at least includes: text identifiers, text topics, and text contents;
[0026] Convert the text data list to be analyzed into an encoding vector;
[0027] When the text content contains sentiment words, obtain the sentiment word vector of the sentiment word;
[0028] Fusing the encoding vector and the sentiment word vector to obtain a fused vector; and
[0029] The fusion vector is input into a trained stance analysis model, and an analysis result is output, wherein the trained stance analysis model is trained according to a stance analysis model training method.
[0030] A third aspect of the present disclosure provides a stance analysis model training device, comprising:
[0031] A first acquisition module is used to acquire a training text data list, wherein the training text data list at least includes: text identifiers, stance labels, text topics, and text contents;
[0032] A first encoding module, used to convert a training text data list into an encoding vector;
[0033] The second acquisition module is used to acquire the sentiment word vector of the sentiment word when the text content contains the sentiment word;
[0034] The first fusion module is used to fuse the encoding vector and the sentiment word vector to obtain a fusion vector;
[0035] A first analysis module, used for inputting the fusion vector into the stance analysis model to be trained and outputting the training analysis result; and
[0036] The parameter adjustment module is used to adjust the model parameters of the stance analysis model based on the training analysis results and the stance labels to obtain the trained stance analysis model.
[0037] A fourth aspect of the present disclosure provides a stance analysis device, comprising:
[0038] A third acquisition module is used to acquire a list of text data to be analyzed, wherein the list of text data to be analyzed at least includes: text identifiers, text topics, and text contents;
[0039] A second encoding module, used for converting the text data list to be analyzed into an encoding vector;
[0040] The fourth acquisition module is used to acquire the sentiment word vector of the sentiment word when the text content contains the sentiment word;
[0041] A second fusion module is used to fuse the encoding vector and the sentiment word vector to obtain a fusion vector; and
[0042] The second analysis module is used to input the fusion vector into a trained stance analysis model and output an analysis result, wherein the trained stance analysis model is trained according to a stance analysis model training method.
[0043] A fifth aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned stance analysis model training method and stance analysis method.
[0044] The sixth aspect of the present disclosure further provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above-mentioned stance analysis model training method and stance analysis method.
[0045] The seventh aspect of the present disclosure also provides a computer program product, including a computer program, which implements the above-mentioned stance analysis model training method and stance analysis method when executed by a processor.
[0046] According to the embodiments of the present disclosure, the present disclosure fully considers the relationship between text topics and text content by converting text identifiers, stance labels, text topics, and text content into vectors, and using sentiment words in the text content as auxiliary; and considers that when only sentiment words are used as features, the classification of stances is not ideal, and emotions cannot accurately reflect stance tendencies, and sentiment words are often closely related to text topics in the text; and further improves the performance of the stance analysis model. According to the training analysis results and stance labels output by the stance analysis model to be trained, fitting learning is performed, and the finally trained stance analysis model has high model accuracy, which can be applied to stance analysis to accurately analyze stances for text topics. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0048] Figure 1 A diagram schematically shows an application scenario of a stance analysis model training method, a stance analysis method, an apparatus, a device, a medium, and a program product according to an embodiment of the present disclosure;
[0049] Figure 2 A flowchart of a stance analysis model training method according to an embodiment of the present disclosure is schematically shown;
[0050] Figure 3 A flowchart of a stance analysis model training method according to another embodiment of the present disclosure is schematically shown;
[0051] Figure 4 A flowchart of a standpoint analysis method according to an embodiment of the present disclosure is schematically shown;
[0052] Figure 5A schematic diagram of a standpoint analysis according to an embodiment of the present disclosure is schematically shown;
[0053] Figure 6 The structural block diagram of the stance analysis model training device according to the embodiment of the present disclosure is schematically shown;
[0054] Figure 7 A schematic diagram of a structural block diagram of a standpoint analysis device according to an embodiment of the present disclosure is shown; and
[0055] Figure 8 A block diagram of an electronic device suitable for implementing a stance analysis model training method and a stance analysis method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0056] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0057] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0058] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0059] When using expressions such as "at least one of A, B and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by technical personnel in this field (for example, "a system having at least one of A, B and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0060] In the technical solution disclosed in the present invention, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations, necessary confidentiality measures are taken, and do not violate public order and good morals.
[0061] The stance detection task has one more important target topic feature than sentiment analysis. For example, "I hate these soliciters the most! And those who drive on the motor vehicle lane!", when this text does not consider any target topic, its sentiment polarity is negative, but when it comes to the topic of "Shenzhen bans motorcycles and limits electricity", the stance of this microblog should be "support". When implementing this disclosure, it was found that in stance detection research, the target topic is often directly ignored and only the text content is processed similar to sentiment analysis.
[0062] For the stance detection task, the methods used by researchers mainly include machine learning methods based on feature engineering and deep learning methods based on neural networks. Some extract sentiment words and topic words from microblog texts as feature words, then train word vectors for feature words through Word2Vec, and take the average of word vectors as text features and input them into the SVM classifier for stance classification. Experiments show that when only sentiment words are used as features, the stance classification is not ideal, and emotions cannot accurately reflect the author's stance tendency.
[0063] Compared with machine learning methods based on feature engineering, the advantage of deep learning is that it does not require complex manual feature extraction. Instead, it maps all text content into vectors and then uses multi-layer neural networks to fit labels to automatically learn text features. The work based on deep learning mainly improves the stance detection effect by adding target topic information to text content in different ways and by modifying the neural network structure.
[0064] The convolutional neural network is used to classify Weibo texts. It uses a model voting mechanism to fuse the results of each model generated during training. After each epoch of training, some test set data will be iterated to predict the label. The final result of the test set is that after all epochs are iterated, the label with the most predicted times is selected as the final result for each data. However, it only extracts and classifies features for Weibo texts, and ignores the role of the target topic in stance detection.
[0065] Based on this, an embodiment of the present disclosure provides a stance analysis model training method, including: obtaining a training text data list, wherein the training text data list includes at least: text identifiers, stance labels, text topics, and text content; converting the training text data list into a coding vector; when the text content contains sentiment words, obtaining the sentiment word vector of the sentiment word; fusing the coding vector and the sentiment word vector to obtain a fused vector; inputting the fused vector into the stance analysis model to be trained and outputting the training analysis results; and adjusting the model parameters of the stance analysis model based on the training analysis results and the stance labels to obtain a trained stance analysis model.
[0066] Figure 1 The application scenario diagram of the stance analysis model training method, stance analysis method, apparatus, device, medium and program product according to the embodiments of the present disclosure is schematically shown.
[0067] like Figure 1 As shown, the application scenario 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0068] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as financial product applications, shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0069] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0070] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0071] It should be noted that the stance analysis model training method and stance analysis method provided in the embodiments of the present disclosure can generally be executed by the server 105. Accordingly, the stance analysis model training device and stance analysis device provided in the embodiments of the present disclosure can generally be arranged in the server 105. The stance analysis model training method and stance analysis method provided in the embodiments of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the stance analysis model training device and stance analysis device provided in the embodiments of the present disclosure can also be arranged in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.
[0072] The stance analysis model training method and stance analysis method provided in the embodiments of the present disclosure may also be executed by the terminal devices 101, 102, and 103. Accordingly, the stance analysis model training device and stance analysis device provided in the embodiments of the present disclosure may also be generally provided in the terminal devices 101, 102, and 103. The stance analysis model training method and stance analysis method provided in the embodiments of the present disclosure may also be executed by other terminals different from the terminal devices 101, 102, and 103. Accordingly, the stance analysis model training device and stance analysis device provided in the embodiments of the present disclosure may also be provided in other terminals different from the terminal devices 101, 102, and 103.
[0073] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0074] The following will be based on Figure 1 The scene described by Figure 2 to Figure 4 The stance analysis model training method of the embodiment of the present disclosure is described in detail.
[0075] Figure 2 The flowchart of the stance analysis model training method according to the embodiment of the present disclosure is schematically shown.
[0076] like Figure 2 As shown, the stance analysis model training method 200 of this embodiment includes operations S201 to S206.
[0077] In operation S201, a training text data list is obtained, wherein the training text data list at least includes: text identifier, stance label, text topic, and text content.
[0078] According to an embodiment of the present disclosure, a training text data list can be obtained through a web crawler or other data acquisition methods. Among them, the training text data list may include text identifiers, stance labels, text topics, and text content. The text identifier may be an identifier that can identify the text, such as a text URL or a text number. The stance label may be positive, negative, neutral, and irrelevant. The text topic may be able to indicate the subject of the corresponding text obtained. The text content represents the specific table statements in the obtained text. For example, the training text data list may be obtained from a certain review APP or a certain type of financial APP or a certain type of social network information through data acquisition software, etc.
[0079] For example, the training text data list is obtained as shown in Table 1 below.
[0080] Table 1
[0081]
[0082] In operation S202, the training text data list is converted into an encoding vector.
[0083] According to an embodiment of the present disclosure, each character in the training text data list may be embedded and represented and then input into an encoder for encoding to obtain an encoding vector.
[0084] According to an embodiment of the present disclosure, a question-answering system can be used to convert a text data list into a format of questions and answers; the converted text data list is encoded to obtain the encoding vector. The text topic is used as a question, the text content is used as an answer, and training is performed in the form of QA text, which strengthens the model's extraction of the target to expand the coverage of the text topic information in the text.
[0085] For example, the format of the first row in Table 1 can be: [149.0, forward, XX, XX is so annoying, ... he actually rides a motorcycle], which is converted into the StandInputExample format (str, list(str), list(str), optional(list(str))), and put into examples for subsequent data iterators to load and convert into corresponding word vectors. The converted data can be encoded using an encoder to obtain an encoded vector.
[0086] In operation S203, when the text content includes a sentiment word, a sentiment word vector of the sentiment word is obtained.
[0087] According to an embodiment of the present disclosure, the text content can be detected, and when it is determined that the text content contains sentiment words, the sentiment words contained can be converted into embedded representations to obtain sentiment word vectors of the sentiment words.
[0088] For example, the TF-IDF method can be used to find the sentiment words in all text content and sort them in order to determine the frequency of the sentiment words. Then, corresponding to all texts, the sentiment words in each text data are found and marked as 1, and the rest are marked as 0. The word vector representation of the sentiment word is then used as a feature of the emotion of the input vector to assist in determining the stance expressed by the text.
[0089] The TF-IDF method can be used to calculate the term frequency (TF) first, that is, the frequency TF of the i-th word appearing in the j-th text content. i,j , as shown in the following formula (1):
[0090]
[0091] Among them, the molecule n i,j Expressing words t i In the text content jThe number of times it appears in the denominator ∑ k n k,j Indicates that the text content j The sum of the number of occurrences of all words in , k represents the kth word in the jth text content.
[0092] Then calculate the inverse document frequency (IDF), which is a measure of the general importance of the i-th word. i , as shown in the following formula (2):
[0093]
[0094] Among them, |D| represents the total number of text contents in the training text data list, |{j:t i ∈d j}| indicates that the text content contains the word t i The number of.
[0095] Then calculate TF-IDF as shown in the following formula (3):
[0096] TF-IDF i,j =TF i,j ×IDF i (3)
[0097] Through this calculation method, we can find the sentiment words in all text contents and obtain the frequency of sentiment words.
[0098] According to the embodiments of the present disclosure, words with obvious emotional connotations are often closely related to the stance of the text theme. Making good use of these emotional words can assist in determining the stance represented by the text and further improve the performance of the model.
[0099] In operation S204, the encoding vector and the sentiment word vector are fused to obtain a fused vector.
[0100] According to an embodiment of the present disclosure, the encoding vector and the sentiment word vector may be concatenated and then input into a pre-trained language model for encoding, and a fusion vector may be output.
[0101] In operation S205, the fused vector is input into the stance analysis model to be trained, and the training analysis result is output.
[0102] According to an embodiment of the present disclosure, the training analysis result may be the i-th position in the category of position labels, which is actually the i-th position or is not actually the i-th position; or it may be the i-th position in the category that is not a position label, which is not actually the i-th position or is actually the i-th position, where i is a positive integer.
[0103] In operation S206 , model parameters of the stance analysis model are adjusted based on the training analysis results and the stance labels to obtain a trained stance analysis model.
[0104] According to the embodiments of the present disclosure, the loss value can be calculated based on the training analysis results and the stance labels using the cross entropy commonly used in natural language processing. The loss value is compared with a preset threshold, and if it is not satisfied, the model parameters of the stance analysis model are adjusted and the stance analysis model is retrained; if it is satisfied, the trained stance analysis model is obtained.
[0105] The function formula of cross entropy can be expressed as shown in the following formula (4):
[0106]
[0107] Wherein, n represents the number of samples in the training text data list; c represents the number of categories of the training analysis results, and in this disclosure, the number of categories is 4, namely, neutral, positive, negative, and irrelevant; Represents the true output result of the jth category of the i-th sample. Only the correct category is output as 1, and the outputs of other categories are 0; It represents the analysis probability value of the stance analysis model for the i-th sample belonging to the j-th category.
[0108] For example, at the beginning, the loss value is 1.76981. After 2 epochs, the loss value is reduced to 0.86094. After 100 epochs, the loss value can be reduced to 0.00117. At this time, it can be considered that the preset threshold is met and the trained stance analysis model is obtained. The preset threshold can be determined according to the accuracy of the model actually to be trained.
[0109] According to the embodiments of the present disclosure, the model parameters can also be corrected in the direction of smaller loss value according to the loss back propagation to train the model. For example, the loss calculation function CrossEntropyLoss cross entropy function can be used, and the optimizer AdamW is adopted. Since the update of the bias and LayerNorm.weight is not related to the weight decay, the bias LayerNorm.weight does not need to be decayed, and the parameters of the remaining hidden layers will be updated with the model iteration. Among them, the calculation in the optimizer AdamW is as follows:
[0110] First, the gradient formula (5) of the objective function with respect to the current parameters is calculated as follows:
[0111]
[0112] Second, the first-order momentum formula (6) is calculated based on the historical gradient as follows:
[0113] m t =β1·m t-1 +(1-β1)·g t (6)
[0114] Third, the second-order momentum formula (7) is calculated based on the historical gradient as follows:
[0115]
[0116] Fourth, the formula (8) for calculating the descent gradient at the current moment is as follows:
[0117]
[0118] Fifth, update formula (9) according to the descending gradient as follows:
[0119] ω t+1 =ω t -η t (9)
[0120] Among them, ω represents the parameter to be optimized; f(ω) represents the objective function; α represents the initial learning rate; t represents the current step; β1 represents the control of the first-order momentum m t Hyperparameters; β2 represents the control of the second-order momentum V t Hyperparameters of .
[0121] In setting the learning rate, the learning rate warmup method can be used. During the warmup period, the learning rate increases linearly from 0 to the initial learning rate 10 in the optimizer. -5 Among them, the learning rate warm-up formula (10) is as follows:
[0122]
[0123] Where x represents the number of steps that have been trained; s refers to the training step threshold. If the training step is less than the step threshold, the warm-up learning rate is used, otherwise the initial learning rate 10 is used. -5 .
[0124] It should be noted that this setting is due to the fact that when training starts, the model weights are randomly initialized. If a larger learning rate is selected at this time, it may cause instability (oscillation) of the model. Selecting the Warmup learning rate preheating method can make the learning rate smaller in the first few epoches or steps of training. Under the small preheating learning rate, the model can gradually stabilize. After the model is relatively stable, the pre-set learning rate can be selected for training, which makes the model converge faster and the model effect better.
[0125] According to the embodiments of the present disclosure, the present disclosure fully considers the relationship between text topics and text content by converting text identifiers, stance labels, text topics, and text content into vectors, and using sentiment words in the text content as auxiliary; and considers that when only sentiment words are used as features, the classification of stances is not ideal, and emotions cannot accurately reflect stance tendencies, and sentiment words are often closely related to text topics in the text; and further improves the performance of the stance analysis model. According to the training analysis results and stance labels output by the stance analysis model to be trained, fitting learning is performed, and the finally trained stance analysis model has high model accuracy, which can be applied to stance analysis to accurately analyze stances for text topics.
[0126] According to another embodiment of the present disclosure, the stance analysis model training method may further include:
[0127] Evaluate the trained stance analysis model and obtain evaluation results;
[0128] If the evaluation results do not meet the preset results, adjust the model parameters of the trained stance analysis model again; or
[0129] When the evaluation results meet the preset results, the trained stance analysis model is determined as the final stance analysis model.
[0130] According to an embodiment of the present disclosure, the preset result may be determined according to the model accuracy of the stance analysis model to be trained.
[0131] According to an embodiment of the present disclosure, evaluating a trained stance analysis model to obtain an evaluation result may include: obtaining a test stance label based on a test text using the trained stance analysis model; annotating the test text to obtain a predicted span of stance evidence representing the test text, wherein the predicted span of the stance evidence includes: a starting position of the stance evidence and an ending position of the stance evidence; determining a predicted stance label of the test text based on the predicted span of the stance evidence; and obtaining an evaluation result based on the predicted stance label and the test stance label.
[0132] Among them, based on the test text, using the trained stance analysis model to obtain the test stance label can include: obtaining a test text data list, wherein the test text data list includes at least: a test text identifier, a test text topic, and a test text content; converting the test text data list into an encoding vector of the test text; when the test text content contains sentiment words, obtaining the sentiment word vector of the sentiment word of the test text; fusing the encoding vector and the sentiment word vector to obtain a fused vector of the test text; inputting the fused vector into the trained stance analysis model to output the test stance label.
[0133] Among them, annotating the test text to obtain the predicted span of the stance evidence of the test text may include: annotating each word of the test text content by the BIO annotation method. For example, the previous one is "O", followed by "B-stance type", and then "I-stance type", then this "B-stance type" can represent the starting position of the stance evidence. The previous one is "I-stance type", and the next one is "O", and this "I-stance type" can represent the ending position of the stance evidence. The predicted span of the stance evidence can be obtained based on the starting position of the stance evidence and the ending position of the stance evidence. The stance type can be a positive stance, a reverse stance, a neutral stance, etc.
[0134] Wherein, determining the predicted stance label of the test text according to the predicted span of the stance evidence may include: determining the predicted stance label of the test text according to the annotations in the predicted span of the stance evidence.
[0135] The evaluation result is obtained according to the predicted stance label and the test stance label. For example, if the predicted stance label and the test stance label match, the evaluation result meets the preset result; if the predicted stance label and the test stance label do not match, the evaluation result does not meet the preset result.
[0136] According to the embodiments of the present disclosure, the span of the text describing the stance in the test text, that is, the predicted span of the stance evidence, is confirmed by labeling the test text, and the start and end positions of the stance evidence are obtained. The predicted labels of the test text thus determined are compared with the test labels obtained by the training model, which not only enhances the interpretability of the trained stance analysis model, but also provides new ideas for the performance evaluation of the trained stance analysis model.
[0137] According to yet another embodiment of the present disclosure, converting a training text data list into an encoding vector includes:
[0138] Use question-answering systems to convert text data lists into question and answer formats;
[0139] Encode the converted text data list to obtain the encoded vector.
[0140] According to an embodiment of the present disclosure, the format of questions and answers can be to first integrate the content in the text data list into the format of [ID, stance label, question, answer], and then convert it into a standard format, such as the StandInputExample format (str, list(str), list(str), optional(list(str))). By encoding, an encoding vector is obtained. Each word in the format can be encoded to obtain a word vector.
[0141] According to an embodiment of the present disclosure, the method in the field of question-answering system (QA) is migrated to the classification problem, and the text data is processed into the format of questions and answers, so that the stance analysis model to be trained can learn the relationship between word vectors in the data, thereby improving the model performance of the trained stance analysis model.
[0142] Figure 3 A flowchart of a stance analysis model training method according to another embodiment of the present disclosure is schematically shown.
[0143] like Figure 3 As shown, the stance analysis model training method 300 of this embodiment includes operations S301 to S306.
[0144] In operation S301, a text data list is converted into a QA form.
[0145] According to an embodiment of the present disclosure, a question-answering system is used to convert a text data list into a format of questions and answers.
[0146] In operation S302, BERT encoding obtains BERT word vectors.
[0147] According to an embodiment of the present disclosure, after operation S301 is performed, BERT is used for encoding to obtain a BERT word vector.
[0148] In operation S303, whether sentiment words are included.
[0149] According to an embodiment of the present disclosure, it is possible to detect whether the text data contains sentiment words. If the sentiment words are contained, operation S304 is performed; otherwise, operation S306 is performed.
[0150] In operation S304, sentiment word vectors are obtained.
[0151] According to an embodiment of the present disclosure, when it is determined in operation S303 that a sentiment word is included, a sentiment word vector is obtained.
[0152] In operation S305, the BERT word vector and the sentiment word vector are fused.
[0153] According to an embodiment of the present disclosure, a fused vector is generated by fusing the BERT word vector and the sentiment word vector respectively obtained in performing operations S302 and S304.
[0154] In operation S306, the vector is input into a classifier to obtain a classification result.
[0155] According to an embodiment of the present disclosure, by inputting the fusion vector obtained in performing operation S305 into the classifier, a classification result can be obtained.
[0156] In operation S307, the classifier is trained to obtain a trained classifier.
[0157] According to an embodiment of the present disclosure, the model parameters of the classifier may be adjusted according to the classification result of operation S305 and its corresponding stance label until the number of iterations is reached or the model converges, and the trained classifier is output.
[0158] In operation S308, whether to perform model evaluation on the trained classifier.
[0159] According to an embodiment of the present disclosure, after obtaining the trained classifier in operation S307, it is selected whether to perform model evaluation on the trained classifier. If the model evaluation is performed, operation S310 is performed; if the model evaluation is not performed, operation S309 is performed.
[0160] In operation S309, the trained classifier is output.
[0161] According to an embodiment of the present disclosure, based on the trained classifier obtained in operation S307, its model parameters are determined, and the trained classifier is output.
[0162] In operation S310 , a stance evidence prediction span and a prediction label are obtained.
[0163] According to the embodiments of the present disclosure, when performing model evaluation, it is necessary to annotate the test text using the evaluation model based on the acquired test text to obtain the predicted span of the position evidence representing the test text, wherein the predicted span of the position evidence includes: the starting position of the position evidence and the ending position of the position evidence. Then, the predicted label of the test text is predicted based on the predicted span of the position evidence.
[0164] It should be noted that the evaluation model can adjust the parameters of the evaluation model according to the predicted span of the position evidence and the actual span of the position evidence. The evaluation model's precision (Presision) can be calculated as shown in formula (11), recall (Recall) as shown in formula (12), and F1-score (F1) as shown in formula (13). The parameters of the evaluation model can be adjusted according to the calculation results.
[0165]
[0166]
[0167]
[0168] Among them, correct span Indicates the number of correct prediction spans of position evidence; num pred The total number of prediction spans representing position evidence; num total The true number of prediction spans representing the position evidence.
[0169] In operation S311, the model is evaluated to determine whether it is qualified.
[0170] According to an embodiment of the present disclosure, the test text obtained in operation S310 can be analyzed using a trained stance analysis model to obtain a test label. The evaluation result is determined based on the predicted label and the test label. The performance of the model can be judged by the accuracy, recall and F1-score of the predicted label.
[0171] If the evaluation result is qualified, operation S312 is performed; otherwise, operation S307 is performed. The evaluation result can also be evaluated by combining the real span of the position evidence, the predicted label and the test label, so that the evaluation result is more accurate.
[0172] In operation S312, the trained classifier is output.
[0173] Based on the above stance analysis model training method, the present disclosure also provides a stance analysis method. Figure 4-5 The device is described in detail.
[0174] Figure 4 A flowchart of a standpoint analysis method according to an embodiment of the present disclosure is schematically shown; Figure 5 A schematic diagram of standpoint analysis according to an embodiment of the present disclosure is schematically shown.
[0175] like Figure 4 As shown, the stance analysis method 400 of this embodiment includes operations S401 to S406.
[0176] In operation S401, a list of text data to be analyzed is obtained, wherein the list of text data to be analyzed at least includes: text identifiers, text topics, and text contents.
[0177] According to an embodiment of the present disclosure, the text identifier may include a text URL and a text number. The text topic may be, for example, a target event.
[0178] In operation S402, the text data list to be analyzed is converted into a coding vector.
[0179] According to an embodiment of the present disclosure, converting the text data list to be analyzed into a coding vector can be as follows: Figure 5 As shown in the figure, through the embedding layer of the BERT encoding module, each character of the word in the text data list to be analyzed has an embedding representation, that is, the embedding representation of the i-th character O i , as shown in the following formula (14), where the embedding dimension can be, for example, 768 dimensions (representing the dimension of the BERT hidden layer).
[0180]
[0181] in, Embedding representations representing different dimensions.
[0182] Then it is input into the Bert model for encoding to obtain the encoded character representation and the word representation C after average pooling. i , as shown in the following formula (15):
[0183]
[0184] Among them, exp represents the exponential function; ReLU represents the activation function, which is used to add nonlinear factors to the model; T represents transposition; n represents the number of each character of the word in the text data list to be analyzed, which is a positive integer; O represents all the characters of the word in the text data list to be analyzed. At this time, the input dimension can be, for example, 128×768, where 128 is the maximum length of a single text and 768 is the dimension of the Bert hidden layer, as shown below:
[0185] C1=[-0.0173,0.7668,-0.1924…-0.2253,0.0550,0.4806]
[0186] C2=[-0.3843,0.8979,-0.6690…0.3450,-0.0163,0.8809]
[0187] …
[0188] C 128 =[-0.0059,0.7628,0.5298…0.1866,0.2073,-0.1972]
[0189] In operation S403, when the text content includes a sentiment word, a sentiment word vector of the sentiment word is obtained.
[0190] According to an embodiment of the present disclosure, when the text content contains sentiment words, the sentiment word vector of the sentiment word is obtained, and the words representing each emotion are embedded and encoded through BERT to obtain the sentiment word vector of the sentiment word.
[0191] Among them, Figure 5 As shown, in the sentiment word module, the TF-IDF method described above can be used to first find the sentiment word G in the text content through the sentiment word dictionary. i , as shown in the following formula (16):
[0192]
[0193] Then calculate the importance of these sentiment words. We can select the most important m sentiment words, embed them and encode them through BERT to get the sentiment word vector P of the sentiment words. i , as shown in the following formula (17):
[0194]
[0195] Among them, exp represents the exponential function; ReLU represents the activation function, which is used to add nonlinear factors to the model; T represents transposition; m is a positive integer; G represents all sentiment words in the text content.
[0196] In operation S404, the encoding vector and the sentiment word vector are fused to obtain a fused vector.
[0197] According to the embodiments of the present disclosure, Figure 5 As shown in the figure, the sentiment word vector and the encoding vector can be concatenated and then input into the BERT model for encoding. At this time, the input dimension is 256 × 768, and the sentiment word vector dimension corresponding to the text is also 128. When connected with the dimension of the encoding vector of the text itself, it can become 256 dimensions. After pooling, the fusion vector M is obtained. i , the dimension can be, for example, 32 × 4, as shown below:
[0198] M1=[-0.2711,0.5058,-0.1116,-0.0714]
[0199] M2=[-0.3051,0.6516,0.1715,0.0405]
[0200] …
[0201] M 32 =[-0.0850,0.6021,-0.1416,-0.1488]
[0202] In operation S405, the fused vector is input into the trained stance analysis model, and the analysis result is output.
[0203] According to an embodiment of the present disclosure, the analysis result may be a stance on a text topic, for example, positive, negative, neutral, or irrelevant.
[0204] For example, the fusion vector can be input into a trained stance analysis model, and then connected using the fully connected layer of the model to calculate the stance Y for the text topic. The calculation formula can be as shown in the following equations (18) and (19):
[0205]
[0206] Y=max(Y1,Y2,…,Yn ) (19)
[0207] Among them, B represents all types of analysis results, Y i represents the probability of the i-th type of analysis result, and Y represents the maximum value selected from the probabilities of all types of analysis results as the final output analysis result.
[0208] According to the embodiments of the present disclosure, Figure 5 As shown, by encoding the text data list to be analyzed and combining it with the sentiment word vector and inputting it into the classifier, a trained stance analysis model can be obtained, and then the analysis results can be obtained accurately and efficiently.
[0209] Based on the above-mentioned stance analysis model training method, the present disclosure also provides a stance analysis model training device. Figure 6 The device is described in detail.
[0210] Figure 6 The structural block diagram of the stance analysis model training device according to an embodiment of the present disclosure is schematically shown.
[0211] like Figure 6 As shown, the stance analysis model training device 600 of this embodiment includes a first acquisition module 610 , a first encoding module 620 , a second acquisition module 630 , a first fusion module 640 , a first analysis module 650 and a parameter adjustment module 660 .
[0212] The first acquisition module 610 is used to acquire a training text data list, wherein the training text data list includes at least: text identifiers, stance labels, text topics, and text contents. In one embodiment, the first acquisition module 610 can be used to perform the operation S201 described above, which will not be described in detail here.
[0213] The first encoding module 620 is used to convert the training text data list into an encoding vector. In one embodiment, the first encoding module 620 can be used to perform the operation S202 described above, which will not be described in detail here.
[0214] The second acquisition module 630 is used to acquire the sentiment word vector of the sentiment word when the text content contains the sentiment word. In one embodiment, the second acquisition module 630 can be used to perform the operation S203 described above, which will not be repeated here.
[0215] The first fusion module 640 is used to fuse the encoding vector and the sentiment word vector to obtain a fusion vector. In one embodiment, the first fusion module 640 can be used to perform the operation S204 described above, which will not be repeated here.
[0216] The first analysis module 650 is used to input the fusion vector into the stance analysis model to be trained and output the training analysis result. In one embodiment, the first analysis module 650 can be used to perform the operation S205 described above, which will not be described in detail here.
[0217] The parameter adjustment module 660 is used to adjust the model parameters of the stance analysis model based on the training analysis results and the stance labels to obtain a trained stance analysis model. In one embodiment, the parameter adjustment module 660 can be used to perform the operation S206 described above, which will not be described in detail here.
[0218] According to an embodiment of the present disclosure, any multiple modules of the first acquisition module 610, the first encoding module 620, the second acquisition module 630, the first fusion module 640, the first analysis module 650 and the parameter adjustment module 660 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the first acquisition module 610, the first encoding module 620, the second acquisition module 630, the first fusion module 640, the first analysis module 650 and the parameter adjustment module 660 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware and firmware or by a suitable combination of any of them. Alternatively, at least one of the first acquisition module 610, the first encoding module 620, the second acquisition module 630, the first fusion module 640, the first analysis module 650 and the parameter adjustment module 660 can be at least partially implemented as a computer program module, and when the computer program module is executed, the corresponding function can be executed.
[0219] Based on the above standpoint analysis method, the present disclosure also provides a standpoint analysis device. Figure 7 The device is described in detail.
[0220] Figure 7 The structural block diagram of the standpoint analysis device according to an embodiment of the present disclosure is schematically shown.
[0221] like Figure 7 As shown, the stance analysis device 700 of this embodiment includes a third acquisition module 710 , a second encoding module 720 , a fourth acquisition module 730 , a second fusion module 740 and a second analysis module 750 .
[0222] The third acquisition module 710 is used to acquire a list of text data to be analyzed, wherein the list of text data to be analyzed at least includes: text identifiers, text topics, and text contents. In one embodiment, the third acquisition module 710 can be used to perform the operation S401 described above, which will not be described in detail here.
[0223] The second encoding module 720 is used to convert the text data list to be analyzed into an encoding vector. In one embodiment, the second encoding module 720 can be used to perform the operation S402 described above, which will not be described in detail here.
[0224] The fourth acquisition module 730 is used to acquire the sentiment word vector of the sentiment word when the text content contains the sentiment word. In one embodiment, the fourth acquisition module 730 can be used to perform the operation S403 described above, which will not be described in detail here.
[0225] The second fusion module 740 is used to fuse the encoding vector and the sentiment word vector to obtain a fusion vector. In one embodiment, the second fusion module 740 can be used to perform the operation S404 described above, which will not be repeated here.
[0226] The second analysis module 750 is used to input the fusion vector into the trained stance analysis model and output the analysis result. In one embodiment, the second analysis module 750 can be used to perform the operation S405 described above, which will not be described in detail here.
[0227] According to an embodiment of the present disclosure, any multiple modules of the third acquisition module 710, the second encoding module 720, the fourth acquisition module 730, the second fusion module 740, and the second analysis module 750 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the third acquisition module 710, the second encoding module 720, the fourth acquisition module 730, the second fusion module 740, and the second analysis module 750 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware, and firmware, or by a suitable combination of any of them. Alternatively, at least one of the third acquisition module 710, the second encoding module 720, the fourth acquisition module 730, the second fusion module 740 and the second analysis module 750 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.
[0228] Figure 8 A block diagram of an electronic device suitable for implementing a stance analysis model training method and a stance analysis method according to an embodiment of the present disclosure is schematically shown.
[0229] like Figure 8 As shown, the electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 908 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0230] In RAM 803, various programs and data required for the operation of electronic device 800 are stored. Processor 801, ROM 802 and RAM 803 are connected to each other via bus 804. Processor 801 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 802 and / or RAM 803. It should be noted that the program can also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0231] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the I / O interface 805: an input portion 806 including a keyboard, a mouse, etc.; an output portion 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 808 including a hard disk, etc.; and a communication portion 809 including a network interface card such as a LAN card, a modem, etc. The communication portion 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage portion 808 as needed.
[0232] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0233] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.
[0234] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present disclosure.
[0235] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 801. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0236] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 809, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0237] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0238] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0239] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0240] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0241] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A stance analysis model training method, comprising: Obtaining a training text data list, wherein the training text data list at least includes: text identifiers, stance labels, text topics, and text contents; Converting the training text data list into an encoding vector; When the text content contains sentiment words, obtaining sentiment word vectors of the sentiment words; The encoding vector and the sentiment word vector are fused to obtain a fused vector; Inputting the fusion vector into the stance analysis model to be trained, and outputting the training analysis result; Adjusting the model parameters of the stance analysis model based on the training analysis results and the stance labels to obtain a trained stance analysis model; Based on the test text, using the trained stance analysis model, obtaining a test stance label; Marking each word of the test text to obtain a predicted span of the position evidence of the test text, wherein the predicted span of the position evidence includes: a start position of the position evidence and an end position of the position evidence; Determining a predicted stance label of the test text according to the predicted span of the stance evidence; When the predicted stance label and the tested stance label match, determining the trained stance analysis model as a final stance analysis model; Wherein, converting the training text data list into a coding vector comprises: Using a question-answering system, the text data list is converted into a format of questions and answers, wherein the format of the questions and answers is a standardized format including the text identifier, the position label, the question, and the answer; The converted text data list is encoded to obtain the encoding vector.
2. The method according to claim 1, further comprising: When the predicted stance label and the tested stance label do not match, the model parameters of the trained stance analysis model are adjusted again.
3. A position analysis method, comprising: Obtaining a list of text data to be analyzed, wherein the list of text data to be analyzed at least includes: text identifiers, text topics, and text contents; Convert the text data list to be analyzed into a coding vector; When the text content contains sentiment words, obtaining sentiment word vectors of the sentiment words; Fusing the encoding vector and the sentiment word vector to obtain a fused vector; and The fusion vector is input into a trained stance analysis model, and an analysis result is output, wherein the trained stance analysis model is trained according to the method according to any one of claims 1 to 2.
4. A stance analysis model training device, comprising: A first acquisition module is used to acquire a training text data list, wherein the training text data list at least includes: text identifier, position label, text topic, and text content; A first encoding module, used for converting the training text data list into an encoding vector; A second acquisition module is used to acquire the sentiment word vector of the sentiment word when the text content contains the sentiment word; A first fusion module, used for fusing the encoding vector and the sentiment word vector to obtain a fusion vector; A first analysis module, used for inputting the fusion vector into a stance analysis model to be trained and outputting a training analysis result; A parameter adjustment module, used to adjust the model parameters of the stance analysis model based on the training analysis result and the stance label to obtain a trained stance analysis model; A testing module, used to obtain a test stance label based on a test text using the trained stance analysis model; A tagging module, used for tagging each word of the test text to obtain a predicted span of the position evidence representing the test text, wherein the predicted span of the position evidence includes: a starting position of the position evidence and an ending position of the position evidence; A prediction module, configured to determine a predicted stance label of the test text according to a predicted span of the stance evidence; a determination module, configured to determine the trained stance analysis model as a final stance analysis model when the predicted stance label and the tested stance label match; Wherein, converting the training text data list into a coding vector comprises: Using a question-answering system, the text data list is converted into a format of questions and answers, wherein the format of the questions and answers is a standardized format including the text identifier, the position label, the question, and the answer; The converted text data list is encoded to obtain the encoding vector.
5. A stance analysis device, comprising: A third acquisition module is used to acquire a list of text data to be analyzed, wherein the list of text data to be analyzed at least includes: text identifiers, text topics, and text contents; A second encoding module, used for converting the text data list to be analyzed into an encoding vector; A fourth acquisition module, configured to acquire a sentiment word vector of the sentiment word when the text content includes a sentiment word; A second fusion module is used to fuse the encoding vector and the sentiment word vector to obtain a fusion vector; and The second analysis module is used to input the fusion vector into a trained stance analysis model and output an analysis result, wherein the trained stance analysis model is trained according to the method according to any one of claims 1 to 2.
6. An electronic device comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 3.
7. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the method according to any one of claims 1 to 3.
8. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Emotion classification method, device, apparatus and medium based on variational automatic encoder
CN109086357A
Label generation for element of business process model
US20220092352A1