Information extraction method and device, storage medium and electronic equipment
By decomposing the information extraction task into three sub-tasks—identifying the first entity, identifying the second entity, and classifying relation types—and sharing pre-trained model parameters, the problem of high model complexity and poor stability in existing technologies is solved, achieving efficient and accurate information extraction under conditions of small sample size and class imbalance.
Patent Information
- Application Number
- CN202111284909.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-01
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2041-11-01
AI Technical Summary
Existing information extraction methods suffer from problems such as complex models, large number of parameters, and poor stability.
An information extraction method based on a pre-trained model is adopted. By constructing a first entity recognition label, a second entity recognition label, and a classification label, the information extraction task is decomposed into three sub-tasks: recognizing the first entity, recognizing the second entity, and classifying the relation type. The model parameters are shared to reduce the number of parameters and the complexity of the model.
It improves the robustness of the model and the stability of information extraction results, and can still achieve good results, especially in the case of small samples or class imbalance, thus improving the accuracy of the recognition results.
Smart Images

Figure CN114020907B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of information processing, and in particular, to an information extraction method, an information extraction device, a computer readable storage medium and an electronic device. BACKGROUND
[0002] Information extraction (IE) is a task of natural language processing technology, which focuses on extracting information from machine-readable unstructured or semi-structured text, and finally describing in a structured form so that the information can be stored in a database for further processing.
[0003] There are various existing information extraction methods, such as pipeline relation extraction method and entity relation joint learning extraction method, which can all achieve the extraction of triplets.
[0004] However, the existing information extraction methods have the problems of complex model, large number of parameters, and poor stability such as not easy to converge. SUMMARY
[0005] The present disclosure provides an information extraction method, an information extraction device, a computer readable storage medium and an electronic device, thereby at least partially solving the problem of poor information extraction stability in the related art.
[0006] According to a first aspect of the present disclosure, an information extraction method is provided, comprising: obtaining a target text to be information extracted; constructing a first input text of a first entity recognition label plus the target text, and extracting a first entity from the first input text; constructing a second input text of a second entity recognition label plus the first entity, and plus the target text, and extracting a second entity from the second input text; constructing a third input text of a classification label plus the first entity and the second entity, and plus the target text, and extracting a relationship type from the third input text.
[0007] According to a second aspect of the present disclosure, an information extraction device is provided, comprising: a target text obtaining module configured to obtain a target text to be information extracted; a first entity extraction module configured to construct a first input text of a first entity recognition label plus the target text, and extract a first entity from the first input text; a second entity extraction module configured to construct a second input text of a second entity recognition label plus the first entity, and plus the target text, and extract a second entity from the second input text; and a relationship type extraction module configured to construct a third input text of a classification label plus the first entity and the second entity, and plus the target text, and extract a relationship type from the third input text.
[0008] According to a third aspect of the present disclosure, a computer readable storage medium is provided, which stores a computer program. The computer program, when executed by a processor, implements the information extraction method of the first aspect and possible implementation manners thereof.
[0009] According to a fourth aspect of the present disclosure, an electronic device is provided, which comprises a processor and a memory for storing executable instructions of the processor. The processor is configured to execute the executable instructions to implement the information extraction method of the first aspect and possible implementation manners thereof.
[0010] The technical solution of the present disclosure has the following beneficial effects:
[0011] On the one hand, the first entity recognition label and the second entity recognition label can be used as question labels. In the first entity and second entity extraction process, the task of distinguishing can be achieved, and the effect of the task can be achieved by means of the same model, reducing the complexity of the model. On the other hand, by splitting the information extraction into three tasks of identifying the first entity, identifying the second entity and classifying the relationship type, the parameter amount of the identification process is reduced, and good results can be achieved even in small samples or unbalanced categories, thereby improving the robustness of the used model and the stability of the information extraction result. On the other hand, in the extraction of the second entity, the first entity is used as feature information, and in the extraction of the relationship type, the first entity and the second entity are used as feature information at the same time, so that the input information has stronger pertinence and relevance, thereby improving the accuracy of the identification result.
[0012] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0013] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained from these drawings without creative labor for those skilled in the art.
[0014] Figure 1 A flowchart of the information extraction method in the present exemplary embodiment is shown;
[0015] Figure 2 A subject recognition process diagram in the information extraction method of the present exemplary embodiment is shown;
[0016] Figure 3 An object recognition process diagram in the information extraction method of the present exemplary embodiment is shown;
[0017] Figure 4 Fig. 1 shows a viewing position coordinate diagram in the present exemplary embodiment;
[0018] Figure 5 Fig. 2 shows a flow structure diagram of an information extraction process in the present exemplary embodiment;
[0019] Figure 6 Fig. 3 shows a structure diagram of an information extraction apparatus in the present exemplary embodiment;
[0020] Figure 7 Fig. 4 shows a hardware composition structure diagram of an electronic device in the present exemplary embodiment. DETAILED DESCRIPTION
[0021] Example embodiments now will be described more fully hereinafter with reference to the accompanying drawings. Example embodiments, however, can be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of example embodiments to those skilled in the art. Like reference numerals refer to like elements throughout. The terminology used in the description presented below is not intended to be interpreted in any specific and / or particular manner. The terminology utilized in the description presented below is intended to be used only in a generic and / or descriptive sense and not a specific and / or restrictive sense unless specifically so indicated.
[0022] In addition, the drawings are only schematic and are non-limiting. Like reference numerals designate corresponding parts throughout the several views. Some embodiments will be described using the expression "coupled" and "connected" along with their derivatives, which are intended to mean either an indirect or direct connection. Thus, any connection made between components in the description can be connected directly or connected indirectly through one or more intervening components. Additionally, some embodiments will be described using a variety of functional terminology, such as "means" and "device", which are intended to encompass any hardware, software, firmware, or combination thereof, which serves the described function.
[0023] The flow diagrams depicted herein are examples only and are not meant to limit the scope of the application. One will appreciate that some steps can be omitted, combined, or performed in a different order than that shown. Additionally, the term "first", "second", etc. are used herein only for the purpose of distinguishing between different components, and are not meant to limit the scope of the application.
[0024] The information extraction method provided by the embodiments of the present disclosure is mainly based on a reading comprehension paradigm for information extraction, wherein the reading comprehension paradigm is a standardized sentence pattern in the field of reading comprehension, for example, a subject-verb-object paradigm, etc. The information extraction method will be described in detail below in combination with Figure 1 The information extraction method of the exemplary embodiments of the present disclosure will be described in detail. As shown in the information extraction method can include: Figure 1
[0025] Step S110, obtaining a target text to be information extracted;
[0026] Step S120, constructing a first input text of a first entity recognition label plus the target text, extracting a first entity from the first input text;
[0027] Step S130, constructing a second input text of a second entity recognition label plus the first entity, and then plus the target text, extracting a second entity from the second input text;
[0028] Step S140, constructing a third input text of a classification label plus the first entity and the second entity, and then plus the target text, extracting a relationship type from the third input text.
[0029] The information extraction method achieves the following technical effects: on the one hand, the first entity recognition label and the second entity recognition label can be used as question labels, and in the process of extracting the first entity and the second entity, the task can be distinguished, and the effect of the task can be achieved by means of the same model, reducing the complexity of the model. On the other hand, by splitting the information extraction into three tasks of recognizing the first entity, recognizing the second entity and classifying the relationship type, the parameter amount of the recognition process is reduced, and even in the case of small samples or uneven categories, good results can be achieved, thereby improving the robustness of the used model and the stability of the information extraction result. On the other hand, when extracting the second entity, the first entity is used as feature information, and when extracting the relationship type, the first entity and the second entity are used as feature information at the same time, so that the input information has stronger pertinence and relevance, thereby improving the accuracy of the recognition result.
[0030] The implementation process of each step will be described in detail below:
[0031] In step S110, the target text to be information extracted is obtained.
[0032] In actual application, the target text to be information extracted can be a structured text, or an unstructured text, etc.
[0033] The target text can be obtained from a webpage, input by a user, or recognized from speech input by the user. The target text can be one or more sentences or one or more paragraphs.
[0034] It should be noted that the language of the target text is not limited in the embodiments of the present disclosure, for example, the target text can be a Chinese text, an English text, a Japanese text, etc. For ease of understanding, the Chinese text is taken as an example for description in the following examples.
[0035] In step S120, a first input text of the first entity recognition label and the target text is constructed, and the first entity is extracted from the first input text.
[0036] The pre-training model is trained based on a large-scale text corpus to represent a general language, which is helpful for a downstream task. The pre-training can provide better model initialization parameters, so that the generalization performance is better and the convergence speed is faster on the target task. The pre-training model includes a multi-purpose natural language processing model, a word embedding model, etc.
[0037] The information extraction method provided by the embodiments of the present disclosure is also implemented based on the pre-training model described above. It should be noted that in the example embodiment, the first entity recognition label and the second entity recognition label are added to the pre-training model before the first input text is constructed. The entity recognition labels contained therein are mainly used to identify and extract elements in the triplets in the text to be information extracted, to provide a basis for information extraction.
[0038] In actual applications, the triplet is a semantic network representing an entity and an entity relationship, wherein the triplet includes a subject-predicate-object. In the example embodiment of the present disclosure, the first entity and the second entity represent the subject or the object, and the relationship type represents the predicate.
[0039] Specifically, when the first entity recognition label is a subject recognition label [SUB], the first entity is a subject; when the second entity recognition label is an object recognition label [OBJ], the second entity is an object. When the first entity recognition label is an object recognition label [OBJ], the first entity is an object; when the second entity recognition label is a subject recognition label [SUB], the second entity is a subject.
[0040] Next, the information extraction method provided by the embodiments of the present disclosure is described by taking the BERT (Bidirectional Encoder Representation from Transformers) pre-training model in the multi-purpose natural language processing model as an example.
[0041] BERT is a deep bidirectional pre-training language understanding model using Transformers as a feature extractor. The input received by the BERT model includes three parts: Token Embedding (token embedding) after word embedding, symbol of sentence category, and Position Embedding (position embedding).
[0042] Before training the BERT model, the feature vector of the new label provided by the embodiment of the present disclosure, i.e., the subject recognition label [SUB] and the object recognition label [OBJ], needs to be embedded into the Embedding embedding module of BERT as Token Embedding. In the specific embedding process, the unused label reserved by BERT, i.e., the unused label, can be used without changing the original Embedding vector in BERT to increase the Token Embedding of BERT.
[0043] After adding the first entity recognition label and the second entity recognition label to the pre-training model, the first input text of the first entity recognition label and the target text can be constructed. The following takes the target text “AAA’s wife is BBB, daughter is CCC” as an example to illustrate the information extraction process provided by the embodiment of the present disclosure:
[0044] Taking the first entity recognition label as the subject recognition label [SUB] and the first entity as the subject, and taking the second entity recognition label as the object recognition label [OBJ] and the second entity as the object, the information extraction process is illustrated. Other cases can be implemented with reference. It should be noted that the information extraction method provided by the embodiment of the present disclosure, whether the subject recognition is performed first or the object recognition is performed first, falls within the protection scope of the embodiment of the present disclosure.
[0045] In the extraction process of the first entity, i.e., the subject extraction process, the format of the first input text constructed is “[SUB] target text”, for example, the first input text is “[SUB] AAA’s wife is BBB, daughter is CCC”, as shown in Figure 2 The first input text is input into the pre-training model, and the output of the pre-training model is the Embedding of each character in the input after model coding, two tasks are to predict the words masked in the input, and to predict whether the two sentences in the input are upper and lower sentences or spliced. By adding a fully connected layer to the pre-training model, the nonlinearity of attention can be increased, and the expression of the model can be enhanced.
[0046] The exemplary embodiment of the present disclosure uses a pointer network for sequence labeling in the subject extraction process, and determines the start position (SUB START) and end position (SUB END) of the subject in combination with the subject recognition label [SUB] problem instruction, so as to obtain the subject recognition result: "AAA", as the first entity.
[0047] In step S130, the second entity recognition label plus the first entity, and the second input text of the target text are constructed, and the second entity is extracted from the second input text.
[0048] After the first entity is extracted, the first entity can be combined into the second input text to increase the accuracy of the second entity extraction.
[0049] Specifically, the first entity can be placed after the second entity recognition label, for example, the subject "AAA" is placed after the object recognition label [OBJ]; and the first entity is separated from the target text, that is, when constructing the second input text, the first entity and the target text are separated by a separation label [SEP]. The format of the obtained second input text is "[OBJ] subject [SEP] target text", for example, "[OBJ] AAA [SEP] AAA's wife is BBB, daughter is CCC".
[0050] As shown in Figure 3 The constructed second input text is input into the pre-training model, and then a full connection layer is connected to the pre-training model, the pointer network is used for sequence labeling, and the object start position (SUB START) and end position (SUB END) are determined in combination with the object recognition label [OBJ] problem instruction, so as to obtain the object recognition result: "BBB", "CCC", as the second entity.
[0051] In the second entity extraction process, the pre-training model used in the first entity extraction process can share parameters, that is, it can be the same model, so as to reduce the parameter amount in the whole information extraction process, so that the model can also be identified in the case of small sample or category imbalance, and the robustness of the model is improved.
[0052] In step S140, the classification label plus the first entity and the second entity, and the third input text of the target text are constructed, and the relationship type is extracted from the third input text.
[0053] After the first entity and the second entity are extracted, the relationship type of the two entities needs to be extracted.
[0054] Similarly, the third input text needs to be constructed first, and the original label contained in the third input text is the classification label [CLS] for BERT. Therefore, the classification label can be directly used, and the first entity and the second entity are spliced, and the target text is added to complete the construction of the third input text.
[0055] It should be noted that in order to facilitate machine recognition, when constructing the third input text, the first entity and the second entity need to be separated by a separator label [SEP], and the second entity and the target text also need to be separated by a separator label [SEP].
[0056] The obtained third input text is in the format of "[CLS] subject [SEP] object [SEP] target text", for example, taking the first entity AAA and the second entity BBB as an example, the third input text is "[CLS] AAA [SEP] BBB [SEP] AAA's wife is BBB, daughter is CCC".
[0057] It should be noted that in step S120, two second entities, i.e., two objects, are obtained, and in this case, when constructing the third input text, two kinds of texts can be constructed. In addition to the above example text, another text is "[CLS] AAA [SEP] CCC [SEP] AAA's wife is BBB, daughter is CCC".
[0058] As Figure 4 shown, the constructed third input text is input into the pre-trained model, and then a fully connected layer and an activation function layer (Sigmoid layer) are connected to the pre-trained model. The pointer network is used for sequence labeling, and the subject, object and classification label [CLS] problem instruction are combined to determine the start position (SUB_START) and end position (SUB_END) of the predicate, so that the predicate recognition result "wife" as the relationship type can be obtained. The probability of the recognition label can be obtained through the activation function layer to facilitate the final recognition result determination, and the predicate determination when the same subject and multiple objects are supported can also improve the accuracy of the determination result.
[0059] After obtaining the first entity, the second entity and the relationship type, the "subject-predicate-object" triple is obtained, that is, the information extraction of the target text is completed.
[0060] Next, the attached Figure 5The steps of the triple extraction process in the information extraction method are described as follows: entering step S501, obtaining a target text; entering step S502, constructing a first input text according to a first entity recognition label and the target text; entering step S503, extracting a first entity from the first input text; entering step S504, constructing a second input text according to a second entity recognition label, the first entity and the target text; entering step S505, extracting a second entity from the second input text; entering step S506, constructing a third input text according to a classification label, the first entity, the second entity and the target text; and entering step S507, extracting a relation type from the third input text.
[0061] To sum up, the information extraction method provided by the example embodiment belongs to the technical field of information processing. The information extraction process uses the paradigm of reading comprehension, constructs an input text through a question label, divides information extraction into three tasks of subject recognition, object recognition and relation classification, and can share the parameters of the BERT pre-training model among the three tasks, thereby reducing the parameter quantity of the full connection layer, achieving good results in small samples and category imbalance, and improving the robustness of the model. In addition, the output of the previous task can be constructed into the input of the next task, strengthening the connection among the three tasks, improving the pertinence of model recognition, and improving the efficiency of information extraction. In addition, while sharing the parameters of the pre-training model, the newly added [SUB] and [OBJ] labels are used to distinguish tasks, so that the shared layer can perform different tasks according to different question labels, providing a new idea for using pre-training models.
[0062] In addition, the layer connection task is used for screening instead of full-process prediction on all entities, thereby reducing the prediction quantity and improving the efficiency of the model. At the same time, each step is a simple task, the model converges quickly, is robust, and can overcome the problem of partial sample imbalance.
[0063] It should be noted that although the steps of the method in the present disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. In addition or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be divided into multiple steps, etc.
[0064] The example embodiment of the present disclosure also provides an information extraction device. As shown in the figure, the information extraction device 600 can include: Figure 6
[0065] a target text acquisition module 610, configured to acquire a target text to be information extracted;
[0066] The first entity extraction module 620 is configured to construct a first input text of the first entity identification label plus the target text, and extract the first entity from the first input text.
[0067] The second entity extraction module 630 is configured to construct a second input text of the second entity identification label plus the first entity plus the target text, and extract the second entity from the second input text.
[0068] The relationship type extraction module 640 is configured to construct a third input text of the classification label plus the first entity and the second entity plus the target text, and extract the relationship type from the third input text.
[0069] In an example embodiment of the present disclosure, the first entity extraction module 620 is configured to input the first input text into a pre-training model plus a full connection layer to obtain the first entity.
[0070] In an example embodiment of the present disclosure, the second entity extraction module 630 is configured to input the second input text into a pre-training model plus a full connection layer to obtain the second entity.
[0071] In an example embodiment of the present disclosure, the relationship type extraction module 640 is configured to input the third input text into a pre-training model plus a full connection layer and an activation function layer to obtain the relationship type.
[0072] In an example embodiment of the present disclosure, the label adding module 650 is further configured to add the first entity identification label and the second entity identification label to the pre-training model before constructing the first input text.
[0073] The label adding module 650 is configured to add the first entity identification label and the second entity identification label to the pre-training model before constructing the first input text.
[0074] In an example embodiment of the present disclosure, the second entity extraction module 630 is configured to separate the first entity and the target text by a separation label when constructing the second input text.
[0075] In an example embodiment of the present disclosure, the relationship type extraction module 640 is configured to separate the first entity and the second entity by a separation label, and separate the second entity and the target text by a separation label when constructing the third input text.
[0076] In an example embodiment of the present disclosure, the first entity identification label is a subject identification label, and the first entity is a subject.
[0077] The second entity identification label is an object identification label, and the second entity is an object.
[0078] In an example embodiment of the present disclosure, the first entity identification label is an object identification label, and the first entity is an object.
[0079] The second entity recognition label is a subject recognition label, and the second entity is a subject.
[0080] It should be noted that the above Figure 6 The information extraction device provided by the embodiment divides the above-mentioned programs into different program modules to complete all or part of the above-mentioned processing. In addition, the information extraction device and the information extraction method provided by the embodiment belong to the same concept, and the specific implementation process is described in the method embodiment, which will not be repeated here.
[0081] It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, such division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into a plurality of modules or units.
[0082] It should be understood that the present disclosure is not limited to the precise structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0083] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present application, the embodiment of the present application further provides an electronic device, Figure 7 The hardware composition structure of the electronic device of the embodiment of the present application is shown in Figure 7 The electronic device 700 includes:
[0084] The communication interface 701 can interact with other devices such as network devices and the like.
[0085] The processor 702 is connected with the communication interface 701 to realize information interaction with other devices, and is used to run a computer program to execute the information extraction method provided by one or more technical solutions. The computer program is stored on the memory 703.
[0086] Of course, in actual application, each component in the electronic device is coupled together through the bus system 704. It can be understood that the bus system 704 is used to realize the connection and communication between the components. In addition to the data bus, the bus system 704 also includes a power bus, a control bus and a status signal bus. However, in order to clearly illustrate, all kinds of buses are marked as the bus system 704 in the Figure 7 .
[0087] The memory 703 in the embodiments of the present application is used to store various types of data to support the operation of the electronic device. Examples of these data include: any computer programs for operating on the electronic device.
[0088] It can be understood that the memory 703 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a ferromagnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM can be used, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM).The memory 703 described in the embodiments of the present application is intended to include, but not limited to, these and any other suitable type of memory.
[0089] The method disclosed in the embodiments of the present application can be applied in the processor 702 or implemented by the processor 702. The processor 702 can be an integrated circuit chip having a signal processing capability. In the implementation process, each step of the above method can be completed by an integrated logic circuit or an instruction in the form of software in the processor 702. The processor 702 described above can be a general processor, a DSP, or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The processor 702 can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application. The general processor can be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiments of the present application, the execution can be directly completed by a hardware decoding processor, or completed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in the memory 703. The processor 702 reads the program in the memory 703 and combines the hardware to complete the steps of the above method.
[0090] The processor 702 implements the corresponding flow in each method of the embodiments of the present application when executing the program. For brevity, it will not be repeated here.
[0091] In the exemplary embodiments, the embodiments of the present application also provide a storage medium, that is, a computer storage medium, specifically a computer readable storage medium, for example, the memory 703 storing a computer program, which can be executed by the processor 702 to complete the steps of the above method. The computer readable storage medium can be FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM, etc.
[0092] In several embodiments provided in the present application, it should be understood that the disclosed apparatus, terminal and method can be implemented by other means. The above described device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed components can be through some interface, indirect coupling or communication connection between devices or units, which can be electrical, mechanical or other forms.
[0093] The units described as separate components above can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place or distributed on multiple network units; part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0094] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
[0095] Those skilled in the art can understand that all or part of the steps of the above method embodiments can be completed by program instruction related hardware, and the above program can be stored in a computer readable storage medium, and the program executes the steps including the above method embodiments when executed; and the above storage medium includes mobile storage device, ROM, RAM, magnetic disc or optical disc and various storage program codes.
[0096] Alternatively, the integrated unit of the present application, if implemented in the form of a software function module and sold or used as an independent product, can also be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for making an electronic device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the methods described in the embodiments of the present application. The above storage medium includes mobile storage device, ROM, RAM, magnetic disc or optical disc and various storage program codes.
[0097] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. An information extraction method characterized by, The method comprises: acquiring a target text to be information extracted; constructing a first input text by splicing a first entity recognition label and the target text, and extracting a first entity from the first input text; constructing a second input text by splicing a second entity recognition label, the first entity and the target text, and extracting a second entity from the second input text; constructing a third input text by splicing a classification label, the first entity, the second entity and the target text, and extracting a relationship type of the first entity and the second entity from the third input text.
2. The information extraction method of claim 1, wherein, The extracting of the first entity from the first input text comprises: inputting the first input text into a pre-training model to obtain the first entity.
3. The information extraction method of claim 2, wherein, The extracting of the second entity from the second input text comprises: inputting the second input text into the pre-training model to obtain the second entity.
4. The information extraction method of claim 3, wherein, The extracting of the relationship type from the third input text comprises: inputting the third input text into the pre-training model and an activation function layer to obtain the relationship type.
5. The information extraction method according to any one of claims 2-4, characterized in that, The method further comprises: before constructing the first input text, the first entity recognition label and the second entity recognition label need to be added to the pre-training model.
6. The information extraction method according to any one of claims 2-4, characterized in that, The pre-training model comprises a BERT model and a full connection layer.
7. The information extraction method of claim 1, wherein, The method further comprises: when constructing the second input text, the first entity and the target text are separated by a separation label.
8. The information extraction method of claim 1, wherein, The method further comprises: when constructing the third input text, the first entity and the second entity are separated by a separation label, and the second entity and the target text are separated by a separation label.
9. The information extraction method of claim 1, wherein, The first entity recognition label is a subject recognition label, and the first entity is a subject. The second entity recognition label is an object recognition label, and the second entity is an object.
10. The information extraction method of claim 1, wherein, The first entity recognition label is an object recognition label, and the first entity is an object. The second entity recognition label is a subject recognition label, and the second entity is a subject.
11. An information extraction apparatus characterized by comprising: The device comprises: a target text acquisition module configured to acquire a target text to be information extracted; a first entity extraction module configured to construct a first input text by splicing a first entity recognition label and the target text, and extract a first entity from the first input text; a second entity extraction module configured to construct a second input text by splicing a second entity recognition label, the first entity and the target text, and extract a second entity from the second input text; a relationship type extraction module configured to construct a third input text by splicing a classification label, the first entity, the second entity and the target text, and extract a relationship type from the third input text.
12. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by a processor to implement the information extraction method of any one of claims 1 to 10.
13. An electronic device, comprising: comprises: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the information extraction method of any one of claims 1 to 10 by executing the executable instructions.
Citation Information
Patent Citations
Information extraction method and device, electronic equipment and storage medium
CN111291185A
Entity relationship extraction method and device
CN111753029A