Training method of entity extraction model, entity relation extraction method and device

By training an entity extraction model by fusing entity features and part-of-speech features from the training sample set, and combining it with a relation extraction model, the problem of insufficient accuracy in entity and relation extraction in existing technologies is solved, achieving higher accuracy in both entity and relation extraction.

CN115545030BActive Publication Date: 2026-01-23BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211247349.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2026-01-23
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

In existing technologies, entity relation extraction methods rely on the semantic and entity information of the input text, resulting in poor extraction accuracy.

Method used

By acquiring entity features and part-of-speech features from the training sample set, adjusting the model parameters of the initial entity extraction model, fusing character features, entity features, and part-of-speech features for training, generating the trained entity extraction model, and combining it with the relation extraction model to extract the target entity relations.

Benefits of technology

It improves the accuracy of entity extraction and entity relationship extraction, enhances the model's transferability and feature representation diversity, and reduces training error accumulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115545030B_ABST
    Figure CN115545030B_ABST
Patent Text Reader

Abstract

The application provides a training method of an entity extraction model, an entity relation extraction method and device, wherein the training method of the entity extraction model comprises the following steps: determining entity features and part-of-speech features of a training sample set; inputting the training sample set into an initial extraction model; after obtaining character features of the training sample set through a feature extraction layer, fusing different bottom features of the training sample set, such as the character features, the entity features and the part-of-speech features, to jointly train the initial extraction model, thereby enriching the dependent information of the initial extraction model when learning sample texts in the training sample set, reducing error accumulation of the training sample set, enhancing the migration ability of the trained entity extraction model, and fusing different bottom features to expand the difference of feature representation and improve the extraction ability of the trained entity extraction model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, in particular to a training method of an entity extraction model, an entity relation extraction method, a training device of an entity extraction model, an entity relation extraction device, a computing device, and a computer storage medium. BACKGROUND

[0002] Named entity recognition (NER) refers to extracting entities with specific meanings or strong referentiality from input text, and is a very important task in natural language processing, which has a wide range of applications in text information understanding, knowledge question answering, retrieval, graph construction and other scenarios. At present, when performing named entity recognition, in addition to extracting entities with specific meanings or strong referentiality from input text and the entity type of the entity, the entity relationship between entities may also need to be extracted.

[0003] In the prior art, the semantic information of the input text is often obtained through the encoding layer of the pre-trained language model, and the semantic information is directly used as the word embedding feature to input a linear network to obtain the entity information in the input text, and then the semantic information and the entity information are jointly used to judge the relationship between entities based on the semantic information and the entity information.

[0004] However, in the above entity relation extraction method, only the semantic information and the entity information of the input text are used to jointly judge the relationship between entities, and the underlying information relied on in the extraction of entity relationships is less, resulting in poor accuracy of entity relation extraction. Therefore, how to provide a more accurate entity relation extraction method has become a problem to be solved by technical personnel. SUMMARY

[0005] Therefore, the embodiments of the present application provide a training method of an entity extraction model, an entity relation extraction method and device, a computing device, and a computer readable storage medium to solve the technical defects in the prior art.

[0006] According to a first aspect of the embodiments of the present application, a training method of an entity extraction model is provided, comprising:

[0007] obtaining a training sample set and determining entity features and part-of-speech features of the training sample set, wherein the training sample set comprises at least one sample text;

[0008] inputting the training sample set into a feature extraction layer in an initial entity extraction model to obtain character features corresponding to each sample text in the training sample set;

[0009] According to the character feature, the entity feature and the part-of-speech feature, the model parameters of the initial entity extraction model are adjusted, and the operation step of obtaining the training sample set is returned until a training stop condition is reached, and a trained entity extraction model is obtained.

[0010] According to a second aspect of the embodiment of the present application, an entity relation extraction method is provided, comprising:

[0011] The text to be extracted is input into the entity extraction model to obtain each target entity included in the text to be extracted and corresponding entity annotation information, wherein the entity extraction model is obtained by training the entity extraction model training method of the first aspect.

[0012] Each target entity and corresponding entity annotation information are input into the relation extraction model to obtain the target entity relation between each target entity.

[0013] According to a third aspect of the embodiment of the present application, a training device of an entity extraction model is provided, comprising:

[0014] The obtaining module is configured to obtain a training sample set and determine entity features and part-of-speech features of the training sample set, wherein the training sample set comprises at least one sample text.

[0015] The first obtaining module is configured to input the training sample set into a feature extraction layer in the initial entity extraction model to obtain character features corresponding to each sample text in the training sample set.

[0016] The first training module is configured to adjust model parameters of the initial entity extraction model according to the character features, the entity features and the part-of-speech features, and return to execute the operation step of obtaining the training sample set until a training stop condition is reached, and obtain a trained entity extraction model.

[0017] According to a fourth aspect of the embodiment of the present application, an entity relation extraction device is provided, comprising:

[0018] The second obtaining module is configured to input the text to be extracted into the entity extraction model to obtain each target entity included in the text to be extracted and corresponding entity annotation information, wherein the entity extraction model is obtained by training the entity extraction model training method of the first aspect.

[0019] The third obtaining module is configured to input each target entity and corresponding entity annotation information into the relation extraction model to obtain the target entity relation between each target entity.

[0020] According to a fifth aspect of the embodiments of the present application, a computing device is provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, and the processor implements the steps of the entity extraction model training method or the entity relation extraction method when executing the instructions.

[0021] According to a sixth aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores computer instructions, and the instructions are executed by a processor to implement the steps of the entity extraction model training method or the entity relation extraction method.

[0022] According to a seventh aspect of the embodiments of the present application, a chip is provided, which stores computer instructions, and the instructions are executed by the chip to implement the steps of the entity extraction model training method or the entity relation extraction method.

[0023] In the embodiments of the present application, the entity extraction model training method is provided. When training the entity extraction model, the entity features and the part-of-speech features of the training sample set can be determined, the training sample set is input into the initial extraction model, and after the character features of the training sample set are obtained through the feature extraction layer, the different bottom features such as the character features, the entity features and the part-of-speech features of the training sample set are fused to train the initial extraction model together, which enriches the dependent information of the initial extraction model when learning the sample text in the training sample set, reduces the error accumulation of the training sample set, enhances the migration ability of the trained entity extraction model, and fuses different bottom features to expand the difference of feature representation, improve the extraction ability of the trained entity extraction model, so that the trained entity extraction model can more accurately determine each target entity included in the input text and the corresponding entity annotation information, and improve the accuracy of the model in extracting entities.

[0024] In the embodiments of the present application, the entity relation extraction method is provided. The entity extraction model is obtained by training the above entity extraction model, so that the entity extraction model can accurately determine each target entity included in the text to be extracted and the corresponding entity annotation information, and then each target entity and the corresponding entity annotation information can be input into the relation extraction model, the target entity and the corresponding entity annotation information are analyzed by the relation extraction model, and the target entity relation between each target entity is determined. In this way, the target entity relation extraction of the text to be extracted is divided into two stages, the entity annotation information corresponding to each target entity is recognized first, and then the entity relation between each target entity is extracted. When the relation between each target entity is extracted, the different feature information such as the entity information and the entity annotation information of the target entity is fused, and the accuracy of the entity relation extraction result is improved. BRIEF DESCRIPTION OF DRAWINGS

[0025] Figure 1 is a processing flowchart of an entity relation extraction process provided by an embodiment of the present application;

[0026] Figure 2 is a flowchart of a training method of an entity extraction model provided by an embodiment of the present application;

[0027] Figure 3 is a flowchart of a determination process of entity features and part-of-speech features provided by an embodiment of the present application;

[0028] Figure 4 is a flowchart of a determination process of entity features provided by an embodiment of the present application;

[0029] Figure 5 is a flowchart of a determination process of part-of-speech features provided by an embodiment of the present application;

[0030] Figure 6 is a flowchart of an obtaining process of character features provided by an embodiment of the present application;

[0031] Figure 7 is a flowchart of a model parameter adjustment method of an initial entity extraction model provided by an embodiment of the present application;

[0032] Figure 8 is a flowchart of an obtaining method of fusion features provided by an embodiment of the present application;

[0033] Figure 9 is a flowchart of a determination method of a predicted entity type provided by an embodiment of the present application;

[0034] Figure 10 is a flowchart of an entity relation extraction method provided by an embodiment of the present application;

[0035] Figure 11 is a flowchart of a determination method of entity annotation information provided by an embodiment of the present application;

[0036] Figure 12 is a flowchart of a determination method of a target entity relation provided by an embodiment of the present application;

[0037] Figure 13 is a flowchart of a determination method of a fusion semantic vector provided by an embodiment of the present application;

[0038] Figure 14 is a flowchart of another determination method of a fusion semantic vector provided by an embodiment of the present application;

[0039] Figure 15 is a flowchart of a training method of a relation extraction model provided by an embodiment of the present application;

[0040] Figure 16 is a flowchart of a determination method of predicting an entity relationship provided by an embodiment of the present application;

[0041] Figure 17 is a flowchart of another entity relationship extraction method provided by an embodiment of the present application;

[0042] Figure 18 is a structural schematic diagram of a training device of an entity extraction model provided by an embodiment of the present application;

[0043] Figure 19 is a structural schematic diagram of an entity relationship extraction device provided by an embodiment of the present application;

[0044] Figure 20 is a structural block diagram of a computing device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0045] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be practiced without the specific details, and it is understood that the present application is not limited to the embodiments described herein. In other instances, well-known methods, procedures, components, and circuits have not been described in detail as not to unnecessarily obscure aspects of the present application.

[0046] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present application. As used in one or more embodiments of the present application and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in one or more embodiments of the present application, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0047] It is to be understood that the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. It is to be further understood that the terms "comprise," "comprises," and / or "comprising" when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0048] First, the noun terms related to one or more embodiments of the present application are explained.

[0049] Long Short-Term Memory (LSTM): A type of time recurrent neural network, mainly to solve the problem of gradient disappearance and gradient explosion in long sequence training process. The difference between LSTM and RNN is that it adds a "processor" to judge whether the information is useful in the algorithm. The structure of this processor is called cell. A cell is placed in three doors called input gate, forget gate and output gate. When information enters the LSTM network, it can be judged according to the rules whether it is useful. Only the information that meets the algorithm certification will be left, and the information that does not meet the algorithm certification will be forgotten through the forget gate. Compared with ordinary RNN, LSTM can have better performance in longer sequence.

[0050] Convolutional Neural Network (CNN): A type of feedforward neural network composed of several convolutional layers and pooling layers. Its artificial neurons can respond to a part of the surrounding units within the coverage range, and have excellent performance for large image processing.

[0051] BERT (Bidirectional Encoder Representations from Transformers) model: A language representation model representing bidirectional encoder representations from Transformers. The bidirectional means that it can consider the information before and after the word when processing a word, so as to obtain the semantic context of the word. The network architecture uses a multi-layer Transformer structure, and its biggest feature is to abandon the traditional RNN and CNN, and convert the distance between any two words in a sentence into 1 through the Attention mechanism. BERT predicts the current word through left and right context and predicts the next sentence through the current sentence. BERT aims to pre-train deep bidirectional representations by jointly conditioning on both left and right context in all layers. The pre-trained BERT representation can be fine-tuned with just an additional output layer to create models for many tasks without extensive modification to the task-specific architecture.

[0052] Conditional Random Field (CRF): A discriminative probabilistic model that is a type of random field. It is commonly used for labeling or analyzing sequential data such as natural language text or biological sequences. Conditional Random Field (CRF) combines the characteristics of Maximum Entropy Model and Hidden Markov Model, and is a kind of undirected graph model. In recent years, it has achieved good results in sequence labeling tasks such as word segmentation, part-of-speech tagging and named entity recognition.

[0053] Named Entity Recognition (NER): It is a basic task in Natural Language Processing (NLP) that identifies various types of named entities in a piece of text. The named entities that need to be identified usually include names of people, places, organizations, drugs, and time. NER is an important tool for NLP applications such as question answering systems, information retrieval, and knowledge graphs. The results of NER are used as input data for downstream tasks, and the accuracy of NER determines the final effect of NLP applications to some extent. NER plays a key role in NLP applications.

[0054] Relation Extraction: It is a task that determines the relationship between two entities in free text and obtains structured triple information, i.e., (subject, relation, object), such as (XX region, capital, YY city).

[0055] Entity: It refers to an entity word or phrase in a text that has a specific meaning, such as a person's name, place name, organization name, etc.

[0056] Pipeline Relation Extraction: It is a process that first extracts entities from input sentences and then classifies the relationships between the identified entities. The two sub-processes are connected in series and completely separated.

[0057] Glove Word Vector: Global Vectors for Word Representation, a word representation tool based on count-based and overall statistics. It can represent a word as a vector composed of real numbers, which can capture some semantic properties between words, such as similarity and analogy. In other words, Glove word vector is based on co-occurrence information between words.

[0058] LAC: Lexical Analysis of Chinese, a lexical analysis tool for NLP (Natural Language Processing Department) that can realize Chinese word segmentation, part-of-speech tagging, and proper name recognition.

[0059] In the present application, a training method of an entity extraction model is provided. The present application also relates to an entity relation extraction method, a training device of an entity extraction model, an entity relation extraction device, a computing device, and a computer storage medium, which are described in detail in the following embodiments.

[0060] Figure 1 A processing flowchart of an entity relation extraction process provided by an embodiment of the present application is shown in FIG. 1. Figure 1 As shown in FIG. 1, the server obtains a training sample set provided by an application end, and determines entity features and part-of-speech features of the training sample set. The server inputs the training sample set into a feature extraction layer in an initial entity extraction model, obtains character features corresponding to each sample text in the training sample set, and then fuses the character features corresponding to each sample text with the entity features and the part-of-speech features to obtain a fusion feature representation of each sample text in the training sample set. Subsequently, the server inputs the fusion feature representation into an entity recognition layer in the initial entity extraction model, trains the initial entity extraction model based on predicted entity types output by the entity recognition layer, and generates a trained entity extraction model.

[0061] In addition, the server can also obtain a training sample provided by the application end, input the training sample into a feature extraction layer of an initial relation extraction model, obtain a sample character semantic vector and a sample labeled semantic vector, fuse the sample character semantic vector and the sample labeled semantic vector to obtain a sample fusion semantic vector, and input the sample fusion semantic vector into a classification layer of the initial relation extraction model. The server trains the initial relation extraction model based on predicted entity relations output by the classification layer, and generates a trained relation extraction model.

[0062] The trained entity extraction model and the trained relation extraction model can be sent to the application end to perform entity relation extraction on a text to be extracted.

[0063] The text to be extracted is input into a feature extraction layer of the trained entity extraction model to obtain a text feature representation of the text to be extracted. The text feature representation is input into an entity recognition layer of the trained entity extraction model to obtain each target entity included in the text to be extracted and corresponding entity labeling information. Subsequently, each target entity and the corresponding entity labeling information obtained are input into a feature extraction layer of the trained relation extraction model to obtain a character semantic vector of each character in each target entity and a labeled semantic vector of the entity labeling information corresponding to each character. Then, the fusion semantic vector of each target entity is determined according to the character semantic vector and the labeled semantic vector of each target entity, and the fusion semantic vector of each target entity is input into a classification layer of the trained relation extraction model to obtain a target entity relation between each target entity.

[0064] Figure 2A flowchart of a method for training an entity extraction model is shown, which comprises the following steps.

[0065] In step 202, a training sample set is obtained, and entity features and part-of-speech features of the training sample set are determined, wherein the training sample set comprises at least one sample text.

[0066] Specifically, the training sample set is a large amount of training data obtained in advance, and the training sample set comprises at least one sample text, which is used to train the initial entity extraction model. In actual application, sentences in different languages, different fields and different lengths can be obtained from other devices, servers or local storage as sample texts, and the obtained sample texts are combined to form the training sample set. In addition, the sample texts can be texts or pictures. If the sample texts are pictures, the picture format sample texts can be converted into text format through optical character recognition (OCR) and then processed.

[0067] It should be noted that the entity features of the training sample set refer to the feature representation of sample entities of each sample text in the training sample set, and the part-of-speech features refer to the part-of-speech feature representation of words of each sample text in the training sample set. The determined entity features and part-of-speech features of the training sample set provide rich dependency information for subsequent training of the initial extraction model.

[0068] In an optional embodiment of the present embodiment, a preset entity dictionary can be constructed based on each sample text in the training sample set to obtain corresponding entity features, and part-of-speech features can be determined based on the part-of-speech of each sample text in the training sample set. Figure 3 A flowchart of a process for determining entity features and part-of-speech features is shown, which comprises the following steps. Figure 3

[0069] In step 302, a preset entity dictionary is constructed based on the first sample entity included in each sample text in the training sample set, and entity features corresponding to the preset entity dictionary are determined.

[0070] In step 304, part-of-speech annotation is performed on each sample text in the training sample set, and part-of-speech features of the training sample set are determined based on the part-of-speech annotation.

[0071] ​Specifically, the first sample entity is an entity included in a sample text of the training sample set, and the preset entity dictionary refers to a set of multiple entities determined based on each entity included in each sample text, wherein the entity refers to an entity word or phrase description with specific meaning in the sample text. In addition, the part-of-speech tagging refers to determining the part-of-speech of each word in each sample text. The part-of-speech can indicate the characteristics of the word, and the part-of-speech can be a verb, a noun, an adjective, a pronoun, a preposition, a conjunction, an auxiliary word, or other similar part-of-speech.

[0072] It should be noted that the training sample set includes at least one sample text, which can be a word, a phrase, or a sentence. In a specific implementation, the preset entity dictionary can be constructed according to the first sample entity included in each sample text in the training sample set, and the entity feature corresponding to the preset entity dictionary can be determined. The entity feature is the entity feature of the training sample set.

[0073] In addition, the words or phrases included in each sample text can be tagged with part-of-speech, that is, the part-of-speech of the words or phrases included in each sample text is determined, thereby obtaining the part-of-speech feature of the training sample set.

[0074] In the embodiment of the present application, the entities included in the preset entity dictionary are the entities appearing in each sample text in the training sample set, and the part-of-speech feature is the part-of-speech of each word in each sample text in the training sample set. That is, the entity feature and the part-of-speech feature of the training sample set are the bottom-layer information of different dimensions of the training sample set. In subsequent training of the initial entity extraction model based on the training sample set, the determined entity feature and part-of-speech feature can be fused to provide rich dependency information for subsequent training of the initial extraction model.

[0075] In an optional implementation of the present embodiment, the frequency of each sample entity in each sample text of the training sample set can be counted, and the target sample entity exceeding the frequency threshold can be selected to construct the preset entity dictionary. Then, based on the word vector of each target sample entity in the preset entity dictionary, the entity feature corresponding to the preset entity dictionary is determined. Figure 4 A process flow diagram for determining an entity feature according to an embodiment of the present application is shown in FIG. 1. Figure 4 As shown in FIG. 1, the preset entity dictionary is constructed based on the first sample entity included in each sample text in the training sample set, and the entity feature corresponding to the preset entity dictionary is determined. Specifically, the following steps are included:

[0076] Step 402: Extract the first sample entity included in each sample text in the training sample set, count the frequency of each first sample entity, and select the target sample entity with a frequency greater than the frequency threshold to construct the preset entity dictionary.

[0077] Step 404: For each target sample entity in the preset entity dictionary, a preset word vector table is queried to obtain a word vector corresponding to the target sample entity.

[0078] Step 406: The word vectors corresponding to each target sample entity are fused by a feature fusion network to obtain entity features corresponding to the preset entity dictionary.

[0079] Specifically, the frequency threshold is a value that is set in advance and used to determine whether the number of occurrences of the first sample entity is high, such as 3, 20, 48, …, 100, etc., which is customized based on demand. The target sample entity is a sample entity in each first sample entity whose frequency of occurrence is greater than the frequency threshold. The preset word vector table is a set of word vectors corresponding to a large number of common entities, such as a Glove word vector table. In addition, the feature fusion network is a network model that is pre-trained and can fuse multiple input word vectors, such as a pooling layer in a CNN network.

[0080] In actual application, the first sample entities included in each sample text in the training sample set can be extracted manually or automatically based on existing extraction rules. After extracting the first sample entities included in each sample text in the training sample set and selecting target sample entities with a frequency greater than the frequency threshold to construct a preset entity dictionary, the preset word vector table can be queried to determine the word vectors corresponding to each target sample entity in the preset entity dictionary. Then, the word vectors corresponding to each target sample entity are input into the feature fusion network, which can fuse each input word vector and output entity features corresponding to the preset entity dictionary.

[0081] For example, the training sample set includes three sample texts, sample text 1 is “Zhang San wants to go to XY University”, sample text 2 is “Zhao Wu likes Z area”, and sample text 3 is “Zhang San and Zhao Wu come from Z area and are classmates of XY University”. The sample entities included in sample text 1 are Zhang San and XY University, the sample entities included in sample text 2 are Zhao Wu and Z area, and the sample entities included in sample text 3 are Zhang San, Zhao Wu, Z area, and XY University. Assuming that the frequency threshold is 1, a preset entity dictionary can be constructed, which includes Zhang San, Zhao Wu, Z area, and XY University. Then, the word vectors corresponding to Zhang San, Zhao Wu, Z area, and XY University are queried through the Glove word vector table, and the word vectors corresponding to Zhang San, Zhao Wu, Z area, and XY University are input into the pooling layer in the CNN network to obtain entity features corresponding to the entire preset entity dictionary.

[0082] In the embodiments of the present application, the frequency of occurrence of each sample entity in each sample text in the training sample set can be counted, and a target sample entity exceeding a frequency threshold, i.e., a target sample entity with a higher frequency of occurrence, is selected to construct a preset entity dictionary, and then the word vectors of each target sample entity in the preset entity dictionary are fused to determine the entity features corresponding to the preset entity dictionary. In this way, the preset entity dictionary can be constructed based on the high-frequency sample entities in the training sample set, and the entity features corresponding to the training sample set are determined, thereby providing the dependency information of high-frequency sample entities for subsequent training of the initial entity extraction model, and improving the model training effect.

[0083] In an optional embodiment of the present embodiment, the parts of speech of the words in each sample text in the training sample set can be encoded to obtain a part-of-speech vector, and thus obtain the corresponding part-of-speech features. Figure 5 A flowchart of a process for determining part-of-speech features according to an embodiment of the present application is shown in FIG. 5. Figure 5 As shown in FIG. 5, the part-of-speech of each sample text in the training sample set is annotated, and the part-of-speech features of the training sample set are determined according to the part-of-speech annotation, which specifically includes the following steps:

[0084] Step 502: The part-of-speech of each sample text in the training sample set is annotated by a part-of-speech annotation tool to obtain the part-of-speech of each word included in each sample text in the training sample set.

[0085] Step 504: The part-of-speech of each word is encoded based on a preset encoding rule to obtain a part-of-speech vector of each word.

[0086] Step 506: The part-of-speech vector of each word is taken as the part-of-speech feature of the training sample set.

[0087] Specifically, the part-of-speech annotation tool can be a tool capable of determining the part-of-speech of each word in the sample text. For example, the part-of-speech annotation tool can be an LAC part-of-speech annotation tool. LAC is a morphological analysis tool that can realize Chinese word segmentation, part-of-speech annotation, proper name recognition (also known as named entity recognition), etc. Part-of-speech annotation can refer to a process of determining the part-of-speech of a word, which can be a verb, a noun, an adjective, a pronoun, a preposition, a conjunction, an auxiliary word, or other types of parts of speech. The preset encoding rule can refer to a rule for encoding the part-of-speech, such as encoding a verb as 000, a noun as 001, an adjective as 010, a pronoun as 011, a preposition as 100, a conjunction as 101, an auxiliary word as 110, and other types of parts of speech as 111, etc.

[0088] In a possible implementation, the parts-of-speech of each word in the sample text are encoded to obtain a part-of-speech vector of each word, and the part-of-speech vectors of the words are spliced in the order of the words in the sample text to obtain a part-of-speech vector of the sample text. The set of the part-of-speech vectors of the sample texts in the training sample set is the part-of-speech feature of the training sample set.

[0089] In the above example, the sample text 1 is annotated by the LAC part-of-speech tagging tool, and the parts-of-speech of the words included in the sample text 1 are obtained as “Zhang San - noun”, “yearn - verb”, and “XY University - noun”. The words in the sample text 1 are encoded, and the part-of-speech vector of “Zhang San” is 001, the part-of-speech vector of “yearn” is 000, and the part-of-speech vector of “XY University” is 001. The part-of-speech vectors of the words are spliced in the order of the words to obtain the part-of-speech vector of the sample text 1 as “001 000 001”.

[0090] The sample text 2 is annotated by the LAC part-of-speech tagging tool, and the parts-of-speech of the words included in the sample text 2 are obtained as “Zhao Wu - noun”, “like - verb”, and “Z area - noun”. The words in the sample text 2 are encoded, and the part-of-speech vector of “Zhao Wu” is 001, the part-of-speech vector of “like” is 000, and the part-of-speech vector of “Z area” is 001. The part-of-speech vectors of the words are spliced in the order of the words to obtain the part-of-speech vector of the sample text 2 as “001 000 001”.

[0091] The sample text 3 is annotated by the LAC part-of-speech tagging tool, and the parts-of-speech of the words included in the sample text 3 are obtained as “Zhang San - noun”, “and - conjunction”, “Zhao Wu - noun”, “from - preposition”, “Z area - noun”, “is - other”, “XY University - noun”, “of - auxiliary word”, and “classmate - noun”. The words in the sample text 3 are encoded, and the part-of-speech vector of “Zhang San” is 001, the part-of-speech vector of “and” is 101, the part-of-speech vector of “Zhao Wu” is 001, the part-of-speech vector of “from” is 100, the part-of-speech vector of “Z area” is 001, the part-of-speech vector of “is” is 111, the part-of-speech vector of “XY University” is 001, the part-of-speech vector of “of” is 110, and the part-of-speech vector of “classmate” is 001. The part-of-speech vectors of the words are spliced in the order of the words to obtain the part-of-speech vector of the sample text 3 as “001 101 001 100 001 111 001 110 001”.

[0092] The set of the part-of-speech vectors of the sample text 1 "001 000 001", the part-of-speech vector of the sample text 2 "001 000 001", and the part-of-speech vector of the sample text 3 "001 101 001 100 001 111 001 110 001" are taken as the part-of-speech features of the training sample set.

[0093] In another possible implementation, the part-of-speech of each word in each sample text in the training sample set is encoded to obtain a part-of-speech vector of each word, and then each word and the corresponding set of part-of-speech vectors are directly taken as the part-of-speech features of the training sample set, that is, the part-of-speech features of the training sample set are a set of word-part-of-speech vector pairs. Moreover, when each word and the corresponding set of part-of-speech vectors are taken as the part-of-speech features of the training sample set, the same word can be de-duplicated.

[0094] In the above example, the part-of-speech features of the training sample set can be "Zhang San-001; yearn-000; XY University-001; Zhao Wu-001; like-000; Z area-001; and-101; from-100; is-111; of-110; classmates-001".

[0095] In the embodiment of the present application, the part-of-speech of each sample text in the training sample set can be annotated to obtain the part-of-speech of each word included in each sample text in the training sample set, the part-of-speech of each word is encoded to obtain the part-of-speech features of the training sample set. In this way, the part-of-speech features of the training sample set can be determined based on the part-of-speech of each word in the training sample set, which provides the dependency information of the part-of-speech of the word for subsequent training of the initial entity extraction model, and improves the model training effect.

[0096] Continuing to refer to Figure 2 , step 204: inputting the training sample set into the feature extraction layer in the initial entity extraction model to obtain the character features corresponding to each sample text in the training sample set.

[0097] Specifically, the initial entity extraction model refers to an entity extraction model that has not been trained, and the initial entity extraction model can be trained based on the training sample set to optimize the model parameters to obtain a trained entity extraction model. The trained entity extraction model can perform named entity recognition on the input data. In addition, the character features refer to the features extracted by the feature extraction layer in the initial entity extraction model through analysis and recognition of each sample text in the training sample set.

[0098] The feature extraction layer in the initial entity extraction model can convert the characters of each sample text in the training sample set into feature representation vectors, i.e., character features, through a character distribution representation matrix. The initial entity extraction model can be a pre-trained Bert model structure. The training sample set is input into the pre-trained Bert model, and the character features corresponding to each sample text output by the encoding layer of the pre-trained Bert model can be obtained.

[0099] In an optional embodiment of the present embodiment, the characters in the training sample set can be encoded first, and the encoded features are input into the feature extraction layer in the initial entity extraction model. Figure 6 A process flow diagram of obtaining character features according to an embodiment of the present application is shown in FIG. 6. As shown in FIG. 6, the training sample set is input into the feature extraction layer in the initial entity extraction model to obtain the character features corresponding to each sample text in the training sample set, which includes the following steps: Figure 6

[0100] Step 602: Map the characters in the first sample text to the corresponding positions in the preset character library to obtain the encoding features of the first sample text, wherein the first sample text is any sample text included in the training sample set.

[0101] Step 604: Input the encoding features into the feature extraction layer in the initial entity extraction model to obtain the character features corresponding to the first sample text.

[0102] Specifically, the preset character library is a database including a large number of common characters, similar to a dictionary.

[0103] It should be noted that the sample texts in the training sample set are in the form of characters, and the input received by the feature extraction layer in the initial entity extraction model needs to be in the form of an encoding vector. Therefore, the characters in the first sample text can be mapped to the corresponding positions in the preset character library to obtain the encoding features of the first sample text, and then the encoding features are input into the feature extraction layer in the initial entity extraction model to obtain the character features corresponding to the first sample text. Each sample text in the training sample set can be used as the above-mentioned first sample text to obtain the corresponding character features through the feature extraction layer in the initial entity extraction model.

[0104] In actual applications, when the characters in the first sample text are mapped to the corresponding positions in the preset character library to obtain the encoding features of the first sample text, the mapped positions can be directly used as the encoding features of the first sample text.

[0105] ​With the above example, assuming that the positions corresponding to each character of "Zhang San yearns for XY University" in the preset character library are 3, 5, 7, 8, 12, 15, 19, and 27 respectively, the encoding features corresponding to the sample text 1 obtained at this time are "3 5 7 812 15 19 27". The encoding features of the sample text 1 are input into the Bert model, and the character features corresponding to the sample text 1 can be obtained from the encoding layer of the Bert model, that is, a 8*256-dimensional feature vector (where 256 is the output dimension preset by the Bert model).

[0106] Assuming that the positions corresponding to each character of "Zhao Wu likes Z area" in the preset character library are 4, 6, 13, 16, 24, 32, and 35 respectively, the encoding features corresponding to the sample text 2 obtained at this time are "461316243235". The encoding features of the sample text 2 are input into the Bert model, and the character features corresponding to the sample text 2 can be obtained from the encoding layer of the Bert model, that is, a 7*256-dimensional feature vector.

[0107] Assuming that the positions corresponding to each character of "Zhang San and Zhao Wu come from Z area, and are classmates of XY University" in the preset character library are 3, 5, 41, 4, 6, 47, 52, 24, 32, 35, 54, 12, 15, 19, 27, 71, 87, and 98 respectively, the encoding features corresponding to the sample text 3 obtained at this time are "3 5 41 4 6 47 52 24 32 35 54 12 15 19 27 7187 98". The encoding features of the sample text 3 are input into the Bert model, and the character features corresponding to the sample text 3 can be obtained from the encoding layer of the Bert model, that is, an 18*256-dimensional feature vector.

[0108] In another possible implementation, after mapping the characters in the first sample text to the corresponding positions in the preset character library, the mapped positions can also be encoded by a preset encoding method to obtain the encoding features of the first sample text. The preset encoding method can be a common method for encoding text content, such as binary encoding, one-hot encoding (one-hot encoding), leave-one-out encoding, etc.

[0109] For example, assuming that the positions corresponding to each character of "Zhang San yearns for XY University" in the preset character library are 3, 5, 7, 8, 12, 15, 19, and 27 respectively, and the preset encoding method is a binary encoding method, the mapped positions are converted into a binary vector representation to obtain the encoding features of the first sample text: 11 101 111 1000 1100 111110011 11011. In turn, the encoding features of each sample text in the training sample set can be determined.

[0110] In the embodiments of the present application, the characters in the first sample text can be mapped to the corresponding positions in the preset character library by a preset encoding method to obtain the encoding features of the first sample text, meeting the form requirement of the input data of the feature extraction layer in the initial entity extraction model, so as to obtain the character features corresponding to each sample text through the feature extraction layer in the initial entity extraction model, and the process of determining the encoding features of each sample text in the training sample set does not involve complex encoding algorithms, is simple and easy to implement, improves the efficiency of determining the encoding features, and saves the computing power.

[0111] Continuing to refer to Figure 2 , step 206: adjusting the model parameters of the initial entity extraction model according to the character features, the entity features and the part-of-speech features.

[0112] After step 206 is performed, the operation step of returning to step 202 can be performed until the training stop condition is reached to obtain the trained entity extraction model. Specifically, the training stop condition refers to a condition that needs to be met for the initial entity extraction model to complete the training, such as the number of iterations meeting the preset number threshold.

[0113] It should be noted that after the model parameters of the initial entity extraction model are adjusted according to the character features, the entity features and the part-of-speech features, it can be determined whether the training stop condition is reached. If not, it means that the recognition accuracy of the initial entity extraction model does not meet the requirements, at which time the operation step of returning to step 202 can be performed until the training stop condition is reached to obtain the trained entity extraction model.

[0114] In the embodiments of the present application, the entity features can provide dependency information of high-frequency sample entities, and the part-of-speech features can provide dependency information of word parts-of-speech, so the model parameters of the initial entity extraction model can be adjusted in combination with the character features, the entity features and the part-of-speech features to train the initial entity extraction model, which depends on different dimensions of bottom information when training the initial entity extraction model, reduces the error accumulation of the training sample set, enhances the migration ability of the trained entity extraction model, and fuses different bottom features to expand the difference of feature representation, improve the extraction ability of the trained entity extraction model, so that the trained entity extraction model can more accurately determine each target entity included in the input text and the corresponding entity annotation information, and improve the accuracy of model entity extraction.

[0115] In an optional implementation of the present embodiment, in order to adjust the model parameters of the initial entity extraction model to train the initial entity extraction model, each sample text in the training sample set can carry an entity type label corresponding to the first sample entity, Figure 7A flowchart of a model parameter adjustment method of an initial entity extraction model is shown, according to an embodiment of the present application, as shown in Figure 7 As shown, the model parameters of the initial entity extraction model are adjusted according to the character features, entity features and part-of-speech features, and specifically include the following steps:

[0116] Step 702: Fuse the character features corresponding to each sample text with the entity features and the part-of-speech features to obtain the fused feature representation of each sample text in the training sample set.

[0117] Step 704: Input the fused feature representation into the entity recognition layer of the initial entity extraction model to obtain the predicted entity type output by the initial entity extraction model.

[0118] Step 706: Calculate the first loss value of the initial entity extraction model based on the predicted entity type and the entity type label, and adjust the model parameters of the initial entity extraction model in reverse based on the first loss value.

[0119] Specifically, each sample text in the training sample set carries an entity type label corresponding to the first sample entity, which can be artificially annotated and is the true entity situation of the first sample entity. The entity type label can include a character type label and a sequence type label. The character type label can be a type label of a single entity character, i.e., the character type label can represent the position of a single entity character, such as B (Begin), I (Intermediate), E (End), S (Single), and O (Other), which are used to mark irrelevant characters. The character type label can be referred to as BIESO. The sequence type label can be a type label of an entity word, which can represent the type of an entity word, such as "LOC" for place names, "PER" for personal names, and "ORG" for organizations.

[0120] Corresponding to the entity type label (taking the entity type label as an example of the combination of character type label and sequence type label) of sample text 1 can be: "Zhang, B-PER", "three, E-PER", "Xiang, O", "Xiang, O", "X, B-ORG", "Y, I-ORG", "Da, I-ORG", "Xue, E-ORG"; the entity type label corresponding to sample text 2 can be: "Zhao, B-PER", "five, E-PER", "Xi, O", "Xuan, O", "Z, B-LOC", "Di, I-LOC", "Qu, E-LOC"; the entity type label corresponding to sample text 3 can be: "Zhang, B-PER", "three, E-PER", "and, O", "Zhao, B-PER", "five, E-PER", "Lai, O", "Zi, O", "Z, B-LOC", "Di, I-LOC", "Qu, E-LOC", "shi, O", "X, B-ORG", "Y, I-ORG", "Da, I-ORG", "Xue, E-ORG", "de, O", "tong, O", "xue, O".

[0121] It should be noted that the entity recognition layer in the initial entity extraction model can be a structure capable of analyzing the input features and predicting the entity types of the input features, such as a CRF model structure. The CRF model uses the "BIESO" character type label annotation method to predict the entity type of the input content.

[0122] In actual application, the character features, entity features and part-of-speech features corresponding to each sample text can be fused to obtain the fusion feature representation of each sample text in the training sample set, and then the fusion feature representation is input into the entity recognition layer in the initial entity extraction model. The entity recognition layer can identify and analyze the input fusion features, and output the predicted entity label corresponding to the first sample entity of each sample text. Based on the predicted entity type and entity type label corresponding to the first sample entity of each sample text, the first loss value of the initial entity extraction model can be calculated. Based on the first loss value, the model parameters of the initial entity extraction model are adjusted in reverse, and the operation step of step 202 is returned until the training stop condition is reached, and the trained entity extraction model is obtained.

[0123] The predicted entity type can also include a predicted character type and a predicted sequence type.

[0124] In a possible implementation, whether the training stopping condition is reached can be determined based on a relationship between the first loss value and a loss threshold value. Specifically, if the first loss value is greater than or equal to the loss value threshold value, it indicates that the difference between the predicted entity type corresponding to the first sample entity of each sample text and the entity type label is large, and the extraction capability of the initial entity extraction model is poor. At this time, it can be determined that the training stopping condition is not reached, the model parameters of the initial entity extraction model are adjusted, and the operation step of performing step 202 is returned to continue training the initial entity extraction model until the first loss value is less than the loss value threshold value, which indicates that the difference between the predicted entity type corresponding to the first sample entity of each sample text and the entity type label is small, and the extraction accuracy of the initial entity extraction model meets the demand. At this time, it can be determined that the training stopping condition is reached, and the training is stopped to obtain the trained entity extraction model.

[0125] It should be noted that the first loss value can be calculated based on the predicted entity type corresponding to the first sample entity of each sample text and the entity type label, that is, the real result that the initial entity extraction model is expected to output. The predicted entity type is the prediction result of the initial entity extraction model. When the difference between the prediction result and the real result is small enough, it indicates that the prediction result is close enough to the real result, at which time the initial entity extraction model is trained to obtain the trained entity extraction model.

[0126] The loss value threshold value is a critical value of the loss value. When the first loss value is greater than or equal to the loss value threshold value, it indicates that there is still a certain deviation between the prediction result of the initial entity extraction model and the real result, and the model parameters of the initial detection model still need to be adjusted, at which time it is determined that the training stopping condition is not reached. When the first loss value is less than the loss value threshold value, it indicates that the prediction result of the initial entity extraction model is close enough to the real result, and the training can be stopped, at which time it can be determined that the training stopping condition is reached. The value of the loss value threshold value is selected according to actual conditions, and the embodiments of the present application do not make any limitation in this regard.

[0127] In actual applications, there are many loss functions for calculating the loss value, such as cross-entropy loss function, L1 norm loss function, maximum loss function, mean square error loss function, and logarithmic loss function. The loss function can be used to evaluate the difference between the prediction result and the real result of the model. The better the loss function, the better the performance of the model. Different types of models generally use different loss functions.

[0128] The cross-entropy loss function is also essentially a log-likelihood function, which can be used in binary classification and multi-classification tasks. When the calculated loss value is large, it indicates that the error between the true result and the predicted result is large, and the weights of the model can be updated quickly at this time. When the calculated loss value is small, it indicates that the error between the true result and the predicted result is small, and the weights of the model can be updated slowly at this time. Using the cross-entropy loss function can avoid gradient diffusion when calculating the gradient.

[0129] In actual application, models are generally divided into two categories: classification models and regression models. For a classification model, the cross-entropy loss function is generally used first to avoid gradient diffusion. The initial entity extraction model in this application is actually used to identify the types of each first sample entity in the sample text, which is actually a classification model. Therefore, the cross-entropy loss function is used first to train the initial entity extraction model in the embodiments of this application.

[0130] In a specific implementation, the first loss value of the initial entity extraction model can be calculated based on the predicted entity type and the entity type label by using the following formula (1):

[0131]

[0132] In the formula, LOSS represents the first loss value of the initial entity extraction model, N represents the number of categories (i.e., the number of preset entity categories) that need to be classified by the initial entity extraction model, y(i) represents the entity type label of each sample entity in the i-th sample text, i.e., the true result, and f(x(i)) represents the predicted entity type of each sample entity in the i-th sample text output by the classification function in the initial entity extraction model, i.e., the predicted result.

[0133] In a possible implementation, the initial entity extraction model is a neural network model. When the model parameters of the initial entity extraction model are adjusted based on the calculated first loss value, the weights of the initial entity extraction model can be adjusted by the back propagation of the first loss value. Specifically, after the first loss value of the initial entity extraction model is calculated, the first loss value can be passed to the last layer of the initial entity extraction model. The first loss value can represent the size of the current error, so the last layer can automatically adjust its own weights according to the received first loss value. Then the last layer can pass the first loss value back to the previous layer. After the previous layer receives the first loss value, it can also automatically adjust its own weights according to the received first loss value. In this way, the first loss value is passed to the first layer of the initial entity extraction model, and one round of model parameter adjustment is completed.

[0134] In the embodiment of the present application, the first loss value is calculated to intuitively show the difference between the prediction result of the initial entity extraction model and the true result. The initial entity extraction model can be trained based on the difference to adjust the model parameters of the initial entity extraction model, thereby effectively improving the training rate and training effect of the initial entity extraction model.

[0135] In another possible implementation, in addition to comparing the relationship between the first loss value and the loss value threshold, the number of iterations can also be combined to determine whether the training stopping condition is reached. Specifically, if the first loss value is greater than or equal to the loss value threshold, it can be further determined whether the number of iterations at this moment reaches the preset number of iterations. If the number of iterations at this moment does not reach the preset number of iterations, it can be determined that the training stopping condition is not reached, the model parameters of the initial entity extraction model can be adjusted, and the operation step of returning to step 202 is performed to continue training the initial entity extraction model until the preset number of iterations is reached, and it is determined that the training stopping condition is reached, the iteration is stopped, and the trained entity extraction model is obtained.

[0136] The preset number of iterations is set according to actual conditions, and the embodiment of the present application does not make any limitation thereto. When the number of training reaches the preset number of iterations, it means that the number of training of the initial entity extraction model is sufficient, and at this time, the prediction result of the initial entity extraction model is close to the true result as much as possible, and the training can be stopped.

[0137] In the embodiment of the present application, the specific training of the initial entity extraction model can be determined according to the first loss value, and the model parameters of the initial entity extraction model can be adjusted in reverse according to the first loss value in the case of unqualified training, so as to improve the entity extraction capability of the initial entity extraction model, the training rate is high, and the training effect is good.

[0138] In an optional embodiment of the present embodiment, for each character of a certain sample text, the character feature of the character, the entity feature of the training sample set, and the part-of-speech feature of the character can be fused to obtain the fused feature representation of the character, and then the fused feature representation of the sample text is obtained. Figure 8 A flowchart of a method for obtaining a fused feature according to an embodiment of the present application is shown in FIG. 8. Figure 8 As shown in FIG. 8, the character features corresponding to each sample text are fused with the entity features and the part-of-speech features to obtain the fused feature representation of each sample text in the training sample set, which specifically includes the following steps:

[0139] Step 802: For the character feature of the first character included in the first sample text, the character feature of the first character is fused with the entity feature and the part-of-speech feature of the first character to obtain the fused feature representation of the first character.

[0140] Step 804: the fusion feature representation of each character included in the first sample text is taken as the fusion feature representation of the first sample text.

[0141] wherein the first sample text is any sample text in the training sample set, and the first character is any character included in the first sample text.

[0142] It should be noted that the character feature of the first character included in the first sample text can be fused with the entity feature of the training sample set and the part-of-speech feature of the first character to obtain the fusion feature representation of the first character. By analogy, each character in the first sample text can be taken as the first character to obtain the fusion feature representation corresponding to the character, and then the fusion feature representations of each character included in the first sample text can be taken as the fusion feature representation of the first sample text. By analogy, each sample text in the training sample set can be taken as the first sample text to obtain the fusion feature representation corresponding to the sample text, i.e., to obtain the fusion feature representation of each sample text in the training sample set.

[0143] In actual applications, when the character feature of the first character is fused with the entity feature and the part-of-speech feature of the first character, each element in the character feature, the entity feature and the part-of-speech feature can be added to obtain the fusion feature in this dimension; or the character feature, the entity feature and the part-of-speech feature can also be concatenated in sequence to obtain the corresponding fusion feature, and the dimension of the fusion feature is the sum of the dimensions of the character feature, the entity feature and the part-of-speech feature. For example, if the character feature of each character is 256-dimensional, the entity feature of the training sample set is 256-dimensional, and the part-of-speech feature is also 256-dimensional, then direct addition can obtain a 256-dimensional fusion vector, and if the three features are concatenated in sequence, a 768-dimensional fusion feature can be obtained.

[0144] Taking the above example, the character feature of the sample text 1 is an 8*256-dimensional feature vector, and each character corresponds to a 256-dimensional feature vector. After determining the feature vector corresponding to the first character "Zhang" in the sample text 1, the entity features corresponding to the entire preset entity dictionary and the part-of-speech vector "001" of Zhang San are sequentially spliced to obtain the fusion feature representation of the first character "Zhang". After determining the feature vector corresponding to the second character "San" in the sample text 1, the entity features corresponding to the entire preset entity dictionary and the part-of-speech vector "001" of Zhang San are sequentially spliced to obtain the fusion feature representation of the second character "San". After determining the feature vector corresponding to the third character "Xiang" in the sample text 1, the entity features corresponding to the entire preset entity dictionary and the part-of-speech vector "000" of Xiang Wang are sequentially spliced to obtain the fusion feature representation of the third character "Xiang". Similarly, the fusion feature representations of the characters in the sample text 1 are obtained, and then the fusion feature representations of the characters included in the sample text 1 are spliced to obtain the fusion feature representation of the sample text 1.

[0145] In the embodiment of the application, for each character included in the first sample text, the character feature of the character, the entity features of the training sample set, and the part-of-speech feature of the character are fused to obtain the fusion feature representation of the character. Thus, based on the fusion feature representations of the characters in the first sample text, the fusion feature representation of the first sample text is obtained. The fusion is performed character by character in the unit of character, which ensures the accuracy of the fusion feature of the sample text and provides accurate and different dimension dependent information for training the initial entity extraction model, thereby improving the accuracy of model training.

[0146] In an optional implementation of the embodiment, the initial entity extraction model further includes a feature analysis layer. The hidden layer representation of the fusion feature of each sample text can also be obtained in advance through the feature analysis layer. Figure 9 A flowchart of a determination method for predicting an entity type is shown, as shown in Figure 9 The fusion feature representation is input into the entity recognition layer of the initial entity extraction model to obtain the predicted entity type output by the initial entity extraction model, and the method specifically includes the following steps:

[0147] Step 902: The fusion feature representation is input into the feature analysis layer of the initial entity extraction model to obtain the hidden layer representation corresponding to each sample text.

[0148] Step 904: The hidden layer representation is input into the entity recognition layer of the initial entity extraction model to obtain the predicted entity type output by the initial entity extraction model.

[0149] The feature analysis layer refers to a structure capable of dimension reduction on the input fusion features and obtaining a hidden layer representation, and the hidden layer representation is a vector representation after dimension reduction of the fusion features. The feature analysis layer can be an LSTM network structure. In addition, the predicted entity type can include a predicted character type and a predicted sequence type.

[0150] It should be noted that after obtaining the fusion feature representation of each sample text in the training sample set, the fusion feature representation of each sample text can be input into an LSTM network. The LSTM network can perform dimension reduction on the input fusion feature representation to obtain the hidden layer representation corresponding to each sample text. The LSTM network can consider the front and back dependency of the fusion features during dimension reduction to retain feature information that has a greater impact on entity type prediction. Then, the obtained hidden layer representation can be input into the entity recognition layer (i.e., the CRF model) in the initial entity extraction model to obtain the predicted entity type corresponding to each sample text.

[0151] In the above example, assuming that the fusion feature representation of sample text 1 is an 8*256-dimensional feature vector, the fusion feature representation of sample text 1 is input into the LSTM network, and the hidden layer representation corresponding to sample text 1 can be obtained, which can be an 8*128-dimensional feature vector. The 8*128-dimensional feature vector is input into the CRF model, and the predicted entity type corresponding to sample text 1 can be obtained.

[0152] As can be seen from the above, the fusion feature representations of sample text 1, sample text 2 and sample text 3 are input into the LSTM network, respectively, to obtain the hidden layer representations corresponding to sample text 1, sample text 2 and sample text 3, respectively. Then, the hidden layer representations corresponding to sample text 1, sample text 2 and sample text 3 are input into the CRF model, respectively, and the CRF model can output the predicted entity type of each entity in sample text 1, sample text 2 and sample text 3, respectively.

[0153] In the above example, the hidden layer representation of sample text 1 is input into the CRF model, and the predicted entity type of each entity in sample text 1 output by the CRF model is: “Zhang, B-PER”, “San, I-PER”, “Xiang, I-PER”, “Xiang, E-PER”, “X, B-ORG”, “Y, I-ORG”, “Da, I-ORG”, “Xue, E-ORG”.

[0154] The hidden layer feature representation of sample text 2 is input into the CRF model, and the predicted entity type of each entity in sample text 2 output by the CRF model is: “Zhao, B-PER”, “Wu, E-PER”, “Xi, O”, “Huan, O”, “Z, O”, “Di, B-LOC”, “Qu, E-LOC”.

[0155] The hidden layer feature representation of the sample text 3 is input into the CRF model, and the CRF model can output the predicted entity types of each entity in the sample text 3 as: "Zhang, B-PER", "three, E-PER", "and, B-PER", "Zhao, I-PER", "five, E-PER", "come, O", "from, O", "Z, O", "place, I-LOC", "district, E-LOC", "is, O", "X, O", "Y, O", "big, B-ORG", "school, E-ORG", "of, O", "same, O", "school, O".

[0156] As can be seen from the above, the entity type label of the sample text 1 is: "Zhang, B-PER", "three, E-PER", "toward, O", "to, O", "X, B-ORG", "Y, I-ORG", "big, I-ORG", "school, E-ORG", the entity type label of the sample text 2 is: "Zhao, B-PER", "five, E-PER", "happy, O", "happy, O", "Z, B-LOC", "place, I-LOC", "district, E-LOC", and the entity type label corresponding to the sample text 3 can be: "Zhang, B-PER", "three, E-PER", "and, O", "Zhao, B-PER", "five, E-PER", "come, O", "from, O", "Z, B-LOC", "place, I-LOC", "district, E-LOC", "is, O", "X, B-ORG", "Y, I-ORG", "big, I-ORG", "school, E-ORG", "of, O", "same, O", "school, O".

[0157] "Three", "toward" and "to" in the sample text 1, "Z" and "place" in the sample text 2, and "and", "Zhao", "Z", "X", "Y" and "big" in the sample text 3, the predicted entity type is different from the corresponding entity type label, there is an error, which shows that the current initial entity extraction model has poor extraction ability. Based on the predicted entity type and the entity type label, the first loss value of the initial entity extraction model can be calculated, and the model parameters of the initial entity extraction model can be adjusted based on the first loss value.

[0158] It should be noted that after the character features corresponding to each sample text are fused with the entity features and the part-of-speech features to obtain the fusion feature representation of each sample text in the training sample set, the fusion feature representation of each sample text can be first input to the feature analysis layer in the initial entity extraction model to reduce the dimension of the fusion features of each sample text and obtain the hidden layer representation corresponding to each sample text, and then the hidden layer representation of each sample text is input to the entity recognition layer in the initial entity extraction model to obtain the predicted entity type output by the initial entity extraction model. In this way, the initial entity extraction model also includes a feature analysis layer. Through the feature analysis layer, the preceding and following dependency relationships of the fusion features can be considered, the feature information having a greater effect on entity type prediction can be retained, the feature information having a smaller effect on entity type prediction can be removed, the fusion features of each sample text can be reduced in dimension, the useless information in the fusion features of the sample text can be reduced, the amount of data that needs to be analyzed by the entity recognition layer can be reduced, and the prediction efficiency of the predicted entity type can be improved.

[0159] The training method of the entity extraction model provided in the embodiments of the present application can be used to determine the entity features and the part-of-speech features of the training sample set, input the training sample set to the initial extraction model, and after the character features of the training sample set are obtained through the feature extraction layer, the different bottom features such as the character features, the entity features and the part-of-speech features of the training sample set can be fused to train the initial extraction model together, thereby enriching the dependent information of the initial extraction model when learning the sample texts in the training sample set, reducing the error accumulation of the training sample set, enhancing the migration ability of the entity extraction model trained, fusing different bottom features, expanding the difference of the feature representation, improving the extraction ability of the entity extraction model trained, and enabling the entity extraction model trained to more accurately determine each target entity included in the input text and the corresponding entity annotation information, thereby improving the accuracy of the model in extracting entities.

[0160] Figure 10 A flowchart of an entity relation extraction method according to an embodiment of the present application is shown, which specifically includes the following steps.

[0161] Step 1002: inputting the text to be extracted into the entity extraction model to obtain each target entity included in the text to be extracted and the corresponding entity annotation information, wherein the entity extraction model is obtained by training the entity extraction model through the training method of the entity extraction model.

[0162] Specifically, the text to be extracted can refer to a text in which entities and the relationships between the entities need to be extracted.

[0163] It should be noted that the entity extraction model trained by the training method of the above entity extraction model can accurately identify the entity type corresponding to the input text, so that the to-be-extracted text can be input into the entity extraction model, and each target entity included in the to-be-extracted text and the corresponding entity annotation information can be obtained. The entity annotation information is the entity type corresponding to each target entity, and the entity type can include the character type and sequence type of the entity.

[0164] For example, the to-be-extracted text is "I want to go to the capital of country A and go to school in area P", and the to-be-extracted text is input into the pre-trained entity extraction model, and each target entity included in the to-be-extracted text and the corresponding entity annotation information can be obtained. The entity annotation information is: "A, B-LOC", "country, I-LOC", "home, E-LOC", "P, B-LOC", "place, I-LOC", "area, E-LOC".

[0165] In the embodiment of the application, the to-be-extracted text can be input into the entity extraction model to obtain each target entity included in the to-be-extracted text and the corresponding entity annotation information. Subsequently, based on the entity annotation information of each target entity, the entity relationship between each target entity is analyzed. The target entity relationship extraction of the to-be-extracted text is divided into two stages. The entity annotation information corresponding to each target entity is identified first, and then the entity relationship between each target entity is extracted. When extracting the relationship between each target entity, the different feature information such as the entity annotation information and the entity itself information is fused, thereby improving the accuracy of the entity relationship extraction result.

[0166] In an optional embodiment of the present embodiment, the entity extraction model includes a feature extraction layer and an entity recognition layer, Figure 11 A flowchart of a method for determining entity annotation information according to an embodiment of the present application is shown in FIG. 10. Figure 11 As shown in FIG. 10, the to-be-extracted text is input into the entity extraction model to obtain each target entity included in the to-be-extracted text and the corresponding entity annotation information, which includes the following steps:

[0167] Step 1102: The to-be-extracted text is input into the feature extraction layer of the entity extraction model to obtain the text feature representation of the to-be-extracted text.

[0168] Step 1104: The text feature representation is input into the entity recognition layer of the entity extraction model to obtain each target entity included in the to-be-extracted text and the corresponding entity annotation information.

[0169] It should be noted that the text feature representation of the text to be extracted can be obtained by inputting the text to be extracted into the feature extraction layer of the entity extraction model. The text feature representation is a feature representation vector obtained by converting the feature extraction layer through a preset character distribution representation matrix. Then, the text feature representation is input into the entity recognition layer of the entity extraction model. The entity recognition layer can analyze the text feature, and thus the target entities included in the text to be extracted and the corresponding entity annotation information can be obtained.

[0170] In the embodiment of the present application, the training process of the entity extraction model fuses different bottom features such as character features, entity features and part-of-speech features of the training sample set, enriches the dependent information of the initial extraction model when learning the sample text in the training sample set, reduces the error accumulation of the training sample set, and improves the extraction capability of the trained entity extraction model. Therefore, based on the feature extraction layer and the entity recognition layer of the entity extraction model, each target entity in the text to be extracted and the corresponding entity annotation information can be accurately extracted, which provides an accurate data basis for the subsequent extraction of entity relationships in the text to be extracted.

[0171] Further, when training the entity extraction model, a preset entity dictionary is constructed, which includes the first sample entity of each sample text in the training sample set, that is, the preset entity dictionary includes a large number of entities, and the entity annotation information of the entities is determined. Therefore, based on the preset entity dictionary, a correction rule can be set to correct the obviously incorrect entities and entity annotation information in the target entities and the corresponding entity annotation information extracted by the entity extraction model. Subsequently, based on the corrected target entities and the corresponding entity annotation information, entity relationship extraction is performed, thereby improving the accuracy of entity relationship extraction.

[0172] Continuing to refer to Figure 10 Step 1004: inputting the target entities and the corresponding entity annotation information into the relationship extraction model to obtain the target entity relationship between the target entities.

[0173] The target entity relationship can represent the relationship between the target entities in the text to be extracted predicted by the relationship extraction model, and the target entity relationship can be represented in the form of a multi-tuple.

[0174] For example, when the text to be extracted includes two target entities, the entity relationship label can be in the form of a triple, such as (A country, capital, P region). When the text to be extracted includes three target entities, the target entity relationship can be in the form of a five-tuple, such as (Zhang XX, classmate, Zhao YY, teacher, Li ZZ); or the target entity relationship can also be in the form of a four-tuple, such as (Zhang XX, classmate, Zhao YY, Wang WW).

[0175] It should be noted that the relation extraction model is a pre-trained model capable of extracting entity relationships between entities based on each entity and corresponding entity annotation information. Inputting each target entity and corresponding entity annotation information into the relation extraction model can obtain target entity relationships between each target entity, and the accuracy and efficiency of extracting entity relationships are high.

[0176] In an optional embodiment of the present embodiment, the relation extraction model includes a feature extraction layer and a classification layer, Figure 12 A flowchart of a method for determining target entity relationships is shown, according to an embodiment of the present application, as shown in Figure 12 As shown, inputting each target entity and corresponding entity annotation information into the relation extraction model can obtain target entity relationships between each target entity, and the method specifically includes the following steps:

[0177] Step 1202: Input each target entity and corresponding entity annotation information into the feature extraction layer of the relation extraction model to obtain character semantic vectors of each character in each target entity and annotation semantic vectors corresponding to the entity annotation information of each character.

[0178] Step 1204: Determine the fusion semantic vector of each target entity according to the character semantic vector and the annotation semantic vector of each target entity.

[0179] Step 1206: Input the fusion semantic vector of each target entity into the classification layer of the relation extraction model to obtain the target entity relationship between each target entity.

[0180] The feature extraction layer can be a structure capable of performing semantic analysis on the input features to obtain corresponding semantic vectors, and the classification layer can be a structure capable of analyzing semantic vectors to identify relationships between entities. The feature extraction layer of the relation extraction model can be a Bert model structure, and the classification layer of the relation extraction model can be a softmax function structure.

[0181] It should be noted that inputting each target entity and corresponding entity annotation information into the feature extraction layer (Bert model) of the relation extraction model can obtain character semantic vectors of each character included in each target entity and annotation semantic vectors corresponding to the annotation information of each character. Then, the fusion semantic vector of each target entity can be determined according to the character semantic vector and the annotation semantic vector of each target entity, and the classification layer (softmax function) of the relation extraction model can be inputted to obtain the target entity relationship between each target entity.

[0182] In the embodiments of the present application, the relationship between each target entity can be extracted by combining the semantic information of the target entity itself and the semantic information of the corresponding entity annotation information, thereby improving the accuracy of the entity relationship extraction result.

[0183] In an optional implementation of the present embodiment, Figure 13 A flowchart of a method for determining a fused semantic vector is shown according to an embodiment of the present application, as shown in Figure 13 As shown, the fused semantic vector of each target entity is determined according to the character semantic vector and the annotation semantic vector of each target entity, and specifically includes the following steps:

[0184] Step 1302: The character semantic vector of the first character of the first target entity is taken as a first fused sub-vector, and the annotation semantic vector of the entity annotation information corresponding to the first character is taken as a second fused sub-vector, wherein the first target entity is any target entity included in the text to be extracted.

[0185] Step 1304: The average character semantic vector of each character of the first target entity is taken as a third fused sub-vector, and the average annotation semantic vector of each entity annotation information corresponding to each character is taken as a fourth fused sub-vector.

[0186] Step 1306: The character semantic vector of the last character of the first target entity is taken as a fifth fused sub-vector, and the annotation semantic vector of the last character is taken as a sixth fused sub-vector.

[0187] Step 1308: The first fused sub-vector, the second fused sub-vector, the third fused sub-vector, the fourth fused sub-vector, the fifth fused sub-vector, and the sixth fused sub-vector are weighted and fused to obtain the fused semantic vector of the first target entity.

[0188] It should be noted that the character semantic vector of the first character of the first target entity, the annotation semantic vector of the entity annotation information corresponding to the first character, the average character semantic vector of each character, the average annotation semantic vector of each entity annotation information corresponding to each character, the character semantic vector of the last character, and the annotation semantic vector of the last character can be weighted and fused to obtain the fused semantic vector of the first target entity. By analogy, each target entity included in the text to be extracted can be taken as the first target entity, and the corresponding fused semantic vector can be obtained by the above method.

[0189] In the embodiments of the present application, the features of the target entity itself and the corresponding entity annotation information, etc. can be fused in units of characters, thereby improving the accuracy of the entity relationship extraction result.

[0190] In an optional implementation of the embodiment, the character information of the target entity can be fused first, and then the entity annotation information is fused, and then the fused character information and the entity annotation information are fused. Figure 14 A flowchart of another method for determining a fused semantic vector is shown, according to an embodiment of the present application, as shown in FIG. 14. Figure 14 As shown in FIG. 14, the first fused sub-vector, the second fused sub-vector, the third fused sub-vector, the fourth fused sub-vector, the fifth fused sub-vector, and the sixth fused sub-vector are weighted and fused to obtain a fused semantic vector of the first target entity, and the method specifically includes the following steps:

[0191] Step 1402: The first fused sub-vector, the third fused sub-vector, and the fifth fused sub-vector are weighted and fused to obtain a character fused vector of the first target entity.

[0192] Step 1404: The second fused sub-vector, the fourth fused sub-vector, and the sixth fused sub-vector are weighted and fused to obtain an annotation fused vector of the first target entity.

[0193] Step 1406: The character fused vector and the annotation fused vector are fused to obtain a fused semantic vector of the first target entity.

[0194] In actual application, when the first fused sub-vector, the third fused sub-vector, and the fifth fused sub-vector are weighted and fused to obtain a character fused vector of the first target entity, each element in the first fused sub-vector can be multiplied by a corresponding weight coefficient, each element in the third fused sub-vector can be multiplied by a corresponding weight coefficient, and each element in the fifth fused sub-vector can be multiplied by a corresponding weight coefficient, and then each element in the obtained three sub-vectors can be added correspondingly to obtain the character fused vector of the first target entity.

[0195] In addition, when the second fused sub-vector, the fourth fused sub-vector, and the sixth fused sub-vector are weighted and fused to obtain an annotation fused vector of the first target entity, each element in the second fused sub-vector can be multiplied by a corresponding weight coefficient, each element in the fourth fused sub-vector can be multiplied by a corresponding weight coefficient, and each element in the sixth fused sub-vector can be multiplied by a corresponding weight coefficient, and then each element in the obtained three sub-vectors can be added correspondingly to obtain the annotation fused vector of the first target entity.

[0196] In a specific implementation, when the character fusion vector and the label fusion vector are fused to obtain the fusion semantic vector of the first target entity, the corresponding elements in the character fusion vector and the label fusion vector can be added to obtain the fusion semantic vector of the first target entity, or the corresponding elements in the character fusion vector and the label fusion vector can be set with weights and then added; or the character fusion vector and the label fusion vector can be sequentially spliced to obtain the fusion semantic vector of the first target entity.

[0197] In addition, the classification layer of the relation extraction model can further include a full connection layer and a softmax function. At this time, the fusion semantic vectors of the target entities in the text to be extracted can be input into the full connection layer for connection to obtain an overall semantic vector of the text to be extracted, and then the overall semantic vector of the text to be extracted can be input into the softmax function to obtain the target entity relations between the target entities in the text to be extracted.

[0198] In the above example, the semantic vector of "A" and the semantic vector of the corresponding label information "B-LOC", the semantic vector of "guo" and the semantic vector of the corresponding label information "I-LOC", the semantic vector of "jia" and the semantic vector of the corresponding label information "E-LOC", the semantic vector of "P" and the semantic vector of the corresponding label information "B-LOC", the semantic vector of "di" and the semantic vector of the corresponding label information "I-LOC", and the semantic vector of "qu" and the semantic vector of the corresponding label information "E-LOC" can be obtained by inputting "A, B-LOC", "guo, I-LOC", "jia, E-LOC", "P, B-LOC", "di, I-LOC", and "qu, E-LOC" into the Bert model.

[0199] The semantic vectors of "A", "guo", and "jia" are weighted and averaged to obtain the average semantic vector of each character of "Aguo", and the semantic vectors of the corresponding label information "B-LOC" of "A", the corresponding label information "I-LOC" of "guo", and the corresponding label information "E-LOC" of "jia" are weighted and averaged to obtain the average semantic vector of each corresponding label information of each character of "Aguo".

[0200] The semantic vectors of "P", "di", and "qu" are weighted and averaged to obtain the average semantic vector of each character of "Pdiqu", and the semantic vectors of the corresponding label information "B-LOC" of "P", the corresponding label information "I-LOC" of "di", and the corresponding label information "E-LOC" of "qu" are weighted and averaged to obtain the average semantic vector of each corresponding label information of each character of "Pdiqu".

[0201] The semantic vector of "A", the average semantic vector of each character of "A country", and the semantic vector of "home" are fused by weighting to obtain a character fusion vector of "A country"; the semantic vector of the label information "B-LOC" corresponding to "A", the average semantic vector of each label information corresponding to each character of "A country", and the semantic vector of the label information "E-LOC" corresponding to "home" are fused by weighting to obtain a label information fusion vector of "A country". Then, the character fusion vector of "A country" and the label information fusion vector of "A country" are spliced to serve as the fusion semantic vector of "A country". In this way, the fusion semantic vector of "P region" can be obtained.

[0202] Then, the fusion semantic vector of "A country" and the fusion semantic vector of "P region" can be jointly input into a full connection layer to obtain a complete semantic vector of the text to be extracted, and the complete semantic vector of the text to be extracted is input into a softmax function to obtain the final output target entity relationship.

[0203] In the embodiment of the present application, when the relationship between each target entity is extracted, the entity information of the target entity itself and the corresponding entity label information and other different feature information are fused in units of characters, so that the accuracy of the entity relationship extraction result is improved.

[0204] In an optional implementation of the embodiment, a training method of a relationship extraction model is provided, Figure 15 A flowchart of the training method of the relationship extraction model is shown in FIG. 15. Figure 15 As shown in FIG. 15, the relationship extraction model is trained by the following training method including the following steps:

[0205] Step 1502: obtaining a training sample, wherein the training sample includes at least two second sample entities and sample label information of each second sample entity, and the training sample carries an entity relationship label.

[0206] Step 1504: inputting each second sample entity and the corresponding sample label information into an initial relationship extraction model to obtain a predicted entity relationship between each second sample entity.

[0207] Step 1506: calculating a second loss value of the initial relationship extraction model based on the predicted entity relationship and the entity relationship label, and reversely adjusting the model parameters of the initial relationship extraction model based on the second loss value until a training stop condition is reached to obtain a trained relationship extraction model.

[0208] It should be noted that the training sample can be obtained by the trained entity extraction model. Specifically, the training corpus can be input into the trained entity extraction model to obtain each entity included in the training corpus and the corresponding entity type, wherein the entity is the second sample entity in the training sample, and the entity type corresponding to each entity is the sample annotation information of each second sample entity in the training sample.

[0209] The training corpus can be a training sample set used by the training entity extraction model, or can be another obtained training corpus. The sample annotation information can also include character types and sequence types. In addition, the training sample can be another obtained data manually annotated with the second sample entity and the sample annotation information of each second sample entity.

[0210] Further, the training sample can carry an entity relationship label, which is used to indicate the relationship between each second sample entity in the training sample. For example, the second sample entity included in the training sample is X country and Y region, and the entity relationship label carried by the training sample is the capital, i.e., the entity relationship between X country and Y region is "Y region is the capital of X country".

[0211] In actual application, the initial relationship extraction model is an initial model without training. The initial relationship extraction model can be trained based on the training sample, the model parameters in the initial relationship extraction model are optimized, and the trained relationship extraction model is obtained.

[0212] It should be noted that the second loss value of the initial relationship extraction model is calculated based on the predicted entity relationship and the entity relationship label, and the specific implementation process of training the initial relationship extraction model based on the second loss value is similar to the above training process of the initial entity extraction model. Therefore, the present application will not be repeated here.

[0213] In the embodiment of the present application, the difference between the prediction result and the true result of the initial relationship extraction model can be intuitively shown by calculating the loss value. The initial relationship extraction model can be trained based on the difference in the subsequent process, and the model parameters of the initial relationship extraction model can be adjusted, thereby effectively improving the training rate and training effect of the initial relationship extraction model.

[0214] In addition, at least two second sample entities and the sample annotation information of each second sample entity are used as training samples, and the initial relationship extraction model is trained in combination with the carried entity relationship label, so that the trained relationship extraction model can accurately identify the input entity information and annotation information, analyze the entity relationship between each entity in the input entity information, and provide the accuracy of the relationship extraction model in extracting entity relationship.

[0215] In an optional implementation of the embodiment, the initial relation extraction model comprises a feature extraction layer and a classification layer, Figure 16 A flowchart of a method for determining a predicted entity relation is shown, according to an embodiment of the present application, as shown in Figure 16 As shown, each second sample entity and corresponding sample annotation information are input into the initial relation extraction model to obtain a predicted entity relation between each second sample entity, specifically comprising the following steps:

[0216] Step 1602: Each second sample entity and corresponding sample annotation information are input into the feature extraction layer of the initial relation extraction model to obtain a sample character semantic vector of each sample character in each second sample entity and a sample annotation semantic vector corresponding to the sample annotation information of each sample character.

[0217] Step 1604: The sample fusion semantic vector of each second sample entity is determined according to the sample character semantic vector and the sample annotation semantic vector of each sample character.

[0218] Step 1606: The sample fusion semantic vector of each second sample entity is input into the classification layer of the initial relation extraction model to obtain a predicted entity relation between each second sample entity.

[0219] In actual applications, the specific implementation process of fusing the sample character semantic vector and the sample annotation semantic vector of the second sample entity to obtain the sample fusion semantic vector of the second sample entity can refer to the specific implementation process of fusing the character semantic vector and the annotation semantic vector of the target entity to obtain the fusion semantic vector of the target entity described above. That is, the specific implementation process of inputting each second sample entity and corresponding sample annotation information into the initial relation extraction model to obtain a predicted entity relation between each second sample entity is similar to the specific implementation process of inputting each target entity and corresponding entity annotation information into the relation extraction model to obtain a target entity relation between each target entity, which will not be described herein again.

[0220] It should be noted that when training the initial relation extraction model, the second sample entity itself entity information and corresponding sample annotation information and other different feature information are fused in units of characters, which improves the training accuracy of the initial relation extraction model.

[0221] The embodiment of the present application provides an entity relation extraction method, the entity extraction model is obtained by training the entity extraction model through the training method, so that the entity extraction model can accurately determine each target entity included in the text to be extracted and the corresponding entity annotation information, and then each target entity and the corresponding entity annotation information can be input into the relation extraction model, the target entity and the corresponding entity annotation information are analyzed by the relation extraction model, and the target entity relation between each target entity is determined. In this way, the target entity relation extraction of the text to be extracted is divided into two stages, the entity annotation information corresponding to each target entity is identified first, and then the entity relation between each target entity is extracted, that is, the Pipeline relation extraction method is used, and when the relation between each target entity is extracted, the entity information and the entity annotation information of the target entity and other different feature information are fused, so that the accuracy of the entity relation extraction result is improved.

[0222] Figure 17 A flowchart of another entity relation extraction method provided by an embodiment of the present application is shown, which specifically includes the following steps.

[0223] Step 1702: Obtain a training sample set, wherein the training sample set includes at least one sample text.

[0224] Step 1704: Extract first sample entities included in each sample text in the training sample set, and count the frequency of occurrence of each first sample entity, select target sample entities with a frequency greater than a frequency threshold to construct a preset entity dictionary; for each target sample entity in the preset entity dictionary, query a preset word vector table to obtain a word vector corresponding to the target sample entity; then, the word vectors corresponding to each target sample entity are fused through a pooling layer in the CNN network to obtain entity features corresponding to the preset entity dictionary.

[0225] Step 1706: Perform part-of-speech tagging on each sample text in the training sample set through an LAC part-of-speech tagging tool to obtain the part-of-speech of each word included in each sample text in the training sample set; then, encode the part-of-speech of each word based on a preset encoding rule to obtain a part-of-speech vector of each word, and use the part-of-speech vector of each word as the part-of-speech feature of the training sample set.

[0226] Step 1708: Map the characters of each sample text in the training sample set to the corresponding positions in the preset character library to obtain the encoding features of each sample text, and input the encoding features of each sample text into the feature extraction layer in the initial entity extraction model to obtain the character features corresponding to each sample text.

[0227] The feature extraction layer in the initial entity extraction model can be a pre-trained Bert model structure. The Bert model has been pre-trained using the same task, and thus the output of the encoding layer of the Bert model can better adapt to the feature extraction task.

[0228] Step 1710: Fuse the character features corresponding to each sample text with the entity features and the part-of-speech features to obtain the fusion feature representation of each sample text in the training sample set. The fusion feature representation is input into the feature analysis layer in the initial entity extraction model to obtain the hidden layer representation corresponding to each sample text.

[0229] The feature analysis layer refers to a structure that can reduce the dimension of the input fusion features and obtain a hidden layer representation. The hidden layer representation is a vector representation after dimension reduction of the fusion features. For example, the feature analysis layer can be an LSTM network structure.

[0230] Step 1712: Input the hidden layer representation of each sample text into the entity recognition layer in the initial entity extraction model to obtain the predicted entity type corresponding to each sample text. Based on the predicted entity type corresponding to each sample text and the entity type label, a first loss value of the initial entity extraction model is calculated. Based on the first loss value, the model parameters of the initial entity extraction model are adjusted in reverse until the training stopping condition is reached, and a trained entity extraction model is obtained.

[0231] The entity recognition layer can be a CRF model structure. The CRF model uses the "BIESO" character type label annotation method to predict the entity type, thereby performing model training.

[0232] Step 1714: Input the text to be extracted into the trained entity extraction model to obtain each target entity included in the text to be extracted and the corresponding entity annotation information.

[0233] Step 1716: Input each target entity and the corresponding entity annotation information into the trained Bert model to obtain the character semantic vector of each character in each target entity and the annotation semantic vector corresponding to each character.

[0234] Step 1718: Determine the fusion semantic vector of each target entity according to the character semantic vector and the annotation semantic vector of each target entity. Input the fusion semantic vector of each target entity into a softmax function to obtain the target entity relationship between each target entity.

[0235] In the embodiment of the present application, the different bottom features such as character features, entity features and part-of-speech features of the fusion training sample set are fused to train the initial extraction model, which enriches the dependent information of the initial extraction model when learning the sample texts in the training sample set, reduces the error accumulation of the training sample set, enhances the migration ability of the trained entity extraction model, and fuses different bottom features to expand the difference of feature representation and improve the extraction ability of the trained entity extraction model, so that the trained entity extraction model can more accurately determine each target entity included in the input text and the corresponding entity annotation information, thereby improving the accuracy of model entity extraction. In addition, when extracting the relationship between each target entity, the different feature information such as the entity information and the corresponding entity annotation information of the target entity are fused in the unit of character, thereby improving the accuracy of the entity relationship extraction result.

[0236] Corresponding to the method embodiment, the present application also provides an entity extraction model training device embodiment, Figure 18 The structure of an entity extraction model training device provided by an embodiment of the present application is shown. As shown in the figure, Figure 18 The device comprises:

[0237] The obtaining module 1802 is configured to obtain a training sample set and determine entity features and part-of-speech features of the training sample set, wherein the training sample set comprises at least one sample text;

[0238] The first obtaining module 1804 is configured to input the training sample set into a feature extraction layer in an initial entity extraction model to obtain character features corresponding to each sample text in the training sample set;

[0239] The first training module 1806 is configured to adjust model parameters of the initial entity extraction model according to the character features, the entity features and the part-of-speech features, and return to perform the operation step of obtaining the training sample set until a training stop condition is reached to obtain a trained entity extraction model.

[0240] Optionally, the obtaining module 1802 is further configured to:

[0241] construct a preset entity dictionary according to the first sample entity included in each sample text in the training sample set, and determine entity features corresponding to the preset entity dictionary;

[0242] perform part-of-speech annotation on each sample text in the training sample set, and determine part-of-speech features of the training sample set according to the part-of-speech annotation.

[0243] Optionally, the obtaining module 1802 is further configured to:

[0244] extracting each sample entity included in each sample text in the training sample set, and counting frequency of occurrence of each first sample entity, selecting a target sample entity with frequency greater than a frequency threshold to construct a preset entity dictionary;

[0245] For each target sample entity in the preset entity dictionary, querying the preset word vector table to obtain a word vector corresponding to the target sample entity;

[0246] Fusing the word vectors corresponding to each target sample entity through the feature fusion network to obtain an entity feature corresponding to the preset entity dictionary.

[0247] Optionally, the obtaining module 1802 is further configured to:

[0248] Performing part-of-speech tagging on each sample text in the training sample set through a part-of-speech tagging tool to obtain the part-of-speech of each word included in each sample text in the training sample set;

[0249] Encoding the part-of-speech of each word based on a preset encoding rule to obtain a part-of-speech vector of each word;

[0250] Taking the part-of-speech vector of each word as the part-of-speech feature of the training sample set.

[0251] Optionally, the first obtaining module 1804 is further configured to:

[0252] Mapping the characters in the first sample text to the corresponding positions in the preset character library to obtain an encoding feature of the first sample text, wherein the first sample text is any sample text included in the training sample set;

[0253] Inputting the encoding feature into the feature extraction layer in the initial entity extraction model to obtain a character feature corresponding to the first sample text.

[0254] Optionally, each sample text carries an entity type label corresponding to the first sample entity; the first training module 1806 is further configured to:

[0255] Fusing the character feature, the entity feature, and the part-of-speech feature corresponding to each sample text to obtain a fusion feature representation of each sample text in the training sample set;

[0256] Inputting the fusion feature representation into the entity recognition layer in the initial entity extraction model to obtain a predicted entity type output by the initial entity extraction model;

[0257] Based on the predicted entity type and the entity type label, calculating a first loss value of the initial entity extraction model, and based on the first loss value, reversely adjusting the model parameters of the initial entity extraction model.

[0258] Optionally, the first training module 1806 is further configured to:

[0259] character features of the first character are fused with the entity features and the part-of-speech features of the first character to obtain a fused feature representation of the first character, wherein the first sample text is any sample text in the training sample set, and the first character is any character included in the first sample text;

[0260] The fused feature representations of the characters included in the first sample text are taken as the fused feature representation of the first sample text.

[0261] Optionally, the initial entity extraction model further includes a feature analysis layer; the first training module 1806 is further configured to:

[0262] The fused feature representation is input into the feature analysis layer in the initial entity extraction model to obtain a hidden layer representation corresponding to each sample text;

[0263] The hidden layer representation is input into the entity recognition layer in the initial entity extraction model to obtain a predicted entity type output by the initial entity extraction model.

[0264] In the embodiments of the present application, a training device of an entity extraction model is provided. When training the entity extraction model, the entity features and the part-of-speech features of the training sample set can be determined, the training sample set is input into an initial extraction model, and after the character features of the training sample set are obtained through a feature extraction layer, the character features, the entity features and the part-of-speech features of the training sample set and other different bottom features are fused to train the initial extraction model together, which enriches the dependent information of the initial extraction model when learning the sample texts in the training sample set, reduces the error accumulation of the training sample set, enhances the migration ability of the trained entity extraction model, and fuses different bottom features to expand the difference of the feature representation, improve the extraction ability of the trained entity extraction model, so that the trained entity extraction model can more accurately determine each target entity included in the input text and the corresponding entity annotation information, and improve the accuracy of the model in extracting entities.

[0265] The above is a schematic scheme of the training device of the entity extraction model according to the embodiments of the present application. It should be noted that the technical scheme of the training device of the entity extraction model belongs to the same concept as the technical scheme of the training method of the entity extraction model described above, and the details of the technical scheme of the training device of the entity extraction model that are not described in detail can be referred to the description of the technical scheme of the training method of the entity extraction model.

[0266] Corresponding to the above method embodiments, the present application also provides entity relation extraction device embodiments, Figure 19 A structural schematic diagram of an entity relation extraction device according to an embodiment of the present application is shown. As shown in FIG. 8, the entity relation extraction device includes a first training module 1806 and an initial entity extraction model 1807.Figure 19 The apparatus includes:

[0267] The second obtaining module 1902 is configured to input the text to be extracted into an entity extraction model, to obtain each target entity included in the text to be extracted and corresponding entity annotation information, wherein the entity extraction model is obtained by training the entity extraction model according to the training method of the entity extraction model.

[0268] The third obtaining module 1904 is configured to input each target entity and the corresponding entity annotation information into a relation extraction model, to obtain a target entity relation between each target entity.

[0269] Optionally, the third obtaining module 1904 is further configured to:

[0270] input each target entity and the corresponding entity annotation information into a feature extraction layer of the relation extraction model, to obtain a character semantic vector of each character in each target entity and an annotation semantic vector of the entity annotation information corresponding to each character;

[0271] determine a fusion semantic vector of each target entity according to the character semantic vector and the annotation semantic vector of each target entity;

[0272] input the fusion semantic vector of each target entity into a classification layer of the relation extraction model, to obtain a target entity relation between each target entity.

[0273] Optionally, the third obtaining module 1904 is further configured to:

[0274] take the character semantic vector of the first character of the first target entity as a first fusion sub-vector, and take the annotation semantic vector of the entity annotation information corresponding to the first character as a second fusion sub-vector, wherein the first target entity is any target entity among the target entities included in the text to be extracted;

[0275] take the average character semantic vector of each character of the first target entity as a third fusion sub-vector, and take the average annotation semantic vector of each entity annotation information corresponding to each character as a fourth fusion sub-vector;

[0276] take the character semantic vector of the last character of the first target entity as a fifth fusion sub-vector, and take the annotation semantic vector of the last character as a sixth fusion sub-vector;

[0277] perform weighted fusion on the first fusion sub-vector, the second fusion sub-vector, the third fusion sub-vector, the fourth fusion sub-vector, the fifth fusion sub-vector, and the sixth fusion sub-vector, to obtain the fusion semantic vector of the first target entity.

[0278] Optionally, the third obtaining module 1904 is further configured to:

[0279] perform weighted fusion on the first fusion sub-vector, the third fusion sub-vector and the fifth fusion sub-vector to obtain a character fusion vector of the first target entity;

[0280] perform weighted fusion on the second fusion sub-vector, the fourth fusion sub-vector and the sixth fusion sub-vector to obtain a label fusion vector of the first target entity;

[0281] fuse the character fusion vector and the label fusion vector to obtain a fusion semantic vector of the first target entity.

[0282] Optionally, the entity extraction model comprises a feature extraction layer and an entity recognition layer; the second obtaining module 1902 is further configured to:

[0283] input the text to be extracted into the feature extraction layer of the entity extraction model to obtain a text feature representation of the text to be extracted;

[0284] input the text feature representation into the entity recognition layer of the entity extraction model to obtain each target entity included in the text to be extracted and corresponding entity label information.

[0285] Optionally, the apparatus further comprises a second training module configured to:

[0286] obtain training samples, wherein the training samples comprise at least two second sample entities and sample label information of each second sample entity, and the training samples carry entity relationship labels;

[0287] input each second sample entity and corresponding sample label information into the initial relationship extraction model to obtain predicted entity relationships between each second sample entity;

[0288] based on the predicted entity relationships and the entity relationship labels, calculate a second loss value of the initial relationship extraction model, and based on the second loss value, reversely adjust model parameters of the initial relationship extraction model until a training stop condition is reached to obtain a trained relationship extraction model.

[0289] Optionally, the second training module is further configured to:

[0290] input each second sample entity and corresponding sample label information into the feature extraction layer of the initial relationship extraction model to obtain a sample character semantic vector of each sample character in each second sample entity and a sample label semantic vector of corresponding sample label information of each sample character;

[0291] determine a sample fusion semantic vector of each second sample entity according to the sample character semantic vector and the sample label semantic vector of each sample character;

[0292] The sample fusion semantic vector of each second sample entity is input into a classification layer of the initial relation extraction model to obtain a predicted entity relation between each second sample entity.

[0293] The entity extraction model is trained by the training method of the entity extraction model, and thus the entity extraction model can accurately determine each target entity included in the text to be extracted and corresponding entity annotation information. Then, each target entity and corresponding entity annotation information can be input into the relation extraction model, and the target entity and corresponding entity annotation information are fused and analyzed by the relation extraction model to determine the target entity relation between each target entity. In this way, the target entity relation extraction of the text to be extracted is divided into two stages, the entity annotation information corresponding to each target entity is identified first, and then the entity relation between each target entity is extracted. When the relation between each target entity is extracted, the entity information and entity annotation information of the target entity and other different feature information are fused, and the accuracy of the entity relation extraction result is improved.

[0294] The above is a schematic scheme of the entity relation extraction device of the embodiment. It should be noted that the technical scheme of the entity relation extraction device belongs to the same concept as the technical scheme of the entity relation extraction method described above. The details of the technical scheme of the entity relation extraction device that are not described in detail can be referred to the description of the technical scheme of the entity relation extraction method.

[0295] It should be noted that each component in the device claim should be understood as a functional module that must be established to implement each step of the program flow or each step of the method. Each functional module is not an actual functional division or separation limitation. The device claim defined by such a set of functional modules should be understood as a functional module architecture for implementing the solution by the computer program mainly recorded in the specification, and should not be understood as an entity device for mainly implementing the solution by hardware.

[0296] Figure 20 A structural block diagram of a computing device according to an embodiment of the present application is shown. The components of the computing device 2000 include, but are not limited to, a memory 2010 and a processor 2020. The processor 2020 is connected to the memory 2010 through a bus 2030, and a database 2050 is used to save data.

[0297] The computing device 2000 also includes an access device 2040 that enables the computing device 2000 to communicate via one or more networks 2060. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of networks such as the Internet. The access device 2040 can include one or more of any type of network interface (for example, a network interface card (NIC)) such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, or the like.

[0298] In one embodiment of the present application, the above-mentioned components of the computing device 2000 and other components not shown in FIG. 2 can be connected to each other via a bus. Figure 20 It should be understood that the computing device structure diagram shown is for the purpose of example only and is not a limitation on the scope of the present application. Other components can be added or replaced as needed by those skilled in the art. Figure 20 It should be understood that the computing device structure diagram shown is for the purpose of example only and is not a limitation on the scope of the present application. Other components can be added or replaced as needed by those skilled in the art.

[0299] The computing device 2000 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (for example, a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, and the like), a mobile phone (for example, a smartphone), a wearable computing device (for example, a smart watch, smart glasses, and the like), or other types of mobile devices, or a stationary computing device such as a desktop computer or a PC. The computing device 2000 can also be a mobile or stationary server.

[0300] The steps of the training method of the entity extraction model or the entity relation extraction method implemented by the processor 2020 when executing the instructions.

[0301] The above is a schematic scheme of the computing device of the embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the entity extraction model training method or the entity relation extraction method belong to the same concept, and the details of the technical scheme of the computing device that are not described in detail can be referred to the description of the technical scheme of the entity extraction model training method or the entity relation extraction method.

[0302] An embodiment of the present application further provides a computer readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the entity extraction model training method or the entity relation extraction method.

[0303] The above is a schematic scheme of the computer readable storage medium of the embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the entity extraction model training method or the entity relation extraction method belong to the same concept, and the details of the technical scheme of the storage medium that are not described in detail can be referred to the description of the technical scheme of the entity extraction model training method or the entity relation extraction method.

[0304] An embodiment of the present application discloses a chip storing computer instructions, which, when executed by a processor, implement the steps of the entity extraction model training method or the entity relation extraction method.

[0305] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims can be performed in a different order than the order in which they are recited and still achieve desirable results. In addition, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0306] The computer instructions include computer program code, which can be in the form of source code, object code, executable code, or some intermediate form. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0307] It should be noted that, for the aforementioned method embodiments, the sequences of the described actions are not the only ones that can be performed to implement the present application. In some embodiments, the sequences of actions can be performed in different order or simultaneously. In some embodiments, other sequences of actions can be performed, which should be apparent to a person of ordinary skill in the art in light of the teachings of the present application.

[0308] In the above embodiments, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0309] The preferred embodiments of the present application disclosed above are only used to clarify the present application. The alternative embodiments do not describe all the details and limit the present application to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can well understand and utilize the present application. The present application is limited by the claims and their full scope and equivalents.

Claims

1. A training method for an entity extraction model, characterized in that, include: A training sample set is obtained, and a preset entity dictionary is constructed based on the first sample entities included in each sample text in the training sample set, and the entity features corresponding to the preset entity dictionary are determined; part-of-speech tagging is performed on each sample text in the training sample set, and the part-of-speech features of the training sample set are determined based on the part-of-speech tagging, wherein the training sample set includes at least one sample text; The training sample set is input into the feature extraction layer of the initial entity extraction model to obtain the character features corresponding to each sample text in the training sample set. Based on the character features, entity features, and part-of-speech features, the model parameters of the initial entity extraction model are adjusted, and the operation steps of obtaining the training sample set are returned until the training stopping condition is met, thus obtaining the trained entity extraction model.

2. The training method for the entity extraction model according to claim 1, characterized in that, The step of constructing a preset entity dictionary based on the first sample entities included in each sample text in the training sample set, and determining the entity features corresponding to the preset entity dictionary, includes: Extract the first sample entities included in each sample text in the training sample set, count the frequency of each first sample entity, and select target sample entities with a frequency greater than the frequency threshold to construct the preset entity dictionary; For each target sample entity in the preset entity dictionary, query the preset word vector table to obtain the word vector corresponding to the target sample entity; The entity features corresponding to the preset entity dictionary are obtained by fusing the word vectors corresponding to each target sample entity through a feature fusion network.

3. The training method for the entity extraction model according to claim 1, characterized in that, The step of performing part-of-speech tagging on each sample text in the training sample set and determining the part-of-speech features of the training sample set based on the part-of-speech tagging includes: The training sample texts are labeled with part-of-speech tags using a part-of-speech tagging tool to obtain the part-of-speech tags of each word included in each sample text in the training sample set. The part-of-speech of each word is encoded based on a preset encoding rule to obtain the part-of-speech vector of each word; The part-of-speech vectors of each word are used as the part-of-speech features of the training sample set.

4. The training method for the entity extraction model according to any one of claims 1-3, characterized in that, The step of inputting the training sample set into the feature extraction layer of the initial entity extraction model to obtain the character features corresponding to each sample text in the training sample set includes: The characters in the first sample text are mapped to the corresponding positions in a preset character library to obtain the encoding features of the first sample text, wherein the first sample text is any sample text included in the training sample set; The encoded features are input into the feature extraction layer of the initial entity extraction model to obtain the character features corresponding to the first sample text.

5. The training method for the entity extraction model according to any one of claims 1-3, characterized in that, Each of the sample texts carries an entity type label corresponding to the first sample entity; The step of adjusting the model parameters of the initial entity extraction model based on the character features, the entity features, and the part-of-speech features includes: The character features corresponding to each sample text are fused with the entity features and the part-of-speech features to obtain the fused feature representation of each sample text in the training sample set; The fused feature representation is input into the entity recognition layer in the initial entity extraction model to obtain the predicted entity type output by the initial entity extraction model; Based on the predicted entity type and the entity type label, a first loss value is calculated for the initial entity extraction model. Based on the first loss value, the model parameters of the initial entity extraction model are adjusted in reverse.

6. The training method for the entity extraction model according to claim 5, characterized in that, The step of fusing the character features corresponding to each sample text with the entity features and the part-of-speech features to obtain the fused feature representation of each sample text in the training sample set includes: For the character features of the first character included in the first sample text, the character features of the first character are fused with the entity features and the part-of-speech features of the first character to obtain the fused feature representation of the first character, wherein the first sample text is any sample text in the training sample set, and the first character is any character included in the first sample text. The fusion feature representation of each character included in the first sample text is used as the fusion feature representation of the first sample text.

7. The training method for the entity extraction model according to claim 5, characterized in that, The initial entity extraction model also includes a feature analysis layer; Before inputting the fused feature representation into the entity recognition layer of the initial entity extraction model to obtain the predicted entity type output by the initial entity extraction model, the method further includes: The fused feature representation is input into the feature analysis layer of the initial entity extraction model to obtain the hidden layer representation corresponding to each sample text. The step of inputting the fused feature representation into the entity recognition layer of the initial entity extraction model to obtain the predicted entity type output by the initial entity extraction model includes: The hidden layer representation is input into the entity recognition layer in the initial entity extraction model to obtain the predicted entity type output by the initial entity extraction model.

8. A method for extracting entity relations, characterized in that, include: The text to be extracted is input into the entity extraction model to obtain each target entity included in the text to be extracted and the corresponding entity annotation information, wherein the entity extraction model is trained by the training method of the entity extraction model according to any one of claims 1-7. The target entities and their corresponding entity annotation information are input into the relationship extraction model to obtain the target entity relationships between the target entities.

9. The entity relation extraction method according to claim 8, characterized in that, The step of inputting each target entity and its corresponding entity annotation information into a relationship extraction model to obtain the target entity relationships between the target entities includes: Each target entity and its corresponding entity annotation information are input into the feature extraction layer of the relationship extraction model to obtain the character semantic vector of each character in each target entity, and the annotation semantic vector of the entity annotation information corresponding to each character. Based on the character semantic vector and the labeled semantic vector of each target entity, the fused semantic vector of each target entity is determined; The fused semantic vectors of each target entity are input into the classification layer of the relation extraction model to obtain the target entity relationships between the target entities.

10. The entity relation extraction method according to claim 9, characterized in that, The step of determining the fused semantic vector of each target entity based on the character semantic vector of each target entity and the labeled semantic vector includes: The character semantic vector of the first character of the first target entity is used as the first fusion sub-vector, and the annotation semantic vector of the entity annotation information corresponding to the first character is used as the second fusion sub-vector, wherein the first target entity is any target entity among the target entities included in the text to be extracted; The average character semantic vector of each character of the first target entity is used as the third fusion sub-vector, and the average annotation semantic vector of each entity annotation information corresponding to each character is used as the fourth fusion sub-vector. The character semantic vector of the last character of the first target entity is used as the fifth fusion sub-vector, and the annotation semantic vector of the last character is used as the sixth fusion sub-vector. The first fusion sub-vector, the second fusion sub-vector, the third fusion sub-vector, the fourth fusion sub-vector, the fifth fusion sub-vector, and the sixth fusion sub-vector are weighted and fused to obtain the fused semantic vector of the first target entity.

11. The entity relation extraction method according to claim 10, characterized in that, The step of weightedly fusing the first fused sub-vector, the second fused sub-vector, the third fused sub-vector, the fourth fused sub-vector, the fifth fused sub-vector, and the sixth fused sub-vector to obtain the fused semantic vector of the first target entity includes: The first fusion sub-vector, the third fusion sub-vector, and the fifth fusion sub-vector are weighted and fused to obtain the character fusion vector of the first target entity; The second fusion sub-vector, the fourth fusion sub-vector, and the sixth fusion sub-vector are weighted and fused to obtain the annotation fusion vector of the first target entity; The character fusion vector and the annotation fusion vector are fused to obtain the fused semantic vector of the first target entity.

12. The entity relation extraction method according to any one of claims 8-11, characterized in that, The entity extraction model includes a feature extraction layer and an entity recognition layer; The step of inputting the text to be extracted into the entity extraction model to obtain each target entity included in the text to be extracted and its corresponding entity annotation information includes: The text to be extracted is input into the feature extraction layer of the entity extraction model to obtain the text feature representation of the text to be extracted. The text feature representation is input into the entity recognition layer of the entity extraction model to obtain the target entities included in the text to be extracted and their corresponding entity annotation information.

13. The entity relation extraction method according to any one of claims 8-11, characterized in that, The relation extraction model was trained using the following method: Obtain training samples, wherein the training samples include at least two second sample entities and sample annotation information for each second sample entity, and the training samples carry entity relationship labels; Each second sample entity and its corresponding sample labeling information are input into the initial relation extraction model to obtain the predicted entity relationship between each second sample entity. Based on the predicted entity relationship and the entity relationship label, calculate the second loss value of the initial relationship extraction model. Based on the second loss value, adjust the model parameters of the initial relationship extraction model in reverse until the training stopping condition is met, and obtain the trained relationship extraction model.

14. The entity relation extraction method according to claim 13, characterized in that, The step of inputting each second sample entity and its corresponding sample annotation information into the initial relation extraction model to obtain the predicted entity relationship between the second sample entities includes: Each second sample entity and its corresponding sample annotation information are input into the feature extraction layer of the initial relation extraction model to obtain the sample character semantic vector of each sample character in each second sample entity, and the sample annotation semantic vector of the sample annotation information corresponding to each sample character. Based on the sample character semantic vector of each sample character and the sample annotation semantic vector, determine the sample fusion semantic vector of each second sample entity; The sample fusion semantic vectors of each second sample entity are input into the classification layer of the initial relation extraction model to obtain the predicted entity relations between each second sample entity.

15. A training device for an entity extraction model, characterized in that, include: The acquisition module is configured to acquire a training sample set, construct a preset entity dictionary based on the first sample entities included in each sample text in the training sample set, and determine the entity features corresponding to the preset entity dictionary; perform part-of-speech tagging on each sample text in the training sample set, and determine the part-of-speech features of the training sample set based on the part-of-speech tagging, wherein the training sample set includes at least one sample text; The first obtaining module is configured to input the training sample set into the feature extraction layer of the initial entity extraction model to obtain the character features corresponding to each sample text in the training sample set. The first training module is configured to adjust the model parameters of the initial entity extraction model based on the character features, the entity features, and the part-of-speech features, and then return to execute the operation steps of obtaining the training sample set until the training stop condition is met, thereby obtaining the trained entity extraction model.

16. An entity relation extraction device, characterized in that, include: The second obtaining module is configured to input the text to be extracted into the entity extraction model to obtain each target entity included in the text to be extracted and the corresponding entity annotation information, wherein the entity extraction model is trained by the training method of the entity extraction model according to any one of claims 1-7. The third acquisition module is configured to input the target entities and their corresponding entity annotation information into the relationship extraction model to obtain the target entity relationship between the target entities.

17. A computing device, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that, When the processor executes the instructions, it implements the steps of the training method for the entity extraction model according to any one of claims 1-7, or the steps of the entity relation extraction method according to any one of claims 8-14.

18. A computer-readable storage medium storing computer instructions, characterized in that, When executed by the processor, this instruction implements the steps of the training method for the entity extraction model according to any one of claims 1-7, or the steps of the entity relation extraction method according to any one of claims 8-14.

Citation Information

Patent Citations

  • Information extraction method and device, computer equipment and computer readable storage medium

    CN110162749A

  • Information extraction model training method and device, and information extraction method and device

    CN110765774A