Named entity recognition method and system in the field of power public opinion based on deep learning

Through deep learning methods, BERT and BiLSTM models are used to extract features in electric power public opinion texts and combined with the CRF layer for location index annotation, which solves the accuracy and stability problems of named entity recognition in the existing technology and achieves efficient and accurate entity extraction. and cost savings.

CN114757191BActive Publication Date: 2024-09-17STATE GRID JIANGSU ELECTRIC POWER CO LTD MARKETING SERVICE CENT +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210319638.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-29
Publication Date
2024-09-17
Estimated Expiration
2042-03-29

AI Technical Summary

Technical Problem

Existing named entity recognition methods are not very accurate in power public opinion texts, require frequent updates, have high labor costs, and cannot effectively handle cross-inclusion situations between entities.

Method used

A method based on deep learning is used to organize and preprocess the electric power public opinion text data, use the BERT and BiLSTM models to extract features, combine the CRF layer for position index annotation, and integrate the five-stroke order and radical features to achieve more accurate entity extraction.

Benefits of technology

It improves the accuracy and efficiency of entity word extraction, saves manual annotation costs, can effectively handle cross-inclusion situations between entities, and has good model stability and easy update.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114757191B
    Figure CN114757191B
Patent Text Reader

Abstract

The present invention proposes a method and system for named entity recognition in the field of electric power public opinion based on deep learning, which organizes the text data of electric power public opinion, marks the entity words in the text data; pre-processes and annotates the data into a position index annotation sequence; performs feature extraction on the pre-processed data; and extracts entity words in new electric power public opinion text data based on the data annotation results. The position index annotation method of the present invention solves the problem of cross-inclusion between entities well; combines the five-stroke sequence and radical features of each word in the text, extracts features through the BiLSTM model, and integrates them with the BERT features obtained by the BERT pre-training model, thereby enhancing the semantic representation in the feature vector, and can better and more accurately extract the entities contained in the text; by using the CRF layer to constrain the obtained position index sequence labels, the probability of irregular labels appearing is greatly reduced, so that a better entity label sequence can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of natural language processing, entity recognition, and electric power public opinion analysis, and more specifically, to a method and system for named entity recognition in the electric power public opinion field based on deep learning. Background Art

[0002] As the power industry is closely related to the lives of the people, a series of issues such as electricity price adjustment, power supply, power facility maintenance, and safe production can easily have a great impact on state-owned super-large power companies, making it urgent to explore scientific public opinion management solutions and do a good job in public opinion crisis response. In the context of the continuous development of new media, the speed of information dissemination is constantly increasing, which also makes the outbreak of public opinion crises uncontrollable. Power grid companies are very easy to become the target of public opinion attacks, so it is very important to quickly discover people's focus from the power public opinion text, that is, the entity words in the data.

[0003] Named Entity Recognition (NER) is a basic processing task in natural language processing. Named entities generally refer to entities with specific meanings or references in texts, usually including names of people, places, organizations, dates, times, proper nouns, etc. Entity recognition can also identify more entities according to business needs, such as product names, models, specifications, and sizes. At present, the methods of named entity recognition mainly include rule-based named entity recognition and statistics-based named entity recognition. Rule-based named entity recognition uses a method of constructing entity rule templates to filter entity words. In the process of template formulation, characters containing key features such as punctuation marks, keywords, and indicator words are used, combined with a pre-organized entity word library, to filter entity words in the text. However, the above method is not very accurate, and requires continuous template updates, and has poor stability. The statistical named entity recognition methods mainly include Hidden Markov Model (HMM), Maximum Entropy Model (ME), Support Vector Machine (SVM) and Conditional Random Field (CRF). They use a large amount of manually annotated data to annotate the data corpus, and train the annotated data to obtain the entity annotation model. However, this method requires manually selecting the entity words of interest contained in each text from a large amount of text, which has high labor costs. In addition, the above methods cannot accurately extract entity words when there are cross-inclusions between entities in the text. Summary of the invention

[0004] In order to solve the deficiencies in the prior art, the purpose of the present invention is to provide a method and system for named entity recognition in the field of electric power public opinion based on deep learning, which can automatically mark the included entities from the text and solve the problem of mutual inclusion between marked entities. The present invention adopts the following technical solution. The present invention solves the above problems by using a method and system for named entity recognition in the field of electric power public opinion based on deep learning, and its technical solution mainly includes the following steps:

[0005] S1: sorting out the text data of power public opinion and marking entity words in the text data;

[0006] S2: preprocess the sorted data and mark them as position index annotation sequences;

[0007] S3: extract features from the preprocessed text data;

[0008] S4: Extract entity words from new power public opinion text data based on data annotation results.

[0009] Furthermore, the step S1 includes: obtaining data of electric power public opinion text; marking entity words contained in each text by manual marking.

[0010] Furthermore, the step S2 comprises:

[0011] S21: Data cleaning: remove spaces and special characters in the text data, and split each piece of text data into individual words;

[0012] S22: Process data format: convert the cleaned data into the format of model input, and annotate the text data into a position index annotation sequence; the position index annotation method is to annotate the length of each entity in the text to the position of the entity start index, and end from the start position to the right by the entity length characters to obtain the required entity.

[0013] Furthermore, the step S3 comprises:

[0014] S31: Split the text data into individual words, and use the BERT pre-trained model to extract features from the power public opinion text to obtain its corresponding BERT feature vector;

[0015] S32: Obtain the five-stroke sequence and radical corresponding to each character in the electric power public opinion text data, and encode the corresponding five-stroke sequence and radical by using One-Hot encoding to obtain the encoded five-stroke sequence feature vector and radical feature vector;

[0016] S33: Fuse the Wubi sequence + radical feature vector with the BERT feature vector, and pass the fused feature vector through a linear layer to obtain the label probability of the position index annotation sequence corresponding to each character in the sequence;

[0017] S34: Input the finally obtained label probability into the CRF layer to obtain the label sequence of the final labeled position index label sequence.

[0018] Furthermore, step S4 includes: a label sequence annotated by a position index obtained by a named entity recognition model; starting from a non-zero position in the label sequence and ending at a length indicating a numerical size, representing an entity word from the beginning to the end, and extracting the entity words contained in the electric power public opinion text according to the positions of these non-zero labels.

[0019] The present invention also proposes a named entity recognition system in the field of electric power public opinion based on deep learning, comprising:

[0020] Data acquisition module: sorting out the text data of power public opinion and marking entity words in the text data;

[0021] Data preprocessing module: performs data preprocessing on the sorted data and marks them as position index annotation sequences;

[0022] Feature extraction module: extract features from preprocessed text data;

[0023] Identification module: extract entity words from new power public opinion text data based on data annotation results.

[0024] The present invention also provides a terminal, comprising a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the method according to the present invention.

[0025] The present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements the steps of the method of the present invention when executed by a processor.

[0026] The position index annotation method proposed and used in the present invention can well solve the problem of cross-inclusion between entities, and more and more accurate entity words can be proposed in the entity extraction result; at the same time, by combining the five-stroke sequence and radical features of each word in the text, the BiLSTM model is used to extract features, so that more complete contextual semantic features can be obtained, and the features are integrated with the BERT features obtained by the BERT pre-training model, so that the semantic representation in the feature vector is enhanced, and the entities contained in the text can be better and more accurately extracted; by using the CRF layer to constrain the obtained position index sequence labels, the appearance of label data that does not conform to the rules can be avoided, and the probability of irregular labels appearing is greatly reduced, so that a better entity label sequence can be obtained.

[0027] Compared with the prior art, the present invention has the following beneficial technical effects:

[0028] First, efficient entity word extraction. By using this model, entity words can be quickly extracted, and the entity words contained in each electric power public opinion text can be marked from a large number of electric power public opinion texts.

[0029] Second, it saves manpower. It is a very time-consuming and laborious task to manually select the entity words of interest contained in each text from a large amount of electric power public opinion text. By using this model to perform entity annotation of electric power public opinion text, a lot of manual work can be saved, thereby reducing operating costs.

[0030] Third, the extraction of mutually included entities. In the same electric power public opinion text, there are situations where entities are cross-included with each other. The model takes this situation into consideration and can extract more accurate entity words from it.

[0031] Fourth, it is stable and easy to update when needed. If the power public opinion text does not change much, the model can be used stably for a long time. If there are new types of entities that need to be labeled, you only need to label a part of the training data and add it to the original training data to retrain an entity labeling model. Updating the model is also simple and convenient. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is a basic flow chart of the named entity recognition method based on deep learning.

[0033] Figure 2 It is a method and system flow chart of named entity recognition in the field of electric power public opinion based on deep learning of the present invention.

[0034] Figure 3 A schematic diagram of the method for position indexing and labeling sequences according to the present invention.

[0035] Figure 4Schematic diagram of text data feature extraction according to the present invention. DETAILED DESCRIPTION

[0036] The present application is further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present application.

[0037] Named entity recognition based on deep learning is performed by using a combination of multiple neural networks.

[0038] The basic process of named entity recognition method based on deep learning is as follows Figure 1 As shown in Figure 2, the typical steps of named entity recognition based on deep learning include: text encoding, feature extraction processing and label decoding.

[0039] Text encoding: Commonly used encoding structures include Convolutional Neural Network (CNN), Recursive Neural Network (RNN), and transformer neural network structures. Feature extraction processing: Generally, the feature extraction results of a single neural network have certain defects and shortcomings. In actual applications, two or more neural networks are used to extract text features. Label decoding: The feature vector is used as the input of the feature label decoding part to predict the corresponding label sequence, thereby obtaining the final labeled entity result.

[0040] The present invention proposes a method and system for named entity recognition in the field of electric power public opinion based on deep learning. First, the text data of electric power public opinion is obtained, and the entity words in each text data are marked by manual marking; the electric power public opinion text data is cleaned to remove some irrelevant special characters, such as web page tags, emoticons, etc.; the text data is annotated with position index annotation sequence to obtain the format required for entity model input; the electric power public opinion text is passed through a BERT pre-training model, and its sentence sequence is encoded to extract semantic features to obtain a BERT feature vector; the five-stroke sequence and radical corresponding to each word in the electric power public opinion text data are obtained, and the corresponding five-stroke sequence and radical are encoded by using One-Hot encoding to obtain the encoded five-stroke sequence feature vector and radical feature vector; the fused feature vector is passed through a linear layer to obtain the label probability of the position index annotation sequence corresponding to each word in the sequence, and finally the electric power public opinion text containing position index annotation is obtained, and the entity words in the text are obtained according to the annotation sequence.

[0041] The method and system for named entity recognition in the field of electric power public opinion based on deep learning in the present invention mainly include the acquisition of text data, data preprocessing, feature vector extraction and entity word extraction. The process is as follows: Figure 2 As shown, the following is a detailed explanation:

[0042] 1. Acquisition of text data:

[0043] This step is to extract the original data used for entity words. The data is mainly the text data of power public opinion, and the entity words contained in the text data are extracted. The specific steps are as follows:

[0044] Step 1: Data acquisition: Based on the provided power public opinion text data, data is screened and duplicate removal is performed;

[0045] Step 2: Manual labeling: Manually label the training set of the power public opinion text data and mark the entity words contained in the text. For example: the research report on the smart grid development plan of the Southern Power Grid. The entity words contained in it are "smart grid" and "grid development plan".

[0046] 2. Text data preprocessing:

[0047] This step mainly preprocesses the power public opinion text data and converts the entity words contained in the manually marked text into a position index annotation sequence, and finally converts the data format into the input format required by the entity model. The specific steps are as follows:

[0048] Step 1: Data cleaning: Remove spaces and special characters in the text data, such as web page tag characters, emoticons, etc., and split each text data into single words.

[0049] Step 2: Process data format: Convert the cleaned data into the format of model input, and annotate the text data into a position index annotation sequence. The position index annotation method is to annotate the length of each entity in the text to the position of the entity's starting index, and get the required entity from the starting position to the right of the entity length characters. The index position of the entity's start is a non-zero number. The size of this number represents the length of characters passed from the index position to the right, starting from the index subscript to the end of the length, to get the final entity result. Not all index positions at the beginning of the entity are marked with 0. Specific data position index annotation examples are as follows: Figure 3 shown.

[0050] 3. Feature extraction of text data:

[0051] This step is mainly to more accurately extract the features in the user's questions, and extract the semantic features of each text through the corresponding five-stroke sequence, radicals and semantic features contained in the characters themselves. Split the electric power public opinion text into single-character formats, obtain the five-stroke sequence and radical features of each character in the text, and extract features through the BiLSTM model to obtain more complete contextual semantic features. It is integrated with the BERT features obtained by the BERT pre-training model to enhance the semantic representation in the feature vector, and can better and more accurately extract the entities contained in the text. In the last layer, each text data is annotated by using the CRF layer. The specific department semantic information extraction model is as follows: Figure 4 The specific steps are as follows:

[0052] Step 1: Split the text data into individual words, and use the BERT pre-trained model to extract features from the power public opinion text to obtain its corresponding BERT feature vector;

[0053] Step 2: Obtain the five-stroke sequence and radical corresponding to each character in the electric power public opinion text data, and encode the corresponding five-stroke sequence and radical by using One-Hot encoding to obtain the encoded five-stroke sequence feature vector and radical feature vector;

[0054] Step 3: Fuse the Wubi sequence + radical feature vector with the BERT feature vector, and pass the fused feature vector through a linear layer to obtain the label probability of the position index annotation sequence corresponding to each character in the sequence;

[0055] Step 4: Input the final obtained label probability into the CRF layer to obtain the label sequence of the final labeled position index label sequence.

[0056] 4. Extraction of entity words

[0057] According to the prediction results of the model, the labeled position index labeling sequence corresponding to the text can be obtained, and the entity words extracted from each text can be obtained through the labeling rules.

[0058] Furthermore, the present invention also proposes a method and system for named entity recognition in the field of electric power public opinion based on deep learning, comprising:

[0059] Data acquisition module: sorting out the text data of power public opinion and marking entity words in the text data;

[0060] Data preprocessing module: performs data preprocessing on the sorted data and marks them as position index annotation sequences;

[0061] Feature extraction module: extract features from preprocessed text data;

[0062] Identification module: extract entity words from new power public opinion text data based on data annotation results.

[0063] Furthermore, the present invention also proposes a terminal, comprising a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the named entity recognition method in the field of electric power public opinion based on deep learning according to the present invention.

[0064] Furthermore, the present invention also proposes a computer-readable storage medium on which a computer program is stored, characterized in that when the program is executed by a processor, the steps of the method for named entity recognition in the field of electric power public opinion based on deep learning described in the present invention are implemented.

[0065] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.

Claims

1. A method for named entity recognition in the field of power public opinion based on deep learning, characterized in that: The following steps are involved: S1: sorting out the text data of power public opinion and marking the entity words in the text data; including: obtaining the data of power public opinion text; marking the entity words contained in each text by manual marking; S2: Preprocess the sorted data and mark them as position index mark sequences; including: S21: Data cleaning: remove spaces and special characters in the text data, and split each text data into individual words; S22: Processing data format: converting the cleaned data into the format of model input, and marking the text data into a position index marking sequence; the position index marking method is to mark the length of each entity in the text to the position of the entity start index, from the start position to the right through the entity length characters to get the required entity; S3: Extract features from the preprocessed text data; including: S31: Split the text data into individual words, and use the BERT pre-trained model to extract features from the power public opinion text to obtain its corresponding BERT feature vector; S32: Obtain the five-stroke sequence and radical corresponding to each character in the electric power public opinion text data, and use the BiLSTM model to encode the corresponding five-stroke sequence and radical using One-Hot encoding to obtain the encoded five-stroke sequence feature vector and radical feature vector; S33: Fuse the Wubi sequence + radical feature vector with the BERT feature vector, and pass the fused feature vector through a linear layer to obtain the label probability of the position index annotation sequence corresponding to each character in the sequence; S34: input the finally obtained label probability into the CRF layer to obtain the label sequence of the final labeled position index label sequence; S4: Extract entity words from new power public opinion text data based on data annotation results.

2. According to the method for named entity recognition in the field of electric power public opinion based on deep learning in claim 1, wherein the step S4 comprises: The label sequence annotated by the position index obtained by the named entity recognition model; starting from the non-zero position in the label sequence and ending with the length indicating the size of the number, it represents the entirety of an entity word from the beginning to the end, and the entity words contained in the electric power public opinion text are extracted according to the positions of these non-zero labels.

3. A named entity recognition system in the field of power public opinion based on deep learning, characterized in that: include: Data acquisition module: sorting out the text data of power public opinion and marking the entity words in the text data, including: obtaining the data of power public opinion text and marking the entity words contained in each text by manual marking; Data preprocessing module: perform data preprocessing on the sorted data and mark them as position index mark sequences; including: removing spaces and special characters in the text data, splitting each text data into individual words, converting the cleaned data into the format of model input, and marking the text data into position index mark sequences; the position index marking method is to mark the length of each entity in the text to the position of the entity start index, and end from the start position to the right through the entity length characters to obtain the required entity; Feature extraction module: extracts features from preprocessed text data; including: S31: Split the text data into individual words, and use the BERT pre-trained model to extract features from the power public opinion text to obtain its corresponding BERT feature vector; S32: Obtain the five-stroke sequence and radical corresponding to each character in the electric power public opinion text data, and use the BiLSTM model to encode the corresponding five-stroke sequence and radical using One-Hot encoding to obtain the encoded five-stroke sequence feature vector and radical feature vector; S33: Fuse the Wubi sequence + radical feature vector with the BERT feature vector, and pass the fused feature vector through a linear layer to obtain the label probability of the position index annotation sequence corresponding to each character in the sequence; S34: input the finally obtained label probability into the CRF layer to obtain the label sequence of the final labeled position index label sequence; Identification module: extract entity words from new power public opinion text data based on data annotation results.

4. According to claim 3, a named entity recognition system based on deep learning in the field of electric power public opinion, wherein the recognition module obtains a label sequence annotated with a position index through a named entity recognition model; starting from a non-zero position in the label sequence and ending with a length indicating a numerical size, it represents the entirety of an entity word from the beginning to the end, and extracts the entity words contained in the electric power public opinion text according to the positions of these non-zero labels.

5. A terminal, characterized in that: It comprises a processor and a storage medium; the storage medium is used to store instructions; the processor is used to operate according to the instructions to execute the steps of the method according to any one of claims 1-2.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.