Information extraction method and device, equipment, medium and program product
By introducing recursive loop structures and explicit pattern prompts into the general information extraction model, combined with the short-term and long-term attention change mechanism, the performance problem in multi-span recognition is solved, and efficient extraction of complex data in the financial field is achieved.
Patent Information
- Application Number
- CN202410939338.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-01
AI Technical Summary
Existing general information extraction models show poor generalization and performance when faced with multi-span recognition, especially in the financial field, which performs poorly on complex four-tuple or five-tuple data extraction tasks.
A recursive cycle general information extraction model based on explicit mode prompts is adopted. Through multiple rounds of recognition and a long-short-term attention change mechanism, spans in the text are gradually identified and extracted to ensure that the extraction results comply with the preset structural relationships.
It significantly improves the generalization and performance of information extraction, especially in complex extraction tasks, it can accurately extract multi-span data and enhances the performance in low resource scenarios.
Smart Images

Figure CN118734855A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of financial technology, specifically the field of artificial intelligence technology, and more specifically to an information extraction method, device, equipment, medium and program product. Background Art
[0002] Information extraction refers to the process of extracting data from unstructured text into structured records. The extraction process can set different tasks according to different needs to achieve the extraction of the same unstructured text into different structured records, that is, decoding according to needs. For example, different fields have different needs for information extraction, so the characteristics of the corresponding structured records after extraction will be different. In a typical scenario, such as in the financial field, the focus is on the information in the text, such as companies, managers, and financial events, so the task can be set to extract data such as companies, managers, and financial events.
[0003] Furthermore, especially in the financial field, the document extraction operations involved often involve texts with more than two spans, for example, the data to be extracted and recorded are quadruplets (i.e., four spans) or quintuples (i.e., five spans), etc. In the prior art, the popular universal information extraction model (or UIE) can achieve good results when dealing with named entity recognition and relationship extraction tasks involving fewer span extractions, but this type of universal information extraction model often does not have generalization and good performance when facing such quadruplet or quintuple data. Summary of the invention
[0004] In view of the above problems, the present disclosure provides an information extraction method, apparatus, device, medium and program product for improving the generalization and performance of information extraction in the financial field.
[0005] According to a first aspect of the present disclosure, there is provided an information extraction method, the method comprising: acquiring text data and an explicit mode prompt, wherein the explicit mode prompt comprises N prompt words, there is a preset structural relationship between the N prompt words, and N is a positive integer; and based on the constraints of the N prompt words, performing N rounds of recognition on the text data through a preset recursive cyclic general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship.
[0006] According to an embodiment of the present disclosure, based on the constraints of the N prompt words, N rounds of recognition are performed on the text data through a preset recursive cyclic general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship, including: serializing the text data and the explicit pattern prompt to obtain a sequence to be recognized; and performing N rounds of recognition on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain N spans, wherein the preset recursive cyclic general information extraction model includes a long-short time attention change mechanism, and the long-short time attention change mechanism includes: combining the constraints of one or more spans previously recognized to guide the recognition of subsequent spans.
[0007] According to an embodiment of the present disclosure, the serializing the text data and the explicit pattern prompt to obtain a sequence to be recognized includes: serializing and segmenting the text data and the explicit pattern prompt respectively to convert them into sequences in token form to obtain a text sequence and a pattern sequence respectively; adding tags to the text sequence and the pattern sequence respectively to obtain a first text sequence and a first pattern sequence; and concatenating the first pattern sequence and the first text sequence to obtain the sequence to be recognized.
[0008] According to an embodiment of the present disclosure, the preset recursive cyclic general information extraction model is used to perform N rounds of recognition on the sequence to be recognized to obtain N spans, including: for each round of span recognition, when the currently recognized span is the first span, based on the constraints of the first pattern sequence, the preset recursive cyclic general information extraction model is used to perform a span recognition operation on the sequence to be recognized to obtain the current span; or for each round of span recognition, when the currently recognized span is not the first span, based on the constraints of the first pattern sequence and one or more spans previously recognized, the preset recursive cyclic general information extraction model is used to perform a span recognition operation on the sequence to be recognized to obtain the current span.
[0009] According to an embodiment of the present disclosure, based on the constraints of the first pattern sequence, a span recognition operation is performed on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain a current span, including: taking the sequence to be recognized as the input of an encoder to obtain a feature vector set; using the feature vector set as the input of a decoder to obtain an output sequence; and obtaining the current span based on the output sequence.
[0010] According to an embodiment of the present disclosure, based on the first pattern sequence and the constraints of one or more spans previously identified, a span recognition operation is performed on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain a current span, including: taking the sequence to be recognized as the input of the encoder to obtain a feature vector set; based on the feature vector set, obtaining a first feature vector set through the long-short time attention change mechanism; based on the first feature vector set as the input of the decoder to obtain an output sequence; and obtaining the current span based on the output sequence.
[0011] According to an embodiment of the present disclosure, the step of adding marks to the text sequence and the pattern sequence respectively to obtain a first text sequence and a first pattern sequence includes: adding a type mark to each token of the text sequence and the pattern sequence respectively; and controlling marks at preset positions of the text sequence and the pattern sequence respectively.
[0012] According to an embodiment of the present disclosure, the span identification operation includes: performing span detection on the sequence to be identified to obtain a current span; performing span classification on the current span to obtain a current span classification; and performing span association on the current span to obtain a span relationship.
[0013] A second aspect of the present disclosure provides an information extraction device, which includes: a data acquisition module, used to acquire text data and an explicit mode prompt, wherein the explicit mode prompt includes N prompt words, and there is a preset structural relationship between the N prompt words, and N is a positive integer; and a span recognition module, used to perform N rounds of recognition on the text data based on the constraints of the N prompt words through a preset recursive cyclic general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship.
[0014] According to an embodiment of the present disclosure, the span recognition module includes: a serialization conversion submodule and a span recognition submodule, the serialization conversion submodule is used to serialize the text data and the explicit pattern prompt to obtain a sequence to be recognized; and the span recognition submodule is used to perform N rounds of recognition on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain N spans, wherein the preset recursive cyclic general information extraction model includes a long-short time attention change mechanism, and the long-short time attention change mechanism includes: combining the constraints of one or more spans previously recognized to guide the recognition of subsequent spans.
[0015] According to an embodiment of the present disclosure, the serialization conversion submodule includes: a word segmentation unit, a marking unit, a linking unit and a splicing unit. The word segmentation unit is used to serialize and segment the text data and the explicit pattern prompt respectively to convert them into sequences in the form of tokens to obtain a text sequence and a pattern sequence respectively; the marking unit is used to add marks to the text sequence and the pattern sequence respectively to obtain a first text sequence and a first pattern sequence; the linking unit is used to and the splicing unit are used to splice the first pattern sequence and the first text sequence to obtain the sequence to be recognized.
[0016] According to an embodiment of the present disclosure, the span identification submodule includes: a first span identification unit and a second span identification unit, wherein the first span identification unit is used for, for each round of span identification, when the currently identified span is the first span, based on the constraints of the first pattern sequence, and using a preset recursive cyclic general information extraction model to perform a span identification operation on the sequence to be identified to obtain the current span; or the second span identification unit is used for, for each round of span identification, when the currently identified span is not the first span, based on the constraints of the first pattern sequence and one or more spans previously identified, and using a preset recursive cyclic general information extraction model to perform a span identification operation on the sequence to be identified to obtain the current span.
[0017] According to an embodiment of the present disclosure, the first span recognition unit is specifically used to: use the sequence to be recognized as the input of the encoder to obtain a feature vector set; use the feature vector set as the input of the decoder to obtain an output sequence; and obtain the current span based on the output sequence.
[0018] According to an embodiment of the present disclosure, the second span recognition unit is specifically used to: use the sequence to be recognized as the input of the encoder to obtain a feature vector set; based on the feature vector set, obtain a first feature vector set through the long-short time attention change mechanism; use the first feature vector set as the input of the decoder to obtain an output sequence; and obtain the current span based on the output sequence.
[0019] According to an embodiment of the present disclosure, the marking unit is specifically used to: add a type tag to each token of the text sequence and the pattern sequence respectively; and control the tag at a preset position of the text sequence and the pattern sequence respectively.
[0020] According to an embodiment of the present disclosure, the span identification operation includes: performing span detection on the sequence to be identified to obtain a current span; performing span classification on the current span to obtain a current span classification; and performing span association on the current span to obtain a span relationship.
[0021] The third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned information extraction method.
[0022] The fourth aspect of the present disclosure also provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above-mentioned information extraction method.
[0023] The fifth aspect of the present disclosure also provides a computer program product, including a computer program, which implements the above-mentioned information extraction method when executed by a processor.
[0024] In the embodiments of the present disclosure, in order to solve the technical problem that the general information extraction model in the prior art exhibits poor performance when facing multi-span recognition, the present application proposes a recursive cyclic general information extraction model based on the original general information extraction model. Based on explicit pattern prompts, queries of all pattern types are recursively run, and excellent extraction capabilities are demonstrated in complex extraction tasks (such as quadruples and quintuples). At the same time, explicit pattern instructions are used to increase label semantic information and improve performance in low-resource scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The above contents and other purposes, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0026] Figure 1 The application scenario diagram of the information extraction method according to the embodiment of the present disclosure is schematically shown;
[0027] Figure 2 A flowchart of an information extraction method according to an embodiment of the present disclosure is schematically shown;
[0028] Figure 3 A flowchart of an information extraction method according to an embodiment of the present disclosure is schematically shown;
[0029] Figure 4 A flowchart of a serialization method according to an embodiment of the present disclosure is schematically shown;
[0030] Figure 5 A flow chart of a span identification method according to an embodiment of the present disclosure is schematically shown;
[0031] Figure 6 A flowchart of a first-round span identification method according to an embodiment of the present disclosure is schematically shown;
[0032] Figure 7A flowchart of a non-first-round span identification method according to an embodiment of the present disclosure is schematically shown;
[0033] Figure 8 A recursive loop framework according to an embodiment of the present disclosure is schematically shown;
[0034] Fig. 9 A structural block diagram of an information extraction device according to an embodiment of the present disclosure is schematically shown; and
[0035] Fig.10 A block diagram of an electronic device suitable for implementing the information extraction method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0036] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0037] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0038] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0039] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0040] Before the embodiments of the present disclosure are disclosed in detail, the key technical terms involved in the embodiments of the present disclosure are explained one by one, as follows:
[0041] Information Extraction (IE) aims to extract knowledge from various information sources and integrate it into the existing structured knowledge base. The essence of information extraction is the process from text to structure. In general, information extraction usually includes the following tasks: Entity Recognition (NER): Identify specific entities in the text, such as names, places, organizations, time, values, etc.; Relation Extraction: Identify the relationship between entities in the text, such as the relationship between "Xiaohong" and "Xiaoming" is a "partner" relationship; Event Extraction: Identify the events described in the text and the participants and attributes related to the events; Keyword Extraction: Extract keywords or phrases from the text, which can represent the main content of the text; Summarization: Generate a short summary of the text, usually used in news, articles, etc.; Sentiment Analysis: Determine the emotional tendency expressed in the text, such as positive, negative or neutral.
[0042] Universal Information Extraction (UIE) is a natural language processing (NLP) technology that aims to automatically extract structured information from text data. It is a general framework that can handle many types of information extraction tasks, including but not limited to named entity recognition, relationship extraction, event extraction, sentiment analysis, text classification, etc. UIE models are usually based on deep learning technology, especially pre-trained language models, to understand and process text data.
[0043] Token: Also known as Token, it refers to the discrete units that continuous text strings are divided into according to specific word segmentation rules in text analysis. These units can be words, phrases, numbers, punctuation marks, or any other form of text fragments. It can be understood as the smallest unit in the text.
[0044] Span: also known as Span, is used to define continuous subsequences in text, which can be understood as a basic building block in text. Usually, span needs to contain the starting and ending positions of the subsequence in the sentence. In contrast, Token is the smallest unit of text, and Span is a sequence composed of one or more Tokens. Token is used to represent the basic structure of text, while Span is used to represent continuous segments with specific meanings in text. Token is the basis for building vocabulary and word embedding, while spans are the key to information extraction and text understanding. By identifying and analyzing Span, meaningful structured information can be extracted from text.
[0045] Explicit Schema Instrumentation (ESI) is a method used to guide the model to extract information. This method is opposite to Implicit Schema Instructor (ISI). ISI does not explicitly indicate these mapping relationships when expressing schema information. For example, when using ESI, the schema of the extraction task is defined in advance, and the model is made to extract information through the knowledge of the defined schema.
[0046] Pre-trained Language Models (PLMs) are a technology in the field of artificial intelligence that learns common features and patterns of language by training on large amounts of text data. After training, these models can usually be used for various downstream tasks such as text classification, sentiment analysis, machine translation, question-answering systems, etc., without having to train from scratch.
[0047] Long-short time attention change mechanism: It is a technology that combines the long short-term memory network (or LSTM) and the attention mechanism. It can handle important information in long sequences well, allowing the model to focus more on the important parts. The attention weight can be calculated by adding a fully connected layer to each time step of the LSTM model. Then, by weighted summing the attention weight and the input data, the weighted input is obtained, thereby introducing the attention mechanism at each time step.
[0048] Feed-Forward Network (FFN) is a basic artificial neural network in which information flows in one direction, from the input layer through one or more hidden layers to the output layer. FFN is the most basic neural network structure, which consists of an input layer, one or more hidden layers, and an output layer. Information only propagates forward in the network, from the input layer to the output layer, without feedback connections. Each neuron (or node) receives the output of the previous layer as input and generates output to pass to the next layer. FFN is usually used for simple pattern recognition and classification tasks.
[0049] Multi-Layer Perceptron (MLP) is a feed-forward artificial neural network that consists of at least three layers of neurons: an input layer, one or more hidden layers, and an output layer. MLP is a special form of FFN that contains at least three layers: an input layer, at least one hidden layer, and an output layer. MLP uses nonlinear activation functions to increase the expressive power of the network, enabling it to learn and simulate complex function mappings. MLP training usually uses the back-propagation algorithm and the gradient descent method to optimize the network weights. MLP can handle more complex tasks such as classification, regression, and pattern recognition.
[0050] Encoder: The main task is to read the input sequence (such as text, speech, or other types of sequence data) and convert it into a fixed-size internal representation, usually a vector in a high-dimensional space; the encoder usually uses a deep neural network, such as a recurrent neural network (RNN), a long short-term memory network (LSTM), or a Transformer architecture to process the input data.
[0051] Decoder: The task of the decoder is to generate an output sequence based on the output of the encoder and possible additional conditions. In different tasks, the output sequence may be a translated sentence, a summary, an answer to a question, etc. The decoder is usually also a deep neural network, which can be RNN, LSTM or Transformer. When the decoder generates a sequence, the output of each step will be used as the input of the next step. This autoregressive property enables the decoder to gradually build the output sequence; the decoder can also integrate an attention mechanism, allowing the decoder to focus on the relevant parts of the input sequence when generating each output token.
[0052] In the prior art, a universal information extraction model (or UIE) is often used when performing information extraction. This model can only extract a pair of spans and the relationship between them, while ignoring other qualified spans (such as location, time, etc.) that contain information related to the two entities and their relationship. Specifically, the existing UIE models the information extraction task by defining the relationship between text spans and span pairs (called r), but it is limited to extracting two spans. The existing UIE is not reliable when extracting relationships between more than two spans and span pairs, such as named entity recognition (NER) and relation extraction (RE). These tasks are not reliable when extracting other general patterns (such as quadruplets and quintuples). In addition, these existing UIE models use implicit structural pattern directors when performing span extraction, which may lead to incorrect links between different types, thereby hindering the generalization and performance of the model in low-resource scenarios.
[0053] In order to solve the technical problems existing in the prior art, an embodiment of the present disclosure provides an information extraction method, which includes: acquiring text data and an explicit mode prompt, wherein the explicit mode prompt includes N prompt words, and there is a preset structural relationship between the N prompt words, and N is a positive integer; and based on the constraints of the N prompt words, performing N rounds of recognition on the text data through a preset recursive loop general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship.
[0054] In the embodiments of the present disclosure, in order to solve the technical problem that the general information extraction model in the prior art exhibits poor performance when facing multi-span recognition, the present application proposes a recursive cyclic general information extraction model based on the original general information extraction model. Based on explicit pattern prompts, queries of all pattern types are recursively run, and excellent extraction capabilities are demonstrated in complex extraction tasks (such as quadruples and quintuples). At the same time, explicit pattern instructions are used to increase label semantic information and improve performance in low-resource scenarios.
[0055] Figure 1 The application scenario diagram of the information extraction method according to the embodiment of the present disclosure is schematically shown.
[0056] like Figure 1 As shown, the application scenario 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0057] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
[0058] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0059] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0060] It should be noted that the information extraction method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the information extraction device provided in the embodiment of the present disclosure can generally be set in the server 105. The information extraction method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the information extraction device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.
[0061] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0062] The following will be based on Figure 1 The scene described by Figure 2 to Figure 8 The information extraction method of the disclosed embodiment is described in detail.
[0063] Figure 2 The flowchart of the information extraction method according to the embodiment of the present disclosure is schematically shown.
[0064] like Figure 2 As shown, the information extraction method of this embodiment includes operations S210 to S220, and the information extraction method can be executed by the server 105.
[0065] In operation S210, text data and an explicit mode prompt are acquired, wherein the explicit mode prompt includes N prompt words, and there is a preset structural relationship between the N prompt words, where N is a positive integer.
[0066] In the embodiments of the present disclosure, text data is data that needs to realize specific structured information extraction. Usually, the text data is a sentence or a paragraph. The explicit mode prompt contains N prompt words with preset structural relationships. The preset structural relationship is a set of structural relationships between prompt words. The structural relationship between prompt words can at least include: dependency relationship, syntactic structure, subordinate structure, parallel structure and nested structure. It can be understood that the preset structural relationship is preset by humans and can combine the above different relationships, which will not be described in detail here.
[0067] Specifically, the process of identifying spans using the explicit model prompt can be completed by defining an explicit model tool. The definition of the explicit model tool is shown in the following formula 1:
[0068] N_s=N_sd+N_sc+N_sa Formula 1
[0069] Among them, according to the distribution of patterns, the N_s pattern can be divided into three parts, where N_sd is used for span detection, N_sc is used for span classification, and N_sa is used for span association. This formula provides rich hierarchical semantic information for the model, while ensuring that the extraction results meet the constraints of the pattern. Subsequently, N_s can be spliced with text data to identify spans in text data.
[0070] In operation S220, based on the constraints of the N prompt words, N rounds of recognition are performed on the text data through a preset recursive cyclic general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship.
[0071] Under the constraint of the prompt word, the preset recursive cyclic general information extraction model identifies the span information corresponding to each prompt word in the above preset structural relationship through multiple rounds of span recognition. Among them, the preset recursive cyclic general information extraction model is an improved UIE model based on the original UIE model, which combines the explicit pattern prompt to perform multiple rounds of recursive query. The UIE model can perform multiple rounds of span recognition tasks. In the process of multiple rounds of recursive span recognition, each round depends on the results of the previous round.
[0072] The span extraction process is performed in N rounds. In each round of span recognition, a span in a sentence or paragraph is recognized, and in the next round of span recognition, span recognition is continued for the remaining content in the text data that has not yet been span recognized.
[0073] It should be noted that the preset recursive loop general information extraction model extracts a set of structured information from the text, and each item consists of n spans and n corresponding types. The spans are extracted from the text, and the types are defined by a given pattern. Specifically, the probability model for span recognition implemented by the recursive loop is shown in Formula 2 below:
[0074]
[0075] Among them, C n represents a pattern with a depth of n. In the embodiment of the present disclosure, n refers to the depth of the semantic structure. A is the set of all annotation information sequences. t = [t1, t2, ... tn] is one of the type sequences, and x is the text. s = [s1, s2, ... sn] represents the corresponding sequence spanning to t. Use (s, t) i Indicates i and t i Similarly, (s, t) <i Indicates [s 1 ,s 2 ,…,s i-1 ] and [t 1 , t 2 ,...t i-1 ].A i |(s, t) <i is the number of cells in A with (s, t) <i The set of the i-th element of all sequences headed by . In summary, by calculating the probability of occurrence of specific information under given conditions, span recognition can be achieved.
[0076] In a typical scenario, suppose the text data is: User A applied for special loan C from Bank B in X year, and suppose the explicit mode prompt is: "Person {Application (Bank): Special Loan}". Then, when the mode is determined, the preset recursive loop general information extraction model determines "User A" as a span in the first round, and classifies the span as "Person"; in the second round, "Bank B" is determined as a span, and the span is classified as "Bank", and the relationship between "Person" and "Bank" is determined to be "Application". In the third round, "Special Loan C" is determined as a span, and the span is classified as "Special Loan", and the "Special Loan C" is determined to be a classification derived from "Bank". Finally, the information extraction result in the embodiment of the present disclosure is: the text data is extracted as "User A {Application (Bank B): Special Loan C}". Therefore, the result inherits the structure corresponding to each prompt word in the explicit mode prompt.
[0077] In the embodiments of the present disclosure, in order to solve the technical problem that the general information extraction model in the prior art exhibits poor performance when facing multi-span recognition, the present application proposes a recursive cyclic general information extraction model based on the original general information extraction model. Based on explicit pattern prompts, queries of all pattern types are recursively run, and excellent extraction capabilities are demonstrated in complex extraction tasks (such as quadruples and quintuples). At the same time, explicit pattern instructions are used to increase label semantic information and improve performance in low-resource scenarios.
[0078] The following is a detailed description of the information extraction method in the embodiments of the present disclosure, as shown below:
[0079] Figure 3 The flowchart of an information extraction method according to an embodiment of the present disclosure is schematically shown.
[0080] like Figure 3 As shown, an information extraction method of this embodiment includes operations S310 to S320, and operations S310 to S320 can at least partially execute the above-mentioned operation S220.
[0081] In operation S310, the text data and the explicit mode prompt are serialized to obtain a sequence to be recognized.
[0082] The process of serialization is to convert raw text data into a form that the model can understand and process, which is the first step in any data-based NLP task. Serialized data can be used for various tasks such as text classification, sentiment analysis, named entity recognition, machine translation, etc.
[0083] Specifically, the general serialization process includes: first, performing text preprocessing on the text data and explicit mode prompts respectively, including: cleaning the text and standardizing the text; then, performing word segmentation processing on the preprocessed text data and explicit mode prompts: dividing the text into multiple tokens (or tokens), generally, a token is a separate word; then, performing part-of-speech tagging on each token to identify its part of speech; finally, recording the position of each token in the sequence for subsequent manipulation.
[0084] In the embodiments of the present disclosure, the format of the serialized data may be specified as follows:
[0085] Figure 4 A flowchart of a serialization method according to an embodiment of the present disclosure is schematically shown.
[0086] like Figure 4As shown, an information extraction method of this embodiment includes operations S410 to S430, and operations S410 to S430 can at least partially execute the above-mentioned operation S310.
[0087] In operation S410, the text data and the explicit pattern prompt are serialized and segmented respectively to be converted into sequences in token form, thereby obtaining a text sequence and a pattern sequence respectively.
[0088] In operation S420, tags are added to the text sequence and the pattern sequence respectively to obtain a first text sequence and a first pattern sequence.
[0089] According to an embodiment of the present disclosure, the step of adding marks to the text sequence and the pattern sequence respectively to obtain a first text sequence and a first pattern sequence includes: adding a type mark to each token of the text sequence and the pattern sequence respectively; and controlling marks at preset positions of the text sequence and the pattern sequence respectively.
[0090] Specifically, adding tags may include: vocabulary tags, part-of-speech tags, entity tags, text tags, paragraph tags, etc. In the embodiments of the present disclosure, tags may be added first to distinguish text sequences from pattern sequences, and then, each token in the pattern sequence may be further marked to divide its structure, etc. For the text sequence, only tags for distinguishing texts may be maintained.
[0091] In order to distinguish the types of tokens and the relationship between tokens, you can add a tag type tag to clarify it, for example, "t" is the type of a token, and "t1" is the subtype of this type; in order to control information extraction more flexibly, you can control it by adding tags, for example, you can add a task start tag or a task end tag. For example, [CLS] refers to the classification task control model to perform span classification tasks.
[0092] Of course, in addition to the above-mentioned type tags and control tags, there are also some other special tags in the field of information extraction, such as [PAD]: used to fill in the sequence, [BOS]: the beginning of the sentence, [EOS]: the end of the sentence, [SPLT]: used to indicate the segmentation of the text, etc., which will not be repeated here.
[0093] In operation S430, the first pattern sequence and the first text sequence are concatenated to obtain the sequence to be recognized.
[0094] In the process of pattern matching, prefix tags and text tags can be set to distinguish the corresponding positions of patterns and texts. The prefix refers to the starting part of a string or token sequence. The prefix can serve as an important clue for identifying and extracting information, which helps to improve the accuracy and efficiency of information extraction.
[0095] For example, a sequence to be identified is: [P] Person [T] Company [T] Business [Text] Employee B of Company A applies for financial business C. The content after the prefix [P] "Person [T] Company [T] Business" corresponds to the first pattern sequence, and the remaining content is the first text sequence "Employee B of Company A applies for financial business C" corresponds to the first text sequence.
[0096] Based on the above operations S410 to S430, the formation of a mold entry sequence is achieved.
[0097] In operation S320, N rounds of recognition are performed on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain N spans, wherein the preset recursive cyclic general information extraction model includes a long-short time attention change mechanism, and the long-short time attention change mechanism includes: combining the constraints of one or more spans previously recognized to guide the recognition of subsequent spans.
[0098] The preset recursive cyclic general information extraction model is divided into N rounds of execution. The output of each round is associated with the input of the next round, that is, the output Yi is associated with the output Xi+1. Moreover, in each round of recognition process, the long-short time attention change mechanism can be introduced to ensure that in each round of data output, the previous output can be introduced as an attention mechanism to affect the current output, that is, the output process of output Yi is affected by the previous output Y1, Y2, ..., Yi-1.
[0099] The specific implementation of this process is as follows Figure 8 As shown:
[0100] Figure 8 A recursive loop framework according to an embodiment of the present disclosure is schematically shown.
[0101] like Figure 8 As shown, under the framework of this embodiment, the execution process of a round of span identification is as follows:
[0102] First, the current sequence to be recognized is used as the input X of the current round number i i , the matrix after the cue word isolator outputs the link, where the link includes the tag head-tail link, the tag head-type link and the type-tag tail link;
[0103] Then, the current sequence to be recognized is used as the input X of the current round number i i , combined with the above linked matrix, the encoder outputs the feature vector;
[0104] Secondly, the input of the affine length-time attention change mechanism of the above feature vector is combined with the above linked matrix to output the query score matrix;
[0105] Finally, the decoder decodes the query score matrix to obtain the span of the current round output, and adjusts the sequence to be recognized based on the span of the current round output.
[0106] Among them, the above-mentioned long-short attention change mechanism can be achieved by defining an affine transformation with a weighted matrix W, which processes the input vector through a feedforward neural network (or FFN) and calculates the product of the tensor and the vector to output a scalar. For example, by setting up multiple multi-layer perceptrons (or MLPs) with different purposes, such as long memory MLP, memory MLP, etc., combined with the MLP for normal extraction span recognition, the long-short attention change extraction span can be realized.
[0107] In a typical scenario, based on the long-short attention change mechanism in the embodiment of the present disclosure, a method for implementing span detection is specifically as follows:
[0108] Step 1: Combine Figure 8 As shown, the encoder output data H x Use two independent FFNs to generate two different representations for each token in the text: the start position representation and end position
[0109] Step 2: Define a three-dimensional weight matrix W∈R d×d×d , used for subsequent affine transformations, where d is the dimension of the vector. The matrix W is distributed with a normal distribution N(0, σ 2 )initialization;
[0110] Step 3: Using the weight matrix W and input vector H x , the scalar value is calculated by affine transformation and discrete FFN transformation, as shown in Equations 3 and 4 below:
[0111]
[0112] Step 4: Query based on the pattern with the start and end of the token as the key and value;
[0113] Step 5: Create a rating tensor S of size N s ×N x ×N x , where N s For span detection, for span classification and for span association, the attention score M is calculated through continuous matrix multiplication to map the pattern to the score of the span inside the text, as shown in Formula 5 below:
[0114]
[0115] Step 6: Calculate the long-term score S m , where H m It is a memory feature composed of two layers of MLP, which is used to capture long-term dependencies in text, as shown in Equation 6:
[0116]
[0117] Step 7: Learn a gated scalar β to aggregate the local attention state S and memory content S m ;
[0118] Step 8: Use the sigmoid function and the gate scalar β to balance local and long-term information and obtain the final aggregate representation S total , as shown in Formula 7 below:
[0119] S total =sigmoid(β)⊙S m +(1-sigmoid(β))⊙S Equation 7.
[0120] Figure 5 The flowchart of a span identification method according to an embodiment of the present disclosure is schematically shown.
[0121] like Figure 5 As shown, a span identification method of this embodiment includes operations S510 to S520, and operations S510 to S520 can at least partially execute the above operation S320.
[0122] In operation S510, for each round of span recognition, when the currently recognized span is the first span, based on the constraints of the first pattern sequence, a span recognition operation is performed on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain the current span.
[0123] It is understandable that there is no identifiable span for the long-short time attention change mechanism in the first round of processing. Therefore, in the first round of processing, the long-short time attention change mechanism may not be introduced temporarily, and only the first pattern sequence may be introduced.
[0124] According to an embodiment of the present disclosure, the span identification operation includes: performing span detection on the sequence to be identified to obtain a current span; performing span classification on the current span to obtain a current span classification; and performing span association on the current span to obtain a span relationship.
[0125] Specifically, the recursive cyclic general information extraction model will perform span detection, span classification and span association in each round of span detection, where span classification identifies the semantic type of semantic roles; span association establishes and measures the correlation between semantic roles to determine the semantic type. Among them, the task-based mode performs span detection, and the label-based mode performs span classification and span association.
[0126] Among them, span detection usually uses a pattern (or schema) derived from a task-based pattern representation for span detection. The pattern (or schema) can be obtained from a special token [CLS] (a classification tag) when natural language processing requires the hidden state passed between tokens. Span classification: The label-based pattern representation of entity / parameter / trigger / event type is used for span classification. Span association: The label-based pattern representation of relationship / sentiment type is used for span association, which can specifically model potentially related semantic roles and associate them with corresponding semantic types.
[0127] In an embodiment of the present disclosure, span detection is performed using token head and tail links, span classification is performed using token head links, and span association is performed using token tail links. Specifically, for token head and tail links: extract spans from the current sequence, calculate whether there is a connection between the two tokens, and if so, combine them into one span. Token head link: The token head type link refers to the link established between the head of the span and its type. In order to indicate the type, a special tag [T] is used, which is located in front of the type tag. Token tail link: The type token tail connection refers to the connection established between the type of the span and its tail. Similar to the tag head type link, the [T] tag is used before the type tag to indicate the type.
[0128] Figure 6 The flowchart of a first-round span identification method according to an embodiment of the present disclosure is schematically shown.
[0129] like Figure 6 As shown, a first-round span identification method of this embodiment includes operations S610 to S630, and operations S610 to S630 can at least partially execute the above operation S510.
[0130] In operation S610, the sequence to be identified is used as an input of an encoder to obtain a feature vector set.
[0131] Among them, when facing multiple queries, different types and prefixes will cause interference between tokens, which will make the model unable to clearly distinguish different parts of the text. Therefore, it is necessary to isolate different prompts to ensure the reliability of the output. The prompt isolation rule is used to handle queries containing multiple prefixes or parts to ensure that different parts do not interfere with each other. This isolation is achieved by adjusting the type ID, position ID and attention mask. For the attention mask, each prefix token can only interact with the prefix itself, its subtype tokens and text tokens. Each type token can only interact with the type itself, its corresponding prefix token and text token, which can eliminate the influence of irrelevant prompt words.
[0132] In operation S620, an output sequence is obtained based on the feature vector set as an input of a decoder.
[0133] In operation S630, a current span is obtained based on the output sequence.
[0134] The input text is first fed into the encoder, which is usually a deep neural network, such as Transformer or its derivative model. The encoder processes the tokens of the input sequence one by one and generates feature vectors for each round. The output of the encoder is a sequence of feature vectors, each of which contains the encoding information of the corresponding input token; the decoder usually starts with the final hidden state of the encoder, which captures the contextual information of the entire input sequence.
[0135] Based on the output of the decoder, entity boundaries in the text are identified, which generally involves looking for specific tokens or patterns that indicate the start and end of an entity. Based on the identified boundaries, entity spans are extracted from the original text, and then, types are associated with the extracted spans.
[0136] In operation S520, for each round of span recognition, when the currently recognized span is not the first span, based on the first pattern sequence and the constraints of one or more spans previously recognized, a span recognition operation is performed on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain the current span.
[0137] It is understandable that the long-short time attention change mechanism has a previously identified span when the processing is not the first round. Therefore, the long-short time attention change mechanism and the first pattern sequence should be introduced as constraints when the processing is not the first round.
[0138] Figure 7 The flowchart of a non-first-round span identification method according to an embodiment of the present disclosure is schematically shown.
[0139] like Figure 7As shown, a non-first-round span identification method of this embodiment includes operations S710 to S740, and operations S710 to S740 can at least partially execute the above operation S520.
[0140] In operation S710, the sequence to be identified is used as an input of an encoder to obtain a feature vector set.
[0141] In operation S720, based on the feature vector set, a first feature vector set is obtained through the long-short time attention change mechanism.
[0142] In operation S730, an output sequence is obtained based on the first feature vector set as an input of a decoder.
[0143] In operation S740, a current span is obtained based on the output sequence.
[0144] The input text is first fed into the encoder, which is usually a deep neural network model, such as Transformer or its derivative models. The encoder processes the tokens of the input sequence one by one and generates feature vectors for each round. The output of the encoder is a sequence of feature vectors, each of which contains the encoding information of the corresponding input token; the decoder usually starts with the final hidden state of the encoder, which captures the contextual information of the entire input sequence. During this process, the decoder uses the long-short time variation attention mechanism to focus on the part of the encoder output that is most relevant to the current generation task.
[0145] Based on the output of the decoder, entity boundaries in the text are identified, which generally involves looking for specific tokens or patterns that indicate the start and end of an entity. Based on the identified boundaries, entity spans are extracted from the original text, and then, types are associated with the extracted spans.
[0146] Based on the above information extraction method, the present disclosure also provides an information extraction device. Fig. 9 The device is described in detail.
[0147] Fig. 9 The structural block diagram of the information extraction device according to the embodiment of the present disclosure is schematically shown.
[0148] like Fig. 9 As shown, the information extraction device 900 of this embodiment includes a data acquisition module 910 and a span identification module 920 .
[0149] The data acquisition module 910 is used to acquire text data and an explicit mode prompt, wherein the explicit mode prompt includes N prompt words, and there is a preset structural relationship between the N prompt words, and N is a positive integer. In one embodiment, the data acquisition module 910 can be used to perform the operation S210 described above, which will not be repeated here.
[0150] The span identification module 920 is used to perform N rounds of recognition on the text data based on the constraints of the N prompt words through a preset recursive loop general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship. In one embodiment, the span identification module 920 can be used to perform the operation S220 described above, which will not be repeated here.
[0151] In the embodiments of the present disclosure, in order to solve the technical problem that the general information extraction model in the prior art exhibits poor performance when facing multi-span recognition, the present application proposes a recursive cyclic general information extraction model based on the original general information extraction model. Based on explicit pattern prompts, queries of all pattern types are recursively run, and excellent extraction capabilities are demonstrated in complex extraction tasks (such as quadruples and quintuples). At the same time, explicit pattern instructions are used to increase label semantic information and improve performance in low-resource scenarios.
[0152] According to an embodiment of the present disclosure, the span recognition module includes: a serialization conversion submodule and a span recognition submodule, the serialization conversion submodule is used to serialize the text data and the explicit pattern prompt to obtain a sequence to be recognized; and the span recognition submodule is used to perform N rounds of recognition on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain N spans, wherein the preset recursive cyclic general information extraction model includes a long-short time attention change mechanism, and the long-short time attention change mechanism includes: combining the constraints of one or more spans previously recognized to guide the recognition of subsequent spans.
[0153] According to an embodiment of the present disclosure, the serialization conversion submodule includes: a word segmentation unit, a marking unit, a linking unit and a splicing unit. The word segmentation unit is used to serialize and segment the text data and the explicit pattern prompt respectively to convert them into sequences in the form of tokens to obtain a text sequence and a pattern sequence respectively; the marking unit is used to add marks to the text sequence and the pattern sequence respectively to obtain a first text sequence and a first pattern sequence; the linking unit is used to and the splicing unit are used to splice the first pattern sequence and the first text sequence to obtain the sequence to be recognized.
[0154] According to an embodiment of the present disclosure, the span identification submodule includes: a first span identification unit and a second span identification unit, wherein the first span identification unit is used for, for each round of span identification, when the currently identified span is the first span, based on the constraints of the first pattern sequence, and using a preset recursive cyclic general information extraction model to perform a span identification operation on the sequence to be identified to obtain the current span; or the second span identification unit is used for, for each round of span identification, when the currently identified span is not the first span, based on the constraints of the first pattern sequence and one or more spans previously identified, and using a preset recursive cyclic general information extraction model to perform a span identification operation on the sequence to be identified to obtain the current span.
[0155] According to an embodiment of the present disclosure, the first span recognition unit is specifically used to: use the sequence to be recognized as the input of the encoder to obtain a feature vector set; use the feature vector set as the input of the decoder to obtain an output sequence; and obtain the current span based on the output sequence.
[0156] According to an embodiment of the present disclosure, the second span recognition unit is specifically used to: use the sequence to be recognized as the input of the encoder to obtain a feature vector set; based on the feature vector set, obtain a first feature vector set through the long-short time attention change mechanism; use the first feature vector set as the input of the decoder to obtain an output sequence; and obtain the current span based on the output sequence.
[0157] According to an embodiment of the present disclosure, the marking unit is specifically used to: add a type tag to each token of the text sequence and the pattern sequence respectively; and control the tag at a preset position of the text sequence and the pattern sequence respectively.
[0158] According to an embodiment of the present disclosure, the span identification operation includes: performing span detection on the sequence to be identified to obtain a current span; performing span classification on the current span to obtain a current span classification; and performing span association on the current span to obtain a span relationship.
[0159] According to an embodiment of the present disclosure, any multiple modules in the data acquisition module 910 and the span identification module 920 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the data acquisition module 910 and the span identification module 920 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in an appropriate combination of any of them. Alternatively, at least one of the data acquisition module 910 and the span identification module 920 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0160] Fig.10 A block diagram of an electronic device suitable for implementing the information extraction method according to an embodiment of the present disclosure is schematically shown.
[0161] like Fig.10 As shown, the electronic device 1000 according to an embodiment of the present disclosure includes a processor 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. The processor 1001 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1001 may also include an onboard memory for caching purposes. The processor 1001 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0162] In RAM 1003, various programs and data required for the operation of electronic device 1000 are stored. Processor 1001, ROM 1002 and RAM 1003 are connected to each other via bus 1004. Processor 1001 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 1002 and / or RAM 1003. It should be noted that the program can also be stored in one or more memories other than ROM 1002 and RAM 1003. Processor 1001 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0163] According to an embodiment of the present disclosure, the electronic device 1000 may further include an input / output (I / O) interface 1005, which is also connected to the bus 1004. The electronic device 1000 may further include one or more of the following components connected to the I / O interface 1005: an input portion 1006 including a keyboard, a mouse, etc.; an output portion 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 1008 including a hard disk, etc.; and a communication portion 1009 including a network interface card such as a LAN card, a modem, etc. The communication portion 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage portion 1008 as needed.
[0164] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0165] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 1002 and / or RAM 1003 described above and / or one or more memories other than ROM 1002 and RAM 1003.
[0166] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the item recommendation method provided by the embodiment of the present disclosure.
[0167] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 1001. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0168] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 1009, and / or installed from the removable medium 1011. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0169] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the processor 1001, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0170] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0171] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0172] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0173] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. An information extraction method, characterized in that: The method comprises: Acquire text data and an explicit mode prompt, wherein the explicit mode prompt includes N prompt words, there is a preset structural relationship between the N prompt words, and N is a positive integer; and Based on the constraints of the N prompt words, N rounds of recognition are performed on the text data through a preset recursive cyclic general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship.
2. The method according to claim 1, characterized in that: Based on the constraints of the N prompt words, N rounds of recognition are performed on the text data through a preset recursive cyclic general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship, including: Serializing the text data and the explicit mode prompt to obtain a sequence to be recognized; and Through a preset recursive cyclic general information extraction model, N rounds of recognition are performed on the sequence to be recognized to obtain N spans, wherein the preset recursive cyclic general information extraction model includes a long-short time attention change mechanism, and the long-short time attention change mechanism includes: combining the constraints of one or more spans recognized previously to guide the recognition of subsequent spans.
3. The method according to claim 2, characterized in that The step of serializing the text data and the explicit mode prompt to obtain a sequence to be recognized includes: Sequencing and segmenting the text data and the explicit pattern prompt respectively to convert them into sequences in token form, thereby obtaining a text sequence and a pattern sequence respectively; adding tags to the text sequence and the pattern sequence respectively to obtain a first text sequence and a first pattern sequence; and The first pattern sequence and the first text sequence are concatenated to obtain the sequence to be recognized.
4. The method according to claim 3, characterized in that The preset recursive cyclic general information extraction model is used to perform N rounds of recognition on the sequence to be recognized to obtain N spans, including: For each round of span recognition, when the currently recognized span is the first span, based on the constraint of the first pattern sequence, a span recognition operation is performed on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain the current span; or For each round of span recognition, when the currently recognized span is not the first span, based on the first pattern sequence and the constraints of one or more spans previously recognized, a span recognition operation is performed on the sequence to be recognized through a preset recursive cyclic general information extraction model to obtain the current span.
5. The method according to claim 4, characterized in that The step of performing a span recognition operation on the sequence to be recognized based on the constraint of the first pattern sequence through a preset recursive cyclic general information extraction model to obtain a current span includes: Taking the sequence to be identified as the input of the encoder to obtain a feature vector set; Based on the feature vector set as the input of the decoder, an output sequence is obtained; and A current span is obtained based on the output sequence.
6. The method according to claim 5, characterized in that The step of performing a span recognition operation on the sequence to be recognized based on the first pattern sequence and the constraints of one or more spans previously recognized by using a preset recursive cyclic general information extraction model to obtain a current span includes: Taking the sequence to be identified as the input of the encoder to obtain a feature vector set; Based on the feature vector set, a first feature vector set is obtained through the long-short time attention change mechanism; Based on the first feature vector set as the input of the decoder, an output sequence is obtained; and A current span is obtained based on the output sequence.
7. The method according to claim 5 or 6, characterized in that: The step of adding marks to the text sequence and the pattern sequence respectively to obtain a first text sequence and a first pattern sequence includes: Adding a type tag to each token of the text sequence and the pattern sequence respectively; and The text sequence and the pattern sequence are respectively marked at their respective preset positions.
8. The method according to claim 5, characterized in that in, The span identification operation includes: Performing span detection on the sequence to be identified to obtain a current span; Performing span classification on the current span to obtain a current span classification; and Span association is performed on the current span to obtain a span relationship.
9. An information extraction device, characterized in that: The device comprises: A data acquisition module, used to acquire text data and an explicit mode prompt, wherein the explicit mode prompt includes N prompt words, there is a preset structural relationship between the N prompt words, and N is a positive integer; and The span recognition module is used to perform N rounds of recognition on the text data based on the constraints of the N prompt words through a preset recursive cyclic general information extraction model to obtain N spans that correspond one-to-one to the prompt words and inherit the preset structural relationship.
10. An electronic device comprising: one or more processors; a storage device for storing one or more computer programs, The method is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Knowledge structured extraction method based on multi-modal large model
CN121031762A
