Named entity recognition method, device, equipment and storage medium

By performing sequence conversion and semantic enhancement on social media texts, a feature matrix is ​​generated, which solves the problem of low accuracy of named entity recognition in short informal texts and improves the recognition effect.

CN113836929BActive Publication Date: 2024-09-24PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111139832.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-28
Publication Date
2024-09-24
Estimated Expiration
2041-09-28

AI Technical Summary

Technical Problem

Existing named entity recognition schemes suffer from low accuracy when faced with short and informal texts, especially user-generated social media content, mainly due to data sparsity issues.

Method used

By performing sequence conversion on the original text, the target input sequence is obtained; the target input sequence is semantically enhanced to obtain the target semantic information; the feature matrix is ​​determined based on the target input sequence and the target semantic information, and then named entity recognition is performed. Specific steps include word segmentation, sequence value conversion, semantic enhancement, feature matrix calculation and multi-head attention mechanism generation.

Benefits of technology

It improves the accuracy of named entity recognition, effectively solves the problem of data sparsity, and enhances the accuracy of text recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000
    Figure 00000000_0000
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence, and discloses a named entity recognition method, device, equipment and storage medium for improving the accuracy of named entity recognition. The named entity recognition method comprises: obtaining an original text to be processed; performing sequence conversion on the original text to obtain a target input sequence; performing semantic enhancement on the target input sequence to obtain target semantic information; determining a feature matrix according to the target input sequence and the target semantic information to obtain a target feature matrix; performing named entity recognition on the original text according to the target feature matrix to obtain a target named entity. In addition, the present invention also relates to blockchain technology, and the target named entity can be stored in a blockchain node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing, and in particular to a named entity recognition method, apparatus, device, and storage medium. Background Technology

[0002] Named entity recognition (NER) refers to the identification of entities with specific meanings in text, mainly including names of people, places, organizations, and proper nouns. It is an important basic tool in application fields such as information extraction, question answering systems, syntactic analysis, and machine translation. In recent years, the increasing popularity of online media such as Weibo has generated a large amount of user data, in which the text is usually very short and the expression is not standard.

[0003] Existing named entity recognition schemes encounter the problem of data sparsity when dealing with short and informal text, especially user-generated social media content, resulting in poor recognition performance and low accuracy. Summary of the Invention

[0004] This invention provides a named entity recognition method, apparatus, device, and storage medium to improve the accuracy of named entity recognition.

[0005] The first aspect of the present invention provides a named entity recognition method, the named entity recognition method comprising: acquiring original text to be processed; performing sequence transformation on the original text to obtain a target input sequence; performing semantic enhancement on the target input sequence to obtain target semantic information; determining a feature matrix based on the target input sequence and the target semantic information to obtain a target feature matrix; and performing named entity recognition on the original text based on the target feature matrix to obtain target named entities.

[0006] Optionally, in a first implementation of the first aspect of the present invention, the step of performing sequence transformation on the original text to obtain a target input sequence includes: segmenting the original text into words to obtain multiple target words; performing sequence value transformation on each target word to obtain a target sequence value corresponding to each target word; and performing sequence format transformation on the target sequence value corresponding to each target word to obtain a target input sequence.

[0007] Optionally, in a second implementation of the first aspect of the present invention, the step of semantically enhancing the target input sequence to obtain target semantic information includes: acquiring word embedding information, sentence information, and position information in the target input sequence; concatenating the word embedding information, the sentence information, and the position information to obtain concatenated information; and inputting the concatenated information into a preset context encoder for semantic enhancement to obtain target semantic information.

[0008] Optionally, in a third implementation of the first aspect of the present invention, the step of determining the feature matrix based on the target input sequence and the target semantic information to obtain the target feature matrix includes: extracting sequence elements from the target input sequence and extracting feature information from the target semantic information; calculating the cosine similarity between the sequence elements and the feature information; and generating the target feature matrix based on the cosine similarity and a preset multi-head attention mechanism.

[0009] Optionally, in a fourth implementation of the first aspect of the present invention, the step of performing named entity recognition on the original text based on the target feature matrix to obtain the target named entity includes: determining the character-level matrix corresponding to the original text based on the target feature matrix; and performing named entity recognition on the original text based on the character-level matrix to obtain the target named entity.

[0010] Optionally, in a fifth implementation of the first aspect of the present invention, determining the character-level matrix corresponding to the original text based on the target feature matrix includes: performing single-label classification on each element of the target feature matrix through a preset fully connected network to obtain an element classification result; and calculating global and local information on the element classification result to obtain a character-level matrix.

[0011] Optionally, in a sixth implementation of the first aspect of the present invention, the step of performing named entity recognition on the original text based on the character-level matrix to obtain a target named entity includes: obtaining the target matrix element corresponding to the character-level matrix; performing category matching on the target matrix element to obtain a target category; and determining the named entity corresponding to the original text based on the target category and the target matrix element to obtain the target named entity.

[0012] A second aspect of the present invention provides a named entity recognition device, the named entity recognition device comprising: an acquisition module for acquiring raw text to be processed; a conversion module for performing sequence conversion on the raw text to obtain a target input sequence; an enhancement module for performing semantic enhancement on the target input sequence to obtain target semantic information; a processing module for determining a feature matrix based on the target input sequence and the target semantic information to obtain a target feature matrix; and a recognition module for performing named entity recognition on the raw text based on the target feature matrix to obtain target named entities.

[0013] Optionally, in the first implementation of the second aspect of the present invention, the conversion module is specifically used for: segmenting the original text to obtain multiple target words; performing sequence value conversion on each target word to obtain a target sequence value corresponding to each target word; and performing sequence format conversion on the target sequence value corresponding to each target word to obtain a target input sequence.

[0014] Optionally, in a second implementation of the second aspect of the present invention, the enhancement module is specifically used to: obtain word embedding information, sentence information and position information in the target input sequence; concatenate the word embedding information, the sentence information and the position information to obtain concatenated information; and input the concatenated information into a preset context encoder for semantic enhancement to obtain target semantic information.

[0015] Optionally, in a third implementation of the second aspect of the present invention, the processing module is specifically used to: extract sequence elements from the target input sequence and extract feature information from the target semantic information; calculate the cosine similarity between the sequence elements and the feature information; and generate a target feature matrix based on the cosine similarity and a preset multi-head attention mechanism.

[0016] Optionally, in a fourth implementation of the second aspect of the present invention, the recognition module further includes: a configuration unit, configured to determine the character-level matrix corresponding to the original text based on the target feature matrix; and a generation unit, configured to perform named entity recognition on the original text based on the character-level matrix to obtain the target named entity.

[0017] Optionally, in a fifth implementation of the second aspect of the present invention, the configuration unit is specifically used to: perform single-label classification on each element of the target feature matrix through a preset fully connected network to obtain an element classification result; and perform global and local information calculations on the element classification result to obtain a word-level matrix.

[0018] Optionally, in a sixth implementation of the second aspect of the present invention, the generation unit is specifically used to: obtain the target matrix element corresponding to the word-level matrix; perform category matching on the target matrix element to obtain the target category; and determine the named entity corresponding to the original text based on the target category and the target matrix element to obtain the target named entity.

[0019] A third aspect of the present invention provides a named entity recognition device, comprising: a memory and at least one processor, wherein the memory stores a computer program; the at least one processor invokes the computer program in the memory to cause the named entity recognition device to perform the named entity recognition method described above.

[0020] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the aforementioned named entity recognition method.

[0021] The technical solution provided by this invention involves: performing sequence transformation on the original text to obtain a target input sequence; performing semantic enhancement on the target input sequence to obtain target semantic information, which strengthens the semantic connections in the original text, thereby improving the accuracy of text recognition; determining a feature matrix based on the target input sequence and target semantic information to obtain a target feature matrix; and performing named entity recognition on the original text based on the target feature matrix to obtain target named entities. This invention improves the accuracy of named entity recognition by semantically enhancing the original text. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of one embodiment of the named entity recognition method in this invention;

[0023] Figure 2 This is a schematic diagram of another embodiment of the named entity recognition method in this invention;

[0024] Figure 3 This is a schematic diagram of one embodiment of the named entity recognition device in this invention;

[0025] Figure 4 This is a schematic diagram of another embodiment of the named entity recognition device in this invention;

[0026] Figure 5 This is a schematic diagram of one embodiment of the named entity recognition device in this invention. Detailed Implementation

[0027] This invention provides a named entity recognition method, apparatus, device, and storage medium to improve the accuracy of named entity recognition. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 The first embodiment of the named entity recognition method in this invention includes:

[0029] 101. Obtain the raw text to be processed;

[0030] It is understood that the executing entity of this invention can be a named entity recognition device, a terminal, or a server, and is not specifically limited here. This embodiment of the invention uses a server as an example for illustration. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0031] This invention can acquire and process relevant data based on artificial intelligence (AI) technology. AI utilizes digital computers or computer-controlled machines to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to achieve optimal results. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly include computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0032] Specifically, the server retrieves the raw text to be processed from pre-set social media data. This pre-set social media data includes multiple user data sets, which contain user-input text data (i.e., the raw text). The server searches for the keywords entered by the user, retrieving the text containing those keywords, thus obtaining the raw text. The data format of the raw text is unrestricted; any structured or unstructured data can be input.

[0033] 102. Perform sequence transformation on the original text to obtain the target input sequence;

[0034] Specifically, the server's sequence transformation process includes: the server converting multiple words in the original text into sequence values, and the server generating the target input sequence based on the sequence values.

[0035] For example, when the original text is "Zhang San went swimming at the beach", the server performs word segmentation and obtains the word segmentation results as "Zhang San", "beach", and "swimming". The server then converts the multiple words obtained from the word segmentation into the sequence value corresponding to each word: the sequence value corresponding to "Zhang San" is 3, the sequence value corresponding to "beach" is 5, and the sequence value corresponding to "swimming" is 4. Finally, the server generates the target input sequence [3,5,4] according to the text order of the original text "Zhang San went swimming at the beach".

[0036] 103. Perform semantic enhancement on the target input sequence to obtain target semantic information;

[0037] Specifically, the server extracts key information from the target input sequence and then performs semantic enhancement. Semantic enhancement can achieve more accurate named entity recognition. Specifically, the key information can be concatenated to generate word vectors. The concatenation process includes the server concatenating the 1×1×a vector and the 1×1×b vector from the key information into a 1×1×(a+b) vector.

[0038] 104. Determine the feature matrix based on the target input sequence and target semantic information to obtain the target feature matrix;

[0039] Specifically, the process of the server determining the feature matrix includes: the server calculating the cosine similarity, and the server determining the feature matrix based on the cosine similarity. Specifically, when the target semantic information is a×a×M and the target input sequence is [N], the server determines the feature matrix to be N×M. Here, N character vectors can generate an N×M word segmentation tensor. When a = 1, i.e., when the character vectors are 1×1×M vectors, the N×M word segmentation tensor is the N×M target feature matrix.

[0040] 105. Based on the target feature matrix, perform named entity recognition on the original text to obtain the target named entities.

[0041] Specifically, when the server performs named entity recognition, it performs single-label classification on each element in the target feature matrix. The horizontal and vertical coordinates of each element correspond to the beginning and end positions of the potential entity in the sentence, respectively. The server captures the local and global information of the matrix elements in the target feature matrix through a pre-set encoding layer and a pre-set segmentation layer. When the total number of categories is c+1, such as the entity type being a person's name, place name, organization name, and time, then c=4. The extra category represents that it is not an entity and is equivalent to the background class in image semantic segmentation.

[0042] Furthermore, the server stores the target named entity in a blockchain database, the specifics of which are not limited here.

[0043] In this embodiment of the invention, the target input sequence is obtained by performing sequence transformation on the original text; semantic enhancement is then performed on the target input sequence to obtain target semantic information. The semantic enhancement operation strengthens the connections between semantic elements in the original text, thereby improving the accuracy of text recognition. This invention improves the accuracy of named entity recognition by semantically enhancing the original text.

[0044] Please see Figure 2 The second embodiment of the named entity recognition method in this invention includes:

[0045] 201. Obtain the raw text to be processed;

[0046] The specific implementation of step 201 in this embodiment is similar to that of step 101, and will not be repeated here.

[0047] 202. Perform sequence transformation on the original text to obtain the target input sequence;

[0048] Specifically, the server segments the original text to obtain multiple target words; the server performs sequence value conversion on each target word to obtain the target sequence value corresponding to each target word; the server performs sequence format conversion on the target sequence value corresponding to each target word to obtain the target input sequence.

[0049] The server identifies the text order of the original text and segments it into words according to the text order to obtain multiple target words in the original text. When the original text is "Li Si is singing on the mountaintop", the server segments the original text into three target words: "Li Si", "mountaintop", and "singing" according to the text order. The text order is the order in which the words in the original text appear from left to right. The server sorts the words according to the frequency of their use in the original text, that is, each word corresponds to an order value. This order value is the sequence value corresponding to each word. The server then converts multiple target words into sequence values. The target sequence value corresponding to "Li Si" is 4, the target sequence value corresponding to "mountaintop" is 3, and the target sequence value corresponding to "singing" is 2. The server performs sequence format conversion according to the text order. The server performs sequence format conversion, which is to convert the sequence value corresponding to each word in the original text into a sequence representation in two-dimensional space. Therefore, the target input sequence generated by the server is [4,3,2].

[0050] 203. Perform semantic enhancement on the target input sequence to obtain target semantic information;

[0051] Specifically, the server extracts word embedding information, sentence information, and positional information from the target input sequence; the server concatenates the word embedding information, sentence information, and positional information to obtain concatenated information; the server inputs the concatenated information into a pre-set context encoder for semantic enhancement to obtain target semantic information.

[0052] The server's process of extracting word embedding information, sentence information, and location information specifically includes: the server first classifies the location information according to an untrained classifier to obtain the location information. The untrained classifier refers to the context encoder used to detect the location information in the target input sequence. The context encoder consists of three parts: a context encoder, a multi-scale decoder, and a discriminator. The context encoder is built on the basis of a residual network structure and fills the gaps through an attention transfer network. The server determines word embeddings in the target input sequence based on location information. Word embeddings are real vectors that map words or phrases in the vocabulary to a low-dimensional space relative to the continuous space of the vocabulary. The server determines the word embeddings of all words in the target input sequence. Based on location information and word vectors, the server performs one-hot encoding on words at different positions (e.g., the first word is labeled as 1000, or expressed using the period of sine and cosine), and sentence information for all words. The sentence information is encoded by the context decoder by inputting keywords and input information into a long short-term memory network, resulting in encoded information sequences corresponding to keywords and input information. The server uses an attention model to determine the weights when generating the information sequence corresponding to the target keyword from the encoded information sequences corresponding to the keywords and input information. The server weights the encoded information sequences corresponding to the keywords and input information according to the determined weights. The server decodes the weighted encoded information sequences through the long short-term memory network to generate the target keyword, and then weights the encoded information sequences corresponding to the target keyword and input information. Finally, the server decodes the weighted encoded information sequences through the long short-term memory network to obtain the sentence information. The server performs the concatenation in the order of word embedding information, sentence information, and positional information. The contribution of the enhanced target semantic information to the named entity recognition task may vary in different contexts. Therefore, this invention uses a reset gate to control the information flow for semantic enhancement. Specifically, the semantic enhancement involves:

[0053] g=σ(W1·h i +W2·v i +b g );

[0054] Where σ is the sigmoid function, W1 and W2 are trainable matrices, and b g The corresponding bias term is used, and the information from the context encoder and semantic enhancement module is balanced using the following formula:

[0055]

[0056] Among them, u i For the output of the gate module, This represents element-wise multiplication.

[0057] 204. Determine the feature matrix based on the target input sequence and target semantic information to obtain the target feature matrix;

[0058] Specifically, the server extracts sequence elements from the target input sequence and extracts feature information from the target semantic information; calculates the cosine similarity between the sequence elements and the feature information; and generates the target feature matrix based on the cosine similarity and a pre-set multi-head attention mechanism.

[0059] It should be noted that the pre-configured multi-head attention mechanism involves the server processing the constituent elements in the data source into a series of...<key,value> The data consists of two parts. The server provides the query for each sequence element in the target. The server calculates the similarity or relevance between the query and each key for each sequence element, obtaining the weight coefficient for the value corresponding to each key. The server then performs a weighted summation operation based on these weight coefficients to generate the target feature matrix. The server calculates cosine similarity and determines the feature matrix based on the cosine similarity. Specifically, when the target semantic information is a×a×M and the target input sequence is [N], the server determines the feature matrix to be N×M. Here, N character vectors can generate an N×M word segmentation tensor. When a=1, i.e., the character vectors are 1×1×M vectors, the N×M word segmentation tensor is the N×M target feature matrix.

[0060] 205. Determine the character-level matrix corresponding to the original text based on the target feature matrix;

[0061] Specifically, the server performs single-label classification on each element of the target feature matrix through a pre-configured fully connected network to obtain the element classification result; the server calculates global and local information from the element classification result to obtain a word-level matrix.

[0062] It should be noted that the pre-built fully connected network acts as a "classifier," while the fully connected layers map the learned "distributed feature representations" to the sample label space. Fully connected layers can be transformed into convolutional operations: a fully connected layer preceding a fully connected layer can be converted into a 1x1 convolution; and a fully connected layer preceding a convolutional layer can be converted into a global convolution with an H×W kernel, where H and W are the height and width of the previous convolution result, respectively. For layers n-1 and n, any node in layer n-1 is connected to all nodes in layer n. That is, when each node in layer n performs calculations, the input to the activation function is the weighted sum of all nodes in layer n-1. When the original text contains five target words: "Country A's recent economic situation is good," i.e., n=5, the server can generate an n×m probability matrix based on the pre-built fully connected network. Then, the server uses the probability matrix as input to a conditional random field to perform single-label classification on each element of the target feature matrix, obtaining the element classification result; global and local information are calculated on the element classification result to obtain a word-level matrix. The server extracts local information through the shallow layer of the fully connected network; it extracts global information through the deep layer of the fully connected network, specifically including: the diagonal representing the number of correctly classified elements in each category; the row sum: i.e., the label, the sum of each row represents the total number of elements in that category when all predictions are correct, which is the element classification result of that category in the label; and the column sum: i.e., the prediction, the sum of each column represents how many single-label elements the model predicts as element categories for that category. The server extracts local information through the shallow layer of the fully connected network and global information through the deep layer of the fully connected network, obtaining a word-level matrix. For example, in the global and local information, "Country A" is identified as an organization name, while "recent years," "economy," "situation," and "good" are all identified as non-named entities.

[0063] 206. Named entity recognition is performed on the original text based on the character-level matrix to obtain the target named entity.

[0064] Specifically, the server obtains the target matrix elements corresponding to the word-level matrix; the server performs category matching on the target matrix elements to obtain the target category; the server determines the named entity corresponding to the original text based on the target category and the target matrix elements to obtain the target named entity.

[0065] In this process, the server categorizes the elements of the target matrix according to preset categories during category matching to obtain the target category. The horizontal and vertical coordinates of each element correspond to the start and end positions of the potential entity in the sentence, respectively. The server captures local and global information of the matrix elements in the target feature matrix through preset encoding and segmentation layers, thus determining the target named entity. Furthermore, on multiple datasets, models using semantic enhancement modules consistently outperformed models without them. The server's semantically enhanced named entity recognition effectively addresses the data sparsity problem, thereby improving the accuracy of named entity recognition.

[0066] It should be noted that the server determines the target named entity based on the category and coordinate value of each element in the word-level matrix. When the matrix coordinates (2,1) and (2,3) represent a place name and an organization name respectively, the x-coordinate (2,1) indicates the start position of the entity, and the y-coordinate indicates the end position. Based on the start and end positions, the target named entity "City B" can be located as a place name in the sentence. The parsing method for coordinate (2,3) is the same. Since the end position of the entity cannot be before the start position, the entity coordinates cannot appear in the lower triangular area of ​​the matrix. Determining the target named entity through the word-level matrix reduces misidentification and also reduces the computational cost of the loss function.

[0067] Furthermore, the server stores the target named entity in a blockchain database, the specifics of which are not limited here.

[0068] In this embodiment of the invention, a pre-configured fully connected network is used to perform single-label classification on each element of the target feature matrix to obtain element classification results. Global and local information are calculated on the element classification results to obtain a character-level matrix. Named entity recognition is then performed on this character-level matrix to improve the accuracy of named entity recognition. This invention effectively solves the problem of data sparsity through semantically enhanced named entity recognition, saving the cost of labeled data.

[0069] The named entity recognition method in the embodiments of the present invention has been described above. The named entity recognition device in the embodiments of the present invention will be described below. Please refer to [link / reference]. Figure 3 The first embodiment of the named entity recognition device in this invention includes:

[0070] Module 301 is used to acquire the raw text to be processed;

[0071] The conversion module 302 is used to perform sequence conversion on the original text to obtain the target input sequence;

[0072] Enhancement module 303 is used to perform semantic enhancement on the target input sequence to obtain target semantic information;

[0073] Processing module 304 is used to determine a feature matrix based on the target input sequence and the target semantic information to obtain a target feature matrix;

[0074] The recognition module 305 is used to perform named entity recognition on the original text based on the target feature matrix to obtain the target named entity.

[0075] In this embodiment of the invention, the original text is sequence-transformed to obtain a target input sequence; semantic enhancement is performed on the target input sequence to obtain target semantic information. This semantic enhancement strengthens the connections between semantic elements in the original text, thereby improving the accuracy of text recognition; a feature matrix is ​​determined based on the target input sequence and the target semantic information to obtain a target feature matrix; and named entity recognition is performed on the original text based on the target feature matrix to obtain target named entities. This invention improves the accuracy of named entity recognition by semantically enhancing the original text.

[0076] Please see Figure 4 The second embodiment of the named entity recognition device in this invention includes:

[0077] Module 301 is used to acquire the raw text to be processed;

[0078] The conversion module 302 is used to perform sequence conversion on the original text to obtain the target input sequence;

[0079] Enhancement module 303 is used to perform semantic enhancement on the target input sequence to obtain target semantic information;

[0080] Processing module 304 is used to determine a feature matrix based on the target input sequence and the target semantic information to obtain a target feature matrix;

[0081] The recognition module 305 is used to perform named entity recognition on the original text based on the target feature matrix to obtain the target named entity.

[0082] Optionally, the conversion module 302 is specifically used for:

[0083] The original text is segmented to obtain multiple target words; each target word is converted into a sequence value to obtain a target sequence value corresponding to each target word; the target sequence value corresponding to each target word is converted into a sequence format to obtain a target input sequence.

[0084] Optionally, enhancement module 303 is specifically used for:

[0085] Obtain word embedding information, sentence information, and position information from the target input sequence; concatenate the word embedding information, sentence information, and position information to obtain concatenated information; input the concatenated information into a preset context encoder for semantic enhancement to obtain target semantic information.

[0086] Optionally, processing module 304 is specifically used for:

[0087] Extract sequence elements from the target input sequence and extract feature information from the target semantic information; calculate the cosine similarity between the sequence elements and the feature information; generate a target feature matrix based on the cosine similarity and a preset multi-head attention mechanism.

[0088] Optionally, the recognition module 305 also includes:

[0089] Configuration unit 3051 is used to determine the character-level matrix corresponding to the original text based on the target feature matrix;

[0090] The generation unit 3052 is used to perform named entity recognition on the original text based on the word-level matrix to obtain the target named entity.

[0091] Optionally, configuration unit 3051 is specifically used for:

[0092] Each element of the target feature matrix is ​​classified using a pre-configured fully connected network to obtain the element classification result; global and local information are calculated from the element classification result to obtain a word-level matrix.

[0093] Optionally, the generation unit 3052 is specifically used for:

[0094] Obtain the target matrix elements corresponding to the word-level matrix; perform category matching on the target matrix elements to obtain the target category; determine the named entity corresponding to the original text based on the target category and the target matrix elements to obtain the target named entity.

[0095] In this embodiment of the invention, the original text is sequence-transformed to obtain a target input sequence; semantic enhancement is performed on the target input sequence to obtain target semantic information. This semantic enhancement strengthens the connections between semantic elements in the original text, thereby improving the accuracy of text recognition; a feature matrix is ​​determined based on the target input sequence and the target semantic information to obtain a target feature matrix; and named entity recognition is performed on the original text based on the target feature matrix to obtain target named entities. This invention improves the accuracy of named entity recognition by semantically enhancing the original text.

[0096] above Figure 3 and Figure 4The named entity recognition device in this embodiment of the invention will be described in detail from the perspective of modular functional entities. The named entity recognition device in this embodiment of the invention will be described in detail from the perspective of hardware processing.

[0097] Figure 5 This is a schematic diagram of a named entity recognition device 500 provided in an embodiment of the present invention. The named entity recognition device 500 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) for storing application programs 533 or data 532. The memory 520 and storage media 530 can be temporary or persistent storage. The program stored in the storage media 530 may include one or more modules (not shown in the diagram), each module including a series of computer program operations on the named entity recognition device 500. Furthermore, the processor 510 may be configured to communicate with the storage media 530 and execute the series of computer program operations in the storage media 530 on the named entity recognition device 500.

[0098] The named entity recognition device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input / output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 5 The structure of the named entity recognition device shown does not constitute a limitation on the named entity recognition device. It may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0099] The present invention also provides a named entity recognition device, which includes a memory and a processor. The memory stores a computer-readable computer program. When the computer-readable computer program is executed by the processor, the processor performs the steps of the named entity recognition method in the above embodiments.

[0100] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein a computer program is stored in the computer program, and when the computer program is run on a computer, the computer performs the steps of the named entity recognition method.

[0101] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.

[0102] The blockchain referred to in this invention is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0103] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0104] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several computer programs to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0105] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for named entity recognition, characterized in that: The named entity recognition method comprises: Get the original text to be processed; Performing sequence conversion on the original text to obtain a target input sequence; Performing semantic enhancement on the target input sequence to obtain target semantic information; The semantic enhancement of the target input sequence to obtain target semantic information includes: Obtain word embedding information, sentence information, and position information in the target input sequence; Concatenating the word embedding information, the sentence information, and the position information to obtain concatenated information; Inputting the splicing information into a preset context encoder for semantic enhancement to obtain target semantic information; Determine a feature matrix according to the target input sequence and the target semantic information to obtain a target feature matrix; The step of determining a feature matrix according to the target input sequence and the target semantic information to obtain a target feature matrix includes: Extracting sequence elements from the target input sequence, and extracting feature information from the target semantic information; Calculating the cosine similarity between the sequence element and the feature information; Generate a target feature matrix based on the cosine similarity and a preset multi-head attention mechanism; Performing named entity recognition on the original text according to the target feature matrix to obtain a target named entity; The method for obtaining sentence information in a target input sequence includes: importing keywords and input information into a long short-term memory network for encoding through a context decoder, respectively obtaining encoding information sequences corresponding to the keywords and the input information, determining weights when generating information sequences corresponding to target keywords from encoding information sequences corresponding to the keywords and the input information through an attention model, weighting the encoding information sequences corresponding to the keywords and the input information according to the determined weights, decoding the weighted encoding information sequences through a long short-term memory network to generate target keywords, weighting the encoding information sequences corresponding to the target keywords and the input information, decoding the weighted encoding information sequences through a long short-term memory network to obtain sentence information.

2. The method for named entity recognition according to claim 1, characterized in that: The step of performing sequence conversion on the original text to obtain a target input sequence includes: Segmenting the original text to obtain multiple target words; Convert each target word into a sequence value to obtain a target sequence value corresponding to each target word; The target sequence value corresponding to each target word is converted into a sequence format to obtain a target input sequence.

3. The method for named entity recognition according to claim 1, characterized in that: The step of performing named entity recognition on the original text according to the target feature matrix to obtain a target named entity includes: Determine a word-level matrix corresponding to the original text based on the target feature matrix; Named entity recognition is performed on the original text based on the word-level matrix to obtain a target named entity.

4. The method for named entity recognition according to claim 3, characterized in that: The determining the word-level matrix corresponding to the original text based on the target feature matrix includes: Performing single-label classification on each element of the target feature matrix through a preset fully connected network to obtain an element classification result; The global information and local information of the element classification result are calculated to obtain a word level matrix.

5. The method for named entity recognition according to claim 3, characterized in that: The performing named entity recognition on the original text based on the word-level matrix to obtain a target named entity includes: Obtaining a target matrix element corresponding to the word-level matrix; Performing category matching on the target matrix elements to obtain a target category; The named entity corresponding to the original text is determined based on the target category and the target matrix element to obtain a target named entity.

6. A named entity recognition device, characterized in that: The named entity recognition device comprises: An acquisition module is used to acquire the original text to be processed; A conversion module, used for performing sequence conversion on the original text to obtain a target input sequence; An enhancement module, used for performing semantic enhancement on the target input sequence to obtain target semantic information; The semantic enhancement of the target input sequence to obtain target semantic information includes: Obtain word embedding information, sentence information, and position information in the target input sequence; Concatenating the word embedding information, the sentence information, and the position information to obtain concatenated information; Inputting the splicing information into a preset context encoder for semantic enhancement to obtain target semantic information; A processing module, used to determine a feature matrix according to the target input sequence and the target semantic information to obtain a target feature matrix; The step of determining a feature matrix according to the target input sequence and the target semantic information to obtain a target feature matrix includes: Extracting sequence elements from the target input sequence, and extracting feature information from the target semantic information; Calculating the cosine similarity between the sequence element and the feature information; Generate a target feature matrix based on the cosine similarity and a preset multi-head attention mechanism; A recognition module, used for performing named entity recognition on the original text according to the target feature matrix to obtain a target named entity; The method for obtaining sentence information in a target input sequence includes: importing keywords and input information into a long short-term memory network for encoding through a context decoder, respectively obtaining encoding information sequences corresponding to the keywords and the input information, determining weights when generating information sequences corresponding to target keywords from encoding information sequences corresponding to the keywords and the input information through an attention model, weighting the encoding information sequences corresponding to the keywords and the input information according to the determined weights, decoding the weighted encoding information sequences through a long short-term memory network to generate target keywords, weighting the encoding information sequences corresponding to the target keywords and the input information, decoding the weighted encoding information sequences through a long short-term memory network to obtain sentence information.

7. A named entity recognition device, characterized in that: The named entity recognition device comprises: a memory and at least one processor, wherein the memory stores a computer program; The at least one processor calls the computer program in the memory to enable the named entity recognition device to perform the named entity recognition method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for named entity recognition according to any one of claims 1 to 5 is implemented.