A news subject identification method and system for public opinion data
Through the public opinion subject recognition method combined with AI big model and ChatGPT model, the string matching and public subsequence optimal matching strategies are used to solve the problems of low recognition accuracy and high cost in public opinion subject recognition technology, and realize the massive information efficient subject identification and association matching.
Patent Information
- Application Number
- CN202311503045.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-10
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2043-11-10
AI Technical Summary
The existing public opinion subject identification technology has problems such as low recognition accuracy, difficulty in writing rules, complex feature engineering, high cost of training of large amounts of news and public opinion information, and cannot effectively and accurately carry out credit reporting and credit subjects. Unique association.
The AI big model is used to combine the ChatGPT model for subject name recognition, and the string matching, invalid information removal and subject number discrimination are used to match the pre-constructed company knowledge base to obtain the news subject name recognition results.
It improves the accuracy and efficiency of subject recognition, reduces the cost of model training and deployment, and can automatically and accurately extract the identification text subject from massive information, and accurately establish an association with the subject company registration name.
Smart Images

Figure CN117592471B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of subject identification, and in particular to a method and system for identifying news subjects in public opinion data. Background Art
[0002] Subject identification is a key task in Natural Language Processing (NLP), which aims to identify predefined entities such as names of people, places, organizations or proper nouns from unstructured text. Public opinion subject identification is an important application of subject identification, which can be used to identify subjects involved in news or social media content, such as companies, government agencies, individuals, products, etc. The accurate extraction of public opinion subjects helps investors to effectively monitor and manage public opinion on specific companies, people and products, and help investors make more accurate investment decisions.
[0003] At present, the core implementation schemes for public opinion subject identification are mainly divided into three types: rule-based methods, statistical methods, and deep learning-based methods. The existing rule-based methods are the earliest subject identification methods, which mainly rely on manually defined grammar or pattern rules to identify qualified entities in the text. For example, a rule may be set to identify company names in news, and the rule may be "any phrase followed by a suffix such as 'company' or 'limited' is considered a company name." In this way, through rule identification, "Apple Inc.", "Microsoft Co., Ltd.", etc. will be identified as company entities. However, such rules may have certain limitations in terms of recognition accuracy. For example, in the case of "apple", misidentification may occur. When you see "Apple released a new product" in the text, "apple" refers to "Apple Inc.", but if the context is "I ate an apple today", the "apple" here refers to fruit, not a company. This requires more complex rules or context understanding for accurate identification. In addition, rule-based methods are often sensitive to context changes and the emergence of new words, and cannot adapt to the uncertainty and diversity of natural language. If you encounter various special cases and exceptions, you may need to continuously modify and add rules, which has high maintenance costs and poor adaptability and versatility. Statistical methods mainly include hidden Markov model (HMM), maximum entropy Markov model (MEMM), conditional random field (CRF), etc. These methods are trained on labeled data sets to learn the model of entity recognition.
[0004] Existing statistical-based methods require manual design and selection of features, which requires a lot of expertise and experience. For complex language environments and large-scale application scenarios, therefore, existing statistical-based subject recognition methods still face obvious challenges. For example, HMM assumes that each observation (in this case, a word) depends only on its corresponding state (in this case, the entity type), and each state depends only on the previous state. This "first-order" dependency assumption may not handle the complexity of language well. For example, if the model relies too much on surrounding words, it may mistakenly recognize a person's name as an organization name. CRF is similar to HMM in that it is a sequence-based prediction model, but it no longer assumes that the observations are independent, but can consider the contextual information of the entire sentence. Therefore, CRF is generally better than HMM in entity recognition tasks. However, although CRF performs better than HMM, it still has some problems. First, CRF requires a large amount of labeled data for training, and the data acquisition and labeling costs are high. Second, CRF also has high computational costs during training and prediction, especially when processing long sequences. In addition, CRF relies on manually designed features such as part-of-speech tags, named entity dictionaries, etc., which require a lot of domain knowledge and experience, and the model stability is poor.
[0005] Existing deep learning-based methods, such as recurrent neural networks (RNNs) and long short-term memory networks (LSTMs), can automatically learn features from data and model contextual information, thereby improving the accuracy of entity recognition. However, the accuracy is not high in test data, for example, the algorithm cannot correctly distinguish the difference between news subjects in news. The main reasons for this recognition error are: 1. Data quality and quantity issues: Deep learning algorithms require a large amount of data to be effectively trained. If the training data is insufficient or there is too much noise in the data, its performance will be greatly affected. 2. The ability to handle outliers and emerging situations: Deep learning models may perform poorly when faced with situations that they have never encountered in the training data. This situation is particularly common in the field of autonomous driving, because the environment is changeable and it is impossible to cover all possible situations during the training process. 3. Black box problem: Deep learning models are usually black box models. The internal working method of the model is often carried out in a complex and obscure way for users, which makes it difficult to understand and explain the decisions of the model. For example, in the medical field, even if deep learning models can provide diagnoses, doctors and patients may be confused by the complexity and opacity of the models. 4. Overfitting problem: Deep learning models are often prone to overfitting, that is, the model performs well on the training data, but performs poorly on unseen test data.
[0006] It can be seen from this that the existing public opinion subject identification technology has not completely solved the problems of difficult rule writing, complex feature engineering, the need for a large amount of labeled data and high model training costs. In the massive amount of news and public opinion information, for a large amount of credit subject information, it is impossible to effectively and accurately uniquely associate the credit subject, and it is impossible to accurately extract the subject information. Summary of the invention
[0007] The present invention provides a news subject identification method and system for public opinion data, which can achieve efficient extraction of subject company names from massive news public opinion information and improve the accuracy of subject identification.
[0008] In order to solve the above technical problems, an embodiment of the present invention provides a method for identifying news subjects of public opinion data, comprising:
[0009] The news public opinion data is used to identify the subject name through the AI big model to obtain the public opinion feature recognition result; wherein the AI big model is obtained by training the ChatGPT model with data based on context instructions;
[0010] By performing string matching on the public opinion feature recognition results, it is determined whether there is a news subject in the public opinion feature recognition results. If not, a prompt message indicating that the subject has not been recognized is output;
[0011] If it exists, invalid information will be eliminated from the public opinion feature recognition result to obtain simplified subject data, and the simplified subject data will be segmented according to the number of subjects to obtain the simplified subject name; through the common subsequence optimal matching strategy, the simplified subject name will be matched with the pre-built company knowledge base to obtain the news subject name recognition result, and the news subject name recognition result will be output; among them, there is at least one simplified subject name.
[0012] In implementing the embodiment of the present invention, the news public opinion data is subjected to subject name recognition through an AI big model to obtain a public opinion feature recognition result; wherein, the AI big model is obtained by training the ChatGPT model with data based on context instructions; by performing string matching on the public opinion feature recognition result, it is determined whether there is a news subject in the public opinion feature recognition result, and if not, a prompt message indicating that the subject is not recognized is output; if so, the public opinion feature recognition result is subjected to invalid information elimination to obtain subject simplified data, and the subject simplified data is subjected to subject number discrimination and segmentation to obtain subject simplified names; through the common subsequence optimal matching strategy, the subject simplified name is matched with a pre-built company knowledge base to obtain a news subject name recognition result, and the news subject name recognition result is output; wherein, there is at least one subject simplified name. Automatically and accurately extract and identify the text subject in massive public opinion information, obtain the simplified name of the subject through AI big model and subject information processing (string matching, invalid information elimination, subject quantity discrimination and segmentation), and combine the common subsequence optimal matching strategy to match the simplified name of the subject with the pre-built company knowledge base, which can accurately establish the association relationship with the registered name of the subject company, effectively reduce the training and deployment costs of the public opinion subject analysis AI big model, and efficiently extract the subject company name from massive news public opinion information, and improve the accuracy of subject identification. The existing public opinion subject identification technology has not completely solved the problems of difficult rule writing, complex feature engineering, large amount of labeled data and high model training cost. For a large amount of credit subject information, it is impossible to effectively and accurately make a unique association between credit subjects. Therefore, it is necessary to accurately output the head office of the news subject of public opinion data, accurately match, and improve the accuracy of subject identification.
[0013] As a preferred solution, the AI big model is obtained by training the ChatGPT model with data based on contextual instructions, specifically:
[0014] Constructing a training data set; wherein the training data set includes question-answer data, context instructions, and requested instance data;
[0015] Input the training data set into the ChatGPT model for model training until the preset training end conditions are met, stop model training, and use the trained ChatGPT model as the AI large model.
[0016] As a preferred solution, invalid information is removed from the public opinion feature recognition results to obtain the main simplified data, specifically:
[0017] Based on the preset invalid modifiers, the invalid modifiers in the public opinion feature recognition results are replaced with null values using the rep l ace function to obtain the main simplified data;
[0018] Among them, the preset invalid modifiers are set according to the degree of interference of the modifiers in the public opinion features on the matching process.
[0019] As a preferred solution, the subject simplified data is segmented by subject quantity discrimination to obtain the subject simplified name, specifically:
[0020] Determine the number of subjects in the subject simplification data. If the number of subjects is greater than 1, use the split function to split the subject simplification data by commas, and correspond the split subject simplification data to multiple subject simplification names.
[0021] If the number of entities present is not greater than 1, the entity simplified data is used as the entity simplified name.
[0022] As a preferred solution, the simplified name of the subject is matched with the pre-built company knowledge base through the common subsequence optimal matching strategy to obtain the news subject name recognition result, which is specifically:
[0023] The simplified name of the current subject is used as the first sequence, and the name of each subject information in the company knowledge base is used as the second sequence;
[0024] By using the longest common subsequence dynamic programming method, the first sequence is matched with each second sequence in turn to obtain several longest common subsequences;
[0025] Determine the optimal matching length according to each longest common subsequence;
[0026] When the optimal matching length is not less than the preset length threshold, each longest common subsequence is matched with each second sequence in turn by the longest continuous common subsequence dynamic programming method to obtain a plurality of longest continuous common subsequences;
[0027] The sequence lengths of the longest continuous common subsequences are compared, and the longest continuous common subsequence corresponding to the minimum sequence length is extracted to obtain the news subject name recognition result corresponding to the current simplified subject name.
[0028] As a preferred solution, the first sequence is matched with each second sequence in turn by the longest common subsequence dynamic programming method to obtain several longest common subsequences, specifically:
[0029] Extract the current last element corresponding to the first sequence and the current second sequence to obtain two current elements to be judged, perform element judgment processing based on the current elements to be judged, and delete the current elements to be judged corresponding to the first sequence and the current second sequence to obtain the current longest common subsequence, and cyclically extract the current last element corresponding to the first sequence and the current second sequence and perform element judgment processing in sequence until all elements of the first sequence and the current second sequence are processed to obtain the longest common subsequence corresponding to the current second sequence;
[0030] The longest common subsequences corresponding to the second sequences are counted to obtain several longest common subsequences.
[0031] As a preferred solution, element judgment processing is performed based on the current element to be judged, and the current element to be judged corresponding to the first sequence and the current second sequence is deleted to obtain the current longest common subsequence, specifically:
[0032] Determine whether the two current elements to be determined are the same. If they are the same, delete the current elements to be determined corresponding to the first sequence and the current second sequence respectively, extract the longest common subsequence after deleting the current elements to be determined from the first sequence and the current second sequence respectively, add the current elements to be determined to the longest common subsequence after deleting the current elements to be determined, and obtain the current longest common subsequence;
[0033] If they are not the same, the current elements to be judged corresponding to the first sequence and the current second sequence are deleted respectively, and one of the two longest common subsequences after deleting the current elements to be judged from the first sequence and the current second sequence is used as the current longest common subsequence.
[0034] As a preferred solution, each longest continuous common subsequence is matched with each second sequence in turn by the longest continuous common subsequence dynamic programming method to obtain several longest continuous common subsequences, specifically:
[0035] Extract the current first character corresponding to the current longest common subsequence and the current second sequence to obtain two current characters to be judged, perform character judgment processing based on the current characters to be judged, and delete the current characters to be judged corresponding to the current longest common subsequence and the current second sequence to obtain the current longest continuous common subsequence, and sequentially extract the current last character corresponding to the current longest common subsequence and the current second sequence in a loop and perform character judgment processing until all characters of the current longest common subsequence and the current second sequence are processed to obtain the longest continuous common subsequence corresponding to the current second sequence;
[0036] The longest continuous common subsequences corresponding to the second sequences are counted to obtain a plurality of longest continuous common subsequences.
[0037] As a preferred solution, character determination processing is performed based on the current character to be determined, and the current longest common subsequence and the current character to be determined corresponding to the current second sequence are deleted to obtain the current longest continuous common subsequence, specifically:
[0038] Determine whether the two characters to be determined are the same. If they are the same, delete the characters to be determined corresponding to the current longest common subsequence and the current second sequence respectively, and extract the characters to be determined to the current longest continuous common subsequence; wherein, when the characters to be determined are determined for the first time, the current longest continuous common subsequence is preset to be a null value;
[0039] If they are not the same, the current longest common subsequence and the current character to be determined corresponding to the current second sequence are deleted respectively.
[0040] In order to solve the same technical problem, an embodiment of the present invention also provides a news subject identification system for public opinion data, including: an AI large model module, a subject information module and an optimal subject matching module;
[0041] Among them, the AI big model module is used to identify the subject name of the news public opinion data through the AI big model to obtain the public opinion feature recognition result; wherein, the AI big model is obtained by training the ChatGPT model with data based on context instructions;
[0042] The subject information module is used to determine whether there is a news subject in the public opinion feature recognition result by performing string matching on the public opinion feature recognition result. If not, it outputs a prompt message that the subject is not recognized;
[0043] The optimal subject matching module is used to eliminate invalid information from the public opinion feature recognition result if there is a news subject in the public opinion feature recognition result, obtain simplified subject data, and perform subject quantity discrimination and segmentation on the simplified subject data to obtain the simplified subject name; through the common subsequence optimal matching strategy, the simplified subject name is matched with the pre-built company knowledge base to obtain the news subject name recognition result, and the news subject name recognition result is output; among them, the simplified subject name is at least 1.
[0044] The implementation of the present invention has the following advantages:
[0045] 1. More accurate recognition capability: The large model training process uses less labeled data and more accurate recognition capability. On the one hand, the supervised data of the large model are all general texts that are very easy to obtain. On the other hand, for dedicated tasks, labeled data is not required, that is, zero shot. In order to achieve better results, a few shots are used, which is also low in cost, but has a greater effect gain, and has a higher accuracy rate when dealing with the problem of identifying the subject of public opinion.
[0046] 2. Wider coverage: The large model can not only understand standard language, but also understand and process non-standard language such as slang, abbreviations and Internet terms due to the diversity of its training data, which enhances its practicality in processing actual public opinion data.
[0047] 3. Stronger context understanding ability: The large model can fully consider the context when understanding the meaning of the expression, avoiding misrecognition due to ignoring the context.
[0048] 4. Reduce over-engineering: Traditional methods of identifying public opinion subjects may require a lot of feature engineering and domain knowledge, while large models can automatically learn these features from data, greatly reducing the need for over-engineering.
[0049] 5. Accurate matching: The optimal matching strategy is adopted to solve the technical problem that the existing technology cannot effectively and accurately uniquely associate credit subjects with a large amount of credit subject information.
[0050] Other features and advantages of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 : A flow chart of an embodiment of a method for identifying news subjects of public opinion data provided by the present invention;
[0052] Figure 2 : A simplified flowchart of an embodiment of a method for identifying news subjects of public opinion data provided by the present invention;
[0053] Figure 3 : A structural diagram of an embodiment of a news subject identification system for public opinion data provided by the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] Embodiment 1
[0056] Please refer to Figure 1, which is a flow chart of a method for identifying news subjects of public opinion data provided by an embodiment of the present invention. This embodiment uses an AI big model combined with a common subsequence optimal matching strategy to efficiently extract subject company names from massive news public opinion information and improve the accuracy of subject identification. The news subject identification method includes steps 101 to 103, each of which is as follows:
[0057] Step 101: Use the AI big model to identify the subject name of the news public opinion data to obtain the public opinion feature recognition result; wherein the AI big model is obtained by training the ChatGPT model with data based on context instructions.
[0058] In this embodiment, a simplified flowchart of a method for identifying news subjects of public opinion data is shown in FIG. Figure 2 As shown, it is preliminarily determined whether there is a news subject in the input news, and the description part of the news subject is extracted, that is, the public opinion feature recognition result. For example, there is no news subject in the description of "I am very hungry today".
[0059] It should be noted that the performance of using only the GPT3.5 model or the GPT4 model is better than the effect of other public large models + fine-tuning. The recognition of news subject public opinion features is directly implemented by GPT + context (prompt). The reasons for choosing the ChatGPT model are: 1. Based on matching alone, or the nn+sn method, the subject module is located according to keywords such as "company" and "limited company". Since the subject abbreviation is often used in news data, keywords such as company and limited company will not be omitted in the text, and the simple matching method is often ineffective in news data. 2. The performance of basic NLP models such as BERT was tested in the experiment. Training and fine-tuning based on the given small samples cannot achieve good results. The average accuracy of Caihui August single-day sample recognition is only 68%, while the average accuracy of AI large model single-day sample recognition can reach 95%, so the GPT3.5 model or GPT4 model is directly used as the process of preliminary extraction of news subjects.
[0060] Optionally, the AI big model is obtained by training the ChatGPT model with data based on contextual instructions, specifically:
[0061] Constructing a training data set; wherein the training data set includes question-answer data, context instructions, and requested instance data;
[0062] Input the training data set into the ChatGPT model for model training until the preset training end conditions are met, stop model training, and use the trained ChatGPT model as the AI large model.
[0063] In this embodiment, the AI big model can optionally use ChatGPT3.5 or ChatGPT4 and other available big model interfaces to optimize the learning ability of the model, so that it can make full use of large-scale unlabeled data and small-scale annotated data, improve the reusability of the model, and reduce the annotation cost during model training. The contextual instruction (Prompt) guides the big model to perform accurate subject recognition. In particular, the AI big model can execute the provided contextual instruction (Prompt) in the form of instruction following. The reason why the AI big model can successfully execute the instructions in the prompt (instruction following) is that it is trained through large-scale data, which includes a large number of instances of questions and answers, instructions and requests. During the training process, the AI big model learns how to understand and generate appropriate responses, including responses to specific inquiries or instructions. Through small sample learning to enhance the ability of the big model to transfer subject recognition tasks, and through the plug-in knowledge base / database to automatically correct and improve the subject recognition accuracy of the big model.
[0064] As an example of this embodiment, when training the AI big model, the following news-subject corresponding instruction pairs are extracted and added to the context:
[0065] You are a company researcher. For the news title in three quotation marks, please give the company entity in the news. Please note that the nouns before the chairman and company are usually the company name. If multiple entities are identified, please output all entities and separate them with commas. If the company entity in the news cannot be determined, please output "none".
[0066] Based on the above case, the contextual instruction (Prompt) is given as "If you cannot determine the company entity in the news, please output "None"" to avoid the hallucination problem of the AI big model. That is, when the AI big model cannot identify the subject information from the news, avoid the AI big model's erroneous output and output "None" instead.
[0067] It should be noted that in the AI large model, the role of contextual instructions (Prompt) is mainly to prompt the AI model with the context of input information and parameter information of the input model. When training supervised learning or unsupervised learning models, Prompt can help the model better understand the intention of the input and respond accordingly. In addition, Prompt can also improve the interpretability and accessibility of the model. In layman's terms, it is to provide an AI model with a "prompt" or "guide" to help it better understand and complete tasks.
[0068] Step 102: By performing string matching on the public opinion feature recognition result, it is determined whether there is a news subject in the public opinion feature recognition result. If not, a prompt message indicating that the subject is not recognized is output.
[0069] In this embodiment, a string match is performed on the public opinion feature recognition result output by the AI large model. When the output result is identified as "none", it means that there is no news subject in the public opinion data. The input analysis will be stopped to save resources, and a prompt message that the subject was not identified will be output.
[0070] Step 103: If there is a news subject in the public opinion feature recognition result, invalid information is eliminated from the public opinion feature recognition result to obtain simplified subject data, and the simplified subject data is segmented according to the number of subjects to obtain a simplified subject name; through the common subsequence optimal matching strategy, the simplified subject name is matched with the pre-built company knowledge base to obtain the news subject name recognition result, and the news subject name recognition result is output; wherein, there is at least one simplified subject name.
[0071] It should be noted that the enterprise subject matching method based on part-of-speech tagging of text data in the prior art is based on the matching mode of "ns+nn", and locates the subject module according to keywords such as "company" and "limited company". However, since the abbreviations of the subject are often used in news data, such as "Tencent" refers to "Shenzhen Tencent Computer Systems Co., Ltd.", compared with government texts, which do not omit keywords such as company and limited company, this matching method often fails in news data.
[0072] By implementing the embodiments of the present invention, the text subject can be automatically and accurately extracted and identified from the massive public opinion information, and the association relationship with the registered name of the subject company can be accurately established, effectively reducing the training and deployment costs of the public opinion subject analysis model. For example, for the appearance of "Ali" or "Alibaba" in the news, "Alibaba Group Holding Limited" can be accurately output.
[0073] Optionally, step 103 specifically includes step 1031 to step 1034, each step is as follows:
[0074] Step 1031: Remove invalid information from the public opinion feature recognition results to obtain main simplified data, specifically:
[0075] Based on the preset invalid modifiers, the rep l ace function is used to replace the invalid modifiers in the public opinion feature recognition results with null values to obtain the main simplified data; wherein, the preset invalid modifiers are set according to the degree of interference of the modifiers in the public opinion features on the matching process.
[0076] In this embodiment, the subject recognition result given by the AI large model is used as the public opinion feature data (public opinion feature recognition result). Since modifiers such as "Limited Liability Company" will interfere with the key information recognition of the company name during the matching process, it is necessary to first remove invalid modifiers from the public opinion feature data to remove invalid information. Invalid modifiers refer to data with invalid information such as prompt words and invalid words. The invalid modifiers that need to be removed include: "Company", "Group", "Limited Liability Company", "Shares", "(", ")", and "China". These invalid modifiers are replaced with null values through the rep l ace function to implement the deletion operation.
[0077] Step 1032: Perform subject quantity discrimination and segmentation on the subject simplified data to obtain the subject simplified name, specifically:
[0078] Determine the number of subjects in the subject simplification data. If the number of subjects is greater than 1, use the split function to split the subject simplification data by commas, and correspond the split subject simplification data to multiple subject simplification names.
[0079] If the number of entities present is not greater than 1, the entity simplified data is used as the entity simplified name.
[0080] In this embodiment, the simplified public opinion feature data (subject simplified data) is used to identify the number of subjects. If the subject simplified data contains multiple subjects, the context of the input AI model has been given that "if multiple subjects are identified, different subjects need to be separated by commas". The AI model can automatically split with commas in the case of multiple subjects through instruction tracking. The subject simplified data is then split by commas through the ".sp l it(',')" function. If the subject simplified data contains only a single subject, that is, the subject simplified name, then the single subject simplified name will be directly matched with the next step of the matching strategy. Through the common subsequence optimal matching strategy, the subject simplified name will be matched with the pre-built company knowledge base to obtain the news subject name recognition result. If it contains multiple subjects, that is, multiple subject simplified names, the next step of the matching strategy will be performed on different subject simplified names respectively. Through the common subsequence optimal matching strategy, each subject simplified name in the subject simplified data will be matched with the pre-built company knowledge base respectively to obtain the news subject name recognition result corresponding to each subject simplified name.
[0081] Step 1033: Through the common subsequence optimal matching strategy, the simplified name of the subject is matched with the pre-built company knowledge base to obtain the news subject name recognition result.
[0082] In this embodiment, the matching is performed based on the longest common subsequence (LCS) + the longest continuous common subsequence (LCCS) to achieve the common subsequence optimal matching strategy. The two sequences provide different information: LCS can emphasize the global similarity between the subject and the news name, while LCCS can emphasize the local continuity between the subject and the news name. In the subject identification problem, a global similarity priority strategy is adopted, that is, the answer with the global maximum match is matched first (because the company abbreviation is often the first letter of different words, the local continuity is poor), and when there are multiple global optimal answers, the local matching optimal is used to further screen the answer. In addition, in order to merge these two indicators into a similarity measurement, a certain weight strategy can also be adopted, for example: similarity = α*(the length of LCS / the length of the longer of the two strings)+β*(the length of LCCS / the length of the shorter of the two strings), where α and β are weights and can be adjusted according to actual needs.
[0083] It should be noted that the common subsequence optimal matching strategy considers two levels of string similarity matching, one is global similarity (LCS), and the other is local continuity (LCCS). Most traditional methods only consider one similarity metric, while this method combines the two metrics to provide a comprehensive and flexible strategy. In addition, the characteristics of the subject abbreviations are deeply analyzed, and the local and global metrics are reasonably integrated, so that the common subsequence optimal matching strategy is adapted to news and public opinion data to achieve the purpose of accurate matching.
[0084] Optionally, step 1033 specifically includes steps S1-S5, each step is as follows:
[0085] S1: The simplified name of the current subject is used as the first sequence, and the names of each subject information in the company knowledge base are used as the second sequence;
[0086] In this embodiment, the stored company knowledge base information (e.g., information from the wi nd database + manually screened bond issuers of interest, a total of 4459 subject data) is read in to construct the company knowledge base. According to the Chinese abbreviation rule, the best matching data should be the data with the longest longest common subsequence and the longest continuous common subsequence length under the same longest common subsequence. In order to facilitate the call of the common subsequence optimal matching strategy, the simplified name of the subject is used as the first sequence, and the name of each subject information in the company knowledge base is used as each second sequence, so as to match the first sequence and the second sequence with the longest common subsequence and the longest continuous common subsequence.
[0087] S2: Match the first sequence with each second sequence in turn through the longest common subsequence dynamic programming method to obtain several longest common subsequences;
[0088] In this embodiment, the longest common subsequence (LCS) is a quantitative method for comparing the similarity of two sequences. It is used to find the longest subsequence shared by two sequences (such as strings), that is, the longest common subsequence. The subsequences do not have to be continuous, but the relative order of the elements in the original sequence must be maintained. For example, the longest common subsequence of two strings, "ABCBDAB" and "BDCAB" is "BCAB".
[0089] Optionally, step S2 specifically includes:
[0090] Extract the current last element corresponding to the first sequence and the current second sequence to obtain two current elements to be judged, perform element judgment processing based on the current elements to be judged, and delete the current elements to be judged corresponding to the first sequence and the current second sequence to obtain the current longest common subsequence, and cyclically extract the current last element corresponding to the first sequence and the current second sequence and perform element judgment processing in sequence until all elements of the first sequence and the current second sequence are processed to obtain the longest common subsequence corresponding to the current second sequence;
[0091] The longest common subsequences corresponding to the second sequences are counted to obtain several longest common subsequences.
[0092] Optionally, element determination processing is performed based on the current element to be determined, and the current element to be determined corresponding to the first sequence and the current second sequence is deleted to obtain the current longest common subsequence, specifically:
[0093] Determine whether the two current elements to be determined are the same. If they are the same, delete the current elements to be determined corresponding to the first sequence and the current second sequence respectively, extract the longest common subsequence after deleting the current elements to be determined from the first sequence and the current second sequence respectively, add the current elements to be determined to the longest common subsequence after deleting the current elements to be determined, and obtain the current longest common subsequence;
[0094] If they are not the same, the current elements to be judged corresponding to the first sequence and the current second sequence are deleted respectively, and one of the two longest common subsequences after deleting the current elements to be judged from the first sequence and the current second sequence is used as the current longest common subsequence.
[0095] In this embodiment, the longest common subsequence is calculated using a dynamic programming method, i.e., the longest common subsequence dynamic programming method, and the process is: if the last element of two sequences is the same, then their longest common subsequence is the longest common subsequence of the two sequences after removing the last element respectively and adding the same element. If the last elements of the two sequences are different, then their longest common subsequence is one of the two possible longest common subsequences after removing the last element respectively.
[0096] By implementing the embodiment of the present invention, the scale of the problem can be gradually reduced through the longest common subsequence dynamic programming method until the problem becomes small enough to be easy to solve.
[0097] It should be noted that the high-speed vehicle location identification method of mobile phone signaling road network matching in the prior art quickly locates the location of the mobile phone on the highway through the longest common subsequence in the forward and reverse directions. This method works when each mobile phone (subject) has a unique number and there are no other signals on the road except the regular number. However, for news data, news data has a lot of semantic interference information in addition to the subject. If only the longest common subsequence is matched, this single matching method will often result in incorrect matching when used for identification in a high-noise news data scenario. In the prior art, the cleaning and deduplication method for public resource transaction data calculates the longest common subsequence based on the starting point that the duplicate data has a completely consistent description. It also cannot solve the analysis difficulties faced by a single matching method in a high-noise news data scenario. The matching method of the longest common subsequence fails due to different abbreviation rules of the subject in the semantics and different language semantics.
[0098] S3: Determine the optimal matching length according to each longest common subsequence;
[0099] In this embodiment, in order to evaluate the matching results, the optimal matching length judgment method will be used to match the subject information name in the database with the subject simplified name one by one, and record the length of the number of matches in the database that reaches the highest global matching metric (LCS) with the subject simplified name, that is, select the maximum value of the length of each longest common subsequence and record it as the optimal matching length. If the optimal matching length is less than the preset length threshold (such as: 2), "Unable to accurately query" will be output, indicating that the accurate company subject cannot be found. On the contrary, if the optimal matching length is greater than or equal to the preset length threshold (such as: 2), the company information with the best match (each longest common subsequence) will be extracted for the next step of analysis.
[0100] S4: when the optimal matching length is not less than a preset length threshold, each longest common subsequence is matched with each second sequence in turn by a longest continuous common subsequence dynamic programming method to obtain a plurality of longest continuous common subsequences;
[0101] In the present embodiment, the longest continuous common subsequence, or the longest common substring (Longest Common Substring), is also a method for measuring the similarity of two sequences, which finds the longest continuous subsequence shared by the two sequences, i.e., the longest continuous common subsequence. Note that this is different from the longest common subsequence, in which the elements in the longest common subsequence may not be continuous, while the elements in the longest continuous common subsequence must be continuous. For example, for two strings "ABCDEF" and "ZBCDF", their longest continuous common subsequence is "BCD".
[0102] Optionally, each longest continuous common subsequence is matched with each second sequence in turn by the longest continuous common subsequence dynamic programming method to obtain several longest continuous common subsequences, specifically:
[0103] Extract the current first character corresponding to the current longest common subsequence and the current second sequence to obtain two current characters to be judged, perform character judgment processing based on the current characters to be judged, and delete the current characters to be judged corresponding to the current longest common subsequence and the current second sequence to obtain the current longest continuous common subsequence, and sequentially extract the current last character corresponding to the current longest common subsequence and the current second sequence in a loop and perform character judgment processing until all characters of the current longest common subsequence and the current second sequence are processed to obtain the longest continuous common subsequence corresponding to the current second sequence;
[0104] The longest continuous common subsequences corresponding to the second sequences are counted to obtain a plurality of longest continuous common subsequences.
[0105] Optionally, character determination processing is performed based on the current character to be determined, and the current longest common subsequence and the current character to be determined corresponding to the current second sequence are deleted to obtain the current longest continuous common subsequence, specifically:
[0106] Determine whether the two characters to be determined are the same. If they are the same, delete the characters to be determined corresponding to the current longest common subsequence and the current second sequence respectively, and extract the characters to be determined to the current longest continuous common subsequence; wherein, when the characters to be determined are determined for the first time, the current longest continuous common subsequence is preset to be a null value;
[0107] If they are not the same, the current longest common subsequence and the current character to be determined corresponding to the current second sequence are deleted respectively.
[0108] In this embodiment, the longest continuous common subsequence is calculated by a common dynamic programming method, i.e., the longest continuous common subsequence dynamic programming method. The programming process is: if the current character is matched, add one to the previous matching character; if it is not matched, start again. Each item in the dynamic programming table is the length of the longest continuous common subsequence ending with the current character. Finally, the maximum value in the table is the length of the longest continuous common subsequence, and the sequence itself can be obtained by backtracking.
[0109] S5: Compare the sequence lengths of the longest continuous common subsequences, extract the longest continuous common subsequence corresponding to the minimum sequence length, and obtain the news subject name recognition result corresponding to the current simplified subject name.
[0110] In this embodiment, each longest continuous common subsequence is taken as the result with the best match, and the subsidiary name is removed from all the results with the best match, while the parent company name is retained. Since the subsidiary name is often longer than the parent company name, the result with the smallest length among all the best match results is retained as the output result. The news subject recognition result obtained by the method of the present invention for the public opinion data is output in a structured form to complete the company name with the most relevant relationship identified by the news subject discrimination method based on the large model.
[0111] The implementation of the present invention has the following advantages:
[0112] 1. More accurate recognition capability: The large model training process uses less labeled data and more accurate recognition capability. On the one hand, the supervised data of the large model are all general texts that are very easy to obtain. On the other hand, for dedicated tasks, labeled data is not required, that is, zero shot. In order to achieve better results, a few shots are used, which is also low in cost, but has a greater effect gain, and has a higher accuracy rate when dealing with the problem of identifying the subject of public opinion.
[0113] 2. Wider coverage: The large model can not only understand standard language, but also understand and process non-standard language such as slang, abbreviations and Internet terms due to the diversity of its training data, which enhances its practicality in processing actual public opinion data.
[0114] 3. Stronger context understanding ability: The large model can fully consider the context when understanding the meaning of the expression, avoiding misrecognition due to ignoring the context.
[0115] 4. Reduce over-engineering: Traditional methods of identifying public opinion subjects may require a lot of feature engineering and domain knowledge, while large models can automatically learn these features from data, greatly reducing the need for over-engineering.
[0116] 5. Accurate matching: The optimal matching strategy is adopted to solve the technical problem that the existing technology cannot effectively and accurately uniquely associate credit subjects with a large amount of credit subject information.
[0117] Embodiment 2
[0118] Accordingly, see Figure 3 , Figure 3 1 is a schematic diagram of the structure of a second embodiment of a news subject identification system for public opinion data provided by the present invention. Figure 3 As shown, the news subject identification system of public opinion data includes an AI large model module 401, a subject information module 402 and an optimal subject matching module 403;
[0119] The AI big model module 401 is used to identify the subject name of the news public opinion data through the AI big model to obtain the public opinion feature recognition result; wherein the AI big model is obtained by training the ChatGPT model with data based on context instructions;
[0120] The subject information module 402 is used to determine whether there is a news subject in the public opinion feature recognition result by performing string matching on the public opinion feature recognition result. If not, a prompt message indicating that the subject is not recognized is output;
[0121] The optimal subject matching module 403 is used to eliminate invalid information from the public opinion feature recognition result if there is a news subject in the public opinion feature recognition result, obtain simplified subject data, and perform subject quantity discrimination and segmentation on the simplified subject data to obtain the simplified subject name; through the common subsequence optimal matching strategy, the simplified subject name is matched with the pre-built company knowledge base to obtain the news subject name recognition result, and the news subject name recognition result is output; wherein, the simplified subject name is at least 1.
[0122] In implementing the embodiment of the present invention, the news public opinion data is subjected to subject name recognition through an AI big model to obtain a public opinion feature recognition result; wherein, the AI big model is obtained by training the ChatGPT model with data based on context instructions; by performing string matching on the public opinion feature recognition result, it is determined whether there is a news subject in the public opinion feature recognition result, and if not, a prompt message indicating that the subject is not recognized is output; if so, the public opinion feature recognition result is subjected to invalid information elimination to obtain subject simplified data, and the subject simplified data is subjected to subject number discrimination and segmentation to obtain subject simplified names; through the common subsequence optimal matching strategy, the subject simplified name is matched with a pre-built company knowledge base to obtain a news subject name recognition result, and the news subject name recognition result is output; wherein, there is at least one subject simplified name. Automatically and accurately extract and identify the text subject in massive public opinion information, obtain the simplified name of the subject through AI big model and subject information processing (string matching, invalid information elimination, subject quantity discrimination and segmentation), and combine the common subsequence optimal matching strategy to match the simplified name of the subject with the pre-built company knowledge base, which can accurately establish the association relationship with the registered name of the subject company, effectively reduce the training and deployment costs of the public opinion subject analysis AI big model, and efficiently extract the subject company name from massive news public opinion information, and improve the accuracy of subject identification. The existing public opinion subject identification technology has not completely solved the problems of difficult rule writing, complex feature engineering, large amount of labeled data and high model training cost. For a large amount of credit subject information, it is impossible to effectively and accurately make a unique association between credit subjects. Therefore, it is necessary to accurately output the head office of the news subject of public opinion data, accurately match, and improve the accuracy of subject identification.
[0123] The above-mentioned news subject identification system for public opinion data can implement a news subject identification method for public opinion data in the above-mentioned method embodiment. The options in the above-mentioned method embodiment are also applicable to this embodiment and will not be described in detail here. The rest of the contents of the embodiment of this application can refer to the contents of the above-mentioned method embodiment, and will not be repeated in this embodiment.
[0124] The above specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for identifying news subjects of public opinion data, characterized in that: include: The news public opinion data is subjected to subject name recognition through an AI big model to obtain a public opinion feature recognition result; wherein the AI big model is obtained by training the ChatGPT model with data based on contextual instructions; By performing string matching on the public opinion feature recognition result, it is determined whether there is a news subject in the public opinion feature recognition result, and if not, a prompt message indicating that the subject is not recognized is output; If it exists, the invalid information is removed from the public opinion feature recognition result to obtain simplified subject data, and the simplified subject data is segmented by subject quantity to obtain simplified subject names; the simplified subject name is matched with the pre-built company knowledge base through the common subsequence optimal matching strategy to obtain the news subject name recognition result, and the news subject name recognition result is output; wherein, the simplified subject name is at least 1; The common subsequence optimal matching strategy is used to match the simplified name of the subject with the pre-built company knowledge base to obtain the news subject name recognition result, which is specifically: The simplified name of the current subject is used as the first sequence, and the name of each subject information in the company knowledge base is used as the second sequence; Matching the first sequence with each of the second sequences in sequence by using the longest common subsequence dynamic programming method to obtain a plurality of longest common subsequences; Determining an optimal matching length according to each of the longest common subsequences; When the optimal matching length is not less than a preset length threshold, matching each of the longest common subsequences with each of the second sequences in turn by a longest continuous common subsequence dynamic programming method to obtain a plurality of longest continuous common subsequences; The sequence lengths of the longest continuous common subsequences are compared, and the longest continuous common subsequence corresponding to the minimum sequence length is extracted to obtain the news subject name recognition result corresponding to the current simplified subject name.
2. The news subject identification method of public opinion data according to claim 1, characterized in that: The AI big model is obtained by training the ChatGPT model with data based on contextual instructions, specifically: Constructing a training data set; wherein the training data set includes question-answer data, the context instructions, and requested instance data; The training data set is input into the ChatGPT model for model training until the preset training end condition is met, the model training is stopped, and the trained ChatGPT model is used as the AI large model.
3. The news subject identification method of public opinion data according to claim 1, characterized in that: The invalid information of the public opinion feature recognition result is removed to obtain the main simplified data, which is specifically: Based on the preset invalid modifiers, using the replace function, the invalid modifiers in the public opinion feature recognition result are replaced with null values to obtain the main body simplified data; The preset invalid modifiers are set according to the degree of interference of the modifiers in the public opinion features on the matching process.
4. The news subject identification method of public opinion data according to claim 1, characterized in that: The subject quantity discrimination and segmentation of the subject simplified data to obtain the subject simplified name is specifically as follows: Determine the number of subjects in the subject simplified data. If the number of subjects is greater than 1, use the split function to split the subject simplified data by commas, and correspond the split subject simplified data to a plurality of subject simplified names. If the number of existing entities is not greater than 1, the entity simplified data is used as the entity simplified name.
5. The news subject identification method of public opinion data according to claim 1, characterized in that: The first sequence is matched with each of the second sequences in sequence by the longest common subsequence dynamic programming method to obtain a plurality of longest common subsequences, specifically: Extract the current last element corresponding to the first sequence and the current second sequence to obtain two current elements to be judged, perform element judgment processing based on the current elements to be judged, delete the current elements to be judged corresponding to the first sequence and the current second sequence, obtain the current longest common subsequence, and sequentially extract the current last element corresponding to the first sequence and the current second sequence in a cyclic manner and perform element judgment processing until all elements of the first sequence and the current second sequence are processed to obtain the longest common subsequence corresponding to the current second sequence; The longest common subsequences corresponding to the second sequences are counted to obtain the plurality of longest common subsequences.
6. The news subject identification method of public opinion data according to claim 5, characterized in that: The performing element judgment processing based on the current element to be judged, and deleting the current element to be judged corresponding to the first sequence and the current second sequence to obtain the current longest common subsequence, is specifically: Determine whether the two current elements to be determined are the same. If they are the same, delete the current elements to be determined corresponding to the first sequence and the current second sequence respectively, extract the longest common subsequence after deleting the current elements to be determined from the first sequence and the current second sequence respectively, and add the current elements to be determined to the longest common subsequence after deleting the current elements to be determined, to obtain the current longest common subsequence; If they are not the same, the current elements to be judged corresponding to the first sequence and the current second sequence are deleted respectively, and one of the two longest common subsequences of the first sequence and the current second sequence after deleting the current elements to be judged is used as the current longest common subsequence.
7. The news subject identification method of public opinion data according to claim 5, characterized in that: The longest continuous common subsequence dynamic programming method is used to sequentially match each of the longest common subsequences with each of the second sequences to obtain a plurality of longest continuous common subsequences, specifically: Extract the current first character corresponding to the current longest common subsequence and the current second sequence to obtain two current characters to be judged, perform character judgment processing based on the current characters to be judged, and delete the current characters to be judged corresponding to the current longest common subsequence and the current second sequence to obtain the current longest continuous common subsequence, and sequentially cyclically extract the current last character corresponding to the current longest common subsequence and the current second sequence and perform character judgment processing until all characters of the current longest common subsequence and the current second sequence are processed to obtain the longest continuous common subsequence corresponding to the current second sequence; The longest continuous common subsequences corresponding to the second sequences are counted to obtain the plurality of longest continuous common subsequences.
8. The news subject identification method of public opinion data according to claim 7, characterized in that: The character determination process is performed based on the current character to be determined, and the current character to be determined corresponding to the current longest common subsequence and the current second sequence is deleted to obtain the current longest continuous common subsequence, specifically: Determine whether the two characters to be determined are the same. If they are the same, delete the characters to be determined corresponding to the current longest common subsequence and the current second sequence respectively, and extract the characters to be determined to the current longest continuous common subsequence; wherein, when the characters to be determined are determined for the first time, the current longest continuous common subsequence is preset to be a null value; If they are not the same, the current longest common subsequence and the current character to be determined corresponding to the current second sequence are deleted respectively.
9. A news subject identification system for public opinion data, characterized in that: include: AI big model module, subject information module and optimal subject matching module; The AI big model module is used to identify the subject name of the news public opinion data through the AI big model to obtain the public opinion feature recognition result; wherein the AI big model is obtained by training the ChatGPT model with data based on context instructions; The subject information module is used to determine whether there is a news subject in the public opinion feature recognition result by performing string matching on the public opinion feature recognition result, and if not, output a prompt message that the subject is not recognized; The optimal subject matching module is used to remove invalid information from the public opinion feature recognition result if the news subject exists in the public opinion feature recognition result to obtain subject simplified data, and to perform subject quantity discrimination and segmentation on the subject simplified data to obtain subject simplified names; to match the subject simplified name with a pre-built company knowledge base through a common subsequence optimal matching strategy to obtain a news subject name recognition result, and to output the news subject name recognition result; wherein, the subject simplified name is at least one; The common subsequence optimal matching strategy is used to match the simplified name of the subject with the pre-built company knowledge base to obtain the news subject name recognition result, which is specifically: The simplified name of the current subject is used as the first sequence, and the name of each subject information in the company knowledge base is used as the second sequence; Matching the first sequence with each of the second sequences in sequence by using the longest common subsequence dynamic programming method to obtain a plurality of longest common subsequences; Determining an optimal matching length according to each of the longest common subsequences; When the optimal matching length is not less than a preset length threshold, matching each of the longest common subsequences with each of the second sequences in turn by a longest continuous common subsequence dynamic programming method to obtain a plurality of longest continuous common subsequences; The sequence lengths of the longest continuous common subsequences are compared, and the longest continuous common subsequence corresponding to the minimum sequence length is extracted to obtain the news subject name recognition result corresponding to the current simplified subject name.
