CN112560487A - Entity relationship extraction method and system based on domestic equipment - Google Patents
Entity relationship extraction method and system based on domestic equipment Download PDFInfo
- Publication number
- CN112560487A CN112560487A CN202011409097.3A CN202011409097A CN112560487A CN 112560487 A CN112560487 A CN 112560487A CN 202011409097 A CN202011409097 A CN 202011409097A CN 112560487 A CN112560487 A CN 112560487A
- Authority
- CN
- China
- Prior art keywords
- entity relationship
- news data
- data
- training
- neural network
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
- G06F40/295—Named entity recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- General Engineering & Computer Science (AREA)
- Biomedical Technology (AREA)
- Evolutionary Computation (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Biophysics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Machine Translation (AREA)
Abstract
The invention relates to a method and a system for extracting entity relationships based on domestic equipment. The method comprises the following steps: acquiring news data, wherein the news data comprises character information, national information and weapon equipment information; defining and labeling news data; training a word2vec word vector according to the labeled news data; training the expansion gate convolution neural network by taking the word vector as input and the entity relationship as output to obtain the trained expansion gate convolution neural network; configuring a domestic equipment environment and a paddlee deep learning framework, and performing entity relation extraction on unmarked news data by using the trained inflation gate convolution neural network. The method and the device can improve the speed and accuracy of entity relationship extraction.
Description
Technical Field
The invention relates to the field of text information extraction, in particular to an entity relationship extraction method and system based on domestic equipment.
Background
With the rapid development of big data, mass information is often presented to users in a semi-structured or unstructured form, and how to provide high-quality, accurate and valuable information to users through a text deep analysis model becomes a hot problem for research of scholars. Under the background, research on information extraction is rapidly developed, and entity relationship extraction gradually draws attention of broad scholars as one of important subtasks of the information extraction.
The classical entity relationship method has the problem of error propagation in feature extraction, and the extraction effect is greatly influenced. With the rise of deep learning in recent years, people gradually apply the deep learning to an entity relationship extraction task. The supervised entity relationship extraction method based on deep learning is a research hotspot of relationship extraction in recent years, can avoid steps of artificial feature selection and the like in a classical method, and reduces and improves the problem of error accumulation in the feature extraction process. The model training mainly uses graphics card equipment such as GPU to train and predict, and the effect is more obvious. At present, domestic equipment does not have mature display card equipment, only a domestic CPU (Central processing Unit) can be used for prediction, and the requirement on speed in the using process is considered, so that deep learning models with particularly good effects in the field such as Bert and the like do not meet the requirement.
Disclosure of Invention
The invention aims to provide an entity relationship extraction method and system based on domestic equipment, which can improve the speed and accuracy of entity relationship extraction.
In order to achieve the purpose, the invention provides the following scheme:
an entity relationship extraction method based on domestic equipment comprises the following steps:
acquiring news data, wherein the news data comprises character information, national information and weapon equipment information;
defining and labeling the news data;
training a word2vec word vector according to the labeled news data;
training the expansion gate convolution neural network by taking the word vector as input and taking the entity relationship as output to obtain the trained expansion gate convolution neural network;
configuring a domestic equipment environment and a paddlee deep learning framework, and performing entity relation extraction on unmarked news data by using the trained inflation gate convolution neural network.
Optionally, the defining and labeling of the news data specifically includes:
and carrying out entity relationship definition on the news data, carrying out data annotation on the news data by using an annotation tool, and storing the annotated data into structured data in a json format, wherein each text in the structured data comprises a plurality of entity relationship triples.
Optionally, the training of the word2vec word vector according to the labeled news data specifically includes:
and training the word2vec word vector by adopting a CBOW model according to the marked news data.
Optionally, the expansion gate convolutional neural network comprises a self-coding layer, a first expansion gate convolutional neural network layer, a first self-attention mechanism layer, a first convolutional network-full connection network layer, a bidirectional long-short term memory layer, a second self-attention mechanism layer and a second convolutional network-full connection network layer.
An entity relationship extraction system based on domestic equipment comprises:
the news data acquisition module is used for acquiring news data, and the news data comprises character information, national information and weapon equipment information;
the definition marking module is used for defining and marking the news data;
the word vector training module is used for training word2vec word vectors according to the labeled news data;
the training module is used for training the expansion gate convolution neural network by taking the word vector as input and taking the entity relationship as output to obtain the trained expansion gate convolution neural network;
and the entity relationship extraction module is used for configuring the domestic equipment environment and the frame of the paddlee deep learning, and performing entity relationship extraction on the unmarked news data by using the trained expansion gate convolution neural network.
Optionally, the defining and labeling module specifically includes:
and the definition marking unit is used for carrying out entity relationship definition on the news data, carrying out data marking on the news data by using a marking tool, and storing the marked data into structured data in a json format, wherein each text in the structured data comprises a plurality of entity relationship triples.
Optionally, the word vector training module specifically includes:
and the word vector training unit is used for training word2vec word vectors by adopting a CBOW model according to the marked news data.
Optionally, the expansion gate convolutional neural network comprises a self-coding layer, a first expansion gate convolutional neural network layer, a first self-attention mechanism layer, a first convolutional network-full connection network layer, a bidirectional long-short term memory layer, a second self-attention mechanism layer and a second convolutional network-full connection network layer.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects:
the invention provides an entity relation extraction method based on domestic equipment, which comprises the steps of obtaining and marking training data; word2vec word vectors are trained using data, rather than being generated in real time using the Bert model; training an entity relation extraction model based on a paddley framework by using GPU equipment, and performing combined extraction by using an expansion gate convolution neural network with a specific structure; and configuring a domestic equipment environment, configuring a paddley deep learning framework, and performing entity relationship extraction by using a model after CPU operation training, thereby realizing the speed and accuracy of entity relationship extraction.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a flow chart of the method for extracting entity relationship based on domestic equipment according to the present invention;
FIG. 2 is a schematic diagram of the overall structure of an expansion gate convolutional neural network;
FIG. 3 is a schematic diagram illustrating the process of configuring and compiling a paddleversion by a domestic device;
FIG. 4 is a schematic block diagram of a computer system suitable for use in implementing the domestic apparatus of the present invention;
fig. 5 is a structural diagram of an entity relationship extraction system based on domestic devices according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The invention aims to provide an entity relationship extraction method and system based on domestic equipment, which can effectively utilize data to acquire semantic information of words and phrases with training word vectors, adopt an expansion gate convolution network with a specific structure to perform entity relationship joint extraction, have better effect than a common convolution model, simultaneously can meet the requirement of operation speed in a domestic platform, and can improve the speed and accuracy of entity relationship extraction.
FIG. 1 is a flow chart of the method for extracting entity relationship based on domestic equipment. As shown in fig. 1, an entity relationship extraction method based on domestic devices includes:
step 101: news data is acquired, and the news data comprises character information, country information and weapon equipment information.
An important research field of intelligence is data processing, analysis and deep mining, knowledge and rules are found from complex data, and value-added information products are formed to support scientific decisions of different levels. The method for extracting the entity relationship mainly extracts information elements aiming at news, such as the news related to military affairs and party affairs, thereby obtaining news data of Xinlang, China web and the like.
For military related news, information including many weaponry and the like is included, and for political related news, information including various organizations and political figures is included. Data tagging requires building ontological information, and thus defines multiple entities including military equipment, organizations, and people, as well as corresponding relationships, such as (people, duties, organizations), and this triple constitutes a relationship of duties.
Step 102: defining and labeling the news data, specifically comprising:
and carrying out entity relationship definition on the news data, carrying out data annotation on the news data by using an annotation tool, and storing the annotated data into structured data in a json format, wherein each text in the structured data comprises a plurality of entity relationship triples.
Step 103: training a word2vec word vector according to the labeled news data specifically comprises:
and training the word2vec word vector by adopting a CBOW model according to the marked news data.
The text input deep learning model needs to be converted into a digital vector, and a randomly initialized vector is generally used, but the method cannot utilize semantic information of the text, and the effect of the deep learning model is not improved. In recent years, the Bert model has appeared, and most tasks related to natural language processing use the Bert model as an upstream input, convert text into vectors with semantic information, and use the vectors for downstream tasks. However, the present invention is directed to a domestic device, and an important aspect to be considered in the use of the domestic device is the requirement for the running speed, and if the Bert model is run on a domestic CPU, a huge delay is caused, so that the use of the Bert model is not considered.
Word2vec from Google is a relatively classical word embedding model, and word2vec is a fully connected neural network with only one hidden layer, is used for predicting words with high relevance of given words, and is a language model. Two variants thereof are now more commonly used, respectively: continuous bag of words model (CBOW) and Skip-Gram model. From an algorithmic perspective, the two approaches are very similar, with the difference that CBOW predicts the target vocabulary from the source vocabulary context vocabulary, whereas the Skip-Gram model does the opposite, which predicts the source vocabulary from the target vocabulary.
Compared with a Skip-Gram model, the CBOW model has a more obvious effect in small data, so that the word vector is pre-trained by adopting the CBOW model, the word vector is respectively trained for characters and words, a word segmentation tool uses jieba to segment words, and finally the pre-trained word vector is stored locally.
Step 104: and training the expansion gate convolution neural network by taking the word vector as input and the entity relationship as output to obtain the trained expansion gate convolution neural network.
The expansion gate convolutional neural network comprises a self-coding layer, a first expansion gate convolutional neural network layer, a first self-attention mechanism layer, a first convolutional network-full-connection network layer, a bidirectional long-short term memory layer, a second self-attention mechanism layer and a second convolutional network-full-connection network layer.
The invention adopts an extraction scheme based on the idea of probability map, and then completes the model by using the CNN + Attention architecture from the aspect of efficiency.
For the information extraction task, the extraction process of the triples can be converted into a formula of hierarchical recursion for extraction, and for the triples (s, o, p), the extraction process can be modeled as:
p(s,p,o)=P(s)P(o|s)P(p|s,o)
that is, s is predicted first, and then o and p corresponding to s are predicted according to s. Since the processes of extracting s and extracting o and p corresponding to s are non-unique, the invention adopts the extraction method of the pointer network commonly used in MRC, that is, only the start and end positions of the answer are extracted, and the task of predicting the start and end positions is converted into the task of predicting whether each position is the start position or the end position (softmax is converted into sigmoid). The overall structure of the model is shown in fig. 2.
The model is mainly based on CNN and Self-orientation, so the model has very high speed and is suitable for the application scene of domestic equipment, and simultaneously, the model is different from the common 12-layer DGCNN. Specifically, the processing flow of the expansion gate convolutional neural network is as follows:
(1) through the self-encoding layer, word hybrid encoding and Position information encoding (Position encoding) are obtained.
(2) And inputting the obtained character expression into a 5-layer DGCNN (first expansion gate convolutional neural network layer) for coding to obtain a coded sequence H.
(3) And (3) transmitting H into a self-attention layer (a first self-attention mechanism layer), transmitting the result into a CNN + Dense network layer (a first convolution network-full connection network layer), and predicting the head and tail positions of the main body by using a 'half pointer-half label' structure.
(4) During training, a labeled main body is randomly sampled (all the main bodies are traversed one by one during prediction), then a subsequence of the main body corresponding to H is transmitted into a BilSTM layer (bidirectional long and short term memory layer) to obtain a coding vector of the main body, and then Position Embedding of a relative Position is added to obtain a vector sequence with the same length as an input sequence.
(5) And transmitting H into another self-attention mechanism layer, transmitting the spliced result into a CNN + Dense layer (a second convolution network-full connection network layer), and constructing a half pointer-half label structure for each type of p to predict the head and tail positions of the corresponding o.
Step 105: configuring a domestic equipment environment and a paddlee deep learning framework, and performing entity relation extraction on unmarked news data by using the trained inflation gate convolution neural network.
Considering that entity relationship extraction in domestic devices only involves prediction tasks, step 104 is trained in the GPU machine and the trained optimal model is saved. The deep learning framework used by the invention is pagedl, so that the setup and compilation of the pagedl version are required to be carried out on domestic equipment. The flow is shown in fig. 3.
FIG. 4 is a block diagram of a computer system suitable for use in implementing the home device of the present invention. The computer system includes a domestic Central Processing Unit (CPU), which can perform various appropriate actions and processes in accordance with a program stored in a Read-Only Memory (ROM) or a program loaded from a storage section into a Random Access Memory (RAM). In the RAM, various programs and data necessary for system operation are stored. The CPU, ROM, and RAM are connected to each other via a bus. An Input/Output (I/O) interface is also connected to the bus.
The entity relationship extraction prediction model can be realized in the form of a software functional unit and used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or make a contribution to the prior art, or may be implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present invention.
The invention performs entity relation extraction in domestic equipment by pre-training word vectors for training data and using an expansion gate convolution network with a specific structure, and can extract elements in news, including information of characters, countries, weaponry and the like. Semantic relation analysis can be carried out on information in sample data with smaller granularity through entity relation extraction, and unstructured texts can be converted into relation data with uniform format through relation extraction on massive information, so that support is provided for tasks such as knowledge maps, recommendation systems and information retrieval.
Fig. 5 is a structural diagram of an entity relationship extraction system based on domestic devices according to the present invention. As shown in fig. 5, an entity relationship extraction system based on domestic devices includes:
the news data acquisition module 201 is configured to acquire news data, where the news data includes character information, country information, and weaponry information.
And a definition labeling module 202, configured to define and label the news data.
And the word vector training module 203 is used for training word2vec word vectors according to the labeled news data.
And the training module 204 is configured to train the expansion gate convolutional neural network by using the word vector as an input and the entity relationship as an output, so as to obtain the trained expansion gate convolutional neural network.
And the entity relationship extraction module 205 is configured to configure a domestic equipment environment and a frame of paddlee deep learning, and perform entity relationship extraction on the unmarked news data by using the trained inflation gate convolutional neural network.
The definition labeling module 202 specifically includes:
and the definition marking unit is used for carrying out entity relationship definition on the news data, carrying out data marking on the news data by using a marking tool, and storing the marked data into structured data in a json format, wherein each text in the structured data comprises a plurality of entity relationship triples.
The word vector training module 203 specifically includes:
and the word vector training unit is used for training word2vec word vectors by adopting a CBOW model according to the marked news data.
The expansion gate convolutional neural network comprises a self-coding layer, a first expansion gate convolutional neural network layer, a first self-attention mechanism layer, a first convolutional network-full-connection network layer, a bidirectional long-short term memory layer, a second self-attention mechanism layer and a second convolutional network-full-connection network layer.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.
Claims (8)
1. An entity relationship extraction method based on domestic equipment is characterized by comprising the following steps:
acquiring news data, wherein the news data comprises character information, national information and weapon equipment information;
defining and labeling the news data;
training a word2vec word vector according to the labeled news data;
training the expansion gate convolution neural network by taking the word vector as input and taking the entity relationship as output to obtain the trained expansion gate convolution neural network;
configuring a domestic equipment environment and a paddlee deep learning framework, and performing entity relation extraction on unmarked news data by using the trained inflation gate convolution neural network.
2. The entity relationship extraction method based on domestic equipment according to claim 1, wherein the defining and labeling of the news data specifically comprises:
and carrying out entity relationship definition on the news data, carrying out data annotation on the news data by using an annotation tool, and storing the annotated data into structured data in a json format, wherein each text in the structured data comprises a plurality of entity relationship triples.
3. The method for extracting entity relationship based on domestic equipment according to claim 1, wherein training word2vec word vectors according to labeled news data specifically comprises:
and training the word2vec word vector by adopting a CBOW model according to the marked news data.
4. The domestic apparatus based entity relationship extraction method of claim 1, wherein said inflation gate convolutional neural network comprises a self-coding layer, a first inflation gate convolutional neural network layer, a first self-attention mechanism layer, a first convolutional network-fully-connected network layer, a bidirectional long-short term memory layer, a second self-attention mechanism layer and a second convolutional network-fully-connected network layer.
5. An entity relationship extraction system based on domestic equipment is characterized by comprising:
the news data acquisition module is used for acquiring news data, and the news data comprises character information, national information and weapon equipment information;
the definition marking module is used for defining and marking the news data;
the word vector training module is used for training word2vec word vectors according to the labeled news data;
the training module is used for training the expansion gate convolution neural network by taking the word vector as input and taking the entity relationship as output to obtain the trained expansion gate convolution neural network;
and the entity relationship extraction module is used for configuring the domestic equipment environment and the frame of the paddlee deep learning, and performing entity relationship extraction on the unmarked news data by using the trained expansion gate convolution neural network.
6. The system for extracting entity relationship based on domestic equipment according to claim 5, wherein said definition labeling module specifically comprises:
and the definition marking unit is used for carrying out entity relationship definition on the news data, carrying out data marking on the news data by using a marking tool, and storing the marked data into structured data in a json format, wherein each text in the structured data comprises a plurality of entity relationship triples.
7. The system for extracting entity relationship based on domestic equipment according to claim 5, wherein the word vector training module specifically comprises:
and the word vector training unit is used for training word2vec word vectors by adopting a CBOW model according to the marked news data.
8. The domestic apparatus based entity relationship extraction system of claim 5, wherein said inflation gate convolutional neural network comprises a self-coding layer, a first inflation gate convolutional neural network layer, a first self-attention mechanism layer, a first convolutional network-fully-connected network layer, a bidirectional long-short term memory layer, a second self-attention mechanism layer and a second convolutional network-fully-connected network layer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011409097.3A CN112560487A (en) | 2020-12-04 | 2020-12-04 | Entity relationship extraction method and system based on domestic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011409097.3A CN112560487A (en) | 2020-12-04 | 2020-12-04 | Entity relationship extraction method and system based on domestic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112560487A true CN112560487A (en) | 2021-03-26 |
Family
ID=75048258
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011409097.3A Pending CN112560487A (en) | 2020-12-04 | 2020-12-04 | Entity relationship extraction method and system based on domestic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112560487A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113128229A (en) * | 2021-04-14 | 2021-07-16 | 河海大学 | Chinese entity relation joint extraction method |
-
2020
- 2020-12-04 CN CN202011409097.3A patent/CN112560487A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113128229A (en) * | 2021-04-14 | 2021-07-16 | 河海大学 | Chinese entity relation joint extraction method |
CN113128229B (en) * | 2021-04-14 | 2023-07-18 | 河海大学 | Chinese entity relation joint extraction method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11501182B2 (en) | Method and apparatus for generating model | |
CN109359297B (en) | Relationship extraction method and system | |
WO2023160472A1 (en) | Model training method and related device | |
CN116415654A (en) | Data processing method and related equipment | |
US11036996B2 (en) | Method and apparatus for determining (raw) video materials for news | |
CN113987147A (en) | Sample processing method and device | |
CN111881292B (en) | Text classification method and device | |
CN114722826B (en) | Model training method and device, electronic equipment and storage medium | |
WO2023159767A1 (en) | Target word detection method and apparatus, electronic device and storage medium | |
CN113657105A (en) | Medical entity extraction method, device, equipment and medium based on vocabulary enhancement | |
CN113723105A (en) | Training method, device and equipment of semantic feature extraction model and storage medium | |
CN114358201A (en) | Text-based emotion classification method and device, computer equipment and storage medium | |
CN116661805B (en) | Code representation generation method and device, storage medium and electronic equipment | |
CN111145914B (en) | Method and device for determining text entity of lung cancer clinical disease seed bank | |
CN116541492A (en) | Data processing method and related equipment | |
CN116258137A (en) | Text error correction method, device, equipment and storage medium | |
CN114445832A (en) | Character image recognition method and device based on global semantics and computer equipment | |
CN112560487A (en) | Entity relationship extraction method and system based on domestic equipment | |
CN117373591A (en) | Disease identification method and device for electronic medical record, electronic equipment and storage medium | |
CN114611529B (en) | Intention recognition method and device, electronic equipment and storage medium | |
CN115240713B (en) | Voice emotion recognition method and device based on multi-modal characteristics and contrast learning | |
CN114722774B (en) | Data compression method, device, electronic equipment and storage medium | |
CN114911940A (en) | Text emotion recognition method and device, electronic equipment and storage medium | |
CN113591493B (en) | Translation model training method and translation model device | |
CN114998041A (en) | Method and device for training claim settlement prediction model, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |