Information extraction method and device, electronic equipment and storage medium
By jointly encoding the extraction target and the text to be extracted, the matching degree and reference structure text are determined, which solves the problem of quickly and accurately extracting target triples in information extraction and achieves good transferability and versatility.
Patent Information
- Application Number
- CN202211154645.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-21
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2042-09-21
AI Technical Summary
Existing technologies struggle to quickly and accurately extract target triples from the text to be extracted during the information extraction process, and lack good transferability and universality.
By jointly encoding the extraction target and the text to be extracted, the first encoding vector of each character is obtained. The first matching degree between every two first encoding vectors and the second matching degree between each first encoding vector are determined to determine the reference structure text. Based on the second matching degree between the first encoding vector and the second encoding vector corresponding to each character in the segment, the second reference structure text is determined. Finally, based on the first reference structure text and the second reference structure text, the target triplet corresponding to the extraction target is determined.
It achieves fast and accurate extraction of target triples from the text to be extracted, and has good transferability and versatility.
Smart Images

Figure CN115481184B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, in particular to the technical field of artificial intelligence such as natural language processing and deep learning, which can be applied to the smart city scenario, and specifically relates to an information extraction method and device, an electronic equipment and a storage medium. BACKGROUND
[0002] Information extraction technology extracts structured text information by analyzing and processing structured, semi-structured and unstructured text data, and is a basic and important task link in the field of natural language processing. Information extraction plays a very important role in artificial intelligence applications, and more and more upper-layer applications rely on the results of information extraction. Therefore, how to accurately and quickly extract information from the target text based on the extraction target has become a key research direction. SUMMARY
[0003] The present disclosure provides an information extraction method and device, an electronic equipment and a storage medium.
[0004] According to a first aspect of the present disclosure, an information extraction method is provided, comprising:
[0005] jointly encoding the current extraction target and the text to be extracted to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target;
[0006] determining a first matching degree between each two first encoding vectors and a second matching degree between each first encoding vector and the second encoding vector;
[0007] determining a segment contained in the text to be extracted and a first reference structure text according to the first matching degree;
[0008] determining a second reference structure text according to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector;
[0009] determining a target triple corresponding to the extraction target according to the first reference structure text and the second reference structure text.
[0010] According to a second aspect of the present disclosure, an information extraction device is provided, comprising:
[0011] an obtaining module configured to jointly encode the current extraction target and the text to be extracted to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target;
[0012] a first determining module, configured to determine a first matching degree between each two of the first encoding vectors and a second matching degree between each of the first encoding vectors and the second encoding vector;
[0013] a second determining module, configured to determine a segment contained in the text to be extracted and a first reference structured text according to the first matching degree;
[0014] a third determining module, configured to determine a second reference structured text according to the second matching degree between the second encoding vector and the first encoding vector corresponding to each character in the segment;
[0015] a fourth determining module, configured to determine a target triple corresponding to the extraction target according to the first reference structured text and the second reference structured text.
[0016] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0017] at least one processor; and
[0018] a memory connected with the at least one processor in communication; wherein
[0019] the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method for information extraction according to the first aspect.
[0020] According to a fourth aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, and the computer instructions are used to enable the computer to perform the method for information extraction according to the first aspect.
[0021] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising computer instructions, and the computer instructions, when executed by a processor, implement the steps of the method for information extraction according to the first aspect.
[0022] The method for information extraction, the device, the electronic device and the storage medium provided by the present disclosure have the following beneficial effects:
[0023] In the embodiments of the present disclosure, the current extraction target and the text to be extracted are first jointly encoded to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target. Then, a first matching degree between each two first encoding vectors and a second matching degree between each first encoding vector and the second encoding vector are determined. Then, according to the first matching degree, a segment contained in the text to be extracted and a first reference structure text are determined, and according to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector, a second reference structure text is determined. Finally, according to the first reference structure text and the second reference structure text, a target triple corresponding to the extraction target is determined. Thus, by jointly encoding the extraction target and the text to be extracted, and then extracting the first reference structure text contained in the text to be extracted and the second reference structure text associated with the extraction target, the target triple is determined, so that the target triple can be quickly and accurately extracted from the text to be extracted based on the extraction target, and the method has good migration and universality.
[0024] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0025] The accompanying drawings are used to better understand the present scheme and do not limit the present disclosure. Among them:
[0026] Figure 1 is a flowchart of a method of information extraction according to an embodiment of the present disclosure;
[0027] Figure 2 is a flowchart of a method of information extraction according to another embodiment of the present disclosure;
[0028] Figure 3 is a flowchart of a method of information extraction according to another embodiment of the present disclosure;
[0029] Figure 4 is a structural diagram of an information extraction device according to an embodiment of the present disclosure;
[0030] Figure 5 is a block diagram of an electronic device for implementing the method of information extraction according to the embodiments of the present disclosure. DETAILED DESCRIPTION
[0031] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, which are included to provide a thorough understanding of embodiments of the present disclosure and are taken along with the detailed description to explain various examples thereof. As such, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted for clarity and conciseness.
[0032] Embodiments of the present disclosure relate to the field of artificial intelligence technologies such as computer vision and deep learning.
[0033] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.
[0034] Deep learning is learning the internal rules and representation levels of sample data, and the information obtained in the learning process is very helpful for the interpretation of data such as text, images and sound. The ultimate goal of deep learning is to enable machines to have analysis and learning capabilities like humans, and to recognize text, images and sound data.
[0035] Natural language processing is the use of computers to process, understand and use human languages (such as Chinese, English, etc.), which is a cross-discipline of computer science and linguistics, and is also commonly known as computational linguistics. Since natural language is the fundamental mark that distinguishes humans from other animals. Without language, human thinking cannot be discussed, so natural language processing embodies the highest task and realm of artificial intelligence, that is, only when computers have the ability to process natural language, machines can be considered to have achieved true intelligence.
[0036] In the technical solutions of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information comply with relevant laws and regulations and do not violate public order and good customs.
[0037] The information extraction method, device, electronic equipment and storage medium of the embodiments of the present disclosure are described below with reference to the accompanying drawings.
[0038] It should be noted that the execution subject of the information extraction method of the present embodiment is an information extraction device, which can be realized by software and / or hardware. The device can be configured in an electronic equipment, which can include but is not limited to a terminal, a server end, etc.
[0039] Figure 1 is a flowchart of an information extraction method according to an embodiment of the present disclosure.
[0040] AsFigure 1 As shown, the information extraction method comprises:
[0041] S101: Jointly encode the current extraction target and the text to be extracted to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target.
[0042] Wherein, the extraction target can be a label corresponding to the target information that needs to be extracted from the text to be extracted. For example, the labels contained in the extraction target can include "person", "place of birth", "country", etc. The present disclosure does not limit this.
[0043] Wherein, the text to be extracted can be a text to be extracted according to the extraction target. For example, the text to be extracted can be a resume text, a project plan text, etc. The present disclosure does not limit this.
[0044] Optionally, the extraction target and the text to be extracted can be spliced and input into a pre-trained pre-training language model, so that the pre-training language model uniformly encodes the extraction target and the text to be extracted to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target output by the pre-training language model.
[0045] Wherein, the second encoding vector can be an encoding vector corresponding to each character in each label in the extraction target.
[0046] S102: Determine the first matching degree between each two first encoding vectors, and the second matching degree between each first encoding vector and the second encoding vector.
[0047] Optionally, the Euclidean distance formula or the Manhattan distance formula can be used to calculate the first matching degree between two first encoding vectors, or the second matching degree between each first encoding vector and the second encoding vector.
[0048] Alternatively, the cosine similarity between two first encoding vectors can also be calculated, and the cosine similarity is taken as the first matching degree between two first encoding vectors. The cosine similarity between each first encoding vector and the second encoding vector is calculated, and the cosine similarity is taken as the second matching degree between each first encoding vector and the second encoding vector. The present disclosure does not limit this.
[0049] S103: According to the first matching degree, determine the segment contained in the text to be extracted and the first reference structure text.
[0050] Wherein, the segment can be a word composed of two or more characters contained in the text to be extracted. For example, "Li Ming", "born in", "the United States", etc. The present disclosure does not limit this.
[0051] The first reference structure text can be a structure text composed of fragments having a subject-object association relationship in the to-be-extracted text.
[0052] For example, the to-be-extracted text is "Li Ming was born in the capital of the United States, Wancheng", and the fragments included in the to-be-extracted text can include "Li Ming", "the United States", and "Wancheng". The first reference structure text can include "Li Ming-Wancheng" and "the United States-Wancheng". The present disclosure does not limit this.
[0053] Optionally, two characters corresponding to two first encoding vectors with a first matching degree greater than a first threshold value can be determined first, and then the two characters and the characters between the two characters in the to-be-extracted text are determined as a fragment. In the case that the first matching degree between the start characters of the two fragments and the first matching degree between the end characters are both greater than a second threshold value, the two fragments are determined as a first reference structure text. Thus, according to the set first threshold value and second threshold value, the text included in the to-be-extracted text and the first reference structure text can be accurately determined.
[0054] The first threshold value can be a pre-set value. For example, the first threshold value can be 0.5, 0.8, etc. The present disclosure does not limit this.
[0055] For example, if the first threshold value can be 0.5, the to-be-extracted text is "Li Ming was born in the capital of the United States, Wancheng", and the first matching degree between the first encoding vector corresponding to "Li" and the first encoding vector corresponding to "Ming" is greater than 0.5, then "Li Ming" is determined as a fragment. If the to-be-extracted text is "Li San Ming was born in the capital of the United States, Wancheng", and the first matching degree between the first encoding vector corresponding to "Li" and the first encoding vector corresponding to "Ming" is greater than 0.5, then "Li San Ming" is determined as a fragment.
[0056] In the present disclosure, after the fragments included in the to-be-extracted text are determined, it can be further determined whether there is a subject-object association relationship between each two fragments, and then the first reference structure text included in the to-be-extracted text is obtained. The number of the first reference structure text included in the to-be-extracted text can be one or more. The present disclosure does not limit this.
[0057] The second threshold value is a pre-set value. For example, the second threshold value can be 0.6, 0.9, etc. It should be noted that the value of the second threshold value can be the same as or different from the value of the first threshold value. The present disclosure does not limit this.
[0058] For example, the second threshold value can be 0.9, the text to be extracted is "Li Ming was born in the capital of the United States, Guangcheng", the segments contained in the text to be extracted include "Li Ming", "the United States", "Guangcheng", and if it is determined whether "Li Ming" and "Guangcheng" are a first reference structure text, it can be determined whether the first matching degree between "Li" and "Guang" is greater than 0.9 and whether the first matching degree between "Ming" and "Cheng" is greater than 0.9. In the case where the first matching degree between "Li" and "Guang" and the first matching degree between "Ming" and "Cheng" are both greater than 0.9, "Li Ming-Guangcheng" is determined to be a first reference structure text.
[0059] Optionally, after the segments are determined, the encoding vector corresponding to each segment can also be determined according to the first encoding vector corresponding to each character contained in the segment, and the matching degree between each two segments can be determined according to the encoding vectors corresponding to each two segments, respectively. In the case where the matching degrees corresponding to two segments are both greater than the second threshold value, it is determined that the two segments can constitute a first reference structure text.
[0060] S104: Determine the second reference structure text according to the second matching degree between the first encoding vector and the second encoding vector corresponding to each character in the segment.
[0061] The second reference structure text can be a structure text composed of the label contained in the extraction target and the segment corresponding to the label contained in the text to be extracted. For example, "person-Zhang San", "country-the United States", "place of birth-Guangcheng", etc.
[0062] Optionally, in the case where the second matching degree between the starting character of the second label in the extraction target and the starting character of the first segment and the second matching degree between the ending character of the second label and the ending character of the first segment are both greater than the third threshold value, it is determined that the second label and the first segment are a second reference structure text. Thus, the starting and ending characters of the label in the extraction target and the starting and ending characters of the segment in the text to be extracted are matched, respectively, and in the case where the starting and ending characters are both matched, it is determined to be a second reference structure text, thereby improving the accuracy of the obtained second reference structure text.
[0063] The third threshold value is a pre-set value. For example, the third threshold value can be 0.88, 0.66, etc. It should be noted that the value of the third threshold value can be the same as or different from the value of the first threshold value and the value of the second threshold value. The present disclosure does not limit this.
[0064] For example, if the third threshold value can be 0.88, the second label is "person", the first segment is "Li Ming", the starting character of the second label is "person", and the ending character is "object"; the starting character of the first segment is "Yang", and the ending character is "Ming", the second matching degree between the second encoding vector corresponding to "person" and the first encoding vector corresponding to "Yang" is greater than 0.88, and the second matching degree between the second encoding vector corresponding to "object" and the first encoding vector corresponding to "Ming" is greater than 0.88, it is determined that "person-Li Ming" is a second reference structure text.
[0065] S105: determining a target triple corresponding to the extraction target according to the first reference structure text and the second reference structure text.
[0066] The triple can be a structure of [subject entity, predicate label, object entity], the predicate label defines the relationship between the subject entity and the object entity, and the subject entity and the object entity are respectively the subject and the object in the text. The target triple can be a triple obtained by performing information extraction on the to-be-extracted text based on the extraction target.
[0067] In the embodiments of the present disclosure, after the first reference structure text and the second reference structure text are determined, the first reference structure text and the second reference structure text can be combined to determine the target triple. For example, the first reference structure text is "Li Ming-Duancheng", and the second reference structure text is "place of birth-Duancheng", and the target triple composed is "Li Ming-place of birth-Duancheng".
[0068] In the embodiments of the present disclosure, the current extraction target and the to-be-extracted text are first jointly encoded to obtain the first encoding vector corresponding to each character in the to-be-extracted text and the second encoding vector corresponding to the extraction target, and then the first matching degree between each two first encoding vectors and the second matching degree between each first encoding vector and the second encoding vector are determined, and then the segment contained in the to-be-extracted text and the first reference structure text are determined according to the first matching degree, the second reference structure text is determined according to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector, and finally the target triple corresponding to the extraction target is determined according to the first reference structure text and the second reference structure text. Therefore, by jointly encoding the extraction target and the to-be-extracted text, and then extracting the first reference structure text contained in the to-be-extracted text and the second reference structure text associated with the extraction target to determine the target triple, the target triple can be quickly and accurately extracted from the to-be-extracted text based on the extraction target, and the method has good migration and universality.
[0069] Figure 2 is a flowchart of a method for information extraction according to another embodiment of the present disclosure. As shown in Figure 2As shown, the information extraction method comprises:
[0070] S201: jointly encoding the current extraction target and the text to be extracted to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target.
[0071] S202: determining a probability value of each first encoding vector belonging to each type element in the triple.
[0072] Wherein, if the structure of the triple is [subject entity, predicate label, object entity], each type element in the triple is the subject entity, the predicate label, and the object entity. The probability value of each first encoding vector belonging to each type element in the triple includes: the probability that the first encoding vector is the start character of the subject entity, the probability that the first encoding vector is the end character of the subject entity, the probability that the first encoding vector is the start character of the predicate label, the probability that the first encoding vector is the end character of the predicate label, the probability that the first encoding vector is the start character of the object entity, and the probability that the first encoding vector is the end character of the object entity.
[0073] Optionally, the matching degrees between the first encoding vector and the encoding vectors corresponding to the start and end characters of each type element in the triple can be determined first, and the type element corresponding to the maximum matching degree is determined as the type element to which the first encoding vector belongs. The maximum matching degree is the corresponding probability value.
[0074] S203: determining a first matching degree between each two first encoding vectors according to the probability value that each two first encoding vectors belong to the same type element.
[0075] Optionally, the product of the probability values that each two first encoding vectors belong to the same type element can be determined as the first matching degree between each two first encoding vectors.
[0076] Optionally, the product of the probability value that one first encoding vector belongs to the start character of the first type element and the probability value that another first encoding vector belongs to the end character of the first type element can be determined as the first matching degree between the one first encoding vector and the another first encoding vector. In this way, the first matching degree between each two first encoding vectors can be determined more accurately.
[0077] For example, the two first encoding vectors are the first encoding vector corresponding to "Yang" and the first encoding vector corresponding to "Ming", the probability value that the first encoding vector corresponding to "Yang" belongs to the start character of the first type element "subject entity" is 0.9, and the probability value that the first encoding vector corresponding to "Ming" belongs to the first type element "subject entity" is 0.7. The first matching degree between the first encoding vector corresponding to "Yang" and the first encoding vector corresponding to "Ming" is determined as 0.63.
[0078] S204: Determine the second matching degrees between the two first encoding vectors with the first matching degree greater than the first threshold value and the second encoding vectors respectively.
[0079] In the embodiments of the present disclosure, the second matching degrees between the two first encoding vectors with the first matching degree greater than the first threshold value and the second encoding vectors corresponding to the characters of each label in the extraction target can be determined. Thus, the second matching degrees between the two first encoding vectors with the first matching degree less than or equal to the first threshold value and the second encoding vectors do not need to be determined, the computing resources are saved, and the efficiency of obtaining the target triple is improved.
[0080] Optionally, candidate labels associated with the element type to which the two first encoding vectors belong can be determined from the extraction target first, and then the second matching degrees between the two first encoding vectors and the second encoding vectors corresponding to the start and end characters in the candidate labels are determined. Thus, the second encoding vectors corresponding to the labels irrelevant to the element type to which the two first encoding vectors belong do not need to be determined, the computing resources are further saved, and the efficiency of obtaining the target triple contained in the text to be extracted is further improved.
[0081] For example, if the element type is a subject entity, the corresponding candidate label can be an entity type label such as "person", "country", etc. If the element type is a predicate label, the corresponding candidate label can be a relationship type label such as "place of birth", etc.
[0082] Optionally, in the case that the attribute of the first label in the extraction target matches the type of the element to which the two first encoding vectors belong, the first label is determined as a candidate label associated with the two first encoding vectors. Thus, the candidate labels associated with the element type to which the two first encoding vectors belong can be accurately determined.
[0083] The attribute of the first label in the extraction target can include an entity label, a relationship label, etc.
[0084] For example, if the element type to which the two first encoding vectors with the first matching degree greater than the first threshold value belongs is a subject entity, the extraction target includes "person", "country", "place of birth", etc., "person" and "country" are entity labels, and "place of birth" is a relationship label, the corresponding candidate labels are "person" and "country", and then the second matching degrees between the two first encoding vectors and the second encoding vectors corresponding to the start and end characters in "person" and "country" are determined.
[0085] S205: Determine the segment in the text to be extracted and the first reference structure text according to the first matching degree.
[0086] S206: determining the second reference structure text according to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector.
[0087] S207: determining the target triple corresponding to the extraction target according to the first reference structure text and the second reference structure text.
[0088] The specific implementation forms of steps S205 to S207 can refer to the detailed steps in other embodiments of the present disclosure, and will not be described in detail here.
[0089] In the embodiments of the present disclosure, the current extraction target and the text to be extracted are first jointly encoded to obtain the first encoding vector corresponding to each character in the text to be extracted and the second encoding vector corresponding to the extraction target. Then, the probability value of each first encoding vector belonging to each type element in the triple is determined, and the first matching degree between each two first encoding vectors is determined according to the probability value of each two first encoding vectors belonging to the same type element. Then, the second matching degree between the two first encoding vectors with the first matching degree greater than the first threshold and the second encoding vector is determined. Then, the segment contained in the text to be extracted and the first reference structure text are determined according to the first matching degree, and the second reference structure text is determined according to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector. Finally, the target triple corresponding to the extraction target is determined according to the first reference structure text and the second reference structure text. Thus, the first matching degree between each two first encoding vectors is determined according to the probability value of each two first encoding vectors belonging to the same type element, and the second matching degree between the two first encoding vectors with the first matching degree greater than the first threshold and the second encoding vector is determined. Therefore, the data amount of the first matching degree and the second matching degree to be calculated is reduced, and the efficiency of extracting the target triple from the text to be extracted based on the extraction target is improved.
[0090] Figure 3 is a flowchart of a method for information extraction according to another embodiment of the present disclosure; as shown in Figure 3 the method for information extraction comprises:
[0091] S301: jointly encoding the current extraction target and the text to be extracted to obtain the first encoding vector corresponding to each character in the text to be extracted and the second encoding vector corresponding to the extraction target.
[0092] S302: determining the first matching degree between each two first encoding vectors and the second matching degree between each first encoding vector and the second encoding vector.
[0093] S303: determining the segment contained in the text to be extracted and the first reference structure text according to the first matching degree.
[0094] S304: determining the second reference structure text according to the second matching degree between the first encoding vector and the second encoding vector corresponding to each character in the segment.
[0095] The specific implementation forms of steps S301 to S304 can refer to the detailed descriptions in other embodiments of the present disclosure, and will not be described in detail here.
[0096] S305: combining a first reference structure text and a second reference structure text containing the same segment to generate a candidate triple, wherein the candidate triple includes a segment of a specified type and a relation label.
[0097] The segment of the specified type can be a subject entity in the triple, that is, a subject segment in the text. The relation label is a predicate label included in the extraction target.
[0098] For example, the extraction target includes "person", "country", and "place of birth"; the text to be extracted is "Li Ming was born in the capital of the United States, Wancheng"; the first reference structure text can include "Li Ming-Wancheng" and "the United States-Wancheng"; the second reference structure text includes "person-Li Ming", "country-the United States", and "place of birth-Wancheng"; the first reference structure text containing "Wancheng" includes "Li Ming-Wancheng" and "the United States-Wancheng"; the second reference structure text containing "Wancheng" includes "place of birth-Wancheng", and the candidate triple satisfying the condition that the candidate triple includes a segment of a specified type and a relation label is "Li Ming-place of birth-Wancheng" and "the United States-place of birth-Wancheng".
[0099] As can be seen, "the United States-place of birth-Wancheng" is an incorrect triple, and therefore, the candidate triple with a subject entity and a predicate label relationship error can be further filtered in the embodiment of the present disclosure to determine the target triple.
[0100] S306: filtering the candidate triple according to the third matching degree between the segment of the specified type and the relation label in each candidate triple to determine the target triple.
[0101] Optionally, the product of the first encoding vector corresponding to the starting character of the segment of the specified type in the first candidate triple and the second encoding vector corresponding to the starting character of the relation label in the first candidate triple is determined as a third matching degree corresponding to the first candidate triple, and the product of the first encoding vector corresponding to the terminal character of the segment of the specified type and the second encoding vector corresponding to the terminal character of the relation label is determined as another third matching degree corresponding to the first candidate triple. In the case where both the third matching degree and the other third matching degree are greater than a fourth threshold value, the first candidate triple is determined as a target triple.
[0102] Therefore, the association relationship between the specified type of segment and the relationship label in the candidate triple can be accurately determined according to the third matching degree between the start character of the specified type of segment and the start character of the relationship label, and the third matching degree between the start character of the specified type of segment and the start character of the relationship label, and the target triple can be accurately determined.
[0103] The fourth threshold value can be a pre-set value. For example, the fourth threshold value can be 0.8, 0.75, etc. It should be noted that the value of the fourth threshold value can be the same as or different from the value of the first threshold value, the value of the second threshold value, and the value of the third threshold value. The present disclosure does not limit this.
[0104] For example, the candidate triple is "Li Ming - birthplace - Wancheng", and the specified type of segment in "Li Ming - birthplace - Wancheng" is "Li Ming", and the relationship label is "birthplace". The third matching degree between "Li" and "out" and the third matching degree between "Ming" and "land" are determined. If the third matching degree between "Li" and "out" and the third matching degree between "Ming" and "land" are greater than the fourth threshold value, "Li Ming - birthplace - Wancheng" is determined as a target triple.
[0105] Optionally, the first encoding vector corresponding to each character contained in the specified type of segment in each candidate triple can be spliced to obtain the encoding vector corresponding to the specified type of segment, the second encoding vector corresponding to each character in the relationship label can be spliced to obtain the encoding vector corresponding to the relationship label, and the candidate triple corresponding to the candidate triple is determined as a target triple when the matching degree between the encoding vector corresponding to the specified type of segment and the encoding vector corresponding to the relationship label is greater than the fourth threshold value.
[0106] In the embodiments of the present disclosure, the current extraction target and the text to be extracted are first jointly encoded to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target. Then, a first matching degree between each two first encoding vectors and a second matching degree between each first encoding vector and the second encoding vector are determined. Then, a segment contained in the text to be extracted and a first reference structure text are determined according to the first matching degree. A second reference structure text is determined according to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector. Finally, one first reference structure text and one second reference structure text containing the same segment are combined to generate a candidate triple. One candidate triple includes a segment of a specified type and a relation label. The candidate triples are filtered according to a third matching degree between the segment of the specified type and the relation label in each candidate triple to determine a target triple. In this way, the candidate triples generated based on the first reference structure text and the second reference structure text can be screened, and the ambiguity of the subject entity and the predicate label in the generated candidate triples can be avoided, thereby improving the accuracy of the generated target triple.
[0107] Figure 4 is a structural schematic diagram of an information extraction device according to an embodiment of the present disclosure. As shown in the figure, the information extraction device 400 includes: Figure 4 The obtaining module 410 is configured to jointly encode the current extraction target and the text to be extracted to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target.
[0108] The first determining module 420 is configured to determine a first matching degree between each two first encoding vectors and a second matching degree between each first encoding vector and the second encoding vector.
[0109] The second determining module 430 is configured to determine a segment contained in the text to be extracted and a first reference structure text according to the first matching degree.
[0110] The third determining module 440 is configured to determine a second reference structure text according to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector.
[0111] The fourth determining module 450 is configured to determine a target triple corresponding to the extraction target according to the first reference structure text and the second reference structure text.
[0112] In some embodiments of the present disclosure, the first determining module 420 includes:
[0113]
[0114] The first determining unit is configured to determine a probability value of each first encoding vector belonging to each type element in the triple;
[0115] The second determining unit is configured to determine a first matching degree between each two first encoding vectors according to the probability value of each two first encoding vectors belonging to the same type element;
[0116] The third determining unit is configured to determine a second matching degree between the second encoding vector and each of the two first encoding vectors whose first matching degree is greater than the first threshold.
[0117] In some embodiments of the present disclosure, the second determining unit is specifically configured to:
[0118] The first matching degree between the two first encoding vectors is determined as a product of the probability value of one first encoding vector belonging to the start character of the first type element and the probability value of the other first encoding vector belonging to the end character of the first type element.
[0119] In some embodiments of the present disclosure, the third determining unit is specifically configured to:
[0120] The candidate label associated with the type of the element to which the two first encoding vectors belong is determined from the extraction target.
[0121] The second matching degree between the second encoding vector corresponding to the start and end characters in the candidate label and each of the two first encoding vectors is determined.
[0122] In some embodiments of the present disclosure, the third determining unit is further specifically configured to:
[0123] In a case where the attribute corresponding to the first label in the extraction target matches the type of the element to which the two first encoding vectors belong, the first label is determined as a candidate label associated with the two first encoding vectors.
[0124] In some embodiments of the present disclosure, the second determining module 430 is specifically configured to:
[0125] The two characters corresponding to the two first encoding vectors whose first matching degree is greater than the first threshold are determined.
[0126] The two characters and the character between the two characters in the text to be extracted are determined as a segment.
[0127] In a case where the first matching degree between the start characters of the two segments and the first matching degree between the end characters of the two segments are both greater than the second threshold, the two segments are determined as a first reference structure text.
[0128] In some embodiments of the present disclosure, the third determining module 440 is specifically configured to:
[0129] In a case where the second matching degree between the start character of the second label and the start character of the first segment and the second matching degree between the end character of the second label and the end character of the first segment are both greater than a third threshold, it is determined that the second label and the first segment are a second reference structure text.
[0130] In some embodiments of the present disclosure, the fourth determining module 450 is specifically configured to:
[0131] combine a first reference structure text and a second reference structure text containing the same segment to generate a candidate triple, a candidate triple including a segment of a specified type and a relation label;
[0132] filter the candidate triples according to a third matching degree between the segment of the specified type and the relation label in each candidate triple to determine a target triple.
[0133] In some embodiments of the present disclosure, the fourth determining module 450 is further specifically configured to:
[0134] determine a product between a first encoding vector corresponding to the start character of the segment of the specified type in the first candidate triple and a second encoding vector corresponding to the start character of the relation label in the first candidate triple as a third matching degree corresponding to the first candidate triple;
[0135] determine a product between a first encoding vector corresponding to the end character of the segment of the specified type and a second encoding vector corresponding to the end character of the relation label as another third matching degree corresponding to the first candidate triple;
[0136] In a case where the third matching degree and the another third matching degree are both greater than a fourth threshold, it is determined that the first candidate triple is a target triple.
[0137] It should be noted that the foregoing explanation and description of the method for information extraction also apply to the device for information extraction of the present embodiment, which will not be described here again.
[0138] In the embodiments of the present disclosure, the current extraction target and the text to be extracted are first jointly encoded to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target, then a first matching degree between each two first encoding vectors and a second matching degree between each first encoding vector and the second encoding vector are determined, then the first reference structure text contained in the text to be extracted is determined according to the first matching degree, the second reference structure text is determined according to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector, and finally the target triple corresponding to the extraction target is determined according to the first reference structure text and the second reference structure text. Thus, by jointly encoding the extraction target and the text to be extracted, the first reference structure text contained in the text to be extracted and the second reference structure text associated with the extraction target are extracted to determine the target triple, so that the target triple can be quickly and accurately extracted from the text to be extracted based on the extraction target, and the target triple has good migration and universality.
[0139] According to the embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0140] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the present disclosure described and / or claimed in this document.
[0141] As shown in Figure 5 The device 500 includes a computing unit 501 that can perform various appropriate actions and processes in accordance with a computer program stored in a read-only memory (ROM) 502 or a computer program loaded into a random access memory (RAM) 503 from a storage unit 508. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0142] A number of components in the device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a magnetic disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0143] The computing unit 501 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs various methods and processes described above, such as the method of information extraction. For example, in some embodiments, the method of information extraction can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded onto the RAM 503 and executed by the computing unit 501, one or more steps of the method of information extraction described above can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the method of information extraction by any other appropriate means, such as by means of firmware.
[0144] Various implementations of the systems and techniques described above herein can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0145] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0146] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0147] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0148] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0149] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server can also be a server of a distributed system, or a server combined with a blockchain.
[0150] In this embodiment, the current extraction target and the text to be extracted are first jointly encoded to obtain a first encoding vector corresponding to each character in the text to be extracted and a second encoding vector corresponding to the extraction target. Then, a first matching degree between each two first encoding vectors and a second matching degree between each first encoding vector and the second encoding vector are determined. Then, according to the first matching degree, a segment contained in the text to be extracted and a first reference structure text are determined. According to the second matching degree between the first encoding vector corresponding to each character in the segment and the second encoding vector, a second reference structure text is determined. Finally, according to the first reference structure text and the second reference structure text, a target triple corresponding to the extraction target is determined. Thus, by jointly encoding the extraction target and the text to be extracted, and then extracting the first reference structure text contained in the text to be extracted and the second reference structure text associated with the extraction target, the target triple is determined, so that the target triple can be quickly and accurately extracted from the text to be extracted based on the extraction target, and the system has good migration and universality.
[0151] It should be understood that the various forms of flow shown above can be used to reorder, add, or remove steps. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technology disclosed in the present disclosure are achieved, which is not limited herein.
[0152] Furthermore, the terms "first", "second", etc. are used herein only to describe various steps in a method, process, and / or apparatus, and are not construed as indicating or implying relative importance or a specific number of the indicated technical features. Thus, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "a plurality of" is at least two, for example, two, three, etc., unless otherwise specifically limited. In the description of the present disclosure, the word "if" can be interpreted as "when" or "upon" or "in response to determining" or "in the event that" as long as the context permits.
[0153] The above detailed description does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. An information extraction method, comprising: The current extraction target and the text to be extracted are jointly encoded to obtain the first encoding vector corresponding to each character in the text to be extracted and the second encoding vector corresponding to the extraction target. Determine the first matching degree between every two first coding vectors, and the second matching degree between each first coding vector and the second coding vector; Based on the first matching degree, the fragments contained in the text to be extracted and the first reference structure text are determined. The first reference structure text is a structure text composed of fragments containing a subject-object relationship in the text to be extracted. Based on the second matching degree between the first encoding vector corresponding to each character in the fragment and the second encoding vector, a second reference structure text is determined. The second reference structure text is a structure text composed of the tags contained in the extraction target and the fragments containing the tags in the text to be extracted. The first reference structure text and the second reference structure text are combined to determine the target triplet corresponding to the extraction target.
2. The method as described in claim 1, wherein, Determining the first matching degree between every two first coding vectors and the second matching degree between each first coding vector and the second coding vector includes: Determine the probability value of each of the first encoded vectors belonging to each type element in the triplet; The first matching degree between each pair of first encoded vectors is determined based on the probability value that each pair of first encoded vectors belongs to the same type of element; Determine the second matching degree between the two first encoding vectors with a first matching degree greater than a first threshold and the second encoding vector.
3. The method as described in claim 2, wherein, The step of determining the first matching degree between any two first encoded vectors based on the probability value that each pair of first encoded vectors belongs to the same type of element includes: The first matching degree between the first encoded vector and the other first encoded vector is determined by multiplying the probability value of one first encoded vector belonging to the start character of the first type element with the probability value of another first encoded vector belonging to the end character of the first type element.
4. The method of claim 2, wherein, Determining the second matching degree between the two first encoding vectors with a first matching degree greater than a first threshold and the second encoding vector includes: From the extraction target, candidate tags associated with the element types of the two first encoding vectors are determined; Determine the second matching degree between the two first encoding vectors and the second encoding vectors corresponding to the start and end characters in the candidate tags.
5. The method of claim 4, wherein, The step of determining candidate tags from the extracted target that are associated with the element types of the two first encoding vectors includes: If the attribute corresponding to the first tag in the extraction target matches the type of the element to which the two first encoding vectors belong, the first tag is determined to be a candidate tag associated with the two first encoding vectors.
6. The method of claim 1, wherein, The step of determining the fragments and the first reference structure text contained in the text to be extracted based on the first matching degree includes: Determine the two characters corresponding to the two first encoding vectors whose first matching degree is greater than the first threshold; The two characters and the characters in the text to be extracted located between the two characters are defined as a segment; If the first matching degree between the starting characters and the first matching degree between the ending characters of the two segments are both greater than the second threshold, the two segments are determined to be a first reference structure text.
7. The method of claim 1, wherein, The step of determining the second reference structure text based on the second matching degree between the first encoding vector and the second encoding vector corresponding to each character in the segment includes: If the second matching degree between the starting character of the second tag and the starting character of the first segment in the extraction target, and the second matching degree between the ending character of the second tag and the ending character of the first segment are both greater than the third threshold, then the second tag and the first segment are determined to be a second reference structure text.
8. The method of claim 1, wherein, The step of combining the first reference structure text and the second reference structure text to obtain the target triplet corresponding to the extraction target includes: Combine a first reference structure text and a second reference structure text that contain the same fragment to generate a candidate triplet, wherein a candidate triplet includes a fragment of a specified type and a relation label; Candidate triples are filtered based on the third degree of matching between fragments of a specified type and relation labels in each candidate triple to determine the target triples.
9. The method of claim 8, wherein, The step of filtering candidate triples based on the third matching degree between fragments of a specified type and relation labels in each candidate triple to determine the target triples includes: The product of the first encoding vector corresponding to the starting character of the specified type of fragment in the first candidate triplet and the second encoding vector corresponding to the starting character of the relation label in the first candidate triplet is determined as a third matching degree corresponding to the first candidate triplet. The product of the first encoding vector corresponding to the terminating character of the specified fragment type and the second encoding vector corresponding to the terminating character of the relation label is determined as another third matching degree corresponding to the first candidate triplet. If both the third matching degree and the other third matching degree are greater than the fourth threshold, the first candidate triplet is determined to be a target triplet.
10. An information extraction apparatus, comprising: The acquisition module is used to jointly encode the current extraction target and the text to be extracted, so as to obtain the first encoding vector corresponding to each character in the text to be extracted and the second encoding vector corresponding to the extraction target. The first determining module is used to determine the first matching degree between every two first coding vectors and the second matching degree between each first coding vector and the second coding vector; The second determining module is used to determine the segments contained in the text to be extracted and the first reference structure text based on the first matching degree. The first reference structure text is a structure text composed of segments containing a subject-object relationship contained in the text to be extracted. The third determining module is used to determine the second reference structure text based on the second matching degree between the first encoding vector corresponding to each character in the fragment and the second encoding vector. The second reference structure text is a structure text composed of the tags contained in the extraction target and the fragments containing the tags in the text to be extracted. The fourth determining module is used to combine the first reference structure text and the second reference structure text to determine the target triplet corresponding to the extraction target.
11. The apparatus of claim 10, wherein, The first determining module includes: The first determining unit is used to determine the probability value of each of the first encoded vectors belonging to each type element in the triplet; The second determining unit is used to determine the first matching degree between each pair of first encoded vectors based on the probability value that each pair of first encoded vectors belongs to the same type of element; The third determining unit is used to determine the second matching degree between the two first encoding vectors with a first matching degree greater than the first threshold and the second encoding vector, respectively.
12. The apparatus of claim 11, wherein, The second determining unit is specifically used for: The first matching degree between the first encoded vector and the other first encoded vector is determined by multiplying the probability value of one first encoded vector belonging to the start character of the first type element with the probability value of another first encoded vector belonging to the end character of the first type element.
13. The apparatus of claim 11, wherein, The third determining unit is specifically used for: From the extraction target, candidate tags associated with the element types of the two first encoding vectors are determined; Determine the second matching degree between the two first encoding vectors and the second encoding vectors corresponding to the start and end characters in the candidate tags.
14. The apparatus of claim 13, wherein, The third determining unit is further specifically used for: If the attribute corresponding to the first tag in the extraction target matches the type of the element to which the two first encoding vectors belong, the first tag is determined to be a candidate tag associated with the two first encoding vectors.
15. The apparatus of claim 10, wherein, The second determining module is specifically used for: Determine the two characters corresponding to the two first encoding vectors whose first matching degree is greater than the first threshold; The two characters and the characters in the text to be extracted located between the two characters are defined as a segment; If the first matching degree between the starting characters and the first matching degree between the ending characters of the two segments are both greater than the second threshold, the two segments are determined to be a first reference structure text.
16. The apparatus of claim 10, wherein, The third determining module is specifically used for: If the second matching degree between the starting character of the second tag and the starting character of the first segment in the extraction target, and the second matching degree between the ending character of the second tag and the ending character of the first segment are both greater than the third threshold, then the second tag and the first segment are determined to be a second reference structure text.
17. The apparatus of claim 10, wherein, The fourth determining module is specifically used for: Combine a first reference structure text and a second reference structure text that contain the same fragment to generate a candidate triplet, wherein a candidate triplet includes a fragment of a specified type and a relation label; Candidate triples are filtered based on the third degree of matching between fragments of a specified type and relation labels in each candidate triple to determine the target triples.
18. The apparatus of claim 17, wherein, The fourth determining module is further specifically used for: The product of the first encoding vector corresponding to the starting character of the specified type of fragment in the first candidate triplet and the second encoding vector corresponding to the starting character of the relation label in the first candidate triplet is determined as a third matching degree corresponding to the first candidate triplet. The product of the first encoding vector corresponding to the terminating character of the specified fragment type and the second encoding vector corresponding to the terminating character of the relation label is determined as another third matching degree corresponding to the first candidate triplet. If both the third matching degree and the other third matching degree are greater than the fourth threshold, the first candidate triplet is determined to be a target triplet.
19. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-9.
21. A computer program product comprising computer instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1-9.
Citation Information
Patent Citations
Text processing method and device, equipment and storage medium
CN112613322A
Element extraction method and device, electronic equipment and storage medium
CN114238550A