A method, system, device and storage medium for extracting and identifying entity affiliation based on NLP and triggers
Through methods based on NLP and triggers, the problem of high time consumption in the entity relationship extraction process in the scientific field is solved, fast and accurate entity relationship identification is achieved, manual annotation costs are reduced, and data processing efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202210224702.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-03-07
AI Technical Summary
The existing technology has the problems of high time consumption and poor data timeliness in the process of extracting entity relationships from text data in the scientific field. Especially in the processing of massive labeled data sets in the era of big data, manual annotation consumes a lot of time and affects the quality of the data. Dynamic.
Using the entity affiliation extraction method based on NLP and triggers, a custom multi-category entity list is obtained through the context segment of the training text, clustering processing is performed to obtain the entity affiliation, and pre-built triggers are used for deduplication processing and multi-way matching. , combines the bidirectional long short-term memory neural network and the attention mechanism to perform relationship extraction, and generates a sample data set to output entity affiliation.
It achieves fast and accurate entity relationship extraction, improves the efficiency of text data processing, reduces the time cost of manual annotation, and improves the overall efficiency of data set construction and the accuracy of entity relationship recognition.
Smart Images

Figure CN114625885B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method, system, device and storage medium for extracting and identifying entity affiliation based on NLP and triggers, and belongs to the technical field of natural language processing. Background Art
[0002] Natural language processing is an interdisciplinary subject that integrates linguistics, computer science, mathematics and other related fields. Natural language processing technology has gradually penetrated into various industries for text data mining and information storage. From the perspective of named entity recognition, while meeting the analysis and understanding of unstructured text, it is necessary to ensure the scalability of data. From the perspective of relationship extraction, the relationship link between entities after entity extraction is an extension of data processing and association. The amount of text data analysis in the field of scientific information is increasing, especially in the era of big data. Data mining and processing requires learning and analyzing massive labeled data sets. In order to cope with the growing demand for analysis, domain experts are required to establish a large number of entity-entity relationships. At present, professional fields generally rely on manual annotation of text information, which consumes a lot of time, affects the timeliness of data, and restricts the dynamic development of the information industry.
[0003] In order to meet the urgent need to save time in the scientific field, how to implement text information mining methods for heterogeneous data sources in text data supported by natural language processing is a hot topic in industry and academia. Through triggers, key information of text can be screened. The development of named entity recognition technology promotes the efficient processing capability of text data. Through trigger elements, key information can be customized, thereby reducing the amount of interfering information in the data and reducing the label noise generated by multi-way matching during the data set generation process. However, in the process of relation extraction, in addition to the errors caused by standard text reading, the noise conflicts caused by entities also need to be comprehensively considered. Therefore, it is necessary to design a reasonable relation extraction technology to realize batch processing of large amounts of text.
[0004] Named entity recognition and relation extraction technology have been widely used in text data mining and storage. Through part-of-speech analysis technology, information screening of different keyword hotspots can be achieved. For example, the document "Peng Zhou et al. "Attention-Based Bidirectional Long Short-Term Memory Networks for Relation Classification" Meeting of the Association for Computational Linguistics (2016)" mainly adds attention mechanism to classify text relations. The document "F. Hussain, U. Qamar and S. Zeb, A Novel Approach for Searching Linguistic Synonyms through Parts of Speech Tagging, 2016 IEEE / WIC / ACM International Conference on Web Intelligence (WI), Omaha, NE, USA, 2016, pp. 465-468, doi: 10.1109 / WI.2016.0076." proposes a part-of-speech tagging method for open text data, which is oriented to short text data and realizes information extraction of similar text sentences through synonym tagging.
[0005] Current part-of-speech analysis ignores the identification of valuable information in the process of data mining in professional fields. With the widespread application of part-of-speech analysis technology, the data generated by hot spots in the text of the field is increasing, which will bring technical challenges to the identification of key information and its relationships in the text. Summary of the invention
[0006] The purpose of the present invention is to overcome the deficiencies in the prior art and to provide an entity affiliation extraction and recognition method based on NLP and triggers, as well as a recognition system, a recognition device and a storage medium that can quickly and accurately extract the relationship between entities.
[0007] To achieve the above object, the present invention is implemented by adopting the following technical solutions:
[0008] A method for extracting and identifying entity affiliation relationships based on NLP and triggers, comprising:
[0009] According to the context paragraph of the training text, obtain the customized multi-category entities and entity lists in the training text;
[0010] According to the entity list, the entity affiliation is obtained through clustering processing;
[0011] Input different training texts in batches into pre-built triggers for deduplication processing to obtain corrected entities and entity lists;
[0012] Perform multi-way matching on the obtained correction entities, record the relationship label attributes between the entities, and generate a sample data set;
[0013] According to the sample data set, the text to be recognized is taken as input, and the relationship is extracted in sequence through the bidirectional long short-term memory neural network model and the attention mechanism, and the entity affiliation of the text to be recognized is output.
[0014] Furthermore, the method of obtaining a customized multi-category entity and entity list in the text according to the context paragraph of the training text specifically includes:
[0015] Analyze the context of the training text content and obtain the entity list of custom multi-category entities in the training text sentences:
[0016] ER={er1,er2,...,er N}
[0017] In the formula, er1 represents the entity list of the first type, er2 represents the entity list of the second type, and er N Represents a list of entities of the Nth category;
[0018] The tuple of the entity list of the nth kind in the ER is represented as
[0019] er n =(tim n ,geo n ,nat n ,org n ,per n ), 1≤n≤N,
[0020] In the formula, tim n Represents the entity's existence time, geo n Represents the geographic location of the discovered entity, nat n Representative n The corresponding entity name in org n Represents the organization that discovered the entity, per n represents the finder of the entity;
[0021] Define relationships for the entity list dataset:
[0022] Relationship={ER1,R1,ER2,ER3,R2,ER4,...,ER n ,ER n ,ER n+1},n>1,
[0023] In the formula, ER n Represents the nth entity in the entity list dataset, ER n+1 Represents the n+1th entity in the entity dataset, R n Represents associated ER n and ER n+1 The tuple of entity lists of the nth relation in R is denoted by r n =(nat-tim n ,nat-include n ,nat-property n ,nat-unknow n ), where 1≤n≤N, where nat-tim n Indicates that there is a time relationship between entities, nat-includ n Indicates that there is a subordinate relationship between entities, nat-property n Indicates that there is an attribute value relationship between entities, nat-unknown n There is no relationship between entities.
[0024] Furthermore, the entity affiliation is obtained by clustering the entity list; specifically including:
[0025] The parent node is inferred through the entity list, and all parent combination routes are inferred. At the same time, the best path among multiple parent combinations is calculated, and the parent entity is finally determined. The frequency of occurrence of words contained in the entity list is used for weighted processing. When all the input entity combinations appear in the entity list, the maximum ratio is 1. The final word frequency F expression is:
[0026] F=tf(d,w)*idf(w)
[0027] tf(d,w)=w / d
[0028] idf(w)=log(N / N(w))
[0029] Where tf(d,w) is the frequency of word w in each entity list sub-list d; idf(w) is the inverse sub-list frequency; w is the number of times it appears in sub-list d, d is the total number of words in the sub-list; N is the total number of lists in the entity list, and N(w) is the sum of the number of lists containing word w.
[0030] Furthermore, the trigger is embedded in the gate recurrent unit of the named body recognition.
[0031] Furthermore, the batch input of different training texts into the pre-built trigger is used for deduplication processing to obtain corrected entities and entity lists; specifically, the following steps are included:
[0032] The construction of the trigger first determines the event trigger word trigger = er n ={t1,t2,t3,.....t n}, you also need to set the trigger word's corresponding event trigger element argument = {a1, a2, a3, .....a n}; The triggering elements include at least two different types of er n and the two adjacent sentences contain at least two different types of er n ;
[0033] Under the trigger factor, the sentences containing entities are initially screened out, and there is a current input x t , and the hidden state h passed down from the previous node t-1 , this hidden state contains the relevant information of the previous node; combined with x t and h t-1 , the gate recurrent unit in the named body recognition will get the output y of the current hidden node t and the hidden state h passed to the next node t ;
[0034] Through the last transmitted state h t-1 and the input x of the current node t To obtain two gate states, the calculation expression is as follows:
[0035] r=δ(w r [h t-1 ,x t ])
[0036] Where r is the control reset gate, δ is the sigmoid function, which transforms the data into a value in the range of 0-1, thus acting as a gating signal; h t-1 is the last transmitted state, x t is the current input node, w r is the corresponding weight matrix, [h t-1 , x t ] t-1 and x t Stack them up in rows;
[0037] Get the control update gate Z, the calculation expression is as follows:
[0038] z=δ(w z [h t-1 ,x t ])
[0039] Where z is the control update gate, δ is the sigmoid function, which transforms the data into a value in the range of 0-1, thus acting as a gating signal; h t-1 is the last transmitted state, x t is the current input node, w z is the corresponding weight matrix, [h t-1 , x t ] t-1 and x t Stack them up in rows;
[0040] After obtaining the gate signal, first use the reset gate to obtain the data after reset. The calculation expression is as follows:
[0041]
[0042] Where h t-1′ is the information to be transmitted to the next moment, h t-1 is the last transmitted state. is the Hadamard Product, which means multiplying the corresponding elements in the operation matrix. Therefore, the two multiplication matrices are required to be of the same type, and r is the reset gate;
[0043] The stored information is updated. At this stage, the forgetting and memorizing steps are performed simultaneously. The previously obtained control update gate z is used, and the update data expression is as follows:
[0044]
[0045] Where h t represents the state of the hidden layer at time t, z is the control update gate, h t-1 is the last transmitted state. is the multiplication of the corresponding elements in the operation matrix, (1-z) represents the input gate, and h′ is the state information passed to the next moment; Indicates the selective forgetting of the originally hidden state. Indicates the selective memory of h′ containing the current node information;
[0046] Different training texts are input in batches, entities are identified through the triggers, relationships are listed after the entities through clustering transfer, and repeated entity nodes are removed, and the corrected entity and relationship tables are output.
[0047] Furthermore, the obtained correction entities are respectively subjected to multi-way matching, the relationship label attributes between the entities are recorded, and a sample data set is generated; specifically including:
[0048] The final entities are matched in multiple ways to form a sample data set, which is expressed as
[0049] Dataset = {sentence, m ,er n ,r n}, sentence represents the entity sentence, er m ,er n are a type of entity list tuple, r n Indicates m ,er n The relationship between.
[0050] Furthermore, according to the sample data set, the text to be recognized is taken as input, and the relationship is extracted in sequence through the bidirectional long short-term memory neural network model and the attention mechanism, and the entity affiliation of the text to be recognized is output; specifically, it includes:
[0051] The text to be recognized is input into the bidirectional long short-term memory neural network model, and the output is further input into the attention mechanism. Finally, the relationship extraction result of the entity affiliation of the text to be recognized is output according to the matching of the sample data set; for each input label ER n Finally, the corresponding output label PL will be obtained n , predict input ER n The probability of continuous correctness is Score(ER n ,PL n ), Score(ER n ,PL n ) is as follows:
[0052]
[0053] In the formula, R means the total number of labels in the training data set is R, P (i,PLi) For the i-th input label ER i Output is PL i The probability of A (PLi,PLi+1) For PL i To PL i+1 The transition probability of
[0054] Find all input tags ER n The continuous correct probability Score (ER n ,PL n ), using the Viterbi algorithm to input the label ER n And output label PL n Perform probability normalization processing P (PLn|ERn) , where the probability normalization process P (PLn|ERn) The expression is as follows:
[0055]
[0056] In the formula, Represents the prediction of the i-th input label ER i The exponential value of the probability of successive correctness, For the i-th input label ER i , and get the wrong output label rate, Indicates the wrong predicted input label ER i The exponential value of the continuous probability.
[0057] The present invention also provides an entity affiliation extraction and recognition system based on NLP and triggers, comprising:
[0058] Custom entity module: used to obtain custom multi-category entities and entity lists in the training text according to the context segment of the training text;
[0059] The first processing module is used to obtain entity affiliation through clustering processing according to the entity list;
[0060] The second processing module is used to batch input different training texts into pre-built triggers for deduplication processing to obtain corrected entities and entity lists;
[0061] The third processing module is used to perform multi-way matching on the obtained correction entities, record the relationship label attributes between the entities, and generate a sample data set;
[0062] The recognition module is used to take the text to be recognized as input according to the sample data set, extract relations through the bidirectional long short-term memory neural network model and attention mechanism in sequence, and output the entity affiliation of the text to be recognized.
[0063] The present invention also provides an entity subordination relationship extraction and recognition device based on NLP and triggers, including a processor and a storage medium;
[0064] The storage medium is used to store instructions;
[0065] The processor is used to operate according to the instructions to execute the steps of the above method.
[0066] The present invention also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented.
[0067] Compared with the prior art, the present invention has the following beneficial effects:
[0068] After analyzing the document context paragraphs and constructing entities and relationships, the method of the present invention uses a clustering algorithm to associate loose sub-class entities with parent-class entities to form a tight query structure; in the text entity recognition process, a trigger construction method is used to select trigger elements to improve the accuracy of text recognition, and the recognition target can be found more quickly and conveniently; in the data set construction, a multi-way matching method is adopted, which is conducive to improving the overall data set construction efficiency and reducing the time cost caused by manual annotation. In the process of extracting text relationships, a bidirectional long-short term neural network is used in combination with an attention mechanism to improve the accuracy of extracting relationships between entities in the text. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 It is a flow chart of the method provided in Embodiment 1 of the present invention. DETAILED DESCRIPTION
[0070] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0071] Embodiment 1:
[0072] This embodiment provides a method for extracting and identifying entity affiliation relationships based on NLP and triggers, including:
[0073] According to the context paragraph of the training text, obtain the customized multi-category entities and entity lists in the training text;
[0074] According to the entity list, the entity affiliation is obtained through clustering processing;
[0075] Input different training texts in batches into pre-built triggers for deduplication processing to obtain corrected entities and entity lists;
[0076] Perform multi-way matching on the obtained correction entities, record the relationship label attributes between the entities, and generate a sample data set;
[0077] According to the sample data set, the text to be recognized is taken as input, and the relationship is extracted in sequence through the bidirectional long short-term memory neural network model and the attention mechanism, and the entity affiliation of the text to be recognized is output.
[0078] Specifically, this embodiment mainly includes three stages:
[0079] 1. Customization stage
[0080] According to the context segment of the training text, obtain the customized multi-category entities and entity lists in the training text; specifically including:
[0081] Analyze the context of the training text content and obtain the entity list of custom multi-category entities in the training text sentences:
[0082] ER={er1,er2,...,er N}
[0083] In the formula, er1 represents the entity list of the first type, er2 represents the entity list of the second type, and er N Represents a list of entities of the Nth category;
[0084] The category record of an entity list is a multi-attribute tuple. The tuple of the entity list of the nth category in ER is represented as
[0085] er n =(tim n ,geo n ,nat n ,org n ,per n ), 1≤n≤N,
[0086] In the formula, tim n Represents the entity's existence time, geo n Represents the geographic location of the discovered entity, nat n Representative n The corresponding entity name in org n Represents the organization that discovered the entity, per n represents the finder of the entity;
[0087] Define relationships for the entity list dataset:
[0088] Relationship={ER1,R1,ER2,ER3,R2,ER4,...,ER n ,ER n ,ER n+1},n>1,
[0089] In the formula, ER n Represents the nth entity in the entity list dataset, ER n+1 Represents the n+1th entity in the entity dataset, R n Represents associated ER n and ER n+1 The tuple of entity lists of the nth relation in R is denoted by r n =(nat-tim n ,nat-include n ,nat-property n ,nat-unknow n), where 1≤n≤N, where nat-tim n Indicates that there is a time relationship between entities, nat-includ n Indicates that there is a subordinate relationship between entities, nat-property n Indicates that there is an attribute value relationship between entities, nat-unknown n There is no relationship between entities.
[0090] According to the entity list, the entity affiliation is obtained through clustering processing; specifically including:
[0091] The parent node is inferred through the entity list, and all parent combination routes are inferred. At the same time, the best path among multiple parent combinations is calculated, and the parent entity is finally determined, the entity relationship is expanded and structured.
[0092] The frequency of occurrence of words in the entity list is used for weighted processing. When all the input entity combinations appear in the entity list, the maximum ratio is 1. The final word frequency F is expressed as:
[0093] F=tf(d,w)*idf(w)
[0094] tf(d,w)=w / d
[0095] idf(w)=log(N / N(w))
[0096] In the formula, tf(d,w) is the word frequency of word w in each entity list sub-column d; idf(w) is the inverse sub-column frequency; w is the number of times it appears in sub-column d, and d is the total number of words in the sub-column; N is the total number of lists in the entity list, and N(w) is the sum of the number of lists containing word w. In this way, self-defined multi-class entities and entity lists are completed, and the classification of entity affiliation relationships is preliminarily established.
[0097] 2. Build a complete sample data set
[0098] Input different training texts in batches into pre-built triggers for deduplication processing to obtain corrected entities and entity lists; specifically:
[0099] The construction of the trigger first determines the event trigger word trigger = er n ={t1,t2,t3,.....t n}, you also need to set the trigger word's corresponding event trigger element argument = {a1, a2, a3, .....a n}, so that sentences containing key information can be preliminarily screened out; in this embodiment, trigger elements are defined as two categories, the first category includes a single sentence containing at least two different types of er n For example, if tim appears in a sentence n and nat n ; The second category is that two adjacent sentences contain at least two different types of er n For example, in the first sentence, tim appears n , if the next sentence appears nat n , then the two sentences are extracted at the same time.
[0100] Under the trigger factor, the sentences containing entities are initially screened out, and there is a current input x t , and the hidden state h passed down from the previous node t-1 , this hidden state contains the relevant information of the previous node; combined with x t and h t-1 , the gate recurrent unit in the named body recognition will get the output y of the current hidden node t and the hidden state h passed to the next node t ;
[0101] Through the last transmitted state h t-1 and the input x of the current node t To obtain two gate states, the calculation expression is as follows:
[0102] r=δ(w r [h t-1 ,x t ])
[0103] Where r is the control reset gate, δ is the sigmoid function, which transforms the data into a value in the range of 0-1, thus acting as a gating signal; h t-1 is the last transmitted state, x t is the current input node, w r is the corresponding weight matrix, [h t-1 , x t ] t-1 and x t Stack them up in rows;
[0104] Get the control update gate Z, the calculation expression is as follows:
[0105] z=δ(w z [h t-1 ,x t ])
[0106] Where z is the control update gate, δ is the sigmoid function, which transforms the data into a value in the range of 0-1, thus acting as a gating signal; h t-1 is the last transmitted state, x t is the current input node, w z is the corresponding weight matrix, [h t-1 , x t ] t-1 and x t Stack them up in rows;
[0107] After obtaining the gate signal, first use the reset gate to obtain the data after reset. The calculation expression is as follows:
[0108]
[0109] Where h t-1′ is the information to be transmitted to the next moment, h t-1 is the last transmitted state. is the Hadamard Product, which means multiplying the corresponding elements in the operation matrix. Therefore, the two multiplication matrices are required to be of the same type, and r is the reset gate;
[0110] The stored information is updated. At this stage, the forgetting and memorizing steps are performed simultaneously. The previously obtained control update gate z is used, and the update data expression is as follows:
[0111]
[0112] Where h t represents the state of the hidden layer at time t, z is the control update gate, h t-1 is the last transmitted state. is the multiplication of the corresponding elements in the operation matrix, (1-z) represents the input gate, and h′ is the state information passed to the next moment; Indicates the selective forgetting of the originally hidden state. Indicates the selective memory of h′ containing the current node information;
[0113] Different training texts are input in batches, entities are identified through the triggers, relationships are listed after the entities through clustering transfer, and repeated entity nodes are removed, and the corrected entity and relationship tables are output.
[0114] Among them, the pre-constructed trigger in this embodiment is embedded in the typical recurrent neural network model (Recurrent Neural Network, RNN) of the gate recurrent unit (GRU GateRecurrent Unit) in the named body recognition.
[0115] Perform multi-way matching on the corrected entities, record the relationship label attributes between the entities, and generate a sample data set; specifically, it includes:
[0116] The final entities are matched in multiple ways to form a sample data set, which is expressed as
[0117] Dataset = {sentence, m ,er n ,r n}, sentence represents the entity sentence, er m ,er n are a type of entity list tuple, r n Indicates m ,er n The relationship between them is established, thereby obtaining the corrected entities and the formulation of the entity list, completing the acquisition of the sample data set.
[0118] 3. Entity Relationship Extraction Stage
[0119] For the sample data set, the text to be recognized is taken as input, and the relationship is extracted through the bidirectional long short-term memory neural network model and the attention mechanism in turn, and the entity affiliation of the text to be recognized is output; specifically, it includes:
[0120] The text to be recognized is input into the bidirectional long short-term memory neural network model, and the output is further input into the attention mechanism. Finally, the relationship extraction result of the entity affiliation of the text to be recognized is output according to the matching of the sample data set; for each input label ER n Finally, the corresponding output label PL will be obtained n , predict input ER n The probability of continuous correctness is Score(ER n ,PL n ), Score(ER n ,PL n ) is as follows:
[0121]
[0122] In the formula, R means that there are a total of R labels in the training data set. For the i-th input label ER i Output is PL i The probability of A (PLi,PLi+1) For PL i To PL i+1 The transition probability of
[0123] Find all input tags ER nThe continuous correct probability Score (ER n ,PL n ), using the Viterbi algorithm to input the label ER n And output label PL n Perform probability normalization processing P (PLn|ERn) , thereby completing the training and mining of text data, where the probability normalization process P (PLn|ERn) The expression is as follows:
[0124]
[0125] In the formula, Represents the prediction of the i-th input label ER i The exponential value of the probability of successive correctness, For the i-th input label ER i , and get the wrong output label rate, Indicates the wrong predicted input label ER i The exponential value of the continuous probability. Finally, the accurate entity affiliation is output.
[0126] After analyzing the document context paragraphs and constructing entities and relationships, the method of the present invention uses a clustering algorithm to associate loose sub-class entities with parent-class entities to form a tight query structure; in the text entity recognition process, a trigger construction method is used to select trigger elements to improve the accuracy of text recognition, and the recognition target can be found more quickly and conveniently; in the data set construction, a multi-way matching method is adopted, which is conducive to improving the overall data set construction efficiency and reducing the time cost caused by manual annotation. In the process of extracting text relationships, a bidirectional long-short term neural network is used in combination with an attention mechanism to improve the accuracy of extracting relationships between entities in the text.
[0127] Embodiment 2:
[0128] This embodiment provides an entity affiliation extraction and recognition system based on NLP and triggers, including:
[0129] Custom entity module: used to obtain custom multi-category entities and entity lists in the training text according to the context segment of the training text;
[0130] The first processing module is used to obtain entity affiliation through clustering processing according to the entity list;
[0131] The second processing module is used to batch input different training texts into pre-built triggers for deduplication processing to obtain corrected entities and entity lists;
[0132] The third processing module is used to perform multi-way matching on the obtained correction entities, record the relationship label attributes between the entities, and generate a sample data set;
[0133] The recognition module is used to take the text to be recognized as input according to the sample data set, extract relations through the bidirectional long short-term memory neural network model and attention mechanism in sequence, and output the entity affiliation of the text to be recognized.
[0134] The specific implementation methods in each module have been described in detail in Example 1, and will not be repeated here.
[0135] Embodiment three:
[0136] The embodiment of the present invention also provides an entity affiliation extraction and recognition device based on NLP and triggers, including a processor and a storage medium;
[0137] The storage medium is used to store instructions;
[0138] The processor is used to operate according to the instructions to perform the steps of the following method:
[0139] According to the context paragraph of the training text, obtain the customized multi-category entities and entity lists in the training text;
[0140] According to the entity list, the entity affiliation is obtained through clustering processing;
[0141] Input different training texts in batches into pre-built triggers for deduplication processing to obtain corrected entities and entity lists;
[0142] Perform multi-way matching on the obtained correction entities, record the relationship label attributes between the entities, and generate a sample data set;
[0143] According to the sample data set, the text to be recognized is taken as input, and the relationship is extracted in sequence through the bidirectional long short-term memory neural network model and the attention mechanism, and the entity affiliation of the text to be recognized is output.
[0144] The specific implementation methods in each step have been described in detail in Example 1, and will not be repeated here.
[0145] Embodiment 4:
[0146] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the following method are implemented:
[0147] According to the context paragraph of the training text, obtain the customized multi-category entities and entity lists in the training text;
[0148] According to the entity list, the entity affiliation is obtained through clustering processing;
[0149] Input different training texts in batches into pre-built triggers for deduplication processing to obtain corrected entities and entity lists;
[0150] Perform multi-way matching on the obtained correction entities, record the relationship label attributes between the entities, and generate a sample data set;
[0151] According to the sample data set, the text to be recognized is taken as input, and the relationship is extracted in sequence through the bidirectional long short-term memory neural network model and the attention mechanism, and the entity affiliation of the text to be recognized is output.
[0152] The specific implementation methods in each step have been described in detail in Example 1, and will not be repeated here.
[0153] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0154] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 generate 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.
[0155] 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.
[0156] 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.
[0157] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for extracting and identifying entity affiliation relationships based on NLP and triggers, characterized in that: include: According to the context paragraph of the training text, obtain the customized multi-category entities and entity lists in the training text; According to the entity list, the entity affiliation is obtained through clustering processing; Input different training texts in batches into pre-built triggers for deduplication processing to obtain corrected entities and entity lists; Perform multi-way matching on the obtained correction entities, record the relationship label attributes between the entities, and generate a sample data set; According to the sample data set, the text to be recognized is taken as input, and the relationship is extracted through the bidirectional long short-term memory neural network model and the attention mechanism in sequence, and the entity affiliation of the text to be recognized is output; The batch input of different training texts into the pre-built trigger is used for deduplication processing to obtain corrected entities and entity lists; specifically includes: The construction of the trigger first determines the event trigger word trigger = er n ={t1,t2,t3,.....t n }, you also need to set the trigger word's corresponding event trigger element argument = {a1, a2, a3, .....a n }; The triggering elements include at least two different types of er n and the two adjacent sentences contain at least two different types of er n ; Under the trigger factor, the sentences containing entities are initially screened out, and there is a current input x t , and the hidden state h passed down from the previous node t-1 , this hidden state contains the relevant information of the previous node; combined with x t and h t-1 , the gate recurrent unit in the named body recognition will get the output y of the current hidden node t and the hidden state h passed to the next node t ; Through the last transmitted state h t-1 and the input x of the current node t To obtain two gate states, the calculation expression is as follows: r=δ(w r [h t-1 ,x t ]) Where r is the control reset gate, δ is the sigmoid function, which transforms the data into a value in the range of 0-1, thus acting as a gating signal; h t-1 is the last transmitted state, x t is the current input node, w r is the corresponding weight matrix, [h t-1 , x t ] t-1 and x t Stack them up in rows; Get the control update gate Z, the calculation expression is as follows: z=δ(w z [h t-1 ,x t ]) Where z is the control update gate, δ is the sigmoid function, which transforms the data into a value in the range of 0-1, thus acting as a gating signal; h t-1 is the last transmitted state, x t is the current input node, w z is the corresponding weight matrix, [h t-1 , x t ] t-1 and x t Stack them up in rows; After obtaining the gate signal, first use the reset gate to obtain the data after reset. The calculation expression is as follows: Where h t-1′ is the information to be transmitted to the next moment, h t-1 is the last transmitted state. is the Hadamard Product, which means multiplying the corresponding elements in the operation matrix. Therefore, the two multiplication matrices are required to be of the same type, and r is the reset gate; The stored information is updated. At this stage, the forgetting and memorizing steps are performed simultaneously. The previously obtained control update gate z is used, and the update data expression is as follows: Where h t represents the state of the hidden layer at time t, z is the control update gate, h t-1 is the last transmitted state. is the multiplication of the corresponding elements in the operation matrix, (1-z) represents the input gate, and h′ is the state information passed to the next moment; Indicates the selective forgetting of the originally hidden state. Indicates the selective memory of h′ containing the current node information; Different training texts are input in batches, entities are identified through the triggers, relationships are listed after the entities through clustering transfer, and repeated entity nodes are removed, and the corrected entity and relationship tables are output.
2. According to claim 1, the entity affiliation extraction and recognition method based on NLP and triggers is characterized in that: The method of obtaining a customized multi-category entity and entity list in the text according to the context paragraph of the training text specifically includes: Analyze the context of the training text content and obtain the entity list of custom multi-category entities in the training text sentences: IS={is1,is2,...,is N } In the formula, er1 represents the entity list of the first type, er2 represents the entity list of the second type, and er N Represents a list of entities of the Nth category; The tuple of the entity list of the nth kind in the ER is represented as is n =(hour n ,geo n ,night n ,org n ,per n ), 1≤n≤N, In the formula, tim n Represents the entity's existence time, geo n Represents the geographic location of the discovered entity, nat n Representative n The corresponding entity name in org n Represents the organization that discovered the entity, per n represents the finder of the entity; Define relationships for the entity list dataset: Relationship={ER1,R1,ER2,ER3,R2,ER4,...,ER n ,IS n ,IS n+1 },n>1, In the formula, ER n Represents the nth entity in the entity list dataset, ER n+1 Represents the n+1th entity in the entity dataset, R n Represents associated ER n and ER n+1 The tuple of entity lists of the nth relation in R is denoted by r n =(nat-tim n ,nat-include n ,nat-property n ,nat-unknow n ), where 1≤n≤N, where nat-tim n Indicates that there is a time relationship between entities, nat-includ n Indicates that there is a subordinate relationship between entities, nat-property n Indicates that there is an attribute value relationship between entities, nat-unknown n There is no relationship between entities.
3. The entity affiliation extraction and recognition method based on NLP and triggers according to claim 1 is characterized in that: The entity affiliation is obtained by clustering the entity list; specifically including: The parent node is inferred through the entity list, and all parent combination routes are inferred. At the same time, the best path among multiple parent combinations is calculated, and the parent entity is finally determined. The frequency of occurrence of words contained in the entity list is used for weighted processing. When all the input entity combinations appear in the entity list, the maximum ratio is 1. The final word frequency F expression is: F=tf(d,w)*idf(w) tf(d,w)=w / d idf(w)=log(N / N(w)) Where tf(d,w) is the frequency of word w in each entity list sub-list d; idf(w) is the inverse sub-list frequency; w is the number of times it appears in sub-list d, d is the total number of words in the sub-list; N is the total number of lists in the entity list, and N(w) is the sum of the number of lists containing word w.
4. The entity affiliation extraction and recognition method based on NLP and triggers according to claim 1 is characterized in that: The trigger is embedded in the gate recurrent unit of named body recognition.
5. The entity affiliation extraction and recognition method based on NLP and triggers according to claim 1 is characterized in that: The method performs multi-way matching on the obtained correction entities, records the relationship label attributes between the entities, and generates a sample data set; specifically includes: The final entities are matched in multiple ways to form a sample dataset, which is represented as Dataset = {sentence, m ,er n ,r n }, sentence represents the entity sentence, er m ,er n are a type of entity list tuple, r n Indicates m ,er n The relationship between.
6. The entity affiliation extraction and recognition method based on NLP and triggers according to claim 1 is characterized in that: According to the sample data set, the text to be recognized is taken as input, and the relationship is extracted in sequence through the bidirectional long short-term memory neural network model and the attention mechanism, and the entity affiliation of the text to be recognized is output; specifically, it includes: The text to be recognized is input into the bidirectional long short-term memory neural network model, and the output is further input into the attention mechanism. Finally, the relationship extraction result of the entity affiliation of the text to be recognized is output according to the matching of the sample data set; for each input label ER n Finally, the corresponding output label PL will be obtained n , predict input ER n The probability of continuous correctness is Score(ER n ,PL n ), Score(ER n ,PL n ) is as follows: In the formula, R means that there are a total of R labels in the training data set. For the i-th input label ER i Output is PL i The probability of A (PLi,PLi+1) For PL i To PL i+1 The transition probability of Find all input tags ER n The continuous correct probability Score (ER n ,PL n ), using the Viterbi algorithm to input the label ER n And output label PL n Perform probability normalization processing P (PLn|ERn) , where the probability normalization process P (PLn|ERn) The expression is as follows: In the formula, Represents the prediction of the i-th input label ER i The exponential value of the probability of successive correctness, For the i-th input label ER i , and get the wrong output label rate, Indicates the wrong predicted input label ER i The exponential value of the continuous probability.
7. An entity affiliation extraction and recognition system based on NLP and triggers, characterized in that: include: Custom entity module: used to obtain custom multi-category entities and entity lists in the training text according to the context segment of the training text; The first processing module is used to obtain entity affiliation through clustering processing according to the entity list; The second processing module is used to batch input different training texts into pre-built triggers for deduplication processing to obtain corrected entities and entity lists; The third processing module is used to perform multi-way matching on the obtained correction entities, record the relationship label attributes between the entities, and generate a sample data set; The recognition module is used to take the text to be recognized as input according to the sample data set, extract the relationship through the bidirectional long short-term memory neural network model and the attention mechanism in sequence, and output the entity affiliation of the text to be recognized; The batch input of different training texts into the pre-built trigger is used for deduplication processing to obtain corrected entities and entity lists; specifically includes: The construction of the trigger first determines the event trigger word trigger = er n ={t1,t2,t3,.....t n }, you also need to set the trigger word's corresponding event trigger element argument = {a1, a2, a3, .....a n }; The triggering elements include at least two different types of er n and the two adjacent sentences contain at least two different types of er n ; Under the trigger factor, the sentences containing entities are initially screened out, and there is a current input x t , and the hidden state h passed down from the previous node t-1 , this hidden state contains the relevant information of the previous node; combined with x t and h t-1 , the gate recurrent unit in the named body recognition will get the output y of the current hidden node t and the hidden state h passed to the next node t ; Through the last transmitted state h t-1 and the input x of the current node t To obtain two gate states, the calculation expression is as follows: r=δ(w r [h t-1 ,x t ]) Where r is the control reset gate, δ is the sigmoid function, which transforms the data into a value in the range of 0-1, thus acting as a gating signal; h t-1 is the last transmitted state, x t is the current input node, w r is the corresponding weight matrix, [h t-1 , x t ] t-1 and x t Stack them up in rows; Get the control update gate Z, the calculation expression is as follows: z=δ(w z [h t-1 ,x t ]) Where z is the control update gate, δ is the sigmoid function, which transforms the data into a value in the range of 0-1, thus acting as a gating signal; h t-1 is the last transmitted state, x t is the current input node, w z is the corresponding weight matrix, [h t-1 , x t ] t-1 and x t Stack them up in rows; After obtaining the gate signal, first use the reset gate to obtain the data after reset. The calculation expression is as follows: Where h t-1′ is the information to be transmitted to the next moment, h t-1 is the last transmitted state. is the Hadamard Product, which means multiplying the corresponding elements in the operation matrix. Therefore, the two multiplication matrices are required to be of the same type, and r is the reset gate; The stored information is updated. At this stage, the forgetting and memorizing steps are performed simultaneously. The previously obtained control update gate z is used, and the update data expression is as follows: Where h t represents the state of the hidden layer at time t, z is the control update gate, h t-1 is the last transmitted state. is the multiplication of the corresponding elements in the operation matrix, (1-z) represents the input gate, and h′ is the state information passed to the next moment; Indicates the selective forgetting of the originally hidden state. Indicates the selective memory of h′ containing the current node information; Different training texts are input in batches, entities are identified through the triggers, relationships are listed after the entities through clustering transfer, and repeated entity nodes are removed, and the corrected entity and relationship tables are output.
8. An entity affiliation extraction and recognition device based on NLP and triggers, characterized in that: including processor and storage medium; The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Methods and systems for data collection, learning, and streaming of machine signals for analytics and maintenance using the industrial internet of things
CN112703457A
Sedimentary literature mining method based on NLP information extraction and part-of-speech rules
CN113468890A
