Event Element Extraction Method, Apparatus, Device, Storage Medium, and Program Product
By obtaining and processing financial public opinion data and its knowledge vector library, generating fusion description information and inputting event element extraction model, the problem of poor accuracy of financial public opinion event elements extraction in the existing technology is solved, and higher extraction accuracy and description ability are achieved.
Patent Information
- Application Number
- CN202210548866.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-20
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2042-05-20
AI Technical Summary
The existing technology has poor accuracy in the extraction of factors of financial public opinion events, and it is difficult to effectively obtain accurate information about accurate factor information of financial public opinion events.
By obtaining the target public opinion data and its corresponding knowledge vector library, the correlation weight between the target public opinion data and the reference word vector is determined, the fusion description information is generated, and input it into the event element extraction model to improve the accuracy of event element extraction.
By integrating knowledge semantic information in the knowledge vector library, the accuracy of event elements extraction is improved and the ability to describe event elements is enhanced.
Smart Images

Figure CN114841161B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular, to an event element extraction method, device, equipment, storage medium, and program product. Background Art
[0002] Public opinion generally refers to the attitudes and opinions of the general public towards social conditions and public opinions, which carry the emotions, opinions, and wishes of the public regarding various specific affairs in society. Finance is one of the most important aspects of social livelihood, and it is very important to monitor financial public opinion for understanding the attitudes of the public.
[0003] Event element extraction is one of the important tasks in the field of financial public opinion monitoring. Event elements usually refer to the element information describing the occurrence of public opinion events, such as the time, object, location, etc. when the public opinion event occurs. In the prior art, when extracting event elements from financial public opinion, the method of text classification is usually used to obtain the event element labels corresponding to the financial public opinion.
[0004] However, the above method for extracting event elements from financial public opinion has poor accuracy. Summary of the Invention
[0005] Based on this, in view of the above technical problems, it is necessary to provide an event element extraction method, device, computer equipment, computer-readable storage medium, and computer program product that can improve the accuracy of event element extraction.
[0006] In a first aspect, the present application provides an event element extraction method. The method includes:
[0007] Obtain target public opinion data and a knowledge vector library corresponding to the target public opinion data, where the knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data;
[0008] Determine the association weights between the target public opinion data and each reference word vector, and determine the fusion description information corresponding to the target public opinion data based on the association weights. The fusion description information is used to characterize the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data;
[0009] Input the fusion description information into an event element extraction model to obtain the target event element labels corresponding to the target public opinion data.
[0010] In one embodiment, the target public opinion data includes multiple sentence word vectors corresponding to a public opinion description sentence. Determining the association weights between the target public opinion data and each reference word vector includes:
[0011] For each statement word vector, based on a preset correlation function, calculate the correlation weights corresponding to the statement word vector and each reference word vector to obtain multiple correlation weight values.
[0012] In one embodiment, determining the fusion description information corresponding to the target public opinion data based on the correlation weights includes:
[0013] Obtain the maximum weight value among the multiple correlation weights corresponding to each statement word vector;
[0014] Generate a statement representation matrix based on each statement word vector;
[0015] Perform an outer product operation on the maximum weight value and the statement representation matrix to obtain the fusion description information.
[0016] In one embodiment, obtaining the target public opinion data includes:
[0017] Obtain the public opinion description statements, and perform word segmentation processing on the public opinion description statements to obtain multiple word segments;
[0018] Use a preset text encoding algorithm to encode each word segment to obtain multiple statement word vectors;
[0019] Take the multiple statement word vectors as the target public opinion data.
[0020] In one embodiment, the event element extraction model includes a first sub-model and a second sub-model. Input the fusion description information into the event element extraction model to obtain the target event element labels corresponding to the target public opinion data, including:
[0021] Input the fusion description information into multiple filters included in the first sub-model to obtain the local feature information output by each filter, and the convolution kernel sizes corresponding to each filter are different;
[0022] Based on the first sub-model and each local feature information, obtain the target feature information corresponding to the fusion description information;
[0023] Input the target feature information into the second sub-model to obtain the target event element labels output by the second sub-model.
[0024] In one embodiment, based on the first sub-model and each local feature information, obtaining the target feature information corresponding to the fusion description information includes:
[0025] Through the first sub-model, merge and process each local feature information to obtain the comprehensive feature information corresponding to the fusion description information;
[0026] Perform dimensionality reduction processing on the comprehensive feature information to obtain the target feature information.
[0027] In one embodiment, inputting the target feature information into the second sub-model to obtain the target event element label output by the second sub-model includes:
[0028] Inputting the target feature information into the second sub-model to obtain the prediction probability corresponding to each element label in the element label library, where the prediction probability is obtained based on the target feature information and the element label;
[0029] If the prediction probability is greater than the preset threshold, then use the element label corresponding to the prediction probability as the target event element label.
[0030] Second, the present application also provides an event element extraction device. The device includes:
[0031] An acquisition module, configured to acquire target public opinion data and a knowledge vector library corresponding to the target public opinion data, where the knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data;
[0032] A determination module, configured to determine the association weight between the target public opinion data and each reference word vector, and determine the fusion description information corresponding to the target public opinion data based on the association weight, where the fusion description information is used to represent the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data;
[0033] An extraction module, configured to input the fusion description information into the event element extraction model to obtain the target event element label corresponding to the target public opinion data.
[0034] In one embodiment, the target public opinion data includes multiple sentence word vectors corresponding to the public opinion description sentence, and the determination module is specifically configured to:
[0035] For each sentence word vector, calculate the association weight between the sentence word vector and each reference word vector based on a preset association function to obtain multiple association weight values.
[0036] In one embodiment, the determination module is specifically configured to:
[0037] Obtain the maximum weight value among the multiple association weights corresponding to each sentence word vector;
[0038] Generate a sentence representation matrix based on each sentence word vector;
[0039] Perform an outer product operation on the maximum weight value and the sentence representation matrix to obtain the fusion description information.
[0040] In one embodiment, the acquisition module is specifically configured to:
[0041] Acquire the public opinion description sentence, and perform word segmentation processing on the public opinion description sentence to obtain multiple word segments;
[0042] Encode each word segment using a preset text encoding algorithm to obtain multiple sentence word vectors;
[0043] Use the multiple sentence word vectors as the target public opinion data.
[0044] In one embodiment, the event element extraction model includes a first sub-model and a second sub-model. The extraction module is specifically configured to:
[0045] Input the fusion description information into multiple filters included in the first sub-model to obtain local feature information output by each filter. The convolution kernel sizes corresponding to the filters are different;
[0046] Based on the first sub-model and the local feature information, obtain the target feature information corresponding to the fusion description information;
[0047] Input the target feature information into the second sub-model to obtain the target event element label output by the second sub-model.
[0048] In one embodiment, the extraction module is further specifically configured to:
[0049] Merge and process the local feature information through the first sub-model to obtain the comprehensive feature information corresponding to the fusion description information;
[0050] Perform dimensionality reduction processing on the comprehensive feature information to obtain the target feature information.
[0051] In one embodiment, the extraction module is further specifically configured to:
[0052] Input the target feature information into the second sub-model to obtain the prediction probability corresponding to each element label in the element label library. The prediction probability is obtained based on the target feature information and the element label;
[0053] If the prediction probability is greater than a preset threshold, use the element label corresponding to the prediction probability as the target event element label.
[0054] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the event element extraction method as described in any one of the first aspects above.
[0055] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the event element extraction method as described in any one of the first aspects above.
[0056] In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program which, when executed by a processor, implements the event element extraction method according to any one of the above first aspects.
[0057] For the above event element extraction method, device, computer device, storage medium, and computer program product, target public opinion data and a knowledge vector library corresponding to the target public opinion data are obtained. The knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data; the correlation weights between the target public opinion data and each reference word vector are determined, and fusion description information corresponding to the target public opinion data is determined based on the correlation weights. The fusion description information is used to represent the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data; the fusion description information is input into an event element extraction model to obtain target event element labels corresponding to the target public opinion data. In the embodiments of the present application, since the fusion description information input into the event element extraction model is determined based on the correlation weights between the target public opinion data and each reference word vector in the knowledge vector library, the knowledge semantic information corresponding to the knowledge domain classification dimension is incorporated into the target public opinion data by means of an attention mechanism, and the knowledge semantic information corresponding to the knowledge domain dimension where the target public opinion data is located is comprehensively considered during event element extraction, improving the accuracy of event element extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 It is a flowchart of the event element extraction method in an embodiment;
[0059] Figure 2 It is a flowchart of step 102 in an embodiment;
[0060] Figure 3 It is a flowchart of step 101 in an embodiment;
[0061] Figure 4 It is a model result diagram of the event element extraction model in an embodiment;
[0062] Figure 5 It is a flowchart of step 103 in an embodiment;
[0063] Figure 6 It is a flowchart of the training process of the event element extraction model in an embodiment;
[0064] Figure 7 It is a flowchart of step 402 in an embodiment;
[0065] Figure 8 It is a flowchart of the event element extraction method in another embodiment;
[0066] Figure 9 It is a model result diagram of the event element extraction method in an embodiment;
[0067] Figure 10 It is a structural block diagram of the event element extraction device in an embodiment;
[0068] Figure 11 It is an internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0069] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0070] The embodiment of the present application provides an event element extraction method. For this event element extraction method, the execution subject may be an event element extraction method device, and this event element extraction method device may be implemented as a part or all of the terminal in a software, hardware or a combination of software and hardware manner.
[0071] In the following method embodiments, the execution subject is taken as the terminal for illustration. Among them, the terminal may be a personal computer, a laptop computer, a media player, a smart TV, a smart phone, a tablet computer, a portable wearable device, etc. It can be understood that this method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server.
[0072] Please refer to Figure 1 , which shows a flowchart of an event element extraction method provided by an embodiment of the present application. As Figure 1 shown, this event element extraction method may include the following steps:
[0073] Step 101, obtain target public opinion data and a knowledge vector library corresponding to the target public opinion data.
[0074] Among them, the knowledge vector library includes a plurality of reference word vectors, and the plurality of reference word vectors have the same knowledge domain classification dimension as the target public opinion data.
[0075] Among them, this knowledge domain classification dimension may be one of technical fields such as finance, art, food, and water conservancy projects, or may be one of the sub-fields included in the above-mentioned technical fields.
[0076] Taking the target public opinion data as financial public opinion data as an example, the classification dimension of this knowledge field is the banking knowledge field. This knowledge vector library can be a knowledge vector library constructed based on banking professional knowledge texts. Specifically, a text processing method is adopted to obtain the reference word vectors corresponding to the banking professional knowledge texts. Among them, the algorithm models corresponding to this text processing method include: the bag-of-words model, the word vector model, and the pre-trained BERT model.
[0077] Optionally, the target public opinion data can be a public opinion description sentence, or it can be the target public opinion data obtained after text processing of the public opinion description sentence based on the text processing method, such as sentence word vectors, etc. The text processing method corresponding to the target public opinion data and the text processing method corresponding to the reference word vectors can be the same or different.
[0078] Step 102, determine the association weights between the target public opinion data and each reference word vector, and determine the fusion description information corresponding to the target public opinion data based on the association weights.
[0079] Among them, the fusion description information is used to represent the public opinion description information corresponding to the knowledge field classification dimension included in the target public opinion data.
[0080] Optionally, based on the text similarity between the target public opinion data and each reference word vector, obtain the association weights between the target public opinion data and each reference word vector. The semantic similarity algorithm corresponding to this text similarity can be one of the following algorithms: Cosine Similarity algorithm, Euclidean Distance algorithm, Manhattan Distance algorithm, Chebyshev Distance algorithm, and Jaccard Similarity algorithm, etc.
[0081] Optionally, obtain the reference word vectors that meet the preset weight target conditions as the target reference word vectors, and fuse the target reference word vectors with the target public opinion data to obtain the fusion description information. Among them, the preset weight target conditions include: the association weight exceeds the preset weight threshold; the association weight is the maximum value among the association weights between the target public opinion data and each reference word vector.
[0082] Step 103, input the fusion description information into the event element extraction model to obtain the target event element labels corresponding to the target public opinion data.
[0083] Optionally, the number of labels corresponding to the target event element labels is multiple. The target event element labels can be named entities, such as place names, organization names, product names, person names, and time words, etc.
[0084] Optionally, the event element extraction model is a multi-label classification model. Specifically, the multi-label classification model can be one of the following algorithm models: Support Vector Product (SVM) model, deep learning model, BP neural network model, random forest model, and so on.
[0085] In this embodiment, the target public opinion data and the knowledge vector library corresponding to the target public opinion data are obtained. The knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data; the association weights between the target public opinion data and each reference word vector are determined, and the fusion description information corresponding to the target public opinion data is determined based on the association weights. The fusion description information is used to represent the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data; the fusion description information is input into the event element extraction model to obtain the target event element label corresponding to the target public opinion data. In the embodiment of the present application, since the fusion description information input into the event element extraction model is determined based on the association weights between the target public opinion data and each reference word vector in the knowledge vector library, the knowledge semantic information corresponding to the knowledge domain classification dimension is incorporated into the target public opinion data by means of the attention mechanism, and the knowledge semantic information corresponding to the knowledge domain dimension where the target public opinion data is located is comprehensively considered during event element extraction, improving the accuracy of event element extraction.
[0086] Further, the target public opinion data includes multiple sentence word vectors corresponding to the public opinion description sentences. Based on Figure 1 In the shown embodiment, the implementation process of determining the association weights between the target public opinion data and each reference word vector in step 102 includes the following steps:
[0087] For each sentence word vector, based on a preset association function, calculate the association weights corresponding to the sentence word vector and each reference word vector to obtain multiple association weight values.
[0088] Optionally, the expression of the preset association function is as follows:
[0089] b ij = Soft max(S i ·D j ),
[0090] where b ij represents the association weight corresponding to the i-th sentence word vector and the j-th reference word vector, S i represents the i-th sentence word vector, D j represents the j-th reference word vector, and the operator "." represents dot product operation.
[0091] In this embodiment, based on the preset association function, calculate the association weights corresponding to the sentence word vector and each reference word vector. This method for calculating association weight values is simple and has a small amount of calculation.
[0092] In an embodiment of the present application, based on the above embodiments, as Figure 2 shown, the implementation process of determining the fusion description information corresponding to the target public opinion data based on the association weight in step 102 includes the following steps:
[0093] Step 201, obtain the maximum weight value among the multiple association weights corresponding to each statement word vector.
[0094] Optionally, through the preset association function mentioned in the above steps, calculate each association weight b ij ; compare each association weight b ij , and obtain the maximum weight value b max .
[0095] Step 202, generate a statement representation matrix based on each statement word vector.
[0096] Optionally, use each statement word vector as a row vector of the statement representation matrix to obtain the statement representation matrix S. Or, use each statement word vector as a column vector of the statement representation matrix to obtain the statement representation matrix S.
[0097] Step 203, perform an outer product operation on the maximum weight value and the statement representation matrix to obtain the fusion description information.
[0098] Optionally, based on the following formula, calculate the fusion description information S fin :
[0099]
[0100] where S fin represents the fusion description information, W is a weight coefficient, b max represents the maximum weight value, and S represents the statement representation matrix.
[0101] In this embodiment, by obtaining the maximum weight value among the multiple association weights corresponding to each statement word vector, generating a statement representation matrix based on each statement word vector, and performing an outer product operation on the maximum weight value and the statement representation matrix to obtain the fusion description information, the determination of the association weight of the target public opinion data and the information fusion of the target public opinion data and the knowledge vector library are realized. This method is simple and improves the calculation efficiency of the event element extraction algorithm and the accuracy of event element extraction.
[0102] In an embodiment of the present application, as Figure 3 shown, based on any of the above embodiments, this embodiment relates to the implementation process of obtaining the target public opinion data in step 101, including the following steps:
[0103] Step 301: Obtain the public opinion description statement, and perform word segmentation on the public opinion description statement to obtain multiple segmented words.
[0104] Optionally, use a text word segmentation tool, such as the pkuseg multi-domain word segmentation tool or the THULAC (THU Lexical Analyzer for Chinese) Chinese lexical analysis toolkit, to perform word segmentation on the public opinion description statement to obtain multiple segmented words. Or use a text word segmentation algorithm to perform word segmentation on the public opinion description statement to obtain multiple segmented words. This text word segmentation algorithm can be a string matching-based word segmentation algorithm, an understanding-based word segmentation algorithm, a statistics-based word segmentation algorithm, etc., which is not limited here.
[0105] Step 302: Use a preset text encoding algorithm to encode each segmented word to obtain multiple sentence word vectors.
[0106] Optionally, this text encoding algorithm is a pre-trained BERT model. That is, use the pre-trained BERT model to encode each segmented word to obtain multiple sentence word vectors S1, S2,..., S i ,..., S n , where S i is the i-th sentence word vector of the public opinion description statement.
[0107] Step 303: Use the multiple sentence word vectors as the target public opinion data.
[0108] In this embodiment, use a preset text encoding algorithm to encode each segmented word corresponding to the public opinion description statement to obtain multiple sentence word vectors, which realizes the extraction of sentence information in the public opinion description statement. By converting the text into vectors, it is convenient to extract event element information later.
[0109] In the embodiment of the present application, as Figure 4 shown, the event element extraction model includes a first sub-model 100 and a second sub-model 200. Based on any of the above embodiments, as Figure 5 shown, the implementation process of step 103 for inputting the fusion description information into the event element extraction model to obtain the target event element label corresponding to the target public opinion data includes step 401, step 402, and step 403:
[0110] Step 401: Input the fusion description information into multiple filters included in the first sub-model to obtain the local feature information output by each filter, and the convolutional kernel sizes corresponding to each filter are different.
[0111] Optionally, the number of filters is not less than 3. Figure 4Exemplarily shows the event element extraction model structure corresponding to the case where the number of filters is 3. Taking the example of inputting the fusion description information into the k-th filter, the local feature information output by the k-th filter includes a plurality of local sub-features O i . Specifically, wherein, is the feature from the i-th row to the (i + h k - 1)-th row in the fusion description information, R k represents the k-th filter, h k is the convolution kernel size corresponding to the k-th filter, and b is an adjustment coefficient. Merging the plurality of local sub-features O i to obtain the local feature information Z k , wherein, Z k = concat(o1, o2, …, o i , …, o I ), and I is the number of local sub-features.
[0112] Step 402, based on the first sub-model and each local feature information, obtain the target feature information corresponding to the fusion description information.
[0113] Optionally, merge each local feature information Z k through the first sub-model to obtain the merged feature information Z all , Z all = concat(Z1, Z2, …, Z k , …, Z K ), wherein, K is the number of filters. Take the merged feature information Z all as the target feature information.
[0114] Step 403, input the target feature information into the second sub-model to obtain the target event element label output by the second sub-model.
[0115] Optionally, input the target feature information into the second sub-model to obtain the prediction probability corresponding to each element label in the element label library, and the prediction probability is obtained based on the target feature information and the element label; if the prediction probability is greater than the preset threshold, then take the element label corresponding to the prediction probability as the target event element label.
[0116] Optionally, the element label library includes a plurality of element labels. The second sub-model includes an activation function and a loss function.
[0117] Specifically, based on the activation function, calculate the prediction probability corresponding to the element label according to the target feature information and the element label. Optionally, the activation function is the sigmoid function, and the corresponding function expression is: y(x i ) = Sigmoid(logits i), where x i represents the label vector corresponding to the i-th element label in the element label library, and y(x i ) represents the predicted probability corresponding to the i-th element label, and its i represents the label prediction value corresponding to the i-th element label obtained based on the target feature information and the i-th element label. Optionally, the label prediction value is the matching value between the target feature information and the i-th element label calculated based on the text matching algorithm.
[0118] Optionally, the loss function is a cross-entropy loss function.
[0119] Specifically, the event element extraction method further includes the training process of the event element extraction model. The event element extraction model can be trained by the terminal itself; optionally, in order to save the computing resources of the terminal, the event element extraction model can also be trained by the server and sent to the terminal after training. This embodiment describes the case where the terminal trains the event element extraction model by itself. As Figure 6 shown, the training process of the event element extraction model is as follows:
[0120] Step 501, obtain a training sample set.
[0121] Among them, the training sample includes sample public opinion data and the sample label probability values corresponding to each element label.
[0122] Optionally, the sample public opinion data is a sample public opinion description sentence, or can also be a sample sentence word vector obtained by performing text processing on the sample public opinion description sentence based on a text processing method.
[0123] Optionally, the sample label probability values corresponding to each element label are the probability values corresponding to each element label calculated based on the one-hot encoding method.
[0124] Step 502, based on the training sample set, train the initial event element extraction model to obtain an event element extraction model.
[0125] Optionally, based on the Adam optimizer and the training sample set, use the backpropagation technique to train the initial event element extraction model to obtain an event element extraction model.
[0126] Optionally, an initial event element extraction model is established. Based on the sample public opinion data and the sample label probability values corresponding to each element label, multiple training processes are performed on the initial event element extraction model until the intermediate model obtained in a certain training process meets the target training condition, and this intermediate model is used as the event element extraction model. Among them, the target training condition can be that the loss value is less than a preset loss threshold. The process of obtaining the loss value includes: when performing a certain training process, inputting the sample public opinion data and the element label into the intermediate model to obtain an output result; calculating the loss value between the output result and the sample label probability value according to the loss function.
[0127] In this embodiment, by inputting the fusion description information into the filters with different convolutional kernel sizes included in the first sub-model to obtain the local feature information output by each filter for subsequent event element extraction, the feature of the fusion description information is fully extracted, and the accuracy of event element extraction is improved.
[0128] Further, based on Figure 5 the embodiment shown, as Figure 7 shown, the implementation process of step 402 for obtaining the target feature information corresponding to the fusion description information based on the first sub-model and each local feature information includes the following steps:
[0129] Step 601, merge and process each local feature information through the first sub-model to obtain the comprehensive feature information corresponding to the fusion description information.
[0130] Optionally, the merged feature information Z all obtained in step 402 is used as the comprehensive feature information.
[0131] Step 602, perform dimensionality reduction processing on the comprehensive feature information to obtain the target feature information.
[0132] Optionally, a dimensionality reduction processing algorithm is used to perform dimensionality reduction processing on the comprehensive feature information to obtain the target feature information. Among them, the dimensionality reduction processing algorithm is the max pooling method, that is, the target feature information is Z max = MaxPooling(Z all ).
[0133] In this embodiment, by performing dimensionality reduction processing on the comprehensive feature information obtained after merging and processing each local feature information to obtain the target feature information, the computational amount of the subsequent processing process is reduced, and the algorithm execution efficiency is improved.
[0134] In the embodiment of the present application, as Figure 8 shown, this embodiment provides an event element extraction method, and the method includes the following steps:
[0135] Step 701: Obtain the public opinion description statement, and perform word segmentation on the public opinion description statement to obtain multiple segmented words.
[0136] Figure 9 This is the algorithm model diagram corresponding to the event element extraction method involved in this embodiment. As Figure 9 shown, after word segmentation of the public opinion description statement, multiple segmented words a1, a2,..., an are obtained.
[0137] Step 702: Use a preset text encoding algorithm to encode each segmented word to obtain multiple statement word vectors, and use the multiple statement word vectors as the target public opinion data.
[0138] As Figure 9 shown, the preset text encoding algorithm is the pre-trained BERT model. Use the pre-trained BERT model to encode each segmented word a1, a2,..., an to obtain multiple statement word vectors A1, A2,..., An.
[0139] Step 703: Obtain the knowledge vector library corresponding to the target public opinion data.
[0140] Among them, the knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data.
[0141] Specifically, as Figure 9 shown, use the pre-trained BERT model to encode multiple knowledge text statements (i.e., d1, d2,..., dm) to obtain multiple reference word vectors D1, D2,..., Dm.
[0142] Step 704: For each statement word vector, calculate the association weights corresponding to the statement word vector and each reference word vector based on a preset association function to obtain multiple association weight values.
[0143] Please continue to refer to Figure 9 , calculate the association weights corresponding to the statement word vector and each reference word vector based on a preset association function, and the multiple association weight values are b1, b2,..., bm respectively.
[0144] Step 705: Obtain the maximum weight value among the multiple association weights corresponding to each statement word vector.
[0145] Step 706: Generate a statement representation matrix based on each statement word vector.
[0146] Step 707: Perform an outer product operation on the maximum weight value and the statement representation matrix to obtain the fused description information.
[0147] Among them, the fused description information is used to represent the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data.
[0148] Step 708: Input the fused description information into multiple filters included in the first sub-model to obtain local feature information output by each filter, where the convolution kernel sizes corresponding to the filters are different.
[0149] Please continue to refer to Figure 9 , the number of filters included in the first sub-model 100 is 3.
[0150] Step 709: Through the first sub-model, merge and process each local feature information to obtain comprehensive feature information corresponding to the fused description information.
[0151] Step 710: Perform dimensionality reduction processing on the comprehensive feature information to obtain target feature information.
[0152] Step 711: Input the target feature information into the second sub-model to obtain the prediction probabilities corresponding to each element label in the element label library, where the prediction probabilities are obtained based on the target feature information and the element labels.
[0153] Please continue to refer to Figure 9 , the prediction probability is a probability value obtained based on the sigmoid function according to the target feature information and the element labels.
[0154] Step 712: If the prediction probability is greater than the preset threshold, use the element label corresponding to the prediction probability as the target event element label.
[0155] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or steps or stages in other steps.
[0156] Based on the same inventive concept, the embodiments of the present application also provide an event element extraction device for implementing the event element extraction method involved above. The implementation solutions provided by this device to solve problems are similar to the implementation solutions described in the above method. Therefore, the specific limitations in one or more embodiments of the event element extraction device provided below can refer to the limitations on the event element extraction method in the above text, and will not be repeated here.
[0157] In one embodiment, as Figure 10As shown in the figure, an event element extraction device is provided, including: an acquisition module, a determination module, and an extraction module, where:
[0158] The acquisition module is used to acquire target public opinion data and the knowledge vector library corresponding to the target public opinion data. The knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data;
[0159] The determination module is used to determine the association weights between the target public opinion data and each reference word vector, and determine the fusion description information corresponding to the target public opinion data based on the association weights. The fusion description information is used to represent the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data;
[0160] The extraction module is used to input the fusion description information into the event element extraction model to obtain the target event element labels corresponding to the target public opinion data.
[0161] In one embodiment, the target public opinion data includes multiple sentence word vectors corresponding to public opinion description sentences. The determination module is specifically used for:
[0162] For each sentence word vector, based on a preset association function, calculate the association weights between the sentence word vector and each reference word vector to obtain multiple association weight values.
[0163] In one embodiment, the determination module is specifically used for:
[0164] Obtain the maximum weight value among the multiple association weights corresponding to each sentence word vector;
[0165] Generate a sentence representation matrix based on each sentence word vector;
[0166] Perform an outer product operation on the maximum weight value and the sentence representation matrix to obtain the fusion description information.
[0167] In one embodiment, the acquisition module is specifically used for:
[0168] Obtain public opinion description sentences, and perform word segmentation processing on the public opinion description sentences to obtain multiple segmented words;
[0169] Use a preset text encoding algorithm to encode each segmented word to obtain multiple sentence word vectors;
[0170] Use the multiple sentence word vectors as the target public opinion data.
[0171] In one embodiment, the event element extraction model includes a first sub-model and a second sub-model. The extraction module is specifically used for:
[0172] Input the fusion description information into multiple filters included in the first sub-model to obtain local feature information output by each filter, where the convolution kernel sizes corresponding to the filters are different;
[0173] Based on the first sub-model and each local feature information, obtain the target feature information corresponding to the fusion description information;
[0174] Input the target feature information into the second sub-model to obtain the target event element label output by the second sub-model.
[0175] In one embodiment, the extraction module is further specifically configured to:
[0176] Through the first sub-model, merge and process each local feature information to obtain the comprehensive feature information corresponding to the fusion description information;
[0177] Perform dimensionality reduction processing on the comprehensive feature information to obtain the target feature information.
[0178] In one embodiment, the extraction module is further specifically configured to:
[0179] Input the target feature information into the second sub-model to obtain the prediction probability corresponding to each element label in the element label library, where the prediction probability is obtained based on the target feature information and the element label;
[0180] If the prediction probability is greater than the preset threshold, use the element label corresponding to the prediction probability as the target event element label.
[0181] Each module in the above event element extraction device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor in the computer device in hardware form or be independent of it, or can be stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0182] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 11As shown in the figure. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be achieved through WIFI, mobile cellular networks, NFC (Near Field Communication) or other technologies. When the computer program is executed by the processor, it implements an event element extraction method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0183] Those skilled in the art can understand that Figure 11 the structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0184] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:
[0185] Obtain target public opinion data and a knowledge vector library corresponding to the target public opinion data. The knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data;
[0186] Determine the association weights between the target public opinion data and each reference word vector, and determine the fusion description information corresponding to the target public opinion data based on the association weights. The fusion description information is used to characterize the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data;
[0187] Input the fusion description information into the event element extraction model to obtain the target event element label corresponding to the target public opinion data.
[0188] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0189] For each statement word vector, calculate the association weights between the statement word vector and the reference word vectors corresponding to each reference word vector based on a preset association function to obtain multiple association weight values.
[0190] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0191] Obtain the maximum weight value among multiple associated weights corresponding to each statement word vector; generate a statement representation matrix based on each statement word vector; perform an outer product operation on the maximum weight value and the statement representation matrix to obtain the fusion description information.
[0192] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0193] Obtain the public opinion description statement, and perform word segmentation on the public opinion description statement to obtain multiple segmented words; use a preset text encoding algorithm to encode each segmented word to obtain multiple statement word vectors; use the multiple statement word vectors as the target public opinion data.
[0194] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0195] Input the fusion description information into multiple filters included in the first sub-model to obtain local feature information output by each filter, where the convolution kernel sizes corresponding to each filter are different; based on the first sub-model and each local feature information, obtain the target feature information corresponding to the fusion description information; input the target feature information into the second sub-model to obtain the target event element label output by the second sub-model.
[0196] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0197] Merge and process each local feature information through the first sub-model to obtain the comprehensive feature information corresponding to the fusion description information; perform dimensionality reduction processing on the comprehensive feature information to obtain the target feature information.
[0198] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0199] Input the target feature information into the second sub-model to obtain the prediction probability corresponding to each element label in the element label library, where the prediction probability is obtained based on the target feature information and the element label; if the prediction probability is greater than the preset threshold, use the element label corresponding to the prediction probability as the target event element label.
[0200] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0201] Obtain the target public opinion data and the knowledge vector library corresponding to the target public opinion data, where the knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data;
[0202] Determine the association weights between the target public opinion data and each reference word vector, and determine the fusion description information corresponding to the target public opinion data based on the association weights. The fusion description information is used to represent the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data;
[0203] Input the fusion description information into the event element extraction model to obtain the target event element labels corresponding to the target public opinion data.
[0204] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0205] For each statement word vector, calculate the association weights between the statement word vector and each reference word vector based on a preset association function to obtain multiple association weight values.
[0206] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0207] Obtain the maximum weight value among the multiple association weights corresponding to each statement word vector; generate a statement representation matrix based on each statement word vector; perform an outer product operation on the maximum weight value and the statement representation matrix to obtain the fusion description information.
[0208] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0209] Obtain the public opinion description statement, perform word segmentation processing on the public opinion description statement to obtain multiple word segments; encode each word segment using a preset text encoding algorithm to obtain multiple statement word vectors; use the multiple statement word vectors as the target public opinion data.
[0210] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0211] Input the fusion description information into multiple filters included in the first sub-model to obtain the local feature information output by each filter, and the convolution kernel sizes corresponding to each filter are different; based on the first sub-model and each local feature information, obtain the target feature information corresponding to the fusion description information; input the target feature information into the second sub-model to obtain the target event element labels output by the second sub-model.
[0212] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0213] Merge and process each local feature information through the first sub-model to obtain the comprehensive feature information corresponding to the fusion description information; perform dimensionality reduction processing on the comprehensive feature information to obtain the target feature information.
[0214] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0215] Input the target feature information into the second sub-model to obtain the prediction probabilities corresponding to each element label in the element label library. The prediction probabilities are obtained based on the target feature information and the element labels. If the prediction probability is greater than a preset threshold, the element label corresponding to the prediction probability is used as the target event element label.
[0216] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0217] Obtain the target public opinion data and the knowledge vector library corresponding to the target public opinion data. The knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data.
[0218] Determine the association weights between the target public opinion data and each reference word vector, and determine the fusion description information corresponding to the target public opinion data based on the association weights. The fusion description information is used to characterize the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data.
[0219] Input the fusion description information into the event element extraction model to obtain the target event element label corresponding to the target public opinion data.
[0220] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0221] For each statement word vector, calculate the association weights between the statement word vector and each reference word vector based on a preset association function to obtain multiple association weight values.
[0222] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0223] Obtain the maximum weight value among the multiple association weights corresponding to each statement word vector; generate a statement representation matrix based on each statement word vector; perform an outer product operation on the maximum weight value and the statement representation matrix to obtain the fusion description information.
[0224] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0225] Obtain the public opinion description statement, perform word segmentation processing on the public opinion description statement to obtain multiple word segments; encode each word segment using a preset text encoding algorithm to obtain multiple statement word vectors; use the multiple statement word vectors as the target public opinion data.
[0226] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0227] Input the fused description information into multiple filters included in the first sub-model to obtain local feature information output by each filter, where the convolution kernel sizes corresponding to the filters are different; based on the first sub-model and each local feature information, obtain target feature information corresponding to the fused description information; input the target feature information into the second sub-model to obtain target event element labels output by the second sub-model.
[0228] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0229] Merge and process each local feature information through the first sub-model to obtain comprehensive feature information corresponding to the fused description information; perform dimensionality reduction processing on the comprehensive feature information to obtain target feature information.
[0230] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0231] Input the target feature information into the second sub-model to obtain prediction probabilities corresponding to each element label in the element label library, where the prediction probabilities are obtained based on the target feature information and the element labels; if the prediction probability is greater than a preset threshold, use the element label corresponding to the prediction probability as the target event element label.
[0232] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., and are not limited thereto. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., and are not limited thereto.
[0233] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0234] The above-described embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A method for event element extraction, characterized in that, The method includes: Obtaining target public opinion data and the knowledge vector library corresponding to the target public opinion data, where the knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data; the target public opinion data includes multiple sentence word vectors corresponding to the public opinion description sentences; For each of the sentence word vectors, based on a preset association function, calculating the association weights corresponding to the sentence word vector and each of the reference word vectors to obtain multiple association weight values; Obtaining the maximum weight value among the multiple association weights corresponding to each of the sentence word vectors; Generating a sentence representation matrix based on each of the sentence word vectors; Performing an outer product operation on the maximum weight value and the sentence representation matrix to obtain fused description information; The fused description information is used to represent the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data; Inputting the fused description information into multiple filters included in the first sub-model to obtain local feature information output by each of the filters, and the convolution kernel sizes corresponding to each of the filters are different; Based on the first sub-model and each of the local feature information, obtaining target feature information corresponding to the fused description information; Inputting the target feature information into the second sub-model to obtain target event element labels output by the second sub-model; Among them, the event element extraction model includes the first sub-model and the second sub-model.
2. The method according to claim 1, wherein The obtaining of the target public opinion data includes: Obtaining a public opinion description sentence, and performing word segmentation processing on the public opinion description sentence to obtain multiple segmented words; Using a preset text encoding algorithm to encode each of the segmented words to obtain multiple sentence word vectors; Taking the multiple sentence word vectors as the target public opinion data.
3. The method according to claim 1, wherein The obtaining of the target feature information corresponding to the fused description information based on the first sub-model and each of the local feature information includes: Through the first sub-model, merging and processing each of the local feature information to obtain comprehensive feature information corresponding to the fused description information; Performing dimensionality reduction processing on the comprehensive feature information to obtain the target feature information.
4. The method according to claim 1, wherein The inputting of the target feature information into the second sub-model to obtain the target event element labels output by the second sub-model includes: Inputting the target feature information into the second sub-model to obtain the prediction probabilities corresponding to each of the element labels in the element label library, where the prediction probabilities are based on the target feature information and the element labels; If the prediction probability is greater than a preset threshold, taking the element label corresponding to the prediction probability as the target event element label.
5. An event element extraction device, characterized in that, The device includes: An obtaining module, configured to obtain target public opinion data and the knowledge vector library corresponding to the target public opinion data, where the knowledge vector library includes multiple reference word vectors, and the multiple reference word vectors have the same knowledge domain classification dimension as the target public opinion data; the target public opinion data includes multiple sentence word vectors corresponding to the public opinion description sentences; A determination module, configured to calculate, for each of the statement word vectors, an association weight corresponding to each of the reference word vectors based on a preset association function, to obtain a plurality of association weight values; Obtain the maximum weight value among the plurality of association weights corresponding to each of the statement word vectors; Generate a statement representation matrix based on each of the statement word vectors; Perform an outer product operation on the maximum weight value and the statement representation matrix to obtain fused description information; The fused description information is used to represent the public opinion description information corresponding to the knowledge domain classification dimension included in the target public opinion data; An extraction module, configured to input the fused description information into a plurality of filters included in a first sub-model, to obtain local feature information output by each of the filters, and the convolution kernel sizes corresponding to the filters are different; Based on the first sub-model and each of the local feature information, obtain target feature information corresponding to the fused description information; input the target feature information into a second sub-model, and obtain a target event element label output by the second sub-model; Wherein, the event element extraction model includes the first sub-model and the second sub-model.
6. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 4 are implemented.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Text information processing method and device, storage medium and electronic equipment
CN111539212A
Public opinion category determination method, device and equipment
CN112966161A
Public opinion text classification method and system based on multi-label embedding, terminal and medium
CN113987187A