Emotion-based news event classification method, device, equipment and storage medium

By encoding and classifying the headlines and body text of financial news, combined with probability threshold judgment and model updates, the problem of insufficient accuracy in financial news classification is solved, and the accuracy and efficiency of sentiment and event classification in financial news are improved.

CN116450824BActive Publication Date: 2025-11-07PING AN FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310355382.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-22
Publication Date
2025-11-07
Estimated Expiration
2043-03-22

AI Technical Summary

Technical Problem

Existing technologies suffer from insufficient accuracy in classifying financial news sentiment and events due to misleading headlines, which affects the accuracy of asset price analysis.

Method used

By encoding the headlines and body text of financial news, setting probability thresholds to judge the reliability of classification results, and using pre-trained encoding and corpus classification models for two-level classification, the accuracy of sentiment and event labels for financial news is ensured, and the model is updated through feedback information.

Benefits of technology

It improved the accuracy of sentiment and event classification in financial news, reduced the consumption of analytical resources, and improved the efficiency and accuracy of information acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116450824B_ABST
    Figure CN116450824B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a news event classification method and device based on emotion, equipment and storage medium, relates to the field of artificial intelligence and text analysis, and obtains title feature representation sequence by encoding title data in the obtained financial news corpus in the encoding model, respectively performs event and emotion classification according to the title feature representation sequence in the corpus classification model, when at least one of the obtained maximum classification probabilities is less than the corresponding threshold value, inputs the text data into the corpus classification model, respectively performs event classification and emotion classification on the text data, and confirms the emotion label and the event label corresponding to the financial news corpus. By setting the probability threshold value of the title classification, it is judged whether the title classification result is reliable, and when the title classification result indicates that it is unreliable, the text classification result is used as a supplement, the reliability of the classification result according to the financial news corpus is improved, the efficiency of obtaining useful financial information is improved, and the consumption of analysis resources is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of text analysis, and particularly relates to a news event classification method and device based on sentiment, equipment and a storage medium. BACKGROUND

[0002] At present, the financial industry uses a neural network model to perform sentiment and event analysis on daily financial news, so as to obtain information for analyzing and predicting the asset price trend in the present and the future.

[0003] In order to improve the efficiency of sentiment and event analysis, only the title of the financial news is generally subjected to sentiment analysis and event analysis to determine whether the financial news is valuable. However, due to the fact that the financial news adds false sentiment and event information in the accurate information of the title in order to attract the attention of readers, the neural network model produces errors in the classification of sentiment and event, and therefore, how to improve the accuracy of the sentiment classification and event classification of the financial news becomes a problem to be solved. SUMMARY

[0004] The main purpose of the embodiments of the present application is to provide a news event classification method and device based on sentiment, equipment and a storage medium, which aims to improve the accuracy of the sentiment classification and event classification of the financial news.

[0005] To achieve the above-mentioned purpose, the first aspect of the embodiments of the present application provides a news event classification method based on sentiment, which comprises the following steps:

[0006] obtaining financial news corpus, wherein the financial news corpus comprises title data and text data;

[0007] inputting the title data into a pre-trained encoding model to perform encoding, so as to obtain a title feature representation sequence;

[0008] inputting the title feature representation sequence into a pre-trained corpus classification model to obtain a first event classification probability sequence and a first sentiment classification probability sequence, wherein the first event classification probability sequence comprises the event classification probability of each preset event type corresponding to the financial news corpus, and the first sentiment classification probability sequence comprises the sentiment classification probability of each preset sentiment type corresponding to the financial news corpus;

[0009] when the maximum probability in the first event classification probability sequence is less than a first preset threshold or the maximum probability in the first sentiment classification probability sequence is less than a second preset threshold, inputting the text data into the pre-trained encoding model to perform encoding, so as to obtain a text feature representation sequence;

[0010] inputting the title feature representation sequence into the corpus classification model to obtain a second event classification probability sequence and a second sentiment classification probability sequence, the second event classification probability sequence including event classification probabilities of the financial news corpus corresponding to each preset event type, and the second sentiment classification probability sequence including sentiment classification probabilities of the financial news corpus corresponding to each preset sentiment type;

[0011] determining an event label of the financial news corpus according to a maximum probability in the second event classification probability sequence, and determining a sentiment label of the financial news corpus according to a maximum probability in the second sentiment classification probability sequence.

[0012] In some possible embodiments of the present application, after the first event classification probability sequence and the first sentiment classification probability sequence are obtained, the method further includes:

[0013] when a maximum probability in the first event classification probability sequence is greater than or equal to a first preset threshold, and a maximum probability in the first sentiment classification probability sequence is greater than or equal to a second preset threshold, determining an event label of the financial news corpus according to the maximum probability in the first event classification probability sequence, and determining a sentiment label of the financial news corpus according to the maximum probability in the first sentiment classification probability sequence.

[0014] In some possible embodiments of the present application, after the event label and the sentiment label of the financial news corpus are determined, the method further includes:

[0015] storing the financial news corpus into an event set corresponding to the event label;

[0016] extracting the financial news corpus from the event set to form a recommendation set;

[0017] sending the financial news corpus in the recommendation set to a terminal of a target object.

[0018] In some possible embodiments of the present application, the extracting the financial news corpus from the event set to form a recommendation set includes:

[0019] obtaining a proportion of the number of events corresponding to each sentiment label in the event set in a preset time period;

[0020] extracting the financial news corpus corresponding to the preset time period from the event set to form a recommendation set according to the proportion of the number of events corresponding to each sentiment label.

[0021] In some possible embodiments of the present application, after the financial news corpus in the recommendation set is sent to the terminal of the target object, the method further includes:

[0022] receive feedback information sent by a terminal of the target object, the feedback information including event classification error information or sentiment classification error information for the financial news corpus in the recommendation set;

[0023] construct event classification annotation labels and sentiment classification annotation labels of the financial news corpus according to the event classification error information or the sentiment classification error information for the financial news corpus in the recommendation set;

[0024] add the financial news corpus and the event classification annotation labels and the sentiment classification annotation labels corresponding to the financial news corpus into an updated training set;

[0025] update train the corpus classification model according to the updated training set.

[0026] In some possible embodiments of the present application, before the financial news corpus is acquired, the method further includes:

[0027] collect the financial news corpus according to a preset data source;

[0028] segment the collected financial news corpus to obtain multiple segments;

[0029] perform preprocessing on the financial news corpus, the preprocessing including: for each segment of the financial news corpus, when the segment does not contain any word in a preset financial domain vocabulary set, deleting the segment.

[0030] In some possible embodiments of the present application, the encoding model includes a word segmentation module and a self-attention encoding module, and the training process of the encoding model includes:

[0031] acquire a training set, the training set including multiple training corpora of financial news;

[0032] perform segmentation and sorting on the training corpora according to a preset financial domain vocabulary set to obtain training word segmentation sequences;

[0033] input the training corpora into the word segmentation module after performing mask processing on the training word segmentation sequences to obtain training numerical vector sequences;

[0034] input the training numerical vector sequences into the self-attention encoding module to obtain predicted word segmentation sequences;

[0035] determine a loss function value according to the training word segmentation sequences and the predicted word segmentation sequences;

[0036] adjust model parameters of the encoding model according to the loss function value.

[0037] To achieve the above object, a second aspect of the embodiment of the present application provides a news event classification device based on emotion, which comprises:

[0038] An acquisition module is configured to acquire a financial news corpus, wherein the financial news corpus comprises title data and text data.

[0039] A first encoding module is configured to input the title data into a pre-trained encoding model to obtain a title feature representation sequence.

[0040] A first event classification module is configured to input the title feature representation sequence into a pre-trained corpus classification model to obtain a first event classification probability sequence and a first emotion classification probability sequence, wherein the first event classification probability sequence comprises event classification probabilities of each preset event type corresponding to the financial news corpus, and the first emotion classification probability sequence comprises emotion classification probabilities of each preset emotion type corresponding to the financial news corpus.

[0041] A second encoding module is configured to input the text data into the pre-trained encoding model to obtain a text feature representation sequence when a maximum probability in the first event classification probability sequence is less than a first preset threshold or a maximum probability in the first emotion classification probability sequence is less than a second preset threshold.

[0042] A second event classification module is configured to input the title feature representation sequence into the pre-trained corpus classification model to obtain a second event classification probability sequence and a second emotion classification probability sequence, wherein the second event classification probability sequence comprises event classification probabilities of each preset event type corresponding to the financial news corpus, and the second emotion classification probability sequence comprises emotion classification probabilities of each preset emotion type corresponding to the financial news corpus.

[0043] A determination module is configured to determine an event label of the financial news corpus according to a maximum probability in the second event classification probability sequence, and determine an emotion label of the financial news corpus according to a maximum probability in the second emotion classification probability sequence.

[0044] To achieve the above object, a third aspect of the embodiment of the present application provides an electronic device, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the method of the first aspect when executing the computer program.

[0045] To achieve the above object, a fourth aspect of the embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the method of the first aspect when executed by a processor.

[0046] This application proposes a sentiment-based news event classification method, apparatus, device, and storage medium. It encodes title data from acquired financial news corpora in an encoding model to obtain a title feature representation sequence. In a corpus classification model, event and sentiment classifications are performed separately based on the title feature representation sequence. When at least one of the obtained maximum classification probabilities is less than a corresponding threshold, the text data is input into the corpus classification model for event and sentiment classification, confirming the corresponding sentiment and event tags for the financial news corpus. By setting a probability threshold for title classification, the reliability of the title classification result is determined. When the title classification result is unreliable, the text classification result is used as reinforcement, improving the reliability of the classification results based on the financial news corpus and increasing the efficiency of obtaining useful financial information. Furthermore, the two-level classification steps constructed by setting thresholds improve both the reliability and efficiency of the classification results, reducing the consumption of analytical resources. Attached Figure Description

[0047] Figure 1 This is a schematic diagram illustrating the steps of an emotion-based news event classification method provided in an embodiment of this application;

[0048] Figure 2 yes Figure 1 A schematic diagram illustrating the steps of another embodiment of the method provided in the diagram;

[0049] Figure 3 yes Figure 1 A schematic diagram illustrating the steps of another embodiment of the method provided in the diagram;

[0050] Figure 4 yes Figure 1 A schematic diagram illustrating the steps of another embodiment of the method provided in the diagram;

[0051] Figure 5 yes Figure 4 A schematic diagram of the sub-steps in step S108;

[0052] Figure 6 yes Figure 1 A schematic diagram illustrating the steps of another embodiment of the method provided in the diagram;

[0053] Figure 7 yes Figure 1 A schematic diagram of the encoding model training in step S102;

[0054] Figure 8 This is a schematic diagram of the structure of a news event classification method device based on emotion provided in an embodiment of this application;

[0055] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0056] In order to make the purposes, technical solutions and advantages of the present application clearer, 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 not intended to limit the present application.

[0057] It should be noted that although the functional modules are divided in the device schematic diagram, and the logical sequence is shown in the flowchart, in some cases, the steps shown or described can be performed in a manner different from the module division in the device or the sequence in the flowchart. The terms "first", "second", and the like in the specification and claims and the above-described drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0059] First, the terms involved in the present application are analyzed:

[0060] Artificial intelligence (AI): is a new technical science that studies, develops and applies systems for simulating, extending and expanding human intelligence; artificial intelligence is a branch of computer science, and artificial intelligence aims to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. The research in this field includes robots, language recognition, image recognition, natural language processing and expert systems. Artificial intelligence can simulate the information process of human consciousness and thinking. Artificial intelligence is also the theory, method, technology and application system of using digital computers or digital computer controlled machines to simulate, extend and expand human intelligence, to perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0061] Natural language processing (NLP): NLP uses computers to process, understand and use human language (such as Chinese, English, etc.). NLP is a branch of artificial intelligence and is an interdisciplinary subject of computer science and linguistics, and is also commonly known as computational linguistics. Natural language processing includes syntax analysis, semantic analysis, discourse understanding, etc. Natural language processing is commonly used in machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining, etc. It involves data mining, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research related to language processing, and language computing related linguistic research.

[0062] Information Extraction: A text processing technology that extracts specified types of entity, relationship, event, etc. factual information from natural language text, and forms structured data output. Information extraction is a technology for extracting specific information from text data. Text data is composed of specific units such as sentences, paragraphs, and chapters, and text information is composed of small specific units such as words, phrases, sentences, paragraphs, or combinations of these specific units. Extracting noun phrases, names, and places from text data is text information extraction, and of course, the information extracted by the text information extraction technology can be various types of information.

[0063] Currently, the financial industry uses neural network models to analyze the sentiment and events of daily financial news to obtain information for analyzing and predicting the current and future asset price trends.

[0064] In order to improve the efficiency of sentiment and event analysis, only the title of the financial news is generally analyzed for sentiment and event analysis to determine whether the financial news is valuable. However, due to the fact that financial news adds false sentiment and event information to the accurate information in the title to attract the attention of readers, the neural network model makes errors in classifying sentiment and events, and therefore, how to improve the accuracy of financial news sentiment classification and event classification is a problem to be solved.

[0065] Based on this, the embodiments of the present application provide a news event classification method and device based on sentiment, equipment and storage medium, aiming to improve the accuracy of financial news sentiment classification and event classification.

[0066] The news event classification method and device based on sentiment provided by the embodiments of the present application are specifically explained by the following embodiments, first, a news event classification method based on sentiment in the embodiments of the present application is described.

[0067] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. Among them, artificial intelligence (Artificial Intelligence, AI) is to use digital computers or digital computer controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Theory, method, technology and application system.

[0068] The artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The artificial intelligence software technology mainly includes computer vision technology, robot technology, biometric identification technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.

[0069] The embodiment of the present application provides a news event classification method based on emotion, and relates to the technical field of artificial intelligence. The news event classification method based on emotion provided by the embodiment of the present application can be applied to a terminal, can also be applied to a server end, and can be software running in the terminal or the server end. In some embodiments, the terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer or the like; the server end can be configured as an independent physical server, can also be configured as a server cluster or a distributed system formed by multiple physical servers, and can also be configured as a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN and big data and artificial intelligence platform; the software can be an application for realizing the news event classification method based on emotion, and the like, but is not limited to the above forms.

[0070] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in a distributed computing environment, in which tasks are performed by remote processing devices connected by a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.

[0071] It should be noted that in various specific embodiments of the present application, when relevant processing needs to be performed on data related to the identity or characteristics of the user, such as user information, user behavior data, user history data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of such data will comply with relevant laws, regulations, and standards of the relevant country or region. In addition, when the embodiments of the present application need to obtain sensitive personal information of the user, the separate permission or separate consent of the user will be obtained through a pop-up window or a jump to a confirmation page, and after obtaining the separate permission or separate consent of the user, the necessary user-related data for the normal operation of the embodiments of the present application will be obtained.

[0072] Please refer to Figure 1 , Figure 1 A step schematic diagram of a news event classification method based on emotion provided by the embodiments of the present application, Figure 1 The method in the above embodiment can include but is not limited to steps S101 to S106.

[0073] Step S101, obtaining financial news corpus.

[0074] It should be understood that the financial news corpus here includes title data and text data of financial news, and these data have been cleaned and do not include invalid fragments that affect sentiment analysis.

[0075] It should be understood that the acquisition method is diverse, and exemplary, such as other external terminals uploading preprocessed news corpus; for example, listening to the financial news processing process, and obtaining the latest financial news corpus when the financial news preprocessing is completed. Those skilled in the art can adopt the corresponding acquisition method of the financial news corpus according to the actual situation, and the present application does not limit it.

[0076] Step S102, inputting the title data into a pre-trained encoding model for encoding to obtain a title feature representation sequence.

[0077] Specifically, the title data is input into the model for encoding, the words in the title data are vectorized through a preset financial vocabulary table to obtain vectorized data, and then the vectorized data is converted into corresponding word feature representation through a self-encoding encoder to obtain a title feature representation sequence.

[0078] Exemplarily, the tokenization in the XLnet model is used to perform mask processing on the title data to obtain vectorized title data, and the self-encoding module in the XLnet is used to perform feature processing on the vectorized title data to obtain a title feature representation sequence.

[0079] It should be understood that the title feature representation sequence herein represents that each corresponding word feature representation in the sequence can be used to predict the next word, providing context information for model analysis.

[0080] In step S103, the title feature representation sequence is input into the pre-trained corpus classification model to obtain a first event classification probability sequence and a first sentiment classification probability sequence.

[0081] It should be understood that the first event classification probability sequence herein includes event classification probabilities of each preset event type corresponding to the financial news corpus.

[0082] It should be understood that the number of preset event types in the first event classification probability sequence herein and the specific event types are various, and exemplary preset event types include “policy direction”, “public opinion direction”, “industry direction”, etc. Those skilled in the art can set the corresponding number and specific event types according to actual needs, which are not limited in the present application.

[0083] It should be understood that the first sentiment classification probability sequence herein includes sentiment classification probabilities of each preset sentiment type corresponding to the financial news corpus.

[0084] It should be understood that the number of preset sentiment types in the first sentiment classification probability sequence herein and the specific sentiment types are various, and exemplary preset sentiment types include “positive”, “neutral”, “negative”, etc. Those skilled in the art can set the corresponding number and specific sentiment types according to actual needs, which are not limited in the present application.

[0085] In step S104, when the maximum probability in the first event classification probability sequence is less than a first preset threshold or the maximum probability in the first sentiment classification probability sequence is less than a second preset threshold, the text data is input into the pre-trained encoding model for encoding to obtain a text feature representation sequence.

[0086] It should be understood that there are multiple first preset thresholds herein, and each preset event type is provided with a corresponding preset probability threshold; there are multiple second preset thresholds herein, and each preset sentiment type is provided with a corresponding preset probability threshold.

[0087] It should be understood that the maximum probability in the first event classification probability sequence herein being less than the first preset threshold indicates that the event type represented by the title of the current financial news needs to be detected again whether it is the event type currently represented; the maximum probability in the second event classification probability sequence herein being less than the second preset threshold indicates that the sentiment type represented by the title of the current financial news needs to be detected again whether it is the sentiment type currently represented.

[0088] Specifically, the text data is input into the model for encoding, the words in the text data are vectorized through a preset financial vocabulary table to obtain vectorized data, and then the vectorized data is converted into corresponding word feature representation through a self-recursive encoder to obtain a text feature representation sequence.

[0089] For example, the text data is masked using tokenization in the XLnet model to obtain vectorized text data, and the vectorized text data is then feature processed using a self-recursive encoding module in the XLnet to obtain a text feature representation sequence.

[0090] By setting a threshold to determine whether the current type is correct, the confidence of the type determination is improved, and the probability of financial news determination error is reduced.

[0091] In step S105, the title feature representation sequence is input into a pre-trained corpus classification model to obtain a second event classification probability sequence and a second sentiment classification probability sequence.

[0092] It should be understood that the second event classification probability sequence herein includes event classification probabilities of the financial news corpus corresponding to each preset event type, and the preset event types in the second event classification probability sequence are the same as the preset event types in the first event classification probability sequence.

[0093] It should be understood that the second sentiment classification probability sequence herein includes sentiment classification probabilities of the financial news corpus corresponding to each preset sentiment type, and the preset sentiment types in the second sentiment classification probability sequence are the same as the preset sentiment types in the first sentiment classification probability sequence.

[0094] In step S106, the event label of the financial news corpus is determined according to the maximum probability in the second event classification probability sequence, and the sentiment label of the financial news corpus is determined according to the maximum probability in the second sentiment classification probability sequence.

[0095] It should be understood that the event label herein refers to defining the event type corresponding to the maximum probability of the financial news. For example, if the probability of the event type "public opinion direction" is the maximum, the event label of the financial news is "public opinion direction".

[0096] It should be understood that the sentiment label herein refers to defining the sentiment type corresponding to the maximum probability of the financial news. For example, if the probability of the event type "negative" is the maximum, the sentiment label of the financial news is "negative". If combined with the event label "public opinion direction" above, it indicates that the target object can be negative public opinion direction news according to the financial news.

[0097] The steps S101 to S106 shown in the embodiments of the present application are as follows: the title feature representation sequence is obtained by encoding the title data in the obtained financial news corpus in the encoding model; the event and sentiment classification is performed according to the title feature representation sequence in the corpus classification model; when at least one of the obtained maximum classification probabilities is less than the corresponding threshold value, the text data is input into the corpus classification model, and the event classification and sentiment classification are performed on the text data, and the sentiment label and event label corresponding to the financial news corpus are confirmed. By setting the probability threshold value of the title classification, it is determined whether the title classification result is reliable, and when the title classification result indicates that it is unreliable, the text classification result is used as a supplement to improve the reliability of the classification result of the financial news corpus, and the efficiency of obtaining useful financial information is improved; and by setting the threshold value, the two-stage classification steps are constructed, which improves the reliability of the classification result and also improves the efficiency of the classification, and reduces the consumption of analysis resources.

[0098] See Figure 2 , Figure 2 for Figure 1 the steps of another embodiment of the method provided in the present application. In some possible embodiments of the present application, the following steps are included before step S101.

[0099] In step S201, the financial news corpus is collected according to a preset data source.

[0100] It should be understood that the preset data source herein can be various, for example, a financial news website; for example, a financial information tweet; a person skilled in the art can select a suitable financial news source according to the actual situation, and the present application does not limit this.

[0101] It should be understood that the collection method herein can be various, for example, setting a news burying point, triggering collection when the target object clicks the news; for example, listening to financial news updates, and obtaining the latest financial news corpus when there is financial news update, and a person skilled in the art can adopt a corresponding collection method of the financial news corpus according to the actual situation, and the present application does not limit this.

[0102] In step S202, the financial news corpus is segmented to obtain a plurality of segments.

[0103] It should be understood that the segmentation herein refers to segmentation according to a preset rule, and does not refer to segmentation according to the division of natural paragraphs in the financial news, for example, a sentence can be regarded as a segment, and for example, two sentences can be regarded as a segment, and a person skilled in the art can set a corresponding segmentation rule according to the actual situation, and the present application does not limit this.

[0104] In step S203, the financial news corpus is preprocessed.

[0105] It should be understood that the preprocessing here includes, for each segment of the financial news corpus, deleting the segment when the segment does not contain any word in the preset set of financial domain words.

[0106] It should be understood that the method of detecting whether the preset word is contained in the segment here is various, and examples are, for example, extracting some target words through information extraction, and comparing the words with the set of financial domain words; for another example, performing word segmentation on the segment to extract a list, traversing the list, and comparing each traversed word with the set of financial domain words; a person skilled in the art can adopt a corresponding word detection method according to actual needs, and the present application does not limit this.

[0107] The embodiment of the present application deletes irrelevant segments that affect subsequent model discrimination by preprocessing the financial news, reduces the influence of irrelevant segments on model operation, and improves the efficiency of event and sentiment classification.

[0108] Please refer to Figure 3 , Figure 3 for Figure 1 the steps of another embodiment of the method provided in the above.

[0109] Step S301, when the maximum probability in the first event classification probability sequence is greater than or equal to the first preset threshold value, and the maximum probability in the first sentiment classification probability sequence is greater than or equal to the second preset threshold value, determining the event label of the financial news corpus according to the maximum probability in the first event classification probability sequence, and determining the sentiment label of the financial news corpus according to the maximum probability in the first sentiment classification probability sequence.

[0110] It should be understood that the respective maximum probability in the two sequences is greater than or equal to the corresponding preset threshold value, indicating that the confidence of the discrimination of the sentiment and the event type of the title of the financial news is high, the misjudgment situation is low, and the discrimination of the text data can be saved.

[0111] It should be understood that step S301 and steps S104 to S106 are parallel steps, when step S301 is executed, steps S104 to S106 are not executed, and when steps S104 to S106 are executed, step S301 is not executed.

[0112] Please refer to Figure 4 , Figure 4 for Figure 1 the steps of another embodiment of the method provided in the above. In some possible embodiments of the present application, after step S106, the following steps are further included, but are not limited to the following steps.

[0113] Step S107, save the financial news corpus to the event set corresponding to the event label.

[0114] It should be understood that the financial news corpus saved here is the same as the financial news corpus in step S101, which is the preprocessed financial news corpus.

[0115] Step S108, extract the financial news corpus from the event set to form a recommendation set.

[0116] It should be understood that extraction here means extracting financial news corpus according to predetermined rules, which are diverse. For example, only financial news corpus of a certain event type is selected; for another example, a portion of financial news corpus of each event set is extracted according to a predetermined proportion; those skilled in the art can set the predetermined rules to extract the financial news corpus to form the recommendation set according to the actual situation, and the present application does not limit this.

[0117] Step S109, send the financial news corpus in the recommendation set to the terminal of the target object.

[0118] It should be understood that the financial news corpus sent to the terminal of the target object includes title data and text data, which are preprocessed data and contain one or more words in the financial field vocabulary set.

[0119] The embodiments of the present application extract the corpus to form a recommendation set, filter the information recommended to the target object, extract the key information in the recommendation set, and improve the timeliness and effectiveness of information pushing.

[0120] Please refer to Figure 5 , Figure 5 for Figure 4 the sub-step schematic diagram of step S108 in the method. In some possible embodiments of the present application, step S108 includes but is not limited to the following sub-steps.

[0121] Step S501, obtain the proportion of the number of events corresponding to each sentiment label in the event set in a preset time period.

[0122] It should be understood that the preset time period is diverse, for example, one day; for another example, one hour; those skilled in the art can set the specific event interval corresponding to the preset time period according to the actual situation, and the present application does not limit this.

[0123] Step S502, according to the proportion of the number of events corresponding to each sentiment label, extract the financial news corpus corresponding to the preset time period from the event set to form a recommendation set.

[0124] It should be understood that the number of financial news corpus extracted here is diverse, and the specific number of financial news corpus extracted by those skilled in the art can be set according to the actual situation. The present application does not limit the specific number of financial news corpus extracted.

[0125] It should be understood that the financial news corpus extracted here according to the proportion is relative to the specific value. In the current event set, the corresponding proportion of the financial news corpus extracted according to each sentiment label, and all the financial news corpus extracted in the current event set contains all the sentiment labels.

[0126] The embodiments of the present application achieve the effect of analyzing diversified data by extracting financial news corpus of different sentiment types in different event types to form a recommended set.

[0127] Please refer to Figure 6 , Figure 6 for Figure 1 the steps of another embodiment of the method provided in the present application. In some possible embodiments of the present application, after step S109, the following steps are included but not limited to.

[0128] Step S601, receiving feedback information sent by the terminal of the target object.

[0129] It should be understood that the feedback information here includes event classification error information or sentiment classification error information for the financial news corpus in the recommended set.

[0130] It should be understood that the feedback information here includes not only event classification error information or sentiment classification error information, but also information that distinguishes these information, for example, event classification accuracy or sentiment classification accuracy. Those skilled in the art can set the type of feedback information sent by the terminal according to the actual needs, and the present application does not limit it.

[0131] Step S602, constructing event classification annotation labels and sentiment classification annotation labels of the financial news corpus according to the event classification error information or the sentiment classification error information for the financial news corpus in the recommended set.

[0132] It should be understood that the event classification annotation label here refers to the event label of the financial news corpus given by human classification error; the sentiment classification annotation label here refers to the sentiment label of the financial news corpus given by human classification error.

[0133] It should be understood that the classification error of the financial news corpus here can be one of event classification error or sentiment classification error, or both event classification and sentiment classification can be wrong, and the present application does not limit it.

[0134] Step S603, the financial news corpus and the event classification label and the sentiment classification label corresponding to the financial news corpus are added to the updated training set.

[0135] It should be understood that the corresponding label annotation label added to the updated training set herein refers to two correct annotation labels of the corpus. For example, if the event classification is wrong, the corresponding label is added in addition to the event annotation label, and the original correctly recognized sentiment label is also added.

[0136] Step S604, the corpus classification model is updated and trained according to the updated training set.

[0137] Specifically, the weight parameters or loss function coefficients in the corpus classification model are adjusted using the updated training set to update the corpus classification model.

[0138] The embodiment of the application updates the model parameters through the target object feedback information, improves the accuracy of the model event classification and sentiment classification, and improves the accuracy of the pushed information.

[0139] See Figure 7 , Figure 7 For Figure 1 The encoding model training schematic diagram of step S102. In some possible embodiments of the application, the training process of the encoding model includes but is not limited to the following steps.

[0140] Step S701, obtaining a training set.

[0141] It should be understood that the training set herein includes a plurality of training corpora of financial news; the training set herein can be a general training set or an updated training set in step S604, which is not limited by the application.

[0142] Step S702, according to the preset financial field vocabulary set, the training corpus is segmented and sorted to obtain a training segmented sequence.

[0143] It should be understood that the training corpus herein is a selected corpus, and the corpus contains one or more words in the financial field vocabulary set.

[0144] Step S703, the training corpus is input into the segmentation module after mask processing according to the training segmented sequence to obtain a training numerical vector sequence.

[0145] For example, the XLnet model tokenization is used to mask process the text data to obtain a vectorized sequence, which is the training numerical vector sequence.

[0146] Step S704, inputting the training numerical vector sequence into the autoregressive encoding module to obtain a predicted segmented sequence.

[0147] For example, the training numerical vector sequence in the vectorized representation is characterized using the autoregressive encoding module in XLnet to obtain a predicted segmented sequence.

[0148] Step S705, determining a loss function value according to the training segmented sequence and the predicted segmented sequence.

[0149] It should be understood that the loss function value here is a statistical value, and the loss between the training segmented sequence and the predicted segmented sequence of all corpora is collected to obtain the loss function value using a preset statistical method.

[0150] It should be understood that the preset statistical method here is diverse, and a person skilled in the art can select a suitable statistical method according to actual needs, which is not limited in the present application.

[0151] Step S706, adjusting the model parameters of the encoding model according to the loss function value.

[0152] Please refer to Figure 8 , Figure 8 A structure schematic diagram of a news event classification device based on emotion provided by an embodiment of the present application. In some possible embodiments of the present application, a news event classification device based on emotion 800 is provided, which can implement the above-mentioned news event classification method based on emotion. The device 800 comprises:

[0153] The acquisition module 801 is configured to acquire financial news corpora.

[0154] It should be understood that the financial news corpora here include title data and text data.

[0155] The first encoding module 802 is configured to input the title data into a pre-trained encoding model for encoding to obtain a title feature representation sequence.

[0156] The first event classification module 803 is configured to input the title feature representation sequence into a pre-trained corpus classification model to obtain a first event classification probability sequence and a first emotion classification probability sequence.

[0157] It should be understood that the first event classification probability sequence here includes event classification probabilities of the financial news corpora corresponding to each preset event type.

[0158] It should be understood that the first emotion classification probability sequence here includes emotion classification probabilities of the financial news corpora corresponding to each preset emotion type.

[0159] The second encoding module 804 is used to input the text data into the pre-trained encoding model for encoding when the maximum probability in the first event classification probability sequence is less than the first preset threshold or the maximum probability in the first sentiment classification probability sequence is less than the second preset threshold, so as to obtain the text feature representation sequence.

[0160] The second event classification module 805 is used to input the title feature representation sequence into the pre-trained corpus classification model to obtain the second event classification probability sequence and the second sentiment classification probability sequence.

[0161] It should be understood that the second event classification probability sequence here includes the event classification probabilities of each preset event type corresponding to the financial news corpus.

[0162] It should be understood that the second sentiment classification probability sequence here includes the sentiment classification probabilities of each preset sentiment type corresponding to the financial news corpus.

[0163] The determination module 806 is used to determine the event label of the financial news corpus based on the maximum probability in the second event classification probability sequence, and to determine the sentiment label of the financial news corpus based on the maximum probability in the second sentiment classification probability sequence.

[0164] The specific implementation of this emotion-based news event classification device is basically the same as the specific embodiment of the emotion-based news event classification method described above, and will not be repeated here.

[0165] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned emotion-based news event classification method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0166] Please see Figure 9 , Figure 9 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 900 includes:

[0167] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0168] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM), etc. The memory 902 can store an operating system and other application programs. When the technical solutions provided by the embodiments of the present specification are implemented by software or firmware, the related program codes are stored in the memory 902 and are invoked and executed by the processor 901 to implement a kind of emotion-based news event classification method provided by the embodiments of the present application;

[0169] The input / output interface 903 is used to realize information input and output.

[0170] The communication interface 904 is used to realize the communication interaction between the device and other devices. The communication can be realized by wired mode (such as USB, network cable, etc.), and the communication can also be realized by wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0171] The bus 905 transmits information between various components (such as the processor 901, the memory 902, the input / output interface 903 and the communication interface 904) of the device.

[0172] The processor 901, the memory 902, the input / output interface 903 and the communication interface 904 are connected to each other through the bus 905 to realize the communication connection between the device.

[0173] The embodiments of the present application also provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the above-mentioned emotion-based news event classification method.

[0174] The memory is a kind of non-transient computer readable storage medium, and can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory can include high-speed random access memory, and can also include non-transient memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transient solid-state memory device. In some embodiments, the memory can optionally include a memory remotely arranged relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0175] The method, device and equipment for classifying news events based on emotion and the storage medium provided by the embodiments of the present application encode the title data in the obtained financial news corpus in the encoding model to obtain a title feature representation sequence, and perform event and emotion classification on the title feature representation sequence in the corpus classification model. When at least one of the obtained maximum classification probabilities is less than the corresponding threshold value, the text data is input into the corpus classification model, and the text data is classified in terms of event and emotion, and the emotion label and the event label corresponding to the financial news corpus are confirmed. By setting the probability threshold of the title classification, it is determined whether the title classification result is reliable. When the title classification result indicates that it is unreliable, the text classification result is used as a supplement to improve the reliability of the classification result of the financial news corpus, and the efficiency of obtaining useful financial information is improved. Furthermore, by setting the threshold value, the two-stage classification steps are constructed, which improves the reliability of the classification result and also improves the efficiency of the classification, thereby reducing the consumption of analysis resources.

[0176] The embodiments described in the embodiments of the present application are used to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0177] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and can include more or fewer steps than the figures, or combine certain steps or different steps.

[0178] The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separated, that is, they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments of the present application.

[0179] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functions of the modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations.

[0180] The terms "first", "second", "third", "fourth", and the like in the description and in the claims of this application, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the use of the terms so termed is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of orderly or chronological mundane operation, reverse order operation, based on circuitry availability, based on stated preference or the like, and that "default" or other orderings are thus permissible. Further, the terms "comprise", "comprising", "include", "including", and the like, are specifically intended to be open-ended. That is, references to individual steps and the like do not suhstantially exclude the presence of two or more of a recited step or its integral sub-steps or additional steps whether or not readily ascertainable from the description or the like. Further, the words "a" or "an", as used herein in the disclosure and elsewhere, are used indiscriminately and are to be interpreted in the same way, i.e. as meaning "one or more".

[0181] It should be understood that, in this application, "at least one" means one or more, "multiple" means two or more. "And / or", used to describe the relationship between associated objects, means that there can be three relationships, for example, "A and / or B" can mean: only A, only B, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or the like means any combination of these items, including single or multiple combinations. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0182] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the above units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed objects can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0183] The units described above as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0184] In addition, each of the functional units in the embodiments of the present application can be integrated in one processing unit, or each unit can exist alone physically, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.

[0185] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present application, essentially or partially, or all or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes multiple instructions used to cause a computer device (such as a personal computer, a server, or a network device) to perform all or part of the steps of the methods in the embodiments of the present application. The foregoing storage medium includes: various memories (such as a read-only memory, a random access memory, a flash memory, or the like) and a magnetic disk or an optical disk and the like.

[0186] The preferred embodiments of the embodiments of the present application are described above with reference to the accompanying drawings, and are not intended to limit the scope of the embodiments of the present application. Any modification, equivalent replacement, and improvement made by those skilled in the art without departing from the scope and spirit of the embodiments of the present application shall fall within the scope of the embodiments of the present application.

Claims

1. A method for classifying news events based on sentiment, the method comprising: The method comprises the following steps: obtaining a financial news corpus, wherein the financial news corpus comprises title data and text data; inputting the title data into a pre-trained encoding model to obtain a title feature representation sequence; inputting the title feature representation sequence into a pre-trained corpus classification model to obtain a first event classification probability sequence and a first sentiment classification probability sequence, wherein the first event classification probability sequence comprises event classification probabilities of each preset event type corresponding to the financial news corpus, and the first sentiment classification probability sequence comprises sentiment classification probabilities of each preset sentiment type corresponding to the financial news corpus; when the maximum probability in the first event classification probability sequence is less than a first preset threshold or the maximum probability in the first sentiment classification probability sequence is less than a second preset threshold, inputting the text data into the pre-trained encoding model to obtain a text feature representation sequence; inputting the title feature representation sequence into the corpus classification model to obtain a second event classification probability sequence and a second sentiment classification probability sequence, wherein the second event classification probability sequence comprises event classification probabilities of each preset event type corresponding to the financial news corpus, and the second sentiment classification probability sequence comprises sentiment classification probabilities of each preset sentiment type corresponding to the financial news corpus; determining an event label of the financial news corpus according to the maximum probability in the second event classification probability sequence, and determining a sentiment label of the financial news corpus according to the maximum probability in the second sentiment classification probability sequence. 2.The method of claim 1, wherein, After obtaining the first event classification probability sequence and the first sentiment classification probability sequence, the method further comprises: when the maximum probability in the first event classification probability sequence is greater than or equal to the first preset threshold, and the maximum probability in the first sentiment classification probability sequence is greater than or equal to the second preset threshold, determining the event label of the financial news corpus according to the maximum probability in the first event classification probability sequence, and determining the sentiment label of the financial news corpus according to the maximum probability in the first sentiment classification probability sequence. 3.The method of claim 2, wherein, After determining the event label and the sentiment label of the financial news corpus, the method further comprises: saving the financial news corpus to an event set corresponding to the event label; extracting the financial news corpus from the event set to form a recommendation set; sending the financial news corpus in the recommendation set to a terminal of a target object.

4. The method of claim 3, wherein, The extraction of the financial news corpus from the event set to form a recommendation set comprises: obtaining a proportion of the number of events corresponding to each sentiment label in the event set in a preset time period; extracting the financial news corpus corresponding to the preset time period from the event set to form a recommendation set according to the proportion of the number of events corresponding to each sentiment label.

5. The method of claim 3, wherein the method further comprises: After sending the financial news corpus in the recommendation set to the terminal of the target object, the method further comprises: receiving feedback information sent by the terminal of the target object, wherein the feedback information comprises event classification error information or sentiment classification error information for the financial news corpus in the recommendation set; According to event classification error information or sentiment classification error information of the financial news corpus in the recommendation set, event classification annotation labels and sentiment classification annotation labels of the financial news corpus are constructed; The financial news corpus and the event classification annotation labels and the sentiment classification annotation labels corresponding to the financial news corpus are added to an updated training set; The corpus classification model is updated and trained according to the updated training set.

6. The method of claim 1, wherein, Before the financial news corpus is obtained, the method further includes: The financial news corpus is collected according to a preset data source; The financial news corpus is segmented to obtain multiple segments; The financial news corpus is preprocessed, and the preprocessing includes: for each segment of the financial news corpus, if the segment does not contain any word in a preset financial domain vocabulary set, the segment is deleted.

7. The method of claim 1, wherein, The encoding model includes a word segmentation module and a self-attention encoding module, and the training process of the encoding model includes: A training set is obtained, and the training set includes multiple training corpora of financial news; The training corpora are segmented and sorted according to a preset financial domain vocabulary set to obtain training word segmentation sequences; The training corpora are input into the word segmentation module after mask processing according to the training word segmentation sequences to obtain training numerical vector sequences; The training numerical vector sequences are input into the self-attention encoding module to obtain predicted word segmentation sequences; A loss function value is determined according to the training word segmentation sequences and the predicted word segmentation sequences; The model parameters of the encoding model are adjusted according to the loss function value.

8. An emotion-based news event classification apparatus, characterized by comprising: The device includes: An obtaining module is configured to obtain a financial news corpus, and the financial news corpus includes title data and body data; A first encoding module is configured to input the title data into a pre-trained encoding model to perform encoding and obtain a title feature representation sequence; A first event classification module is configured to input the title feature representation sequence into a pre-trained corpus classification model to obtain a first event classification probability sequence and a first sentiment classification probability sequence, the first event classification probability sequence includes event classification probabilities of each preset event type corresponding to the financial news corpus, and the first sentiment classification probability sequence includes sentiment classification probabilities of each preset sentiment type corresponding to the financial news corpus; A second encoding module is configured to input the body data into a pre-trained encoding model to perform encoding when a maximum probability in the first event classification probability sequence is less than a first preset threshold or a maximum probability in the first sentiment classification probability sequence is less than a second preset threshold, to obtain a body feature representation sequence; A second event classification module is configured to input the title feature representation sequence into a pre-trained corpus classification model to obtain a second event classification probability sequence and a second sentiment classification probability sequence, the second event classification probability sequence includes event classification probabilities of each preset event type corresponding to the financial news corpus, and the second sentiment classification probability sequence includes sentiment classification probabilities of each preset sentiment type corresponding to the financial news corpus; A determining module is configured to determine an event label of the financial news corpus according to a maximum probability in the second event classification probability sequence, and determine a sentiment label of the financial news corpus according to a maximum probability in the second sentiment classification probability sequence.

9. An electronic device, comprising: A computer readable storage medium, comprising a memory storing a computer program or instructions, and a processor, wherein the processor executes the computer program or instructions to implement the method of any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program or instructions, and the computer program or instructions are executed by a processor to implement the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Financial news emotion analysis method and device, computer equipment and storage medium

    CN112380346A

  • Short text classification method and device, equipment and storage medium

    CN114564582A