A character sequence recognition method integrating dictionary and character features

By fusing dictionary and character features, through the splicing of dictionary matching words and the interactive features of the Transformer encoding layer, the accuracy of Chinese named entity recognition is improved, and the problems of insufficient semantic information and inaccurate entity boundary demarcation in the existing technology are solved. , achieving higher entity recognition performance.

CN114662476BActive Publication Date: 2024-09-24BEIJING JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210177253.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-24
Publication Date
2024-09-24
Estimated Expiration
2042-02-24

AI Technical Summary

Technical Problem

Existing Chinese entity recognition methods ignore semantic features when using character embedding or word embedding alone, resulting in inaccurate entity boundary demarcation, and the word joint embedding method has the problems of interference from valuable feature information and insufficient use of dictionary information.

Method used

By obtaining the dictionary matching words of each character in the input sequence, concatenating them and inputting them into the Transformer encoding layer, combined with the conditional random field decoding layer, the interactive features of dictionary-enhanced character embedding vectors and dictionary matching words are realized, improving the representation of semantic information and entities. Recognition accuracy.

Benefits of technology

It improves the accuracy and F1 value of character named entity recognition, solves the problems of insufficient semantic information capture and inaccurate entity boundary demarcation, and enhances the semantic understanding of text sentences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114662476B
    Figure CN114662476B
Patent Text Reader

Abstract

The present invention provides a method for character sequence recognition that integrates dictionaries and character features. The method comprises: obtaining three categories of dictionary matching words in the dictionary that matches each character in the input sequence, splicing each character embedding vector of the input character sequence with the embedding vector of the three categories of dictionary matching words corresponding to the character, and obtaining a dictionary-enhanced character embedding vector; splicing the dictionary-enhanced character embedding vector with the three categories of dictionary matching words, and then sending it to the encoding layer of the Transformer, and the encoding layer of the Transformer outputs information to be decoded; the information to be decoded is input to the conditional random field CRF decoding layer for decoding, and the labeling result of the input sequence is obtained. The method of the present invention effectively enhances the model's representation and understanding of semantic information of text sentences in the embedding process and the reasoning process by integrating the interaction of character features of the matching words of the dictionary in the character embedding and model reasoning stages, and the matching words and the enhanced vector representation of the position information of the characters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of character recognition, and in particular to a character sequence recognition method integrating a dictionary and character features. Background Art

[0002] With the development of the Internet, all kinds of data are growing exponentially. Traditional manual annotation alone can no longer effectively identify entities in a timely manner, and thus cannot mine valuable information in a timely manner. In particular, with the rapid development and widespread application of artificial intelligence technology in recent years, knowledge graphs have gradually become the core technology for recommendation systems, intelligent question answering, and precise matching in various industries. Named entity recognition, as a key technology for building knowledge graphs and a basic task of natural language processing, has been widely studied and concerned.

[0003] Since English sentences are based on words, which are separated by spaces, and Chinese sentences are composed of individual characters, each of which has no actual semantics, this makes Chinese entity recognition more difficult.

[0004] A Chinese entity recognition method in the prior art includes: according to the type of sentence input, Chinese entities are divided into three categories: character embedding, word embedding, and word-character joint embedding. Since word-character joint embedding can solve the shortcomings of the first two methods at the same time, the current mainstream method focuses on joint embedding, that is, using characters and words as model input at the same time. According to the source of the words in the joint embedding, it can be divided into tool segmentation, n-gram feature words, and external dictionary words. Research in recent years has focused on external dictionaries, which enhances the representation of sentences by fusing the matching words corresponding to the input sentence with each character of the input sentence.

[0005] The disadvantages of the above-mentioned Chinese entity recognition method in the prior art are:

[0006] The method of using character embedding alone ignores the semantic features of words and cannot fully obtain the semantic information of characters; the method of using word embedding alone is highly dependent on word segmentation tools, which can easily cause error propagation and entity boundary division errors.

[0007] Among the word joint embedding methods, the joint embedding method based on tool word segmentation has high requirements and strong dependence on the word segmentation tool, and the joint embedding method based on n-gram feature words has a lot of worthless feature information interference.

[0008] The current dictionary-based joint embedding method does not make full use of dictionary information and only uses word feature information in a single process, which leads to increased errors in dividing entity boundaries and identifying entity types. Summary of the invention

[0009] The embodiment of the present invention provides a character sequence recognition method integrating a dictionary and character features to achieve effective Chinese named entity recognition of characters.

[0010] In order to achieve the above object, the present invention adopts the following technical scheme.

[0011] A character sequence recognition method integrating a dictionary and character features, comprising:

[0012] Obtain the three types of dictionary matching words in the dictionary that match each character in the input sequence, and concatenate each character embedding vector of the input character sequence with the embedding vector of the three types of dictionary matching word sets corresponding to the character to obtain a dictionary-enhanced character embedding vector;

[0013] After the dictionary-enhanced character embedding vector is concatenated with the three types of dictionary matching words, the concatenation is sent to the encoding layer of the Transformer, and the encoding layer of the Transformer outputs the information to be decoded;

[0014] The information to be decoded is input into the conditional random field (CRF) decoding layer for decoding to obtain the labeling result of the input sequence.

[0015] Preferably, the method of obtaining three types of dictionary matching words in the dictionary that match each character in the input sequence, and concatenating each character embedding vector of the input character sequence with the embedding vector of the three types of dictionary matching word sets corresponding to the character to obtain a dictionary-enhanced character embedding vector includes:

[0016] Given an input sequence C = [c1, c2, c3, ..., c n ], the i-th character in the input sequence C is c i , character c is mapped using a predefined character table i Mark it and input it into the BERT encoder to get the character c i Character embedding vector

[0017] Respectively represent the character c i The corresponding three types of dictionary matching word sets of the character at the beginning, middle and end of the word are embedded vectors. B, M, and E represent the three types of matching word sets of the character at the beginning, middle and end of the word respectively. Let the word set Z = B|M|E and the word set R = B∪M∪E, then The specific calculation is as follows:

[0018]

[0019]

[0020] Among them, weight(w) represents the weight of the matching word w in a certain type of word set, hum(w) represents the frequency of the matching word w in the corpus, e(w) represents the embedded representation of the matching word w, and e represents the lookup table of the dictionary;

[0021] Embed characters into vectors And the corresponding three types of matching word embedding vectors Perform concatenation and use the concatenation result as the character embedding vector enhanced by the i-th dictionary Dictionary-enhanced character sequences

[0022] Preferably, the dictionary-enhanced character embedding vector is concatenated with the three types of dictionary matching words and then sent to the encoding layer of the Transformer, and the encoding layer of the Transformer outputs the information to be decoded, including:

[0023] The character sequence x that augments the dictionary rep After linear dimensionality reduction, the same as the character c i The three types of matching word sets B, M, and E at the beginning, middle, and end of the corresponding words are concatenated and the start position embedding vector p is added respectively start and the end position embedding vector p end , get the input x of the dictionary enhancement model dec , the starting position and ending position of the character sequence are the same. The starting position of each matching word is the position of the first character of the word, and the ending position is the position of the last character of the word. The calculation is as follows:

[0024] x dec =[x rep W1;e(w1),e(w2),e(w3),...,e(w k )]+p start +p end

[0025] Where W1 represents the model parameters, and p represents the lookup table of position information;

[0026] x dec Input to the Transformer's encoding structure, and the Transformer's encoding structure outputs the information A to be decoded.

[0027] Preferably, the step of inputting the information to be decoded into a conditional random field (CRF) decoding layer for decoding to obtain a labeling result of the input sequence includes:

[0028] The information A to be decoded is input into the CRF decoding layer for decoding prediction, and the sequence with the highest probability obtained by CRF is used as the label sequence y of the input sequence C;

[0029] Label sequence y = [y1, y2, y3, ..., y n ], Y represents the set of all possible label sequences, and the probability of labeling sequence y is calculated as follows:

[0030]

[0031]

[0032] Among them, W y,y′ , b y,y′ It is the training parameter based on the label pair (y, y′), and θ represents all the trainable parameters of the model.

[0033] It can be seen from the technical solutions provided by the above embodiments of the present invention that the method of the present invention can more fully and accurately represent the semantic information of the input sentence, and finally realize more accurate automatic recognition of named entities of characters. It can solve the problem that the semantic information of each character of the input sentence is not captured sufficiently, which may lead to inaccurate entity boundary division, and the problem that the interaction between word features and characters is ignored, which may lead to inaccurate entity type recognition.

[0034] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0036] Figure 1 Schematic diagram of a method for character sequence recognition that integrates dictionary and character features provided by an embodiment of the present invention

[0037] Figure 2 A processing flow chart of a character sequence recognition method integrating a dictionary and character features provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The embodiments of the present invention are described in detail below, examples of which 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 only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0039] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or coupling. The term "and / or" used herein includes any unit and all combinations of one or more associated listed items.

[0040] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless defined as herein.

[0041] To facilitate understanding of the embodiments of the present invention, several specific embodiments will be further explained below with reference to the accompanying drawings, and each embodiment does not constitute a limitation on the embodiments of the present invention.

[0042] The embodiment of the present invention utilizes dictionary matching word information, that is, the word features of the dictionary are used simultaneously in the character embedding process of the sentence and the model reasoning and prediction process, thereby enhancing the model's understanding of the semantic information of the text sentence in the character embedding process and the model reasoning and decision-making process, thereby improving the F1 value of entity recognition.

[0043] The implementation principle diagram of a character sequence recognition method integrating a dictionary and character features provided by an embodiment of the present invention is as follows: Figure 1 As shown in FIG, it includes three parts: a dictionary-enhanced character embedding layer, a dictionary-enhanced reasoning layer, and a CRF (conditional random field) decoding layer. The specific processing flow of the above method is as follows: Figure 2 As shown, the processing steps include the following:

[0044] Step S10, obtaining three types of dictionary matching words in the dictionary that match each character in the input sequence, concatenating each character embedding vector of the input character sequence with the embedding vector of the three types of dictionary matching word sets corresponding to the character, to obtain a dictionary-enhanced character embedding vector.

[0045] Obtain three types of dictionary matching words in the dictionary that match each character in the input sequence, that is, the matching word set of the character at the beginning, middle, and end of the word. The specific implementation of this processing process includes: determining whether any substring of the sentence exists in the dictionary, and if so, dividing the matching word into the corresponding characters of the sentence according to the position of each character in the matching word.

[0046] Since the above three types of dictionary matching words will affect the recognition results, the embedding vectors of the three types of dictionary matching word sets are calculated according to the frequency of each dictionary matching word in the corpus. Then, each character embedding vector of the input character sequence is concatenated with the embedding vectors of the three types of dictionary matching word sets corresponding to the character to obtain the dictionary-enhanced character embedding vector.

[0047] Enhance the vector representation of each character, give each character richer word semantic information, and more fully represent the semantics of the sentence, thereby improving the accuracy of recognition boundary division.

[0048] Step S20: After the dictionary-enhanced character embedding vector is concatenated with the three types of dictionary matching words, the concatenation is sent to the encoding layer of the Transformer, and the encoding layer of the Transformer outputs the information A to be decoded.

[0049] In the dictionary-enhanced inference layer, the above three types of dictionary matching words are introduced again. The dictionary-enhanced character embedding vector output by the dictionary-enhanced character embedding layer is concatenated with the above three types of dictionary matching words after linear dimensionality reduction. The dictionary-enhanced character embedding vector is respectively added with the characters of the corresponding dictionary matching words and the start position information and end position information of the dictionary matching words, and sent to the encoding layer of the Transformer. That is, the interaction between each input character and the matching word is captured through the attention mechanism. The encoding layer of the Transformer outputs the information A to be decoded, so as to capture the interactive features of the dictionary matching words on each character, thereby improving the accuracy of entity type recognition.

[0050] Step S30: input the information A to be decoded into the CRF decoding layer for decoding to obtain the labeling result of the above input sequence.

[0051] Specifically, in the dictionary-enhanced character embedding layer, the characters are embedded into vectors And the corresponding three types of matching word embedding vectors Perform concatenation and use the concatenation result as the character embedding vector enhanced by the i-th dictionary This is the output of the dictionary-enhanced character embedding layer;

[0052] Given an input sentence sequence, denoted as C = [c1, c2, c3, ..., c n ], the i-th character embedding vector augmented by the dictionary The calculation is as follows:

[0053]

[0054] in, Represents a character embedding vector, which is a predefined character table for character c i Marked and input to the BERT encoder, the output is Respectively represent the embedding vectors of the matching word sets corresponding to the character ci at the beginning, middle and end of the word, B, M, E represent the matching word sets of the character at the beginning, middle and end of the word, respectively. Let the word set Z = B|M|E, the word set R = B∪M∪E, then The specific calculation is as follows:

[0055]

[0056]

[0057] Among them, weight(w) represents the weight of the matching word w in a certain type of word set, num(w) represents the frequency of the matching word w in the corpus, e(w) represents the embedded representation of the matching word w, and e represents the lookup table of the dictionary.

[0058] Dictionary-enhanced model inference layer

[0059] The character sequence x that augments the dictionary rep After linear dimensionality reduction, they are concatenated with the corresponding matching words and the start position embedding vector p is added respectively. start and the end position embedding vector p end As the input x of the dictionary augmentation model dec The starting position and ending position of the character sequence are the same. The starting position of each matching word is the position of the first character of the word, and the ending position is the position of the last character of the word. The calculation is as follows:

[0060] x dec =[x rep W1;e(w1),e(w2),e(w3),...,e(w k )]+p start +p end (4)

[0061] Wherein, W1 represents the model parameters, and p represents the lookup table of position information.

[0062] Then, x dec The encoding structure input to Transformer consists of two parts: Self-Attention and FFN. Each part is followed by a residual connection and a normalization part to obtain the interaction features between each input character and the matching word, and output the information A to be decoded.

[0063] Decoding layer

[0064] The information A to be decoded is input into the decoder CRF commonly used in sequence labeling tasks for decoding prediction, and the sequence with the highest probability obtained by CRF is taken as the sequence labeling result of the above input sequence.

[0065] Label sequence y = [y1, y2, y3, ..., y n ], the probability of the labeled sequence y is calculated as follows:

[0066]

[0067]

[0068] Among them, A is the information to be decoded, Y represents the set of all possible tag sequences, and W y,y′ , b y,y′ It is the training parameter based on the label pair (y, y′), and θ represents all the trainable parameters of the model.

[0069] During the model training process, optimization is performed by maximizing the log-likelihood of the predicted value and the true value. The loss function is calculated as follows:

[0070] Loss = -∑log(p|C;θ)

[0071] The experimental data of the present invention comes from the Chinese named entity recognition dataset PeopleDaily, which is publicly available in the news field. The performance of this method and other methods in the Chinese entity recognition task is compared on this dataset. The training set, validation set, and test set of the experimental data contain 20,864, 2,318, and 4,636 Chinese text sentences, respectively. The entity types involved include three types of entity types: person names, place names, and institution names. The steps are as follows:

[0072] In the data preprocessing stage, the matching words of each input sentence and the frequency of the matching words in the corpus can be obtained in advance. Among them, the input sentence matching words can be obtained by treating the input sentence sequence as a string. If the substring of the string exists in the dictionary, the word is a matching word. Otherwise, continue to judge the next substring, and so on. Every time a matching word appears, the number of the matching words is increased by 1, so as to obtain the frequency of the matching word.

[0073] The training steps of the model are as follows:

[0074] (1) Dictionary-enhanced character representation layer: by concatenating character representation vectors Matching word representation vector Character Representation Vectors as Dictionary Enhancement

[0075] (2) Dictionary-enhanced model inference layer: The dictionary-enhanced character representation x rep After linear dimensionality reduction and concatenation with the corresponding matching words, add the starting position P start Information and end position information P end As the input x of the dictionary augmentation model dec , input it into the encoding structure of Transformer, and output the information A to be decoded;

[0076] (3) Decoding: Input the information A to be decoded into the conditional random field for decoding, and output the sequence labeling result.

[0077] According to the above steps, the present invention is compared with commonly used named entity recognition models, including BiLSTM-CRF and BERT-BiLSTM-CRF that do not use dictionary information, and LR-CNN, LGN, Lattice LSTM, Flat and Soft Lexicon that use dictionary information in some part. The accuracy, recall rate and F1 value are used as evaluation indicators. The comparison results are shown in Table 1.

[0078] Table 1 Experimental results of the proposed model and other models on the Boson dataset

[0079]

[0080]

[0081] The experimental results show that:

[0082] By comparing this model with the existing entity recognition model, it can be seen that the model has the highest F1 value performance on the People Daily dataset. Compared with the model that does not use dictionary information, the performance of the present invention is significantly improved. Compared with other models that use dictionaries, there are different degrees of improvement.

[0083] To summarize, the Chinese named entity recognition method for character sequences that deeply integrates dictionaries and character features in an embodiment of the present invention further enhances the model's representation and understanding of semantic information of text sentences in the embedding process and the reasoning process through the interaction of character features, matching words, and character position information enhanced by the comprehensive dictionary's matching words in the character embedding and model reasoning stages, thereby improving the F1 value of named entity recognition of characters.

[0084] The Chinese named entity recognition method of the character sequence that deeply integrates the dictionary and character features proposed in the embodiment of the present invention can more fully and accurately represent the semantic information of the input sentence, and ultimately achieve more accurate automatic recognition of named entities and improve the F1 value of entity recognition. It can solve the problem that the semantic information of each character in the input sentence is not captured sufficiently, which may lead to inaccurate entity boundary division, and the problem that the interaction between word features and characters is ignored, which may cause inaccurate entity type recognition.

[0085] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the accompanying drawings are not necessarily required to implement the present invention.

[0086] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.

[0087] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0088] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A character sequence recognition method integrating dictionary and character features, characterized in that: include: Obtain the three types of dictionary matching words in the dictionary that match each character in the input sequence, and concatenate each character embedding vector of the input character sequence with the embedding vector of the three types of dictionary matching word sets corresponding to the character to obtain a dictionary-enhanced character embedding vector; After the dictionary-enhanced character embedding vector is concatenated with the three types of dictionary matching words, the concatenation is sent to the encoding layer of the Transformer, and the encoding layer of the Transformer outputs the information to be decoded; The information to be decoded is input into the conditional random field (CRF) decoding layer for decoding to obtain the labeling result of the input sequence; the three categories of dictionary matching words in the dictionary matching each character in the input sequence are obtained, and each character embedding vector of the input character sequence is concatenated with the embedding vector of the three categories of dictionary matching word sets corresponding to the character to obtain the dictionary enhanced character embedding vector, including: Given an input sequence C = [c1, c2, c3, ..., c n ], the i-th character in the input sequence C is c i , character c is mapped using a predefined character table i Mark it and input it into the BERT encoder to get the character c i Character embedding vector Respectively represent the character c i The corresponding three types of dictionary matching word sets of the character at the beginning, middle and end of the word are embedded vectors. B, M, and E represent the three types of matching word sets of the character at the beginning, middle and end of the word respectively. Let the word set Z = B|M|E and the word set R = B∪M∪E, then The specific calculation is as follows: Among them, weight(w) represents the weight of the matching word w in a certain type of word set, num(w) represents the frequency of the matching word w in the corpus, e(w) represents the embedded representation of the matching word w, and e represents the lookup table of the dictionary; Embed characters into vectors And the corresponding three types of matching word embedding vectors Perform concatenation and use the concatenation result as the character embedding vector enhanced by the i-th dictionary Dictionary-enhanced character sequences The dictionary-enhanced character embedding vector is concatenated with the three types of dictionary matching words and then sent to the encoding layer of the Transformer, and the encoding layer of the Transformer outputs the information to be decoded, including: The character sequence x that augments the dictionary rep After linear dimensionality reduction, the same as the character c i The three types of matching word sets B, M, and E at the beginning, middle, and end of the corresponding words are concatenated and the start position embedding vector p is added respectively start and the end position embedding vector p end , get the input x of the dictionary enhancement model dec , the starting position and ending position of the character sequence are the same. The starting position of each matching word is the position of the first character of the word, and the ending position is the position of the last character of the word. The calculation is as follows: x dec =[x rep W1;e(w1),e(w2),e(w3),…,e(w k )]+p start + p end Where W1 represents the model parameters, and p represents the lookup table of position information; x dec Input to the Transformer's encoding structure, and the Transformer's encoding structure outputs the information A to be decoded.

2. The method according to claim 1, characterized in that The step of inputting the information to be decoded into a conditional random field (CRF) decoding layer for decoding to obtain a labeling result of the input sequence includes: The information A to be decoded is input into the CRF decoding layer for decoding prediction, and the sequence with the highest probability obtained by CRF is used as the label sequence y of the input sequence C; Label sequence y = [y1, y2, y3, …, y n ], Y represents the set of all possible label sequences, and the probability of labeling sequence y is calculated as follows: Among them, W y,y′ ,b y,y′ It is the training parameter based on the label pair (y,y′), and θ represents all the trainable parameters of the model.