Information extraction method, device, storage medium and electronic equipment

The semantic, part-of-speech and knowledge base label vectors are extracted through the pre-trained model, combined with the semantic information and preset knowledge base of the target text, the problem of insufficient recall and accuracy of the existing information extraction system is solved, and more efficient triple information extraction is achieved.

CN114417850BActive Publication Date: 2025-09-02GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210103652.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-27
Publication Date
2025-09-02
Estimated Expiration
2042-01-27

AI Technical Summary

Technical Problem

The existing information extraction system fails to make full use of existing knowledge bases and part-of-word information, resulting in insufficient recall and accuracy.

Method used

The semantic vector, part-of-speech label vector and knowledge base label vector are extracted through the pre-trained model, and the semantic information and preset knowledge base of the target text are combined to extract triple information.

Benefits of technology

The recall and accuracy of information extraction are improved, and the extraction effect of triple information is improved by combining the semantic information, part of speech and preset knowledge base of the target text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114417850B_ABST
    Figure CN114417850B_ABST
Patent Text Reader

Abstract

The present application discloses an information extraction method, apparatus, storage medium, and electronic device, wherein the method comprises: obtaining a target text; inputting the target text into a pre-trained model, outputting a first matrix corresponding to the target text, the pre-trained model comprising a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors; and extracting triple information of the target text based on the first matrix, the triple information comprising a subject, an object, and a relationship between the subject and the object. Using embodiments of the present application, the recall rate and accuracy of information extraction are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to an information extraction method, device, storage medium, and electronic device. Background Art

[0002] With the rapid development of information technology and the continuous improvement of hardware equipment, information extraction plays a vital role in artificial intelligence applications. More and more deep-level applications rely on the results of information extraction. Information extraction refers to the extraction of entities, relationships, time, and other information from unstructured data. The results of this extraction can generally be used by downstream tasks. For example, constructing entities in knowledge graphs and constructing causal graphs all rely on the results of information extraction. Summary of the Invention

[0003] In order to solve the above problems, the embodiments of the present application provide an information extraction method, device, storage medium and electronic device, which improve the recall rate and accuracy of information extraction.

[0004] In a first aspect, an embodiment of the present application provides an information extraction method, the method comprising:

[0005] Get the target text;

[0006] Inputting the target text into a pre-training model and outputting a first matrix corresponding to the target text, the pre-training model comprising a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors;

[0007] Triple information of the target text is extracted based on the first matrix, where the triple information includes a subject, an object, and a relationship between the subject and the object.

[0008] In a second aspect, an embodiment of the present application provides an information extraction device, the device comprising:

[0009] Information acquisition module, used to obtain target text;

[0010] a matrix determination module, configured to input the target text into a pre-trained model and output a first matrix corresponding to the target text, wherein the pre-trained model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors;

[0011] An information determination module is configured to extract triple information of the target text based on the first matrix, wherein the triple information includes a subject, an object, and a relationship between the subject and the object.

[0012] In a third aspect, an embodiment of the present application provides a computer storage medium, which stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method steps of the above-mentioned first aspect.

[0013] In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps of the above-mentioned first aspect.

[0014] The beneficial effects of the technical solutions provided by some embodiments of the present application include at least:

[0015] In an embodiment of the present application, a target text is obtained, inputted into a pre-trained model, and a first matrix corresponding to the target text is outputted. The pre-trained model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors. Based on the first matrix, triple information of the target text is extracted. The triple information includes a subject, an object, and the relationship between the subject and the object. By extracting target text triple information in combination with the semantic information, part of speech, and a preset knowledge base of the target text, the recall rate and accuracy of information extraction from the target text are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0017] Figure 1 A system architecture diagram of an information extraction method provided in an embodiment of the present application;

[0018] Figure 2 A flowchart of an information extraction method provided in an embodiment of the present application;

[0019] Figure 3 This is a schematic diagram of an example of extracting a part-of-speech tag vector provided in an embodiment of the present application;

[0020] Figure 4 A flowchart of an information extraction method provided in an embodiment of the present application;

[0021] Figure 5 A schematic diagram of the structure of an information extraction device provided in an embodiment of the present application;

[0022] Figure 6A schematic diagram of the structure of an information extraction device provided in an embodiment of the present application;

[0023] Figure 7 A schematic diagram of the structure of an information extraction device provided in an embodiment of the present application;

[0024] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.

[0026] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application. Different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments described. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, even though the embodiment may not be clearly described in the following text.

[0027] The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes may be made to the function and arrangement of the elements described without departing from the scope of the present application. Various examples may appropriately omit, replace, or add various processes or components. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted, or combined. In addition, features described in some examples may be combined in other examples.

[0028] With the rapid development of information technology and the continuous improvement of hardware equipment, information extraction plays a vital role in artificial intelligence applications. An increasing number of deep-level applications rely on information extraction results. Information extraction refers to the extraction of information such as entities, relationships, and time from unstructured data. The extraction results are generally utilized by downstream tasks, such as constructing entities in knowledge graphs and constructing causal graphs. Information extraction consists of two parts: named entity recognition, which identifies entities in text, and relationship extraction, which establishes corresponding relationships between identified entities. These two components form the basic building blocks for triple construction. There are two common information extraction schemes: schema-based information extraction, which extracts triples from a graph using a predefined schema and stores them in a database. Open-domain information extraction technology, which extracts triples based on predefined templates or models by performing syntactic analysis and named entity recognition on the text. Existing information extraction systems typically rely solely on information extraction models, typically using only text as input, without fully leveraging existing knowledge bases and part-of-speech information. Consequently, recall and precision cannot be guaranteed.

[0029] Based on this, an embodiment of the present application provides an information extraction method, which obtains a target text, inputs the target text into a pre-trained model, and outputs a first matrix corresponding to the target text. The pre-trained model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors. Based on the first matrix, triple information of the target text is extracted. The triple information includes a subject, an object, and the relationship between the subject and the object. By extracting the target text triple information in combination with the semantic information, part of speech, and a preset knowledge base of the target text, the recall rate and accuracy of information extraction from the target text are improved.

[0030] See Figure 1, which is a schematic diagram of the system architecture of an information extraction method provided in an embodiment of the present application, the system includes a user terminal, which may include but is not limited to a smart phone, a smart interactive tablet, a personal computer, a desktop computer, a tablet computer, a PDA, a laptop, an all-in-one computer, in-vehicle multimedia, etc. By acquiring the target text, the target text is input into the pre-training model, and a semantic vector corresponding to the target text is obtained based on the semantic processing module; in the part-of-speech processing module of the pre-training model, each word in the target text is divided into parts of speech to obtain the part-of-speech tagging result corresponding to each word, and the target part-of-speech tag vector corresponding to each part-of-speech tagging result is determined in a preset part-of-speech tag vector set, and each target part-of-speech tag vector is combined to obtain the part-of-speech tag vector corresponding to the target text; in the knowledge base processing module of the pre-training model, the existing triple information associated with the target text is determined in the preset knowledge base, and the existing triple information is combined. The subject and object in the target text are labeled separately to obtain the target knowledge base label vector corresponding to the existing triple information. The target knowledge base label vector is determined as the knowledge base label vector corresponding to the target text. The semantic vector, part-of-speech tag vector, and knowledge base tag vector are concatenated to obtain the first matrix corresponding to the target text. The first matrix is ​​converted into a two-dimensional matrix. Based on the two-dimensional matrix, the subject matrix corresponding to the subject in the target text is extracted. The subject matrix and the first matrix are added to obtain a second matrix. The second matrix is ​​converted into a two-dimensional matrix corresponding to each preset relationship. The triple information in the target text is determined based on each two-dimensional matrix and each preset relationship. The triple information in the target text is extracted by combining the part-of-speech and semantic information of each word in the target text input by the user with the existing triple information in the preset knowledge base, thereby improving the recall rate and accuracy of information extraction from the target text.

[0031] exist Figure 1 Based on the system architecture shown below, Figures 2 to 4 , the information extraction method provided in the embodiments of the present application is introduced in detail.

[0032] See Figure 2 , provides a flow chart of an information extraction method according to an embodiment of the present application. Figure 2 As shown, the information extraction method may include the following steps:

[0033] S101, obtaining target text.

[0034] In one embodiment, when a user needs to extract information from a target text, the user inputs the target text into a user terminal, and the user terminal extracts information from the target text to extract triple information from the target text.

[0035] S102, input the target text into a pre-trained model, and output a first matrix corresponding to the target text, wherein the pre-trained model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors.

[0036] In one embodiment, the user inputs the target text into the user terminal, the semantic processing module in the pre-trained model performs semantic recognition on the target text to obtain a semantic vector corresponding to the target text, the part-of-speech processing module in the pre-trained model performs part-of-speech division on the target text to obtain a part-of-speech tag vector corresponding to the target text, the knowledge base processing module in the pre-trained model processes the target text with the knowledge base pre-stored in the pre-trained model to obtain a knowledge base tag vector corresponding to the target text, and the semantic vector, part-of-speech tag vector and knowledge base tag vector are concatenated to obtain a first matrix corresponding to the target text.

[0037] The semantic processing module is used to obtain the semantic information of the target text and generate a semantic vector corresponding to the target text according to the semantic information of the target text.

[0038] The part-of-speech processing module divides the target text into words and tags each word with a part-of-speech tag. In the part-of-speech tag table preset by the part-of-speech processing module, each word is tagged with a part-of-speech tag according to its part of speech. Then, the vector corresponding to each word is determined based on the correspondence between the preset part-of-speech tag and the vector. In this way, the part-of-speech tag vector corresponding to the target text is determined.

[0039] As shown in Table 1, this is the preset part-of-speech tag table.

[0040] Label meaning Label meaning Label meaning Label meaning n common nouns f directional nouns s Place nouns nw Title nz Other proper names v Common verbs vd adverbs vn Noun Verb a adjective ad Adverbials an noun-adjective d adverb m quantifiers q quantifier r pronoun p preposition c conjunction u particle xc Other function words w Punctuation PER Name LOC Place name ORG Institution Name TIME time

[0041] The representation of the labels corresponding to the parts of speech in Table 1 does not limit the representation method of the labels corresponding to each part of speech. In the embodiments of the present application, the representation method of the labels corresponding to the parts of speech is not limited.

[0042] The correspondence between part-of-speech tags and vectors is established by the part-of-speech tag id. Each part-of-speech tag has one and only one part-of-speech tag id corresponding to it, and each part-of-speech tag id has one and only one vector corresponding to it.

[0043] Table 2 Correspondence between part-of-speech tags and part-of-speech tag IDs

[0044] Part-of-speech tags id PER 1 v 2 n 3 m 4 ... ...

[0045] Table 3 Correspondence between part-of-speech tag ID and vector

[0046] id vector 1 Vector 1 2 Vector 2 3 Vector 3 4 Vector 4 ... ...

[0047] According to Table 2 and Table 3, it can be concluded that each part of speech has a corresponding vector. The part of speech tag vector of the target text is determined based on the part of speech tag. Each part of speech tag vector can be a 128-dimensional vector.

[0048] For example, if the target text is "Andy Lau is an actor", the result after part-of-speech segmentation is "Andy Lau / is / an / actor". The part-of-speech tag corresponding to "Andy Lau" is "PER", the corresponding part-of-speech tag id is 1, and the corresponding vector is vector 1. The part-of-speech tag corresponding to "is" is "v", the corresponding part-of-speech tag id is 2, and the corresponding vector is vector 2. The part-of-speech tag corresponding to "an" is "m", the corresponding part-of-speech tag id is 4, and the corresponding vector is vector 4. The part-of-speech tag corresponding to "actor" is "n", the corresponding part-of-speech tag id is 3, and the corresponding vector is vector 3. Figure 3 As shown, it is the part-of-speech tag vector representation of the target text.

[0049] The knowledge base processing module generates a knowledge base tag corresponding to the target text according to the preset knowledge base in the knowledge base. When the user inputs the target text into the user terminal, it provides great help in extracting the triple information of the target text.

[0050] For example, the target text is "Andy Lau starred in TV series such as Infernal Affairs and The Return of the Condor Heroes". In the preset knowledge base, there is the triple "Andy Lau, starring, Infernal Affairs", but there is no triple "Andy Lau, starring, The Return of the Condor Heroes". By labeling "Andy Lau" and "Infernal Affairs" in the target text, it is of great help in extracting the triple "Andy Lau, starring, The Return of the Condor Heroes" in the target text.

[0051] As shown in Table 4, the triples of the target text that exist in the preset knowledge base are labeled.

[0052] Target text Liu Virtue magnificent out play Got it none between road and god carving Knight companion wait film See drama Subject label vector 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Object label vector 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0

[0053] As shown in Table 4, the triples in the preset knowledge base in the target text are labeled to form a subject label vector and an object label vector respectively. The subject label vector and the object label vector are concatenated to obtain the knowledge base label vector.

[0054] The subject vector, part-of-speech tag vector, and knowledge base tag vector are concatenated to obtain the first matrix corresponding to the target text. The dimension of the first matrix is ​​determined by the semantic vector, part-of-speech tag vector, and knowledge base tag vector, and is the sum of the dimensions of the semantic vector, part-of-speech tag vector, and knowledge base tag vector.

[0055] S103: Extract triple information of the target text based on the first matrix, where the triple information includes a subject, an object, and a relationship between the subject and the object.

[0056] In one embodiment, triple information consisting of a subject, an object, and a relationship between the subject and the object is extracted from the target text according to the first matrix.

[0057] For example, the target text is "Andy Lau starred in TV series such as Infernal Affairs and The Return of the Condor Heroes". After the pre-training model is obtained, the first matrix is ​​obtained. According to the first matrix, the triples in the target text include "Andy Lau, starring, Infernal Affairs" and "Andy Lau, starring, The Return of the Condor Heroes".

[0058] In an embodiment of the present application, a target text is obtained, inputted into a pre-trained model, and a first matrix corresponding to the target text is outputted. The pre-trained model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors. Based on the first matrix, triple information of the target text is extracted. The triple information includes a subject, an object, and the relationship between the subject and the object. By extracting target text triple information in combination with the semantic information, part of speech, and a preset knowledge base of the target text, the recall rate and accuracy of information extraction from the target text are improved.

[0059] See Figure 4 , provides a flow chart of an information extraction method according to an embodiment of the present application. Figure 4 As shown, the information extraction method may include the following steps:

[0060] S201, obtaining target text.

[0061] The specific implementation of this step can refer to step S101 and will not be described in detail here.

[0062] S202, input the target text into the pre-training model, and obtain the semantic vector corresponding to the target text based on the semantic processing module, the pre-training model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors.

[0063] In one embodiment, the target text input by the user is obtained and input into a pre-trained model. The pre-trained model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors. The semantic information of the target text is extracted through the semantic processing module, and a corresponding semantic vector is generated.

[0064] S203: Input the target text into a pre-training model, perform part-of-speech classification on each word in the target text, and obtain part-of-speech tagging results corresponding to each word.

[0065] S204: Determine the target word tag vector corresponding to each part-of-speech tagging result in a preset part-of-speech tag vector set.

[0066] S205: Combine the target part-of-speech tag vectors to obtain a part-of-speech tag vector corresponding to the target text.

[0067] In one embodiment, a target text input by a user is obtained and input into a pre-trained model, and the target text is divided into parts of speech through a word segmenter to obtain the parts of speech corresponding to the target text, and the target text is annotated according to the correspondence between the preset parts of speech and the part-of-speech tags to obtain the part-of-speech tagging results of each word in the target text; then, according to the preset part-of-speech tag vector set, the target part-of-speech tag vector corresponding to each part-of-speech tagging result is determined in the part-of-speech tag vector set, and the target part-of-speech tag vectors are combined to obtain the part-of-speech tag vector corresponding to the target text.

[0068] The correspondence between each part of speech and the part-of-speech tag can be the correspondence shown in Table 1. The embodiment of the present application does not limit the representation method of each part-of-speech tag.

[0069] The target part-of-speech tag vector is determined based on the correspondence table between the part-of-speech tag and the part-of-speech tag ID, as well as the correspondence table between the part-of-speech tag ID and the vector, which are preset in the part-of-speech processing module of the pre-trained model. The correspondence between the part-of-speech tag and the part-of-speech tag result ID is shown in Table 2, and the correspondence table between the part-of-speech tag ID and the vector is shown in Table 3.

[0070] The correspondence between parts of speech and part-of-speech tags, a correspondence table between part-of-speech tags and part-of-speech tag ids, and a correspondence table between part-of-speech tag ids and vectors are preset in the part-of-speech processing module of the pre-trained model. After the target text is divided into parts of speech, the part-of-speech tags of each part of speech in the target text can be determined according to the correspondence table between parts of speech and part-of-speech tags, and then the part-of-speech tag id of the target text can be determined according to the correspondence table between part-of-speech tags and part-of-speech tag ids, and then the part-of-speech tag vectors of each part of speech in ... tag ids and vectors, and then the part-of-speech tag vectors of each part of speech can be combined to obtain the part-of-speech tag vector of the target text.

[0071] S206: Input the target text into a pre-training model, and determine existing triple information associated with the target text in a preset knowledge base.

[0072] S207 , labeling the subject and the object in the existing triple information respectively, and obtaining a target knowledge base label vector corresponding to the existing triple information.

[0073] S208: Determine the target knowledge base label vector as the knowledge base label vector corresponding to the target text.

[0074] In one embodiment, a target text input by a user is obtained and input into a pre-trained model, and existing triple information associated with the target text is determined in a knowledge base preset in a knowledge base processing module; after determining the existing triple information of the target text in the preset knowledge base, in the target text, the subject and object in the existing triple information are labeled respectively to obtain a target knowledge base label vector corresponding to the existing triple information; and the target knowledge base label vector is determined as the knowledge base label vector of the target text.

[0075] Among them, among the triple information already in the preset knowledge base, it is determined whether the target text has triple information already in the knowledge base. If the target text has triple information already in the knowledge base, the subject and object of the corresponding position in the target text are labeled to obtain the knowledge base label vector corresponding to the target text.

[0076] S209 , concatenating the semantic vector, the part-of-speech tag vector, and the knowledge base tag vector to obtain a first matrix corresponding to the target text.

[0077] In one embodiment, the semantic vector of the target text extracted by the semantic processing module of the pre-trained model, the part-of-speech tag vector of the target text extracted by the part-of-speech processing module, and the knowledge base tag vector extracted by the knowledge base processing module are spliced ​​to obtain a first matrix corresponding to the target text.

[0078] Among them, the splicing order of semantic vectors, part-of-speech tag vectors and knowledge base label vectors may include but is not limited to semantic vectors, part-of-speech tag vectors, knowledge base label vectors, semantic vectors, knowledge base label vectors, part-of-speech tag vectors, part-of-speech tag vectors, semantic vectors, knowledge base label vectors, part-of-speech tag vectors, knowledge base label vectors, semantic vectors, knowledge base label vectors, semantic vectors, part-of-speech tag vectors, knowledge base label vectors, and the like.

[0079] The first matrix is ​​formed by concatenating the semantic vector, the part-of-speech tag vector, and the knowledge base tag vector. Therefore, the dimension of the first matrix is ​​the sum of the dimensions of the semantic vector, the part-of-speech tag vector, and the knowledge base tag vector.

[0080] S210: Convert the first matrix into a two-dimensional matrix.

[0081] S211: Extract a subject matrix corresponding to the subject in the target text based on the two-dimensional matrix.

[0082] In one embodiment, the first matrix is ​​converted into a two-dimensional matrix through a fully connected layer, and a subject matrix corresponding to the subject of the target text is extracted according to the two-dimensional matrix.

[0083] Among them, the first matrix is ​​converted into the starting bit vector and the ending bit vector corresponding to the subject through the fully connected layer, and the vector values ​​in the converted starting bit vector are compared with the preset value to determine whether the vector value corresponding to the position is 0 or 1. Similarly, the vector values ​​in the converted ending bit vector are compared with the preset value to determine whether the vector value corresponding to each position is 0 or 1.

[0084] If the starting bit vector after conversion is [0.8, 0.1, 0.08, 0.3, 0.4, 0.2, 0.05, 0.2], the preset value is 0.5, and the starting bit vector in the subject matrix corresponding to the subject is [1, 0, 0, 0, 0, 0, 0, 0], it means that the subject of the target text starts from the first word. If the ending bit vector after conversion is [0.03, 0.04, 0.6, 0.08, 0.2, 0.09, 0.3, 0.06], the ending bit vector in the subject matrix corresponding to the subject is [0, 0, 1, 0, 0, 0, 0, 0], it means that the subject of the target text ends at the third word of the target text. The above means that the subject of the target text is the first three words.

[0085] The start bit vector and the end bit vector are concatenated to obtain the subject matrix corresponding to the subject in the target text.

[0086] S212: Add the subject matrix to the first matrix to obtain a second matrix.

[0087] In one embodiment, the vector values ​​in the subject matrix are added to obtain a vector value corresponding to the subject matrix, and the vector value of the subject matrix is ​​added to each vector value in the first matrix to obtain the second matrix.

[0088] S213: Convert the second matrix into two-dimensional matrices corresponding to the preset relationships.

[0089] In one embodiment, before extracting the target text, the user presets the relationship between the subject and the object in the triple. When extracting the triple information in the target text, the second matrix is ​​converted into a two-dimensional matrix corresponding to each preset relationship according to the relationship preset by the user. The two-dimensional matrix includes a start bit vector and an end bit vector.

[0090] For example, the user presets six relationships: "nationality, place of birth, mother, father, wife, daughter, and son". The second matrix is ​​converted into two-dimensional matrices corresponding to the six relationships through the fully connected layer.

[0091] S214: Determine triple information in the target text based on the two-dimensional matrices, the subject matrix, and the preset relationships.

[0092] In one embodiment, the two-dimensional matrix converted according to the preset relationship is the same as how the subject matrix in step S212 above determines the start position and end position of the subject in the target text. Each vector value converted into the two-dimensional matrix is ​​compared with the preset value to determine the position of the object corresponding to the relationship in the target text, and then the subject determined by the subject matrix and the preset relationship are combined to determine the triple information in the target text.

[0093] After determining the subject in the target text based on the subject matrix, the object corresponding to the subject is determined in the target text in combination with the relationship preset by the user, and the subject, object and the relationship between the subject and object are determined as a set of triples.

[0094] In an embodiment of the present application, a target text is obtained, the target text is input into a pre-trained model, and a semantic vector corresponding to the target text is obtained based on a semantic processing module; each word in the target text is divided into parts of speech to obtain a part-of-speech tagging result corresponding to each word, and a target part-of-speech tag vector corresponding to each character tagging result is determined in a preset part-of-speech tag vector set, and each target part-of-speech tag vector is combined to obtain a part-of-speech tag vector corresponding to the target text; and existing triple information associated with the target text is determined in a preset knowledge base, and the subject and object in the existing triple information are labeled respectively. , obtain the target knowledge base label vector corresponding to the existing triple information, determine the target knowledge base label vector as the knowledge base label vector corresponding to the target text; splice the semantic vector, the part-of-speech label vector and the knowledge base label vector to obtain the first matrix corresponding to the target text, convert the first matrix into a two-dimensional matrix, extract the subject matrix corresponding to the subject in the target text based on the two-dimensional matrix, add the subject matrix to the first matrix to obtain a second matrix, convert the second matrix into a two-dimensional matrix corresponding to each preset relationship, and determine the triple information in the target text based on each two-dimensional matrix, the subject matrix and the preset relationship. By presetting the relationship between the subject and the object in the triple before extraction, and combining the semantic information of the target text, the part of speech of each word in the target text and the triple information in the preset knowledge base in the target text, the target text is extracted to obtain triple information, thereby improving the retrieval and accuracy of information extraction from the target text.

[0095] The following will be combined Figure 5, the information extraction device provided in the embodiment of the present application is introduced in detail. It should be noted that. Figure 5 The information extraction device in this application is used to execute Figures 2 to 4 For the sake of convenience, only the relevant parts of the embodiment of the present application are shown. For the specific technical details, please refer to the present application. Figures 2 to 4 The method embodiment shown.

[0096] See Figure 5 , which provides a structural diagram of an information extraction device for this application. Figure 5 As shown, the information extraction device 1 of the embodiment of the present application includes: an information acquisition module 11, a matrix determination module 12, and an information determination module 13.

[0097] Information acquisition module 11, used to acquire target text;

[0098] a matrix determination module 12, configured to input the target text into a pre-trained model and output a first matrix corresponding to the target text, wherein the pre-trained model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors;

[0099] The information determination module 13 is configured to extract triple information of the target text based on the first matrix, where the triple information includes a subject, an object, and a relationship between the subject and the object.

[0100] Optional, such as Figure 6 As shown, the matrix determination module 12 includes:

[0101] A vector acquisition unit 121 is configured to input the target text into a pre-trained model, obtain a semantic vector corresponding to the target text based on the semantic processing module, obtain a part-of-speech tag vector corresponding to the target text based on the part-of-speech processing module, and obtain a knowledge base tag vector corresponding to the target text based on the knowledge base processing module;

[0102] The matrix determination unit 122 is configured to obtain a first matrix corresponding to the target text based on the semantic vector, the part-of-speech tag vector, and the knowledge base tag vector.

[0103] Optionally, the vector acquisition unit 121 is specifically configured to:

[0104] Performing part-of-speech classification on each word in the target text to obtain part-of-speech tagging results corresponding to each word;

[0105] Determining a target part-of-speech tag vector corresponding to each part-of-speech tagging result in a preset part-of-speech tag vector set;

[0106] The target part-of-speech tag vectors are combined to obtain the part-of-speech tag vector corresponding to the target text.

[0107] Optionally, the vector acquisition unit 121 is specifically configured to:

[0108] Determining existing triple information associated with the target text in a preset knowledge base;

[0109] Labeling the subject and object in the existing triple information respectively to obtain a target knowledge base label vector corresponding to the existing triple information;

[0110] The target knowledge base label vector is determined to be the knowledge base label vector corresponding to the target text.

[0111] Optionally, the matrix determination unit 122 is specifically configured to:

[0112] The semantic vector, the part-of-speech tag vector, and the knowledge base tag vector are concatenated to obtain a first matrix corresponding to the target text.

[0113] Optional, such as Figure 7 As shown, the information determination module 13 includes:

[0114] A data conversion unit 131 is configured to convert the first matrix into a two-dimensional matrix;

[0115] An information extraction unit 132 is configured to extract a subject matrix corresponding to a subject in the target text based on the two-dimensional matrix;

[0116] The information determining unit 133 is configured to determine triple information in the target text based on the subject matrix and the first matrix.

[0117] Optionally, the information determining unit 133 is specifically configured to:

[0118] Adding the subject matrix to the first matrix to obtain a second matrix;

[0119] Converting the second matrix into two-dimensional matrices corresponding to the preset relationships;

[0120] Triple information in the target text is determined based on the two-dimensional matrices, the subject matrix, and the preset relationships.

[0121] In an embodiment of the present application, a target text is obtained, the target text is input into a pre-trained model, and a semantic vector corresponding to the target text is obtained based on a semantic processing module; each word in the target text is divided into parts of speech to obtain a part-of-speech tagging result corresponding to each word, and a target part-of-speech tag vector corresponding to each character tagging result is determined in a preset part-of-speech tag vector set, and each target part-of-speech tag vector is combined to obtain a part-of-speech tag vector corresponding to the target text; and existing triple information associated with the target text is determined in a preset knowledge base, and the subject and object in the existing triple information are labeled respectively. , obtain the target knowledge base label vector corresponding to the existing triple information, determine the target knowledge base label vector as the knowledge base label vector corresponding to the target text; splice the semantic vector, the part-of-speech label vector and the knowledge base label vector to obtain the first matrix corresponding to the target text, convert the first matrix into a two-dimensional matrix, extract the subject matrix corresponding to the subject in the target text based on the two-dimensional matrix, add the subject matrix to the first matrix to obtain a second matrix, convert the second matrix into a two-dimensional matrix corresponding to each preset relationship, and determine the triple information in the target text based on each two-dimensional matrix, the subject matrix and the preset relationship. By presetting the relationship between the subject and the object in the triple before extraction, and combining the semantic information of the target text, the part of speech of each word in the target text and the triple information in the preset knowledge base in the target text, the target text is extracted to obtain triple information, thereby improving the recall rate and accuracy of information extraction from the target text.

[0122] The present application also provides a computer storage medium that can store multiple instructions, which are suitable for being loaded and executed by a processor as described above. Figures 2 to 4 The information extraction method of the embodiment shown in the figure can be found in the specific execution process. Figures 2 to 4 The detailed description of the illustrated embodiment will not be repeated here.

[0123] See Figure 8 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8As shown, the terminal device 1000 may include: at least one processor 1001, at least one network interface 1002, at least one input / output interface 1003, at least one display unit 1004, at least one memory 1005, and at least one communication bus 1006. The processor 1001 may include one or more processing cores. The processor 1001 utilizes various interfaces and circuits to connect the various components within the entire electronic device 1000. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and calling data stored in the memory 1005, the processor 1001 executes various functions of the terminal 1000 and processes data. The memory 1005 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage device. The memory 1005 may optionally be at least one storage device located remote from the processor 1001. The network interface 1002 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface or a Bluetooth interface). The communication bus 1006 is used to enable connection and communication between these components. The display unit 1004 may be a touch panel. like Figure 8 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, an input and output interface module, and an information extraction program.

[0124] exist Figure 8 In the electronic device 1000 shown, the input and output interface 1003 is mainly used to provide an interface for users and access devices and obtain data input by users and access devices.

[0125] In one embodiment, the processor 1001 may be configured to call the information extraction program stored in the memory 1005 and specifically perform the following operations:

[0126] Get the target text;

[0127] Inputting the target text into a pre-training model and outputting a first matrix corresponding to the target text, the pre-training model comprising a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors;

[0128] Triple information of the target text is extracted based on the first matrix, where the triple information includes a subject, an object, and a relationship between the subject and the object.

[0129] In one embodiment, when the processor 1001 inputs the target text into the pre-trained model and outputs the first matrix corresponding to the target text, the processor 1001 specifically performs the following operations:

[0130] Inputting the target text into the pre-training model, obtaining a semantic vector corresponding to the target text based on the semantic processing module, obtaining a part-of-speech tag vector corresponding to the target text based on the part-of-speech processing module, and obtaining a knowledge base tag vector corresponding to the target text based on the knowledge base processing module;

[0131] Based on the semantic vector, the part-of-speech tag vector, and the knowledge base tag vector, a first matrix corresponding to the target text is obtained.

[0132] In one embodiment, when the processor 1001 obtains the part-of-speech tag vector corresponding to the target text based on the part-of-speech processing module, the processor 1001 specifically performs the following operations:

[0133] Performing part-of-speech classification on each word in the target text to obtain part-of-speech tagging results corresponding to each word;

[0134] Determining a target part-of-speech tag vector corresponding to each part-of-speech tagging result in a preset part-of-speech tag vector set;

[0135] The target part-of-speech tag vectors are combined to obtain the part-of-speech tag vector corresponding to the target text.

[0136] In one embodiment, when the processor 1001 obtains the knowledge base label vector corresponding to the target text based on the knowledge base processing module, it specifically performs the following operations:

[0137] Determining existing triple information associated with the target text in a preset knowledge base;

[0138] Labeling the subject and object in the existing triple information respectively to obtain a target knowledge base label vector corresponding to the existing triple information;

[0139] The target knowledge base label vector is determined to be the knowledge base label vector corresponding to the target text.

[0140] In one embodiment, when the processor 1001 obtains the first matrix corresponding to the target text based on the semantic vector, the part-of-speech tag vector, and the knowledge base tag vector, the processor 1001 specifically performs the following operations:

[0141] The semantic vector, the part-of-speech tag vector, and the knowledge base tag vector are concatenated to obtain a first matrix corresponding to the target text.

[0142] In one embodiment, when determining the triple information of the target text based on the first matrix, the processor 1001 specifically performs the following operations:

[0143] Converting the first matrix into a two-dimensional matrix;

[0144] Extracting a subject matrix corresponding to a subject in the target text based on the two-dimensional matrix;

[0145] Triple information in the target text is determined based on the subject matrix and the first matrix.

[0146] In one embodiment, when determining triple information in the target text based on the subject matrix and the first matrix, the processor 1001 specifically performs the following operations:

[0147] Adding the subject matrix to the first matrix to obtain a second matrix;

[0148] Converting the second matrix into two-dimensional matrices corresponding to the preset relationships;

[0149] Triple information in the target text is determined based on the two-dimensional matrices, the subject matrix, and the preset relationships.

[0150] In the embodiment of the present application, by obtaining the target text, the target text is input into the pre-training model, and the semantic vector corresponding to the target text is obtained based on the semantic processing module; the parts of speech of each word in the target text are divided to obtain the part-of-speech tagging results corresponding to each word, and the target part-of-speech tag vector corresponding to each character tagging result is determined in the preset part-of-speech tag vector set, and the target part-of-speech tag vectors are combined to obtain the part-of-speech tag vector corresponding to the target text; and the existing triple information associated with the target text is determined in the preset knowledge base, and the subject and object in the existing triple information are labeled respectively , obtain the target knowledge base label vector corresponding to the existing triple information, determine the target knowledge base label vector as the knowledge base label vector corresponding to the target text; splice the semantic vector, the part-of-speech label vector and the knowledge base label vector to obtain the first matrix corresponding to the target text, convert the first matrix into a two-dimensional matrix, extract the subject matrix corresponding to the subject in the target text based on the two-dimensional matrix, add the subject matrix to the first matrix to obtain a second matrix, convert the second matrix into a two-dimensional matrix corresponding to each preset relationship, and determine the triple information in the target text based on each two-dimensional matrix, the subject matrix and the preset relationship. By presetting the relationship between the subject and the object in the triple before extraction, and combining the semantic information of the target text, the part of speech of each word in the target text and the triple information in the preset knowledge base in the target text, the target text is extracted to obtain triple information, thereby improving the recall rate and accuracy of information extraction from the target text.

[0151] Those skilled in the art will clearly understand that the technical solution of the present application can be implemented with the help of software and / or hardware. "Unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (FPGA), an integrated circuit (IC), etc.

[0152] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0153] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0154] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interface, and the indirect coupling or communication connection of the device or unit can be electrical or other forms.

[0155] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0156] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0157] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions for enabling an electronic device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0158] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0159] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure herein, those skilled in the art will easily think of other embodiments of the present disclosure. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not recorded in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. An information extraction method, characterized in that: The method comprises: Get the target text; Inputting the target text into a pre-training model and outputting a first matrix corresponding to the target text, the pre-training model comprising a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors; Converting the first matrix into a two-dimensional matrix; Extracting a subject matrix corresponding to a subject in the target text based on the two-dimensional matrix; Triple information in the target text is determined based on the subject matrix and the first matrix, where the triple information includes a subject, an object, and a relationship between the subject and the object.

2. The method according to claim 1, characterized in that Inputting the target text into the pre-trained model and outputting a first matrix corresponding to the target text includes: Inputting the target text into the pre-training model, obtaining a semantic vector corresponding to the target text based on the semantic processing module, obtaining a part-of-speech tag vector corresponding to the target text based on the part-of-speech processing module, and obtaining a knowledge base tag vector corresponding to the target text based on the knowledge base processing module; Based on the semantic vector, the part-of-speech tag vector, and the knowledge base tag vector, a first matrix corresponding to the target text is obtained.

3. The method according to claim 2, characterized in that The obtaining of the part-of-speech tag vector corresponding to the target text based on the part-of-speech processing module includes: Performing part-of-speech classification on each word in the target text to obtain part-of-speech tagging results corresponding to each word; Determining a target part-of-speech tag vector corresponding to each part-of-speech tagging result in a preset part-of-speech tag vector set; The target part-of-speech tag vectors are combined to obtain the part-of-speech tag vector corresponding to the target text.

4. The method according to claim 2, characterized in that The obtaining of the knowledge base label vector corresponding to the target text based on the knowledge base processing module includes: Determining existing triple information associated with the target text in a preset knowledge base; Labeling the subject and object in the existing triple information respectively to obtain a target knowledge base label vector corresponding to the existing triple information; The target knowledge base label vector is determined to be the knowledge base label vector corresponding to the target text.

5. The method according to claim 2, characterized in that The obtaining of a first matrix corresponding to the target text based on the semantic vector, the part-of-speech tag vector, and the knowledge base tag vector includes: The semantic vector, the part-of-speech tag vector, and the knowledge base tag vector are concatenated to obtain a first matrix corresponding to the target text.

6. The method according to claim 1, wherein The determining of triple information in the target text based on the subject matrix and the first matrix includes: Adding the subject matrix to the first matrix to obtain a second matrix; Converting the second matrix into two-dimensional matrices corresponding to the preset relationships; Triple information in the target text is determined based on the two-dimensional matrices, the subject matrix, and the preset relationships.

7. An information extraction device, characterized in that: The device comprises: Information acquisition module, used to obtain target text; a matrix determination module, configured to input the target text into a pre-trained model and output a first matrix corresponding to the target text, wherein the pre-trained model includes a semantic processing module for extracting semantic vectors, a part-of-speech processing module for extracting part-of-speech tag vectors, and a knowledge base processing module for extracting knowledge base tag vectors; The information determination module includes a data conversion unit for converting the first matrix into a two-dimensional matrix; The information determination module further includes an information extraction unit for extracting a subject matrix corresponding to a subject in the target text based on the two-dimensional matrix; The information determination module further includes an information determination unit for determining triple information in the target text based on the subject matrix and the first matrix, where the triple information includes a subject, an object, and a relationship between the subject and the object.

8. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, which are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 6.

9. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for extracting relations from texts

    CN111859858A