Named entity recognition method, device, electronic device and medium using dictionary knowledge
By obtaining text context representation and entity dictionary matching, using a combination of bidirectional gated cyclic units and conditional random fields, the named entity recognition results are generated, which solves the dependence on domain knowledge and manual annotation in the existing technology and improves named entity recognition. performance.
Patent Information
- Application Number
- CN202210016537.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-07
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-01-07
AI Technical Summary
Existing named entity recognition methods require a large amount of domain knowledge and manual annotation, rely heavily on annotated sentences, and perform poorly in identifying entities that are rare or do not appear in labeled data.
By obtaining the context representation of the text and matching the entity dictionary, a bidirectional gated recurrent unit is used to generate the latent vector representation of the entity, and combined with the conditional random field for joint decoding and classification, the named entity recognition result is generated.
It reduces the dependence on domain knowledge and manual annotation and improves the performance of named entity recognition, especially in identifying rare entities.
Smart Images

Figure CN114492440B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of named entity recognition, and in particular to a method, device, electronic device and medium for named entity recognition using dictionary knowledge. Background Art
[0002] Named entity recognition is to extract various required categories of named entities from a text sequence, such as names of people, places, organizations, etc. For example, in the sentence "Jordan went to Jordan to give a speech", the named entity recognition task needs to extract the named entity "Jordan" and the named entity "Jordan" from the sentence. Named entity recognition is an important upstream task in the field of natural language processing. It is the basis for tasks such as relationship extraction and entity alignment, and is also a prerequisite for subsequent construction of knowledge graphs and reasoning. Therefore, the attention paid to the named entity recognition task is increasing year by year.
[0003] Named entity recognition is usually modeled as a sequence labeling problem. Many traditional named entity recognition methods are based on statistical sequence modeling methods, such as HMM (Hidden Markov Model) and CRF (Conditional Random Field). Usually, the core problem of these methods is how to construct feature vectors for each word, and these features are traditionally constructed through manual feature engineering. For example, word relevance, place names dictionary and prediction history, etc., combined with vocabulary embeddings learned by graph models to enhance the representation of words. Designing these hand-crafted features usually requires a lot of domain knowledge. In addition, feature vectors may be very sparse and their dimensionality may be large.
[0004] In recent years, many neural network-based named body recognition methods have been proposed. For example, the related art proposes to use LSTM (Long Short-Term Memory) to learn the contextual representation of each token in a sentence based on the global context, and use CRF for joint label decoding; for another example, the related art also proposes to use CNN (Convolutional Neural Network) to learn word representations from raw characters, and then use Bi-LSTM (Bidirectional Long Short-Term Memory Network) to learn contextual word representations; for another example, the related art also combines the CNN-LSTM framework with CRF to obtain better performance; for another example, a semi-supervised method called TagLM provides contextualized word representations by pre-training a language model on a large corpus; for another example, a bidirectional pre-trained language model called BERT (Bidirectional Encoder Representations from Transformers) is proposed in the related art, which can achieve accurate modeling of context by using deep Transformers, thereby enhancing the ability of downstream tasks such as named body recognition. However, these neural network-based methods heavily rely on labeled sentences to train named entity recognition models, requiring a large amount of manual annotation. In addition, their performance in recognizing entities that rarely or never appear in labeled data is usually unsatisfactory.
[0005] Among them, many large entity dictionaries are readily available and can be easily obtained from knowledge bases and web pages. These entity dictionaries contain popular and rare entity names, which can provide important information for named entity recognition models to identify these entity names. There are few studies on incorporating entity dictionaries into named entity recognition, most of which are based on dictionary matching features. Related technologies propose to combine dictionary matching features with embedding features and LSTM outputs. However, in many cases, entities are context-dependent. Directly applying entity dictionaries to named entity recognition without considering the context is not optimal.
[0006] Application Contents
[0007] The present application provides a method, device, electronic device and medium for named entity recognition using dictionary knowledge to solve the problems that a large amount of domain knowledge and manual annotation are usually required when recognizing named entities, and that a named entity recognition model is heavily dependent on annotated sentences to train the named entity recognition model.
[0008] The first aspect of the present application provides a method for identifying named entities using dictionary knowledge, comprising the following steps:
[0009] Get contextual representation of text data in the text;
[0010] Matching entities of the text using an entity dictionary to obtain latent vector representations of the matching entities; and
[0011] Based on the context representation and the latent vector representation, a representation of the text-joint entity and a representation of the entity-joint context are obtained to generate a named entity recognition result.
[0012] According to one embodiment of the present invention, before obtaining the context representation of the text data in the text, the method further includes:
[0013] The text data set is preprocessed, and the text is divided into sentences and converted into a first character sequence.
[0014] According to one embodiment of the present invention, the step of obtaining a contextual representation of text data in a text includes:
[0015] Finding vector representations of text characters of the first character sequence based on the character vector embedding matrix;
[0016] Context modeling is performed on the vector representation to obtain the context representation.
[0017] According to one embodiment of the present invention, before matching the matching entities of the text using the entity dictionary, the method further includes:
[0018] The text data set is matched with an entity dictionary, and the matched entities are converted into a second character sequence.
[0019] According to an embodiment of the present invention, the matching entity of the text is matched by using an entity dictionary to obtain a latent vector representation of the matching entity, including:
[0020] A bidirectional gated recurrent unit model is performed on the second character sequence, and the first and last character vectors are concatenated to obtain a latent vector representation of the entity.
[0021] According to an embodiment of the present invention, the step of acquiring a text-joint entity representation and an entity-joint context representation based on the context representation and the latent vector representation to generate a named entity recognition result includes:
[0022] Using the conditional random field to decode the label using the following text representation and the latent vector representation, the predicted entity is obtained, and the loss function of the current text entity annotation is obtained;
[0023] The representations obtained by entity joint text training are classified to obtain the loss function of the entity classification task, and the total loss function is obtained by weighted superposition with the loss function of the entity annotation.
[0024] According to the named entity recognition method using dictionary knowledge in the embodiment of the present application, the contextual representation of the text data in the text is obtained and the text entity is matched using the entity dictionary to obtain the latent vector representation of the matching entity; and the representation of the text joint entity and the entity joint context are obtained based on the contextual representation and the latent vector representation to generate the named entity recognition result. Thus, the problems that a large amount of domain knowledge and manual annotation are usually required when identifying named entities, and the named entity recognition model is heavily dependent on annotated sentences, etc., are solved. By adopting multiple models to obtain the contextual representation of the words in the text and using a bidirectional gated recurrent unit to perform word-level modeling on the matching entity to obtain the representation of the entity, the performance of named entity recognition is improved by jointly learning the representation of text and entity.
[0025] The second aspect of the present application provides a device for identifying named entities using dictionary knowledge, including:
[0026] An acquisition module, used to obtain contextual representation of text data in the text;
[0027] A matching module, configured to match matching entities of the text using an entity dictionary, and obtain a latent vector representation of the matching entity; and
[0028] The recognition module is used to obtain the representation of the text-joint entity and the representation of the entity-joint context based on the context representation and the latent vector representation, and generate a named entity recognition result.
[0029] According to an embodiment of the present invention, before obtaining the context representation of the text data in the text, the obtaining module is further used to:
[0030] The text data set is preprocessed, and the text is divided into sentences and converted into a first character sequence.
[0031] According to an embodiment of the present invention, the acquisition module is specifically used to:
[0032] Finding vector representations of text characters of the first character sequence based on the character vector embedding matrix;
[0033] Context modeling is performed on the vector representation to obtain the context representation.
[0034] According to one embodiment of the present invention, before using the entity dictionary to match the matching entity of the text, the matching module is further used to:
[0035] The text data set is matched with an entity dictionary, and the matched entities are converted into a second character sequence.
[0036] According to an embodiment of the present invention, the matching module is specifically used for:
[0037] A bidirectional gated recurrent unit model is performed on the second character sequence, and the first and last character vectors are concatenated to obtain a latent vector representation of the entity.
[0038] According to one embodiment of the present invention, the identification module is specifically used for:
[0039] Using the conditional random field to decode the label using the following text representation and the latent vector representation, the predicted entity is obtained, and the loss function of the current text entity annotation is obtained;
[0040] The representations obtained by entity joint text training are classified to obtain the loss function of the entity classification task, and the total loss function is obtained by weighted superposition with the loss function of the entity annotation.
[0041] According to the named entity recognition device using dictionary knowledge in the embodiment of the present application, the contextual representation of text data in the text is obtained and the text entity is matched using the entity dictionary to obtain the latent vector representation of the matching entity; and the representation of the text joint entity and the entity joint context are obtained based on the contextual representation and the latent vector representation to generate the named entity recognition result. Thus, the problems that a large amount of domain knowledge and manual annotation are usually required when identifying named entities, and the named entity recognition model is heavily dependent on annotated sentences, etc., are solved. By adopting multiple models to obtain the contextual representation of the words in the text and using a bidirectional gated recurrent unit to perform word-level modeling on the matching entity to obtain the representation of the entity, the performance of named entity recognition is improved by jointly learning the representation of text and entity.
[0042] The third aspect of the present application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for named entity recognition using dictionary knowledge as described in the above embodiment.
[0043] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method for naming entity recognition using dictionary knowledge as described in the above embodiment.
[0044] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0046] Figure 1A flowchart of a method for identifying named entities using dictionary knowledge provided according to an embodiment of the present application;
[0047] Figure 2 It is an interactive schematic diagram of a method for identifying named entities using dictionary knowledge according to a specific embodiment of the present application;
[0048] Figure 3 This is an example diagram of a named entity recognition device using dictionary knowledge provided according to an embodiment of the present application.
[0049] Figure 4 It is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0050] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0051] The following describes a method, device, electronic device, and medium for identifying named entities using dictionary knowledge according to an embodiment of the present application with reference to the accompanying drawings.
[0052] In view of the problem mentioned in the background technology center that a large amount of domain knowledge and manual annotation are usually required when identifying named entities, and the named entity recognition model is heavily dependent on annotated sentences to train the named entity recognition model, the present application provides a named entity recognition method using dictionary knowledge, in which the contextual representation of text data in the text is obtained and the text entity is matched using the entity dictionary to obtain the latent vector representation of the matching entity; and the text joint entity representation and the entity joint context representation are obtained based on the contextual representation and the latent vector representation to generate the named entity recognition result. Thus, the problem that a large amount of domain knowledge and manual annotation are usually required when identifying named entities, and the named entity recognition model is heavily dependent on annotated sentences, etc., is solved. By adopting multiple models to obtain the contextual representation of the words of the text and using a bidirectional gated recurrent unit to perform word-level modeling on the matching entity to obtain the representation of the entity, the performance of named entity recognition is improved by jointly learning the representation of text and entity.
[0053] Specifically, Figure 1 A flowchart of a method for name recognition using dictionary knowledge provided in an embodiment of the present application.
[0054] like Figure 1 As shown, the method for identifying named entities using dictionary knowledge includes the following steps:
[0055] In step S101 , a context representation of text data in a text is obtained.
[0056] Further, in some embodiments, obtaining a contextual representation of text data in a text includes: searching for vector representations of text characters of a first character sequence based on a character vector embedding matrix;
[0057] The context of the vector representation is modeled to obtain the contextual representation.
[0058] Furthermore, in some embodiments, before obtaining the context representation of the text data in the text, it also includes: preprocessing the text data set, and dividing the text into sentences and converting it into a first character sequence.
[0059] Specifically, embodiments of the present application may use a character vector embedding matrix to search for the vector representation of the text character, such as using a character-level neural network (such as long short-term memory (LSTM), etc., or using a character-level pre-trained language model, such as BERT) to learn the latent vector representation of the text character based on the context of the character.
[0060] Among them, the long short-term memory network (LSTM) is a commonly used model for sequence modeling, which can learn global information; the convolutional neural network (CNN) can focus on local information, which is very important for entity recognition; the pre-trained language model is an excellent model proposed in recent years for modeling text sequences to obtain latent vector representation.
[0061] Specifically, if Figure 2 As shown, in the embodiment of the present invention, for a character sequence [w1, w2, ..., w N ], it is necessary to model the latent vector representation of the local information of the text.
[0062] Through this step, each character is embedded in the character lookup table is mapped to a low-dimensional vector, where V is the vocabulary size and D is the embedding dimension. During model training, the parameters of the character embedding lookup table can be trained. The text character sequence is converted to a vector sequence [e1,e2,…,e N ]. The next layer is the latent vector calculation of the embedding vector. Taking BERT as an example, for the input vector [e1,e2,…,e N ] After 12 layers of transformer self-attention encoder, the output latent vector sequence [r1,r2,…,r N ].
[0063] In step S102, matching entities of the text are matched using the entity dictionary to obtain latent vector representations of the matching entities.
[0064] Furthermore, in some embodiments, matching entities of the text are matched using an entity dictionary to obtain a latent vector representation of the matching entity, including: performing bidirectional gated recurrent unit modeling on the second character sequence, and concatenating the first and last character vectors to obtain a latent vector representation of the entity.
[0065] Furthermore, in some embodiments, before matching entities of text using an entity dictionary, the method further includes: matching the entity dictionary on the text dataset, and converting the matched entities into a second character sequence.
[0066] Specifically, the embodiment of the present application can use the entity dictionary to match in the text to obtain the matching entity; for the matching entity i, split it into a character sequence [w i1 , w i2 , ..., w iG ], the character sequence is embedded in the character lookup table Mapped to a low-dimensional vector, and then obtain the vector sequence [e i1 ,e i2 ,…,e iG ]. The embodiment of the present application applies a character-level bidirectional gated recurrent unit (BI-GRU) network to the character embedding sequence of each character to learn a hidden character representation. The GRU layer scans the character embedding sequence of the entity in two directions and merges the last hidden states in the two directions as the representation of the entity. For the i-th item, denoted as t i In the embodiment of the present application, M matching entities are represented as [t1, t2, ..., t M ]. In the embodiment of the present application, a latent vector representation of the entity is obtained.
[0067] In step S103, the representation of the text-joint entity and the representation of the entity-joint context are obtained based on the context representation and the latent vector representation, and a named entity recognition result is generated.
[0068] Furthermore, in some embodiments, representations of text-joint entities and representations of entity-joint contexts are obtained based on context representations and latent vector representations to generate named entity recognition results, including: using conditional random fields to decode labels using the text's context representations and latent vector representations to obtain predicted entities, and obtaining the loss function of the current text entity annotation; classifying the representations obtained from entity-joint text training to obtain the loss function of the entity classification task, and weightedly superimposing them with the loss function of the entity annotation to obtain the total loss function.
[0069] Among them, the predicted entity is obtained by using the conditional random field, and the loss function of the current text entity annotation is obtained; the classification network is used to classify the latent vector representation of the entity combined with the representation of the entity joint context, and the loss function of the auxiliary entity classification task is obtained and weightedly superimposed with the loss function of the entity annotation to obtain the total loss function.
[0070] Specifically, the embodiment of the present application can use the attention mechanism network to represent the context of the text R = [r1, r2, ..., r N ] and the representation of the matching entity T = [t1, t2, …, t M ] to perform joint modeling and obtain the representation of text joint entities D = [d1, d2, …, d N ] and the entity joint context representation C = [c1,c2,…,c M ]; Use conditional random fields to utilize the contextual representation of the text in combination with the representation of the text joint entity to decode the label, obtain the predicted entity, and obtain the loss function of the current text entity annotation; Use a classification network to classify the latent vector representation of the entity in combination with the representation of the entity joint context, and obtain the loss function of the auxiliary entity classification task.
[0071] Specifically, if Figure 2 As shown, the embodiment of the present application can first use a multi-head attention mechanism to learn the joint representation of text and entity. The output text representation is denoted as D, and the representation obtained by the i-th head is denoted as D i , Respectively represent the query, key and value obtained by the i-th head.
[0072]
[0073] D = Concat(D 1 ,D 2 ,…,D h );
[0074] In the above formula, h represents the number of heads of multi-head attention. Similarly, the output entity representation is denoted as C, and the representation obtained by the i-th head is denoted as C i , Respectively represent the query, key and value obtained by the i-th head.
[0075]
[0076] C = Concat(C 1 ,C 2 ,…,C h );
[0077] Then, the following representation of the text obtained in step S101 and the representation obtained by the joint dictionary obtained in step S103 are concatenated to obtain a character with more comprehensive information.
[0078] Indicates h j =[d j ; r j The embodiment of the present application uses the character representation h=[h1,h2,…,h N ] Calculate the score of the character sequence corresponding to each label sequence y.
[0079]
[0080] U i =W U h i +b U ,
[0081] Among them, s(x,y) is the total score of candidate sequence y, U i is to mark the i-th character as y i The score, Assign two consecutive labels to y i and i+1 The transfer score, W U ,b U and A are the parameters of the conditional random field model.
[0082] The probability of labeling the text sequence x as the label sequence y is calculated as:
[0083]
[0084] Among them, Y is the set of all candidate labels.
[0085] Therefore, the loss function of the named entity recognition task can be obtained in the embodiment of the present application as follows:
[0086]
[0087] Where X is the set of all texts.
[0088] Finally, the embodiment of the present application uses a fully connected layer to perform the classification task.
[0089]
[0090] in, is the predicted label, U and v are the parameters to be learned.
[0091] The loss function for this task is:
[0092]
[0093] Among them, X is the set of all texts, M is the number of entity matches, and K is the number of entity categories. The above represents the cross entropy loss function.
[0094] The final loss function of the embodiment of the present application is the weighted sum of the two loss functions.
[0095]
[0096] Among them, λ is a controllable hyperparameter.
[0097] In this embodiment of the application, the loss function is optimized by Adam optimizer To optimize and train the model of the embodiment of the present application.
[0098] In the prediction stage, the entity dictionary is first matched in the text, and the neural network calculation is performed. Finally, the highest label sequence in p(y|x) is selected as the named entity recognition result of the text.
[0099] Therefore, we learn context-aware dictionary knowledge by modeling the interaction between entities in the dictionary and their context through context dictionary attention, and propose an auxiliary entity classification task to predict the type of matching entities, and jointly train this task with the named entity recognition model to integrate context and dictionary knowledge into named entity recognition. This method has been proven to effectively improve the performance of various named entity recognition models.
[0100] According to the named entity recognition method using dictionary knowledge in the embodiment of the present application, the contextual representation of the text data in the text is obtained and the text entity is matched using the entity dictionary to obtain the latent vector representation of the matching entity; and the representation of the text joint entity and the entity joint context are obtained based on the contextual representation and the latent vector representation to generate the named entity recognition result. Thus, the problems that a large amount of domain knowledge and manual annotation are usually required when identifying named entities, and the named entity recognition model is heavily dependent on annotated sentences, etc., are solved. By adopting multiple models to obtain the contextual representation of the words in the text and using a bidirectional gated recurrent unit to perform word-level modeling on the matching entity to obtain the representation of the entity, the performance of named entity recognition is improved by jointly learning the representation of text and entity.
[0101] Next, a named entity recognition device using dictionary knowledge proposed in an embodiment of the present application is described with reference to the accompanying drawings.
[0102] Figure 3 It is a block diagram of a named entity recognition device using dictionary knowledge according to an embodiment of the present application.
[0103] like Figure 3As shown, the named entity recognition device 10 using dictionary knowledge includes: an acquisition module 100 , a matching module 200 , and a recognition module 300 .
[0104] Wherein, the acquisition module 100 is used to obtain the contextual representation of the text data in the text;
[0105] The matching module 200 is used to match the matching entity of the text using the entity dictionary to obtain the latent vector representation of the matching entity;
[0106] The recognition module 300 is used to obtain the representation of the text-joint entity and the representation of the entity-joint context based on the context representation and the latent vector representation, and generate a named entity recognition result.
[0107] Furthermore, in some embodiments, before obtaining the context representation of the text data in the text, the obtaining module 100 is further used to:
[0108] Preprocess the text dataset and divide the text into sentences and convert them into first character sequences.
[0109] Furthermore, in some embodiments, the acquisition module 100 is specifically configured to:
[0110] Finding vector representations of text characters of a first character sequence based on the character vector embedding matrix;
[0111] The context of the vector representation is modeled to obtain the contextual representation.
[0112] Furthermore, in some embodiments, before matching entities of text using the entity dictionary, the matching module 200 is further configured to:
[0113] The text dataset is matched with the entity dictionary and the matched entities are converted into a second character sequence.
[0114] Furthermore, in some embodiments, the matching module 200 is specifically configured to:
[0115] A bidirectional gated recurrent unit is used to model the second character sequence, and the first and last character vectors are concatenated to obtain the latent vector representation of the entity.
[0116] Furthermore, in some embodiments, the identification module 300 is specifically configured to:
[0117] Use the conditional random field to decode the label using the text's context representation and latent vector representation, get the predicted entity, and obtain the loss function of the current text entity annotation;
[0118] Classify the representations obtained from entity joint text training, obtain the loss function of the entity classification task, and add the weighted superposition with the loss function of entity annotation to obtain the total loss function.
[0119] According to the named entity recognition device using dictionary knowledge in the embodiment of the present application, the contextual representation of text data in the text is obtained and the text entity is matched using the entity dictionary to obtain the latent vector representation of the matching entity; and the representation of the text joint entity and the entity joint context are obtained based on the contextual representation and the latent vector representation to generate the named entity recognition result. Thus, the problems that a large amount of domain knowledge and manual annotation are usually required when identifying named entities, and the named entity recognition model is heavily dependent on annotated sentences, etc., are solved. By adopting multiple models to obtain the contextual representation of the words in the text and using a bidirectional gated recurrent unit to perform word-level modeling on the matching entity to obtain the representation of the entity, the performance of named entity recognition is improved by jointly learning the representation of text and entity.
[0120] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0121] Memory 401 , processor 402 , and a computer program stored in the memory 401 and executable on the processor 402 .
[0122] When the processor 402 executes the program, the method for identifying named entities using dictionary knowledge provided in the above embodiment is implemented.
[0123] Furthermore, the electronic device further comprises:
[0124] The communication interface 403 is used for communication between the memory 401 and the processor 402 .
[0125] The memory 401 is used to store computer programs that can be executed on the processor 402 .
[0126] The memory 401 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0127] If the memory 401, the processor 402 and the communication interface 403 are implemented independently, the communication interface 403, the memory 401 and the processor 402 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0128] Optionally, in a specific implementation, if the memory 401, the processor 402 and the communication interface 403 are integrated on a chip, the memory 401, the processor 402 and the communication interface 403 can communicate with each other through an internal interface.
[0129] The processor 402 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0130] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method for identifying named entities using dictionary knowledge as described above is implemented.
[0131] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0132] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0133] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0134] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.
[0135] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0136] A person skilled in the art may understand that all or part of the steps in the above-mentioned embodiment method may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0137] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0138] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for identifying named entities using dictionary knowledge, characterized in that: The following steps are involved: Get contextual representation of text data in the text; Matching entities of the text using an entity dictionary to obtain latent vector representations of the matching entities; and Acquire a text-joint entity representation and an entity-joint context representation based on the context representation and the latent vector representation, and generate a named entity recognition result; Before obtaining the context representation of the text data in the text, the method further includes: preprocessing the text data set, dividing the text into sentences, and converting the text into a first character sequence; The obtaining of the contextual representation of the text data in the text comprises: searching for the vector representation of the text characters of the first character sequence based on the character vector embedding matrix; performing context modeling on the vector representation to obtain the contextual representation; Before using the entity dictionary to match the matching entity of the text, the method further includes: matching the text data set with the entity dictionary and converting the matched entity into a second character sequence; The matching entity of the text is matched by using the entity dictionary to obtain the latent vector representation of the matching entity, including: performing bidirectional gated recurrent unit modeling on the second character sequence, and concatenating the first and last character vectors to obtain the latent vector representation of the entity; The method of obtaining the representation of the text-joint entity and the representation of the entity-joint context based on the context representation and the latent vector representation to generate a named entity recognition result includes: using a conditional random field to decode the label using the text's context representation and the latent vector representation to obtain a predicted entity, and obtaining a loss function for the current text entity annotation; classifying the representation obtained from the entity-joint text training to obtain a loss function for the entity classification task, and weightedly superimposing it with the loss function for the entity annotation to obtain a total loss function.
2. A named entity recognition device using dictionary knowledge, characterized in that: include: An acquisition module, used to obtain contextual representation of text data in the text; A matching module, used to match matching entities of the text using an entity dictionary, and obtain a latent vector representation of the matching entity; as well as A recognition module, used for obtaining a text-joint entity representation and an entity-joint context representation based on the context representation and the latent vector representation, and generating a named entity recognition result; Before obtaining the context representation of the text data in the text, the acquisition module is further used to: pre-process the text data set, and divide the text into sentences and convert them into a first character sequence; The acquisition module is specifically used to: search for vector representations of text characters of the first character sequence based on a character vector embedding matrix; perform context modeling on the vector representation to obtain the context representation; Before using the entity dictionary to match the matching entity of the text, the matching module is further used to: match the entity dictionary on the text data set and convert the matched entity into a second character sequence; The matching module is specifically used to: perform bidirectional gated recurrent unit modeling on the second character sequence, and concatenate the first and last character vectors to obtain a latent vector representation of the entity; The recognition module is specifically used to: use the conditional random field to decode the label using the context representation of the text and the latent vector representation to obtain the predicted entity, and obtain the loss function of the current text entity annotation; classify the representation obtained by the entity joint text training, obtain the loss function of the entity classification task, and weightedly superimpose it with the loss function of the entity annotation to obtain the total loss function.
3. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for named entity recognition using dictionary knowledge as claimed in claim 1.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method for named entity recognition using dictionary knowledge as claimed in claim 1.
