A Chinese named entity recognition method and system
By combining the gated graph neural network and the bidirectional long short-term memory network, using n-gram features and vector representation, the problem of insufficient accuracy in Chinese named entity recognition is solved and higher named entity recognition accuracy is achieved.
Patent Information
- Application Number
- CN202111617535.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-27
AI Technical Summary
Chinese named entity recognition is difficult, lacking clear delimiters and complex structures. Existing models have deficiencies in accuracy and efficiency, which affects the quality of subsequent natural language processing.
Using a combination of gated graph neural network and bidirectional long short-term memory network, through n-gram feature extraction and vector representation, node information is spliced to improve the accuracy of Chinese named entity recognition.
It effectively improves the accuracy of Chinese named entity recognition by extracting n-gram features and vector features after character segmentation to reflect literal and generalized features, and using the bidirectional LSTM model to obtain contextual semantics and boundary information, which improves named entity recognition. accuracy.
Smart Images

Figure CN114298044B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to a Chinese named entity recognition method and system. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Named Entity Recognition (NER) is a very basic and important task in the field of Natural Language Processing (NLP). Its purpose is to automatically discover named entities from plain text and identify their corresponding categories. Entities include names of people, places, names of organizations, time and digital expressions (including time, date, currency and percentage, etc.). It is widely used in machine translation, information retrieval, information extraction, entity connection and other fields. The existing named entity recognition model is usually a sequence labeling task, that is, to label specific entities accordingly. Commonly used labeling methods are BIO and BIOES. If BIOES is used for labeling, B represents the beginning of the entity, I represents the middle of the entity, E represents the end of the entity, S represents a single entity, and O represents an entity that is not to be recognized. If BIO is used for labeling, B also represents the beginning of the entity, I represents the middle and end of the entity, and a single entity is represented by B.
[0004] Chinese named entity recognition mainly determines the entity boundaries and categories of various Chinese named entities in the text. Chinese named entity recognition is more difficult to recognize than English. First, Chinese does not have natural spaces as separators, and there are no clear boundaries between entities. Second, the Chinese structure is relatively complex. Named entity recognition is also an important foundation for research such as information extraction, intelligent question answering, and knowledge graphs. The quality of named entity recognition extraction directly affects the quality and efficiency of subsequent natural processing. Therefore, it is urgent to improve the performance of Chinese named entity recognition. Summary of the invention
[0005] In order to solve the technical problems existing in the above-mentioned background technology, the present invention provides a Chinese named entity recognition method and system, which can effectively improve the performance of Chinese named entity recognition.
[0006] In order to achieve the above object, the present invention adopts the following technical solution:
[0007] A first aspect of the present invention provides a Chinese named entity recognition method.
[0008] A Chinese named entity recognition method, comprising:
[0009] Obtaining a segment to be processed, and segmenting the segment to be processed by characters;
[0010] Based on the paragraph to be processed, a gated graph neural network is used to obtain the node information corresponding to each character in the paragraph;
[0011] Extracting n-gram features from the to-be-processed segment, and determining vector representations of the n-gram features based on the extracted n-gram features;
[0012] After the node information and the vector representation of the n-gram feature are concatenated, the result of Chinese named entity recognition is obtained by passing through a bidirectional long short-term memory network.
[0013] A second aspect of the present invention provides a Chinese named entity recognition system.
[0014] A Chinese named entity recognition system, comprising:
[0015] A segmentation module is configured to: obtain a segment to be processed, and segment the segment to be processed by characters;
[0016] A gated graph neural network module is configured to: based on the paragraph to be processed, use a gated graph neural network to obtain node information corresponding to each character in the paragraph;
[0017] A feature extraction module is configured to: extract n-gram features from the to-be-processed segment, and determine a vector representation of the n-gram features according to the extracted n-gram features;
[0018] The recognition module is configured to: concatenate the node information and the vector representation of the n-gram feature, and then pass it through a bidirectional long short-term memory network to obtain a Chinese named entity recognition result.
[0019] A third aspect of the present invention provides a computer-readable storage medium.
[0020] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps in the Chinese named entity recognition method as described in the first aspect above.
[0021] A fourth aspect of the present invention provides a computer device.
[0022] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps in the Chinese named entity recognition method as described in the first aspect above are implemented.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] The present invention combines the n-gram model, the gated graph neural network model and the Bi-LSTM model to perform Chinese named entity recognition, effectively improving the accuracy of Chinese named entity recognition.
[0025] The present invention can reflect the correlation between adjacent characters in the phrase to be identified by extracting n-gram features and vector features of n-gram features in the phrase to be identified after segmentation by characters, and can embody the literal features and generalized features of the phrase to be identified through n-gram features and vector features of n-gram features. At the same time, the two constructed directed graphs use gated graph neural networks to extract contextual semantic information in the sequence. Finally, we use two BiLSTM models to extract different feature information of each character respectively (the first BiLSTM can well obtain the contextual information and semantic information of each sequence, and the second BiLSTM can well obtain the boundary information of the sequence), so as to improve the accuracy of named entity recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0027] Figure 1 is a flow chart of a Chinese named entity recognition method shown in the present invention;
[0028] Figure 2 It is a framework diagram of the reverse diagram and the forward diagram shown in the present invention;
[0029] Figure 3 It is a schematic diagram of 2-gram, 3-gram, 4-gram and 5-gram shown in the present invention;
[0030] Figure 4 It is a framework diagram of the Bi-LSTM model shown in the present invention. DETAILED DESCRIPTION
[0031] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0032] It should be noted that the following detailed descriptions are all illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0033] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0034] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the methods and systems according to various embodiments of the present disclosure. It should be noted that each box in the flowchart or block diagram can represent a module, a program segment, or a part of a code, and the module, program segment, or a part of a code may include one or more executable instructions for implementing the logical functions specified in each embodiment. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, or they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the flowchart and / or block diagram, and the combination of boxes in the flowchart and / or block diagram can be implemented using a dedicated hardware-based system that performs a specified function or operation, or can be implemented using a combination of dedicated hardware and computer instructions.
[0035] Embodiment 1
[0036] like Figure 1 As shown, this embodiment provides a Chinese named entity recognition method. This embodiment uses the method applied to a server as an example for illustration. It can be understood that the method can also be applied to a terminal, and can also be applied to a terminal, a server, and a system, and is implemented through the interaction between the terminal and the server. The server can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network servers, cloud communications, middleware services, domain name services, security services CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application. In this embodiment, the method includes the following steps:
[0037] Obtaining a segment to be processed, and segmenting the segment to be processed by characters;
[0038] Based on the paragraph to be processed, a gated graph neural network is used to obtain the node information corresponding to each character in the paragraph;
[0039] Extracting n-gram features from the to-be-processed segment, and determining vector representations of the n-gram features based on the extracted n-gram features;
[0040] After the node information and the vector representation of the n-gram feature are concatenated, the result of Chinese named entity recognition is obtained by passing through a bidirectional long short-term memory network.
[0041] This embodiment includes three parts. In the first part, a node is used to represent a character of the input sentence, and then two graphs are constructed with these nodes, and the node information is extracted using a gated graph neural network (GGNN). In the second part, the n-gram model is used to obtain the byte fragments of the input sentence, and then the vector corresponding to each gram is generated using a pre-trained n-gram table or pytorch. In the third part, the information of the node extracted by the gated graph neural network and the several n-gram vectors corresponding to the node are concatenated and input into a bidirectional long short-term memory network (Bi-LSTM), and then the hidden vector of the first Bi-LSTM is concatenated with the vocabulary information and sent to the next Bi-LSTM, and the obtained output features are input into the conditional random field (CRF) for decoding.
[0042] As one or more implementation methods, the gated graph neural network is used based on the paragraph to be processed to obtain the node information corresponding to each character in the paragraph, specifically including: constructing a reverse graph and a forward graph according to the node corresponding to each character, and obtaining the node information corresponding to each character according to the reverse graph and the forward graph, wherein the node information corresponding to each character includes the forward node information corresponding to each character and the reverse node information corresponding to each character. Among them, the process of constructing the forward graph includes: starting from the first node, for each node after it, adding a directed edge between them, the direction is from the front node to the back node; the process of constructing the reverse graph includes: starting from the second node, for each node before it, adding a directed edge between them, the direction is from the back node to the front node.
[0043] Specifically, the first step is to construct a graph. Divide the input sentence into N characters, and use N nodes to represent these N characters, with each character equivalent to a node. Then, add directed edges between these nodes, starting from the first node, and for each node after it, add a directed edge between them, with the direction pointing from the previous node to the next node. The second node is also for each node after it, and a directed edge is added between them, with the direction pointing from the previous node to the next node. The method for constructing graphs from the 3rd to the Nth nodes can be obtained in the same way. Then, construct a reverse graph, starting from the second node, and for each node before it, add a directed edge between them, with the direction pointing from the next node to the previous node. The third node is also for each node before it, and a directed edge is added between them, with the direction pointing from the next node to the previous node. The method for constructing graphs from the 4th to the Nth nodes can be obtained in the same way.
[0044] like Figure 2 As shown, c i It represents the node part in the sentence. For example, c1 to c5 in the figure represent the single characters of "I am from Shandong", g i Represents the feature vector extracted by the graph neural network. The specific calculation formula is as follows:
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051] In formula (1), The node represents the initial hidden vector of the node, which is a D-dimensional vector. When the node inputs the feature v i When the dimension is less than D, the number of zeros is padded. In formula (2), A c Select two columns corresponding to the node V in the graph adjacency matrix. Formulas (3)-(6) are similar to the calculation process of the gated recurrent unit (GRU). Control forgetting information, Control the generation of new information, This is the final updated node status.
[0052] As one or more implementation modes, determining the vector representation of n-gram features based on the extracted n-gram features specifically includes: concatenating the feature vector of each character and the vector generated by the different byte length fragments corresponding to the beginning of the character to obtain the vector representation of the n-gram features corresponding to each character.
[0053] As one or more implementation modes, after obtaining the vector representation of the n-gram feature, the method includes: performing quantitative encoding on the vector representation of the n-gram feature.
[0054] Specifically, in the second step, the n-gram language model is used to extract byte segments of length 2, 3, 4, and 5. Given a sequence, the 2-gram, 3-gram, 4-gram, and 5-gram of the sequence are as follows: Figure 3 shown.
[0055] Each byte segment is called a gram. The occurrence frequency of all the grams is counted and filtered according to a pre-set threshold to form a key gram list, which is the vector feature space of the text. Each gram in the list is a feature vector dimension. This list can greatly improve the accuracy of named entity recognition. Generate the feature vector of each gram based on the existing n-gram vector table or pytorch, and concatenate the feature vector of each character with the corresponding 2-gram, 3-gram, 4-gram, and 5-gram vectors starting with this character to get the b i .
[0056] As one or more implementation modes, the concatenation of the node information and the vector representation of the n-gram feature and the bidirectional long short-term memory network specifically includes: concatenating the node information and the vector representation of the n-gram feature and inputting the concatenation into the first bidirectional long short-term memory network to obtain a hidden layer vector; and concatenating the hidden layer vector and the vocabulary information w of the corresponding character. i Concatenate them together and input them into the second bidirectional long short-term memory network to get the output result.
[0057] As one or more implementation modes, the output result is input into CRF for decoding to obtain a Chinese named entity recognition result.
[0058] Specifically, in the third step, b i , g i , g i , concatenated and input into Bi-LSTM to obtain the hidden layer vector h i , and the vocabulary information w of the corresponding characters iThe results are concatenated and input into the next Bi-LSTM, and finally input into CRF for decoding to obtain the prediction result. The model framework diagram of this method is as follows: Figure 4 shown.
[0059] Embodiment 2
[0060] This embodiment provides a Chinese named entity recognition system.
[0061] A Chinese named entity recognition system, comprising:
[0062] A segmentation module is configured to: obtain a segment to be processed, and segment the segment to be processed by characters;
[0063] A gated graph neural network module is configured to: based on the paragraph to be processed, use a gated graph neural network to obtain node information corresponding to each character in the paragraph;
[0064] A feature extraction module is configured to: extract n-gram features from the to-be-processed segment, and determine a vector representation of the n-gram features according to the extracted n-gram features;
[0065] The recognition module is configured to: concatenate the node information and the vector representation of the n-gram feature, and then pass it through a bidirectional long short-term memory network to obtain a Chinese named entity recognition result.
[0066] It should be noted that the above segmentation module, gated graph neural network module, feature extraction module and recognition module are the same as the examples and application scenarios implemented by the steps in Embodiment 1, but are not limited to the contents disclosed in Embodiment 1. It should be noted that the above modules as part of the system can be executed in a computer system such as a set of computer executable instructions.
[0067] Embodiment 3
[0068] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the Chinese named entity recognition method described in the above embodiment 1 are implemented.
[0069] Embodiment 4
[0070] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the Chinese named entity recognition method described in the first embodiment are implemented.
[0071] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0072] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0073] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0074] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0075] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0076] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A Chinese named entity recognition method, characterized in that: include: Obtaining a segment to be processed, and segmenting the segment to be processed by characters; Based on the paragraph to be processed, a gated graph neural network is used to obtain the node information corresponding to each character in the paragraph; Extracting n-gram features from the to-be-processed segment, and determining vector representations of the n-gram features based on the extracted n-gram features; After the node information and the vector representation of the n-gram feature are concatenated, the result of Chinese named entity recognition is obtained by passing the result through a bidirectional long short-term memory network; The method uses a gated graph neural network based on the paragraph to be processed to obtain node information corresponding to each character in the paragraph, specifically including: constructing a reverse graph and a forward graph according to the nodes corresponding to each character; The process of constructing the forward graph includes: starting from the first node, for each node after it, adding a directed edge between the two nodes, the direction is from the front node to the back node; the process of constructing the reverse graph includes: starting from the second node, for each node before it, adding a directed edge between the two nodes, the direction is from the back node to the front node.
2. The Chinese named entity recognition method according to claim 1, characterized in that: The method of using a gated graph neural network based on the paragraph to be processed to obtain the node information corresponding to each character in the paragraph specifically includes: obtaining the node information corresponding to each character according to the reverse graph and the forward graph, wherein the node information corresponding to each character includes the forward node information corresponding to each character and the reverse node information corresponding to each character.
3. The Chinese named entity recognition method according to claim 1, characterized in that: Determining the vector representation of n-gram features based on the extracted n-gram features specifically includes: concatenating the feature vector of each character and the vector generated by the fragments of different byte lengths corresponding to the beginning of the character to obtain the vector representation of the n-gram features corresponding to each character.
4. The Chinese named entity recognition method according to claim 1, characterized in that: After obtaining the vector representation of the n-gram feature, the method includes: performing quantitative encoding on the vector representation of the n-gram feature.
5. The Chinese named entity recognition method according to claim 1, characterized in that: The step of concatenating the node information and the vector representation of the n-gram feature and passing it through a bidirectional long short-term memory network specifically includes: concatenating the node information and the vector representation of the n-gram feature and inputting the concatenated node information into a first bidirectional long short-term memory network to obtain a hidden layer vector; and concatenating the hidden layer vector and the vocabulary information w of the corresponding character. i Concatenate them together and input them into the second bidirectional long short-term memory network to get the output result.
6. The Chinese named entity recognition method according to claim 5, characterized in that: The output result is input into CRF for decoding to obtain the Chinese named entity recognition result.
7. A Chinese named entity recognition system, characterized in that: include: A segmentation module is configured to: obtain a segment to be processed, and segment the segment to be processed by characters; A gated graph neural network module is configured to: based on the paragraph to be processed, use a gated graph neural network to obtain node information corresponding to each character in the paragraph; The method uses a gated graph neural network based on the paragraph to be processed to obtain node information corresponding to each character in the paragraph, specifically including: constructing a reverse graph and a forward graph according to the nodes corresponding to each character; The process of constructing the forward graph includes: starting from the first node, for each node after it, adding a directed edge between the two nodes, the direction of which is from the front node to the back node; the process of constructing the reverse graph includes: starting from the second node, for each node before it, adding a directed edge between the two nodes, the direction of which is from the back node to the front node; A feature extraction module is configured to: extract n-gram features from the to-be-processed segment, and determine a vector representation of the n-gram features according to the extracted n-gram features; The recognition module is configured to: concatenate the node information and the vector representation of the n-gram feature, and then pass it through a bidirectional long short-term memory network to obtain a Chinese named entity recognition result.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in the Chinese named entity recognition method as described in any one of claims 1 to 6 are implemented.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the Chinese named entity recognition method as described in any one of claims 1-6 are implemented.
