A method, device and apparatus for determining public opinion category
By obtaining and processing public opinion information, and using prediction models and TF-IDF value calculation to determine public opinion categories, the problem of inaccurate prediction of public opinion categories in the existing technology is solved, and the accuracy of investment risk control is improved.
Patent Information
- Application Number
- CN202110174033.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-07
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-02-07
AI Technical Summary
The existing technology cannot accurately predict the current public opinion category, resulting in low accuracy of investment risk control and the inability to adjust investment strategies in a timely manner.
By obtaining target public opinion information, determine its target classification label and feature word vector, use the language representation model, full connection layer and prediction model trained by attention mechanism to determine the weight of public opinion information, calculate the TF-IDF value of feature words, and comprehensively determine the public opinion. The characteristic value of the information is used to represent the category of public opinion.
Accurate prediction of public opinion categories has been achieved, the accuracy of investment risk control has been improved, and investment strategies can be adjusted in a timely manner.
Smart Images

Figure CN112966161B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of big data technology, and in particular to a method, device and apparatus for determining a public opinion category. Background Art
[0002] With the continuous development of Internet applications, company public opinion information is growing every moment, the amount is huge and the data is changing dynamically. Timely determination of company public opinion is also crucial for investment risk control.
[0003] In the prior art, public opinion information in big data is usually classified coarsely according to the industry to which it belongs, and then the classified public opinion information is classified into positive and negative categories based on human experience, and the positive and negative public opinion information is counted, and the statistical results and other data are directly visualized. Processing public opinion information based on human experience requires high work experience and professional quality of business personnel, and it is impossible to objectively process public opinion information to predict the company's current public opinion risks, and the accuracy is low. It can be seen that the technical solutions in the prior art cannot accurately predict the current public opinion situation and make timely adjustments to investments.
[0004] To address the above problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of this specification provide a method, device and apparatus for determining a public opinion category to solve the problem in the prior art of accurately predicting the current public opinion category and making timely adjustments to investments.
[0006] An embodiment of the present specification provides a method for determining a public opinion category, including: obtaining target public opinion information; determining a target classification label and a target feature word vector of the target public opinion information; wherein the target feature word vector contains multiple feature words of the target public opinion information; according to the target classification label and the target feature word vector, determining the weight of the target public opinion information using a target prediction model; wherein the target prediction model is a model for predicting the weight of public opinion information obtained by training using a language representation model, a fully connected layer, and an attention mechanism, and the weight of the target public opinion information is used to characterize the importance of the target public opinion information; calculating the TF-IDF value of each feature word in the target feature word vector; based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector, determining a feature value of the target public opinion information; wherein the feature value is used to characterize the public opinion category of the target public opinion information.
[0007] The embodiment of the present specification also provides a device for determining the category of public opinion, including: an acquisition module for acquiring target public opinion information; a first determination module for determining a target classification label and a target feature word vector of the target public opinion information; wherein the target feature word vector contains multiple feature words of the target public opinion information; a second determination module for determining the weight of the target public opinion information using a target prediction model based on the target classification label and the target feature word vector; wherein the target prediction model is a model for predicting the weight of public opinion information obtained by training using a language representation model, a fully connected layer and an attention mechanism, and the weight of the target public opinion information is used to characterize the importance of the target public opinion information; a calculation module for calculating the TF-IDF value of each feature word in the target feature word vector; a third determination module for determining the feature value of the target public opinion information based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector; wherein the feature value is used to characterize the public opinion category of the target public opinion information.
[0008] The embodiment of the present specification also provides a device for determining a public opinion category, including a processor and a memory for storing instructions executable by the processor, wherein the processor implements the steps of the method for determining the public opinion category when executing the instructions.
[0009] The embodiments of this specification also provide a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed, the steps of the method for determining the public opinion category are implemented.
[0010] The embodiment of this specification provides a method for determining the category of public opinion. By obtaining the target public opinion information, the target classification label and the target feature word vector of the target public opinion information can be determined, and multiple feature words and the category to which the target public opinion information belongs can be determined. Furthermore, the weight of the target public opinion information can be determined by using the target prediction model according to the target classification label and the target feature word vector to determine the importance of the target public opinion information. Among them, the above-mentioned target prediction model is obtained by combining the language representation model, the fully connected layer and the attention mechanism training, and can efficiently and accurately predict the weight of the public opinion information. In order to determine the importance of each feature word in the target public opinion information, the TF-IDF value of each feature word in the target feature word vector can be calculated, and the feature value of the target public opinion information can be determined based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector, wherein the above-mentioned feature value is used to characterize the public opinion category of the target public opinion information. Therefore, the feature value of the target public opinion information can be comprehensively determined from the two dimensions of a single feature word and the overall target public opinion information, so that the determined result is more objective and accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings described herein are used to provide a further understanding of the embodiments of this specification, constitute a part of the embodiments of this specification, and do not constitute a limitation of the embodiments of this specification. In the drawings:
[0012] Figure 1 It is a schematic diagram of the steps of a method for determining a public opinion category provided in an embodiment of this specification;
[0013] Figure 2 It is a schematic diagram of the structure of the target prediction model provided according to a specific embodiment of the embodiment of this specification;
[0014] Figure 3 It is a structural schematic diagram of a device for determining a public opinion category according to an embodiment of this specification;
[0015] Figure 4 It is a structural diagram of a device for determining a public opinion category provided in an embodiment of this specification. DETAILED DESCRIPTION
[0016] The principles and spirit of the embodiments of this specification will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the embodiments of this specification, and are not intended to limit the scope of the embodiments of this specification in any way. On the contrary, these embodiments are provided to make the disclosure of the embodiments of this specification more thorough and complete, and to fully convey the scope of the disclosure to those skilled in the art.
[0017] Those skilled in the art know that the implementation of the embodiments of this specification can be implemented as a system, device, method or computer program product. Therefore, the embodiments disclosed in this specification can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0018] Although the processes described below include multiple operations that occur in a particular order, it should be clear that these processes may include more or fewer operations, which may be performed sequentially or in parallel (eg, using parallel processors or a multi-threaded environment).
[0019] See also Figure 1 This embodiment can provide a method for determining a public opinion category. The method for determining a public opinion category can be used to accurately predict the current public opinion category. The method for determining a public opinion category can include the following steps.
[0020] S101: Obtain target public opinion information.
[0021] In this embodiment, target public opinion information can be obtained, and the target public opinion information can be currently generated public opinion information used to predict the current public opinion category. Of course, it can be understood that the target public opinion information can also be historical public opinion information, which can be determined according to actual conditions, and this specification embodiment does not limit this.
[0022] In this embodiment, the above-mentioned target public opinion information can be any piece of information released in channels such as Wind, Bloomberg, and the company's internal system, such as company announcements, third-party research reports, news reviews, etc. It is currently understood that in some embodiments, all information released for the same event can also be integrated as a piece of public opinion information, which can be determined according to actual conditions, and this specification embodiment does not limit this.
[0023] In this embodiment, public opinion information can be obtained in a targeted manner, for example, public opinion information of a target organization can be obtained, and the target organization can be a company, an organization, etc. The specific information can be determined according to actual conditions, and this embodiment of the specification does not limit this.
[0024] In this embodiment, the method of obtaining the target public opinion information may include: obtaining it from a preset database, or obtaining it by querying it according to a preset path. Of course, it is understandable that other possible methods can also be used to obtain the above sample data set, for example, using crawler technology to collect target public opinion information in multiple channels such as Wind, Bloomberg, and the company's internal system according to certain conditions. The specific conditions can be determined according to actual conditions, and this specification embodiment does not limit this.
[0025] S102: Determine a target classification label and a target feature word vector of the target public opinion information; wherein the target feature word vector includes multiple feature words of the target public opinion information.
[0026] In this embodiment, since the target public opinion information may contain some redundant information, a target feature word vector can be determined, wherein the above-mentioned target feature word vector may contain multiple feature words of the target public opinion information, and the feature words may be keywords extracted from the target public opinion information that can be used to characterize the target public opinion information, such as: breach of contract, overdue, etc.
[0027] In this embodiment, since different public opinion information involves different fields, and the sensitive keywords that can be used to characterize public opinion situations in different fields may also be different, the target classification label of the target public opinion information can be determined. Among them, the target classification label can be used to characterize the field category to which the target public opinion information belongs, such as sports, finance, etc. Of course, it is understandable that in some embodiments, it can be further subdivided into company announcements, news commentary, etc. according to the field to which it belongs. The specific details can be determined according to the actual situation, and the comparison of the embodiments of this specification is not limited.
[0028] S103: Determine the weight of the target public opinion information using the target prediction model according to the target classification label and the target feature word vector; wherein the target prediction model is a model for predicting the weight of public opinion information obtained by training using a language representation model, a fully connected layer, and an attention mechanism, and the weight of the target public opinion information is used to characterize the importance of the target public opinion information.
[0029] In this embodiment, the weight of the target public opinion information can be determined by using the target prediction model according to the target classification label and the target feature word vector. The weight of the target public opinion information is used to characterize the importance of the target public opinion information. The weight of the target public opinion information can be a value greater than 0. Among them, the above-mentioned target prediction model can be a model for predicting the weight of public opinion information obtained by training using a language representation model (BERT, Bidirectional Encoder Representations from Transformers), a fully connected layer (FC, Fully Connected Layers) and an attention mechanism (Attention Mechanism).
[0030] In this embodiment, the input of the target prediction model can be the classification label and feature word vector of a piece of public opinion information, and the output is the weight of the piece of public opinion information. The structure of the target prediction model can be as follows: Figure 2 As shown, the above target prediction model may include BERT, a fully connected layer, an attention layer (Attention) and a Sigmoid function. Among them, the input of BERT may include feature word vectors (Tok1, Tok2...Tok N) and classification labels (CLS). The fully connected layer performs a weighted sum on the features output by BERT. The attention layer is used to determine which features of the fully connected layer input are more important. The Sigmoid function is used as an activation function to map the variable to between 0 and 1, thereby obtaining the weight of the public opinion information.
[0031] In this embodiment, the above BERT aims to pre-train deep bidirectional representations by jointly adjusting the left and right contexts in all layers, so that only an additional output layer is needed to fine-tune the pre-trained BERT representation, thereby creating state-of-the-art models for a wide range of tasks without requiring a large number of task-specific model structure modifications. The above Sigmoid function is an S-shaped function commonly seen in biology, also known as an S-shaped growth curve. In information science, due to its monotonic and inverse monotonic properties, the Sigmoid function is often used as an activation function for neural networks to map variables between 0 and 1.
[0032] S104: Calculate the TF-IDF value of each feature word in the target feature word vector.
[0033] In this embodiment, the TF-IDF value of each feature word in the target feature word vector can be calculated. TF-IDF (Term Frequency–Inverse Document Frequency) is a commonly used weighting technique for information retrieval and data mining. TF stands for term frequency and IDF stands for inverse document frequency. TF-IDF is a statistical method used to evaluate the importance of a word to a document set or one of the documents in a corpus. The importance of a word increases in direct proportion to the number of times it appears in a document, but at the same time it decreases in inverse proportion to the frequency of its appearance in the corpus.
[0034] In this embodiment, the importance of each feature word in the target public opinion information can be determined according to the TF-IDF value of each feature word in the target feature word vector, which is conducive to better determining the public opinion category reflected by the target public opinion information.
[0035] S105: Determine the feature value of the target public opinion information based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector; wherein the feature value is used to characterize the public opinion category of the target public opinion information.
[0036] In this embodiment, since the TF-IDF value of each feature word in the above target feature word vector can reflect the importance of each feature word in the target public opinion information, the feature value of the target public opinion information can be determined based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector. The above feature value can be used to characterize the public opinion category of the target public opinion information.
[0037] In this embodiment, the characteristic value of the target public opinion information can be determined from two dimensions: a single characteristic word and the target public opinion information as a whole, so that the determination result is more objective and accurate. The above characteristic value can be a value greater than 0, and the public opinion category of the target public opinion information can be determined according to the size of the characteristic value. Among them, the public opinion category can include positive public opinion sentiment and negative public opinion sentiment. Of course, the public opinion category can also include other possible values, which can be determined according to actual conditions, and this specification embodiment does not limit this.
[0038] In this embodiment, the characteristic values of the determined target public opinion information, the target classification labels, the target characteristic word vectors and the target public opinion information can also be stored in a distributed cloud to ensure traceability. Furthermore, the characteristic values of the determined target public opinion information can also be displayed so that investors can adjust their investment strategies in a timely manner in response to possible risks.
[0039] From the above description, it can be seen that the embodiments of this specification achieve the following technical effects: by obtaining the target public opinion information, determining the target classification label and target feature word vector of the target public opinion information, multiple feature words and the categories to which the target public opinion information belongs can be determined. Further, the weight of the target public opinion information can be determined by using the target prediction model according to the target classification label and the target feature word vector to determine the importance of the target public opinion information. Among them, the above-mentioned target prediction model is obtained by combining the language representation model, the fully connected layer and the attention mechanism training, and can efficiently and accurately predict the weight of the public opinion information. In order to determine the importance of each feature word in the target public opinion information, the TF-IDF value of each feature word in the target feature word vector can be calculated, and based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector, the feature value of the target public opinion information is determined, wherein the above-mentioned feature value is used to characterize the public opinion category of the target public opinion information. Therefore, the feature value of the target public opinion information can be comprehensively determined from the two dimensions of a single feature word and the overall target public opinion information, so that the determined result is more objective and accurate.
[0040] In one embodiment, obtaining the target public opinion information may include: calling a web crawler to collect a first public opinion information set at a preset time interval, wherein the first public opinion information set includes at least one initial public opinion information. Further, the first public opinion information set may be cleaned to obtain a second public opinion information set, and the public opinion information in the second public opinion information set may be used as the target public opinion information.
[0041] In this embodiment, since public opinion information has a certain timeliness, it is necessary to ensure that the target public opinion information can be obtained in a timely manner. The corresponding web crawler can be called to collect public opinion information in real time. The preset time interval can be 10 minutes, 30 minutes or 1 hour, etc., which can be determined according to the actual situation. The embodiments of this specification do not limit this. Among them, the above-mentioned web crawler is also called a web spider or a web robot. It is a program or script used to automatically browse the World Wide Web. The crawler can verify hyperlinks and HTML (Hypertext Markup Language) codes for network crawling.
[0042] In this embodiment, one piece of public opinion information can be used as a public opinion information set, or multiple pieces of public opinion information collected within a preset time interval can be used as a public opinion information set. Public opinion information can be collected according to actual needs to avoid collecting irrelevant information. For example, if the public opinion risk of Company A needs to be monitored in real time, public opinion information related to Company A can be collected.
[0043] In this embodiment, since the initial public opinion information collected by web crawlers may contain redundant information, the first public opinion information set can be cleaned, so as to remove characters, images, etc. of non-text information in the first public opinion information set, thereby ensuring the validity of the target public opinion information.
[0044] In one embodiment, determining the target classification label and target feature word vector of the target public opinion information may include: using the target public opinion information to determine the target classification label, and extracting at least one feature word of the target public opinion information using a target recognition model based on the target public opinion information and the classification label; wherein the target recognition model is a model trained using a deep learning network for extracting feature words in public opinion information according to category labels. Further, a target feature word vector may be generated based on at least one feature word of the target public opinion information.
[0045] In this embodiment, the target public opinion information can be classified using Bayesian classification, decision tree classification, neural network classification algorithm, etc. to obtain classification labels. Of course, it is understandable that other possible methods can also be used for classification, such as: classification based on fuzzy mathematics, etc. The specific method can be determined according to the actual situation, and this specification embodiment does not limit this.
[0046] In this embodiment, in order to efficiently and accurately determine the characteristic words of the target public opinion information, a target recognition model pre-trained using a deep learning network can be used to extract at least one characteristic word contained in the target public opinion information. The input data of the target recognition model is the classification label of the public opinion information and the text of the public opinion information, and the output data is at least one characteristic word contained in the public opinion information.
[0047] In this embodiment, since the sensitive keywords involved in different field categories may be different, the classification label of the target public opinion information and the text of the target public opinion information can be combined to use the target recognition model to determine the characteristic words of the target public opinion information, so that the characteristic word vector of the target public opinion information can be determined efficiently and accurately.
[0048] In one embodiment, calculating the TF-IDF value of each feature word in the target feature word vector may include: counting the number of times the target feature word in the target feature word vector appears in the target public opinion information, and determining the number of times the feature word that appears most frequently in the target public opinion information, so that the word frequency of the target feature word can be calculated based on the number of times the target feature word appears in the target public opinion information and the number of times the feature word that appears most frequently in the target public opinion information. Further, the total number of public opinion information recorded in the target database can be obtained, and the number of public opinion information containing the target feature word in the target database can be determined, so that the inverse document frequency of the target feature word can be calculated based on the total number of public opinion information recorded in the target database and the number of public opinion information containing the target feature word in the target database. Further, the product of the word frequency of the target feature word and the inverse document frequency can be used as the TF-IDF value of the target feature word.
[0049] In this embodiment, the above TF-IDF is a statistical method for evaluating the importance of a word to a document set or one of the documents in a corpus. The importance of a word increases in direct proportion to the number of times it appears in a document, but at the same time decreases in inverse proportion to the frequency of its appearance in the corpus. The word frequency and inverse document frequency can be calculated separately first, and then the TF-IDF value is calculated based on the word frequency and inverse document frequency, so as to determine the importance of each feature word in the target public opinion information.
[0050] In one embodiment, the frequency of the target feature word may be calculated according to the following formula based on the number of times the target feature word appears in the target public opinion information and the number of times the feature word appears most frequently in the target public opinion information:
[0051]
[0052] Among them, TF i is the frequency of the target feature word; n i is the number of times the target feature word appears in the target public opinion information; n j It is the number of occurrences of the feature words that appear most frequently in the target public opinion information.
[0053] In one embodiment, the inverse document frequency of the target feature word may be calculated according to the total amount of public opinion information recorded in the target database and the amount of public opinion information containing the target feature word in the target database according to the following formula:
[0054]
[0055] Among them, IDF i is the inverse document frequency of the target feature word; N is the total number of public opinion information recorded in the target database; M i It is the number of public opinion information containing the target feature words in the target database.
[0056] In this embodiment, the target database may be a database for recording public opinion information, and the target database may contain all public opinion information collected historically, so that the inverse document frequency may be calculated based on the data recorded in the target database.
[0057] In one embodiment, based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector, determining the feature value of the target public opinion information may include: taking the product of the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector as the public opinion weight of each feature word, and calculating the feature value of each feature word according to the public opinion weight of each feature word. Furthermore, the sum of the feature values of each feature word may be taken as the feature value of the target public opinion information.
[0058] In this embodiment, the public opinion weight of each feature word can be calculated by combining the two dimensions of words and sentences, so that the determined public opinion weight is more comprehensive and objective. Furthermore, the characteristic value of each word can be calculated separately according to the public opinion weight of each feature word, thereby obtaining the characteristic value of the target public opinion information as a whole.
[0059] In one implementation, the characteristic value of each characteristic word may be calculated according to the public opinion weight of each characteristic word according to the following formula:
[0060]
[0061] Among them, S(α i ) is the feature value of the i-th feature word; α i is the public opinion weight of the i-th feature word. The above e is the Euler number, which is an irrational number and is approximately equal to 2.71828.
[0062] In one scenario example, the calculated characteristic values of each public opinion information can be directly displayed on the market interface of each listed company in financial terminals such as Wind and Choice to show public opinion sentiment, making it easier for investors to adjust investment strategies in a timely manner in response to the risks of the company. Among them, the above-mentioned Choice financial terminal is a professional financial data product under Eastmoney. After obtaining and calculating the characteristic values of new public opinion information, the data in the corresponding interface can be updated in a timely manner.
[0063] Based on the same inventive concept, a device for determining a public opinion category is also provided in the embodiments of this specification, such as the following embodiments. Since the principle of solving the problem by the device for determining the public opinion category is similar to that of the method for determining the public opinion category, the implementation of the device for determining the public opinion category can refer to the implementation of the method for determining the public opinion category, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable. Figure 3 is a structural block diagram of a device for determining a public opinion category according to an embodiment of this specification, such as Figure 3 As shown, it may include: an acquisition module 301, a first determination module 302, a second determination module 303, a calculation module 304 and a third determination module 305. The structure is described below.
[0064] The acquisition module 301 can be used to acquire target public opinion information;
[0065] The first determination module 302 may be used to determine a target classification label and a target feature word vector of the target public opinion information; wherein the target feature word vector includes multiple feature words of the target public opinion information;
[0066] The second determination module 303 can be used to determine the weight of the target public opinion information using the target prediction model according to the target classification label and the target feature word vector; wherein the target prediction model is a model for predicting the weight of the public opinion information obtained by training using the language representation model, the fully connected layer and the attention mechanism, and the weight of the target public opinion information is used to characterize the importance of the target public opinion information;
[0067] The calculation module 304 may be used to calculate the TF-IDF value of each feature word in the target feature word vector;
[0068] The third determination module 305 can be used to determine the feature value of the target public opinion information based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector; wherein the feature value is used to characterize the public opinion category of the target public opinion information.
[0069] The embodiment of this specification also provides an electronic device, which can be specifically referred to in Figure 4The electronic device composition structure diagram of the method for determining the public opinion category provided by the embodiment of this specification is shown, and the electronic device may specifically include an input device 41, a processor 42, and a memory 43. Among them, the input device 41 can be specifically used to input the target public opinion information. The processor 42 can be specifically used to determine the target classification label and target feature word vector of the target public opinion information; wherein the target feature word vector contains multiple feature words of the target public opinion information; according to the target classification label and the target feature word vector, the weight of the target public opinion information is determined by using the target prediction model; wherein the target prediction model is a model for predicting the weight of public opinion information obtained by training using a language representation model, a fully connected layer, and an attention mechanism, and the weight of the target public opinion information is used to characterize the importance of the target public opinion information; the TF-IDF value of each feature word in the target feature word vector is calculated; based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector, the feature value of the target public opinion information is determined; wherein the feature value is used to characterize the public opinion category of the target public opinion information. The memory 43 can be specifically used to store parameters such as the TF-IDF value of each feature word and the feature value of the target public opinion information.
[0070] In this embodiment, the input device can specifically be one of the main devices for information exchange between the user and the computer system. The input device can include a keyboard, a mouse, a camera, a scanner, a light pen, a handwriting input board, a voice input device, etc.; the input device is used to input the original data and the program for processing these numbers into the computer. The input device can also obtain and receive data transmitted from other modules, units, and devices. The processor can be implemented in any appropriate manner. For example, the processor can take the form of a computer-readable medium, a logic gate, a switch, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable logic controller, and an embedded microcontroller, etc., such as a microprocessor or a processor and a computer-readable program code (such as software or firmware) that can be executed by the (micro) processor. The memory can specifically be a memory device used to store information in modern information technology. The memory can include multiple levels. In a digital system, anything that can store binary data can be a memory; in an integrated circuit, a circuit with a storage function without a physical form is also called a memory, such as a RAM, a FIFO, etc.; in a system, a storage device with a physical form is also called a memory, such as a memory stick, a TF card, etc.
[0071] In this embodiment, the functions and effects specifically realized by the electronic device can be explained in comparison with other embodiments and will not be described in detail here.
[0072] In the implementation manner of the embodiments of this specification, a computer storage medium based on a method for determining public opinion categories is also provided, and the computer storage medium stores computer program instructions, which can achieve the following when the computer program instructions are executed: obtaining target public opinion information; determining a target classification label and a target feature word vector of the target public opinion information; wherein the target feature word vector contains multiple feature words of the target public opinion information; determining the weight of the target public opinion information using a target prediction model based on the target classification label and the target feature word vector; wherein the target prediction model is a model for predicting the weight of public opinion information obtained by training using a language representation model, a fully connected layer, and an attention mechanism, and the weight of the target public opinion information is used to characterize the importance of the target public opinion information; calculating the TF-IDF value of each feature word in the target feature word vector; determining the feature value of the target public opinion information based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector; wherein the feature value is used to characterize the public opinion category of the target public opinion information.
[0073] In this embodiment, the storage medium includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a cache, a hard disk (HDD), or a memory card. The memory may be used to store computer program instructions. The network communication unit may be an interface for network connection communication set in accordance with the standard specified by the communication protocol.
[0074] In this embodiment, the functions and effects specifically implemented by the program instructions stored in the computer storage medium can be explained in comparison with other embodiments and will not be described in detail here.
[0075] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of this specification can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of this specification are not limited to any specific combination of hardware and software.
[0076] Although the embodiments of this specification provide method operation steps as described in the above embodiments or flowcharts, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiments of this specification. When the device or terminal product of the method described in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or drawings (for example, a parallel processor or a multi-threaded processing environment).
[0077] It should be understood that the above description is for illustration and not for limitation. By reading the above description, many embodiments and many applications beyond the examples provided will be apparent to those skilled in the art. Therefore, the scope of the embodiments of this specification should not be determined with reference to the above description, but should be determined with reference to the full scope of the aforementioned claims and the equivalents possessed by these claims.
[0078] The above is only a preferred embodiment of the embodiment of this specification, and is not intended to limit the embodiment of this specification. For those skilled in the art, the embodiment of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiment of this specification shall be included in the protection scope of the embodiment of this specification.
Claims
1. A method for determining a public opinion category, characterized in that: include: Obtain target public opinion information; Determine a target classification label and a target feature word vector of the target public opinion information; wherein the target feature word vector includes a plurality of feature words of the target public opinion information; According to the target classification label and the target feature word vector, the weight of the target public opinion information is determined using a target prediction model; wherein the target prediction model is a model for predicting the weight of public opinion information obtained by training using a language representation model, a fully connected layer and an attention mechanism, and the weight of the target public opinion information is used to characterize the importance of the target public opinion information; the weight of the target public opinion information includes the weight of each feature word; Calculate the TF-IDF value of each feature word in the target feature word vector; Determine the feature value of the target public opinion information based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector; wherein the feature value is used to characterize the public opinion category of the target public opinion information; The determining the feature value of the target public opinion information based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector includes: The product of the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector is used as the public opinion weight of each feature word; Calculate the feature value of each feature word according to the public opinion weight of each feature word; The sum of the feature values of the feature words is used as the feature value of the target public opinion information.
2. The method according to claim 1, characterized in that Obtain target public opinion information, including: Calling a web crawler to collect a first public opinion information set at a preset time interval; wherein the first public opinion information set includes at least one initial public opinion information; Performing data cleaning on the first public opinion information set to obtain a second public opinion information set; The public opinion information in the second public opinion information set is used as the target public opinion information.
3. The method according to claim 1, characterized in that Determining the target classification label and target feature word vector of the target public opinion information includes: Determine the target classification label using the target public opinion information; According to the target public opinion information and the classification label, at least one characteristic word of the target public opinion information is extracted using a target recognition model; wherein the target recognition model is a model trained using a deep learning network for extracting characteristic words in public opinion information according to the classification label; The target feature word vector is generated based on at least one feature word of the target public opinion information.
4. The method according to claim 1, characterized in that Calculating the TF-IDF value of each feature word in the target feature word vector includes: Counting the number of times a target feature word in the target feature word vector appears in the target public opinion information; Determine the number of occurrences of the characteristic word that appears most frequently in the target public opinion information; Calculate the word frequency of the target feature word according to the number of times the target feature word appears in the target public opinion information and the number of times the feature word that appears most frequently in the target public opinion information; Get the total amount of public opinion information recorded in the target database; Determine the amount of public opinion information in the target database that contains the target characteristic word; Calculating the inverse document frequency of the target feature word according to the total amount of public opinion information recorded in the target database and the amount of public opinion information in the target database containing the target feature word; The product of the word frequency and the inverse document frequency of the target feature word is taken as the TF-IDF value of the target feature word.
5. The method according to claim 4, characterized in that The frequency of the target feature word is calculated according to the number of times the target feature word appears in the target public opinion information and the number of times the feature word that appears most frequently in the target public opinion information, using the following formula: Among them, TF i is the frequency of the target feature word; n i is the number of times the target feature word appears in the target public opinion information; n j is the number of occurrences of the feature word that appears most frequently in the target public opinion information.
6. The method according to claim 4, characterized in that The inverse document frequency of the target feature word is calculated according to the total amount of public opinion information recorded in the target database and the amount of public opinion information in the target database containing the target feature word according to the following formula: Among them, IDF i is the inverse document frequency of the target feature word; N is the total amount of public opinion information recorded in the target database; M i is the number of public opinion information containing the target feature word in the target database.
7. The method according to claim 1, characterized in that The characteristic value of each characteristic word is calculated according to the public opinion weight of each characteristic word according to the following formula: Among them, S(α i ) is the feature value of the i-th feature word; α i is the public opinion weight of the i-th feature word.
8. A device for determining a public opinion category, characterized in that: include: Acquisition module, used to obtain target public opinion information; A first determination module is used to determine a target classification label and a target feature word vector of the target public opinion information; wherein the target feature word vector contains a plurality of feature words of the target public opinion information; The second determination module is used to determine the weight of the target public opinion information using a target prediction model according to the target classification label and the target feature word vector; wherein the target prediction model is a model for predicting the weight of public opinion information obtained by training using a language representation model, a fully connected layer and an attention mechanism, and the weight of the target public opinion information is used to characterize the importance of the target public opinion information; the weight of the target public opinion information includes the weight of each feature word; A calculation module, used to calculate the TF-IDF value of each feature word in the target feature word vector; A third determination module is used to determine the feature value of the target public opinion information based on the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector; wherein the feature value is used to characterize the public opinion category of the target public opinion information; The third determination module is specifically used to: use the product of the weight of the target public opinion information and the TF-IDF value of each feature word in the target feature word vector as the public opinion weight of each feature word; calculate the feature value of each feature word according to the public opinion weight of each feature word; and use the sum of the feature values of each feature word as the feature value of the target public opinion information.
9. A device for determining a public opinion category, characterized in that: The method comprises a processor and a memory for storing processor-executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the instructions.
10. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Public opinion analysis method and system
CN107016107A
Online public opinion text information sentiment polarity classification processing system and method
CN111209401A