Triple information extraction method, device, equipment and computer-readable storage medium
By crawling term information from the Internet and training a BERT pre-trained language model, the problem of extracting information from triples of different types in existing technologies is solved, achieving the effect of efficiently extracting and constructing multi-domain knowledge system graphs.
Patent Information
- Application Number
- CN202011415288.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-03
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2040-12-03
AI Technical Summary
Existing triple information extraction techniques can only extract a few types of entities and relations of specific types, and cannot extract triple information of different types from massive amounts of text.
By crawling massive amounts of internet terminology information, we can initially extract triple information, perform data annotation and train a BERT pre-trained language model, construct a knowledge system graph, and achieve triple information extraction from any text.
It can efficiently extract high-quality triple information from massive amounts of text and construct a multi-domain knowledge system graph that is parsable, searchable, and traceable.
Smart Images

Figure CN112507125B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and computer-readable storage medium for extracting triple information. Background Art
[0002] At present, only a very small amount of knowledge on the Internet has been manually organized by humans into a format that can be parsed by machines, such as various encyclopedia columns and vertical field databases. However, this information is just a drop in the ocean, and its coverage, update frequency, and reliability cannot meet the growing needs of automation and intelligence.
[0003] With the development of knowledge graph construction technology, some mature algorithms can be used to extract a small number of specific types of entities and relations with obvious characteristics, and some open source NLP tools can be used to extract specific types of entities. For example, Stanford University's open source NLP tool stanford-corenlp supports the extraction of 23 types of entities such as names, place names, organization names, numbers, currencies, dates, and times. Harbin Institute of Technology's open source NLP tool LTP supports the recognition of three types of entities: names, organization names, and place names. In the extraction of triples, the existing technology is implemented by constraining the relationship to a number of known categories, and then using a classification model to classify the sentences containing the entities, and then extract the relationship in the triples.
[0004] However, with the development of Internet technology, massive texts contain entities and relationships of various types. The existing triple information extraction technology only extracts several entities and relationships of specific types, that is, it extracts a limited number of pre-agreed types, and is unable to extract triple information of various types in massive texts.
[0005] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0006] The main purpose of the present invention is to provide a triple information extraction method, device, equipment and computer-readable storage medium, aiming to solve the technical problem that the existing triple information extraction technology only extracts several entities and relationships of specific types and cannot extract triple information of different types in the text.
[0007] To achieve the above object, the present invention provides a method for extracting triple information, which comprises the following steps:
[0008] Crawling a large amount of term information from Internet data using a crawler tool, wherein the term information includes data from multiple different fields;
[0009] Based on the entry information, determining a sentence containing triple information in the entry information, and preliminarily extracting triple information in the sentence to obtain initial triple information;
[0010] Based on the initial triplet information, data annotation is performed on any ordinary text to obtain annotated ordinary text, and the annotated ordinary text is used as training text;
[0011] The BERT pre-trained language model is trained based on the training text, a triple extraction model is obtained when the training of the BERT pre-trained language model is completed, and triple information corresponding to any text is determined based on the triple extraction model.
[0012] Optionally, the step of determining, based on the term information, a sentence containing triple information in the term information, and preliminarily extracting triple information in the sentence to obtain initial triple information includes:
[0013] Extracting useful text from the entry information by using a text recognition model to obtain text information, wherein the useful text in the entry information includes semi-structured first text information and unstructured second text information;
[0014] Parsing the text information to obtain sentences containing triple information in the text information;
[0015] The triple information in the sentence is extracted to obtain initial triple information.
[0016] Optionally, after the step of determining the triple information corresponding to any text based on the triple extraction model, the method further includes:
[0017] Inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data;
[0018] When question information input by the user is received, the knowledge data contained in the knowledge graph is matched according to the question information to determine the answer information corresponding to the question information.
[0019] Optionally, the triple information includes association information, and the step of inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data includes:
[0020] Inputting the triple information into a preset knowledge system framework, and obtaining the associated information of each triple information;
[0021] According to the association information of each triple information, the triples are associated and sorted to determine a triple information tree;
[0022] Based on the triple information tree, a knowledge system map containing multi-domain data is constructed.
[0023] Optionally, after the step of inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data, the step further includes:
[0024] If a request for processing the newly added data is received, the newly added data is verified according to a preset information verification rule;
[0025] If the newly added data information passes the verification, the newly added data information is added to the knowledge system map to obtain an updated knowledge system map.
[0026] Optionally, the step of training the BERT pre-trained language model based on the training text and obtaining the triple extraction model when the training of the BERT pre-trained language model is completed includes:
[0027] Input the training text into the BERT pre-trained language model to determine the entity link relationship of entities in the training text;
[0028] Determining a model adjustment parameter according to an actual entity link relationship corresponding to the ordinary text and the entity link relationship, wherein the actual entity link relationship is determined by the annotation information of the ordinary text;
[0029] The BERT pre-trained language model is trained based on the model adjustment parameters, and a triple extraction model is obtained when the training of the BERT pre-trained language model is completed.
[0030] Optionally, the BERT pre-trained language model includes a transformer structure, and the step of inputting the training text into the BERT pre-trained language model and determining the entity link relationship of entities in the training text includes:
[0031] Input the training text into the BERT pre-trained language model, and obtain the vector representation of each character in the training text through the transformer structure;
[0032] The vector representation of the entity information in the training text is used as the entity link relationship of the entity in the training text.
[0033] In addition, to achieve the above object, the present invention also provides a triple information extraction device, the triple information extraction device comprising:
[0034] A crawling module is used to crawl a large amount of term information from Internet data through a crawler tool, wherein the term information includes data from multiple different fields;
[0035] A first extraction module is used to determine, based on the entry information, a sentence containing triple information in the entry information, and preliminarily extract triple information in the sentence to obtain initial triple information;
[0036] A labeling module, used for labeling any ordinary text based on the initial triple information, obtaining the labeled ordinary text, and using the labeled ordinary text as training text;
[0037] The second extraction module is used to train the BERT pre-trained language model based on the training text, obtain a triple extraction model when the training of the BERT pre-trained language model is completed, and determine the triple information corresponding to any text based on the triple extraction model.
[0038] In addition, to achieve the above-mentioned purpose, the present invention also provides a triple information extraction device, which includes: a memory, a processor, and a triple information extraction program stored in the memory and runnable on the processor, and when the triple information extraction program is executed by the processor, it implements the steps of the triple information extraction method as described above.
[0039] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a triple information extraction program is stored, and when the triple information extraction program is executed by a processor, the steps of the triple information extraction method as described above are implemented.
[0040] The present invention crawls a large amount of cross-domain term information from Baidu Encyclopedia, finds sentences containing triple information in the term information, and preliminarily extracts triple information in the sentence to obtain initial triple information, then aligns the initial triple information to pre-acquired common text, and automatically annotates the common text with triple information. These annotated data, i.e., the annotated common text, are used as training texts for subsequent BERT pre-trained language models; then, the obtained training texts are used as inputs of a deep learning algorithm to train a triple extraction model, so that after the triple extraction model is trained, triple information in any text can be identified according to the trained triple extraction model, so that final high-quality triple information can be finally extracted. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a schematic diagram of the structure of a triple information extraction device in a hardware operating environment involved in an embodiment of the present invention;
[0042] Figure 2 It is a flowchart of the first embodiment of the method for extracting triple information of the present invention;
[0043] Figure 3 Schematic diagram of the flow of the second embodiment of the triple information extraction method of the present invention.
[0044] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0046] like Figure 1 As shown, Figure 1 It is a schematic diagram of the structure of a triplet information extraction device in a hardware operating environment involved in an embodiment of the present invention.
[0047] The triplet information extraction device in the embodiment of the present invention can be a PC, or it can be a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a portable computer, or other portable terminal devices with display function.
[0048] like Figure 1 As shown, the triple information extraction device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0049] Optionally, the triple information extraction device may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the triple information extraction device is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the application of the triple information extraction device posture (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the triple information extraction device can also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.
[0050] Those skilled in the art will understand that Figure 1 The structure of the triple information extraction device shown in the figure does not constitute a limitation on the triple information extraction device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0051] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a triple information extraction program.
[0052] exist Figure 1 In the triplet information extraction device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the triplet information extraction program stored in the memory 1005 and execute the triplet information extraction method provided by the embodiment of the present invention.
[0053] The present invention also provides a method for extracting triple information, referring to Figure 2 , Figure 2 Schematic diagram of the process of the first embodiment of the triple information extraction method of the present invention.
[0054] In this embodiment, the triple information extraction method includes the following steps:
[0055] Step S10, crawling a large amount of word information from Internet data using a crawler tool, wherein the word information includes data in multiple different fields;
[0056] In this embodiment, a crawler tool is used to automatically crawl a large amount of Baidu Encyclopedia entries in Internet data. The crawled entries cover all the fields included in Baidu Encyclopedia, such as people, life, culture, science, sports, economy, history, society, geography, nature, art, etc., and include at least 200,000 articles. Among them, the crawler tool is an application program that collects a large amount of information. It is a program or script that automatically crawls World Wide Web information according to certain rules and needs. The crawler tool is realized by combining one or several crawler technologies among General Purpose Web Crawler, Focused Web Crawler, Incremental Web Crawler, and Deep Web Crawler.
[0057] Step S20, based on the entry information, determining the sentence containing triple information in the entry information, and preliminarily extracting the triple information in the sentence to obtain initial triple information;
[0058] In this embodiment, after obtaining the term information of each different field, the triple information in the term information is first preliminarily extracted. Specifically, from the crawled term information, the term information is first preprocessed, wherein the preprocessing operation can be to perform parsing, word segmentation, filtering and other operations on the term information in sequence, thereby preliminarily filtering out the redundant information in the term information. After the preprocessing operation is performed on the term information, that is, the redundant information in the term information is preliminarily filtered out, the term information after the preprocessing operation is parsed to parse out the sentences containing the triple information in the term information; after obtaining the sentences containing the triple information in the term information, the triple information is preliminarily extracted from the sentences containing the triple information to obtain the initial triple information.
[0059] Further, step S20 includes:
[0060] Step S21, extracting useful text from the entry information through a text recognition model to obtain text information, wherein the useful text in the entry information includes semi-structured first text information and unstructured second text information;
[0061] Step S22, parsing the text information to obtain sentences containing triple information in the text information;
[0062] Step S23, extracting triple information from the sentence to obtain initial triple information.
[0063] In this embodiment, from the crawled entry information, a preprocessing operation is first performed on the entry information to filter out redundant information in the entry information. Afterwards, the entry information after filtering out redundant information is input into a pre-trained text recognition model to extract useful text in the entry information, so as to extract useful text in the entry information to obtain text information, and the text information includes semi-structured first text information and unstructured second text information, that is, semi-structured first text information and scattered unstructured second text information, so as to parse out the semi-structured first text information and unstructured second text information in the entry information. Among them, the semi-structured first text information refers to text with a certain structure, such as resume information, which has a certain structure but is not a very neat and strict structure, and is not a very fixed structure, so the resume information belongs to semi-structured text information. The unstructured second text information refers to text information without structure, such as a news article, which is freely written by the writer without a fixed structure. Among them, the text recognition model is used to extract semi-structured text information and unstructured text information in the entry information. The text recognition model includes a text box recognition module and a text recognition module. The text box recognition module is used to recognize the text position in the entry information, and the text recognition module is used to recognize the text in the text box. The text recognition model can be an OCR model.
[0064] After obtaining the semi-structured first text information and the unstructured second text information, the first text information and the second text information are parsed according to preset parsing rules, so as to filter out sentences containing triple information in both the first text information and the second text information; then, the triple information in the sentences is extracted to obtain initial triple information.
[0065] Step S30, based on the initial triple information, data annotation is performed on any common text to obtain annotated common text, and the annotated common text is used as training text;
[0066] In this embodiment, after obtaining the initial triple information in the entry information, obtain the ordinary text, align the extracted initial triple information to the sentence of the ordinary text, and automatically perform sequence annotation on each character in the sentence of the ordinary text. Among them, the beginning characters of the entity information in the ordinary text can be annotated as SUB-B, the beginning characters of the associated information in the ordinary text can be annotated as PDC-B, the beginning characters of the attribute information in the ordinary text can be annotated as OBJ-B, and all other non-triplet information characters in the ordinary text are annotated as O. After the ordinary text is annotated, the annotated ordinary text is used as the training text of the BERT pre-trained language model to train the BERT pre-trained language model.
[0067] Step S40, training the BERT pre-trained language model based on the training text, obtaining a triple extraction model when the training of the BERT pre-trained language model is completed, and determining triple information corresponding to any text based on the triple extraction model.
[0068] In this embodiment, the above-mentioned annotated training text is input into the BERT pre-trained language model for training, and the matrix output by the last hidden layer of the BERT pre-trained language model is obtained. A fully connected layer operation is performed, and the probability value of each character of the training text being predicted as a different label is calculated, and then the cross entropy loss value corresponding to this probability is calculated. The parameters of the learning model are reversely updated according to the cross entropy loss value, and the model is trained until it converges and saved for subsequent triple extraction. Among them, the triple information of the sentence includes the entity information, association information and attribute information of the sentence. The entity information is an abstraction of an objective object, the attribute information represents the nature of the object, and the association information represents the relationship between entities.
[0069] After the training of the triple extraction model is completed, any text can be predicted. Specifically, a news text (or other text) is randomly selected from the Internet, and the news text is segmented into sentences. Then, the triple extraction model is used to extract triples for each sentence in the news text, and the triples extracted from all sentences are combined to obtain triple information. After that, the obtained triple information is verified and filtered, and the triple information extracted by the triple extraction model is further filtered to improve the quality of the triples extracted by the triple extraction model. Finally, the NLP component is used to further verify and filter the recognition results, and the final high-quality triple results can be extracted. Specifically, the sentence from which a certain triple information is extracted is segmented and POS tagged, and entity recognition is performed on the sentence. If the entity information of the extracted triple information is the recognized entity or the noun and idiom in the POS tagging result, the triple information is retained as the prediction result to obtain the triple information of the predicted text. Otherwise, the triple information is discarded and the triple information extraction model is readjusted.
[0070] It should be emphasized that in order to further ensure the privacy and security of the above triplet information, the above triplet information can also be stored in a node of a blockchain.
[0071] The triple information extraction method proposed in this embodiment crawls a large amount of cross-domain term information from Baidu Encyclopedia, finds sentences containing triple information in the term information, and preliminarily extracts triple information in the sentence to obtain initial triple information, then aligns the initial triple information to the pre-acquired ordinary text, and automatically annotates the ordinary text with triple information. These annotated data, that is, the annotated ordinary text, are used as training texts for subsequent BERT pre-trained language models; then, the obtained training texts are used as inputs of the deep learning algorithm to train a triple extraction model, so that after the triple extraction model is trained, possible triple information in any text can be identified according to the trained triple extraction model, so that the final high-quality triple information can be finally extracted.
[0072] Based on the first embodiment, a second embodiment of the triple information extraction method of the present invention is proposed, referring to Figure 3 In this embodiment, after step S40, the following steps are further included:
[0073] Step S50, inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data;
[0074] Step S60, when receiving the question information input by the user, matching the knowledge data contained in the knowledge graph according to the question information to determine the answer information corresponding to the question information.
[0075] In this embodiment, after the triple information of any text is identified, the obtained triple information, namely entity information, association information and attribute information, can be input into the preset knowledge system framework, and a knowledge system map with association can be constructed. Among them, the knowledge system framework is a template framework for constructing the association relationship between triple information. By using the knowledge system framework, the information of the triple information itself can be stored and can be understood and processed by computer equipment. The knowledge system map is a database for storing and associating triple information obtained by constructing the knowledge system framework. After the knowledge system map is constructed based on the triple information, the system corresponding to the knowledge system map provides an information retrieval function, that is, the question information can be input into the system corresponding to the knowledge system map, and the knowledge system map queries the knowledge data in the knowledge map according to the question information. When the relevant information matching the question information is queried, the relevant information matching the question information is assembled according to the preset word order to obtain the answer information, and the answer information is output.
[0076] Furthermore, the triple information includes association information, and the step of inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data includes:
[0077] Step S501, inputting the triple information into a preset knowledge system framework, and obtaining the associated information of each triple information;
[0078] Step S502, according to the association information of each triple information, the triples are associated and sorted to determine a triple information tree;
[0079] Step S503: construct a knowledge system graph containing multi-domain data based on the triple information tree.
[0080] In this embodiment, after identifying the triple information of any text, the obtained triple information, namely the entity information, association information and attribute information, can be input into the preset knowledge system framework to obtain the association information of each triple information. Afterwards, the obtained multiple triples are associated and sorted according to the data association information corresponding to each data information to sort out a triple information tree of the association relationship between the triple information with association relationship; the triple information tree is stored according to the template corresponding to the preset knowledge system framework to obtain a knowledge system map with association. The knowledge map contains multiple triple information trees, and each triple information tree stores the associated triple information and the relationship between the triple information.
[0081] Furthermore, after the step of inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data, it also includes:
[0082] Step S70: if a request for processing the newly added data is received, the newly added data is verified according to a preset information verification rule;
[0083] Step S80: If the newly added data information passes verification, the newly added data information is added to the knowledge system map to obtain an updated knowledge system map.
[0084] In this embodiment, if a request message for processing newly added data information is received, the newly added data information to be added is verified according to the preset information verification rules. The newly added data information is the data information that supplements the knowledge data in the knowledge system graph, and the newly added data information contains multiple newly added knowledge data. The preset information verification rules are the verification information used to verify the knowledge data contained in the knowledge graph.
[0085] Specifically, the information verification rules include knowledge data classification verification information, standard unified verification information, deduplication verification information and association verification information. Classification verification information is information used to classify the newly added knowledge data based on its attribute information; standard unified verification information is information for standardizing the units of time, amount and other data in the newly added knowledge data; deduplication verification information is information for judging whether there is duplication between the newly added knowledge data and the original knowledge data in the knowledge graph. If there is duplication between the newly added knowledge data and the original knowledge data in the knowledge graph, the newly added knowledge data will not be added to the knowledge graph; association verification information is information for sorting out the association relationship between the newly added knowledge data and other knowledge data.
[0086] By verifying the newly added data information through preset information verification rules, it is possible to avoid classification errors, inconsistent unit standards and other problems in the knowledge system map obtained after the update, and to achieve the standardization of the newly added data information in the knowledge map.
[0087] Furthermore, the step of training the BERT pre-trained language model based on the training text and obtaining the triple extraction model when the training of the BERT pre-trained language model is completed includes:
[0088] Step S41, inputting the training text into the BERT pre-trained language model to determine the entity link relationship of entities in the training text;
[0089] Step S42, determining a model adjustment parameter according to an actual entity link relationship corresponding to the ordinary text and the entity link relationship, wherein the actual entity link relationship is determined by the annotation information of the ordinary text;
[0090] Step S43, training the BERT pre-trained language model based on the model adjustment parameters, and obtaining a triple extraction model when the training of the BERT pre-trained language model is completed.
[0091] In this embodiment, the labeled training text is input into the BERT pre-trained language model for training, the matrix of the last hidden layer output of the BERT pre-trained language model is obtained, a fully connected layer operation is performed, the entity link relationship of the entity in the training text is determined, and the probability value of each character of the training text predicted as a different label is calculated according to the actual entity link relationship corresponding to the ordinary text and the entity link relationship, and then the model adjustment parameter corresponding to the probability value is calculated, and the model parameter of the BERT pre-trained language model is reversely updated according to the model adjustment parameter, and the model is trained to converge and saved for subsequent triple extraction. Among them, the model adjustment parameter can be a cross entropy loss value.
[0092] Furthermore, the BERT pre-trained language model includes a transformer structure, and the step of inputting the training text into the BERT pre-trained language model and determining the entity link relationship of entities in the training text includes:
[0093] Step S411, inputting the training text into the BERT pre-trained language model, and obtaining a vector representation of each character in the training text through the transformer structure;
[0094] Step S412: Using the vector representation of the entity information in the training text as the entity link relationship of the entity in the training text.
[0095] In this embodiment, the annotated training text is input into the BERT pre-trained language model for training. Through the transformer structure in the BERT pre-trained language model, the matrix of the last hidden layer output of the BERT pre-trained language model is obtained, and a fully connected layer operation is performed to obtain the vector representation of each character in the training text. After obtaining the vector representation of each character in the training text, the vector representation of the entity information in the training text is used as the entity link relationship in the training text.
[0096] The triple information extraction method proposed in this embodiment constructs a knowledge system graph containing multi-domain data by inputting the triple information into a preset knowledge system framework; when receiving the question information input by the user, the knowledge data contained in the knowledge graph is matched according to the question information to determine the answer information corresponding to the question information. In this embodiment, after extracting triple information from any text in different fields, the extracted triple information is input into the preset knowledge system framework to construct a knowledge system graph containing data from various fields, thereby constructing a parseable, searchable, and traceable knowledge system graph, so that after the knowledge system graph is constructed, the answer information corresponding to the input question information can be output according to the knowledge system graph.
[0097] In addition, an embodiment of the present invention further provides a triple information extraction device, the triple information extraction device comprising:
[0098] A crawling module is used to crawl a large amount of term information from Internet data through a crawler tool, wherein the term information contains data from multiple different fields;
[0099] A first extraction module is used to determine, based on the entry information, a sentence containing triple information in the entry information, and preliminarily extract triple information in the sentence to obtain initial triple information;
[0100] A labeling module, used for labeling any ordinary text based on the initial triple information, obtaining the labeled ordinary text, and using the labeled ordinary text as training text;
[0101] The second extraction module is used to train the BERT pre-trained language model based on the training text, obtain a triple extraction model when the training of the BERT pre-trained language model is completed, and determine the triple information corresponding to any text based on the triple extraction model.
[0102] Furthermore, the first extraction module is further used for:
[0103] Extracting useful text from the entry information by using a text recognition model to obtain text information, wherein the useful text in the entry information includes semi-structured first text information and unstructured second text information;
[0104] Parsing the text information to obtain sentences containing triple information in the text information;
[0105] The triple information in the sentence is extracted to obtain initial triple information.
[0106] Furthermore, the second extraction module is further used for:
[0107] Inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data;
[0108] When question information input by the user is received, the knowledge data contained in the knowledge graph is matched according to the question information to determine the answer information corresponding to the question information.
[0109] Furthermore, the second extraction module is further used for:
[0110] Inputting the triple information into a preset knowledge system framework, and obtaining the associated information of each triple information;
[0111] According to the association information of each triple information, the triples are associated and sorted to determine a triple information tree;
[0112] Based on the triple information tree, a knowledge system map containing multi-domain data is constructed.
[0113] Furthermore, the second extraction module is further used for:
[0114] If a request for processing the newly added data is received, the newly added data is verified according to a preset information verification rule;
[0115] If the newly added data information passes the verification, the newly added data information is added to the knowledge system map to obtain an updated knowledge system map.
[0116] Furthermore, the second extraction module is further used for:
[0117] Input the training text into the BERT pre-trained language model to determine the entity link relationship of entities in the training text;
[0118] Determining a model adjustment parameter according to an actual entity link relationship corresponding to the ordinary text and the entity link relationship, wherein the actual entity link relationship is determined by the annotation information of the ordinary text;
[0119] The BERT pre-trained language model is trained based on the model adjustment parameters, and a triple extraction model is obtained when the training of the BERT pre-trained language model is completed.
[0120] Furthermore, the second extraction module is further used for:
[0121] Input the training text into the BERT pre-trained language model, and obtain the vector representation of each character in the training text through the transformer structure;
[0122] The vector representation of the entity information in the training text is used as the entity link relationship of the entity in the training text.
[0123] In addition, an embodiment of the present invention further proposes a computer-readable storage medium, on which a triple information extraction program is stored. When the triple information extraction program is executed by a processor, the steps of the triple information extraction method as described in any one of the above are implemented.
[0124] The specific embodiments of the computer-readable storage medium of the present invention are basically the same as the embodiments of the above-mentioned triple information extraction method, and will not be described in detail here.
[0125] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0126] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0127] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0129] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for extracting triple information, characterized in that: The triple information extraction method comprises the following steps: Crawling a large amount of term information from Internet data using a crawler tool, wherein the term information includes data from multiple different fields; Based on the entry information, determining a sentence containing triple information in the entry information, and preliminarily extracting triple information in the sentence to obtain initial triple information; Based on the initial triplet information, data annotation is performed on any ordinary text to obtain annotated ordinary text, and the annotated ordinary text is used as training text; Training the BERT pre-trained language model based on the training text, obtaining a triple extraction model when the training of the BERT pre-trained language model is completed, and determining triple information corresponding to any text based on the triple extraction model; The step of determining, based on the entry information, a sentence containing triple information in the entry information, and preliminarily extracting triple information in the sentence to obtain initial triple information comprises: Performing a preprocessing operation on the entry information to obtain preprocessed entry information, wherein the preprocessed entry information is the entry information after filtering out redundant information; Extracting useful text from the preprocessed term information by a text recognition model to obtain text information, wherein the text information includes semi-structured first text information and unstructured second text information; Parsing the text information to obtain sentences containing triple information in the text information; Extracting triple information from the sentence to obtain initial triple information; After the step of determining the triple information corresponding to any text based on the triple extraction model, the method further includes: Inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data; The triple information includes associated information, and the step of inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data includes: Inputting the triple information into a preset knowledge system framework, and obtaining the associated information of each triple information; According to the association information of each triple information, the triples are associated and sorted to determine a triple information tree; Based on the triple information tree, a knowledge system map containing multi-domain data is constructed.
2. The method for extracting triplet information according to claim 1, wherein: After the step of inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data, the method further includes: When question information input by the user is received, the knowledge data contained in the knowledge system map is matched according to the question information to determine the answer information corresponding to the question information.
3. The method for extracting triplet information according to claim 1, wherein: After the step of inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data, the method further includes: If a request for processing the newly added data is received, the newly added data is verified according to a preset information verification rule; If the newly added data information passes the verification, the newly added data information is added to the knowledge system map to obtain an updated knowledge system map.
4. The method for extracting triple information according to any one of claims 1 to 3, characterized in that: The step of training the BERT pre-trained language model based on the training text and obtaining a triple extraction model when the training of the BERT pre-trained language model is completed includes: Input the training text into the BERT pre-trained language model to determine the entity link relationship of entities in the training text; Determining a model adjustment parameter according to an actual entity link relationship corresponding to the ordinary text and the entity link relationship, wherein the actual entity link relationship is determined by the annotation information of the ordinary text; The BERT pre-trained language model is trained based on the model adjustment parameters, and a triple extraction model is obtained when the training of the BERT pre-trained language model is completed.
5. The method for extracting triplet information according to claim 4, wherein: The BERT pre-trained language model includes a transformer structure, and the step of inputting the training text into the BERT pre-trained language model and determining the entity link relationship of entities in the training text includes: Input the training text into the BERT pre-trained language model, and obtain the vector representation of each character in the training text through the transformer structure; The vector representation of the entity information in the training text is used as the entity link relationship of the entity in the training text.
6. A triple information extraction device, characterized in that: The triple information extraction device comprises: A crawling module is used to crawl a large amount of term information from Internet data through a crawler tool, wherein the term information contains data from multiple different fields; A first extraction module is used to determine, based on the entry information, a sentence containing triple information in the entry information, and preliminarily extract triple information in the sentence to obtain initial triple information; A labeling module, used for labeling any ordinary text based on the initial triple information, obtaining the labeled ordinary text, and using the labeled ordinary text as training text; A second extraction module is used to train the BERT pre-trained language model based on the training text, obtain a triple extraction model when the training of the BERT pre-trained language model is completed, and determine the triple information corresponding to any text based on the triple extraction model; The operation of determining, based on the entry information, a sentence containing triple information in the entry information, and preliminarily extracting triple information in the sentence to obtain initial triple information includes: Performing a preprocessing operation on the entry information to obtain preprocessed entry information, wherein the preprocessed entry information is the entry information after filtering out redundant information; Extracting useful text from the preprocessed term information by a text recognition model to obtain text information, wherein the text information includes semi-structured first text information and unstructured second text information; Parsing the text information to obtain sentences containing triple information in the text information; Extracting triple information from the sentence to obtain initial triple information; After the operation of determining the triple information corresponding to any text based on the triple extraction model, the method further includes: Inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data; The triple information includes associated information, and the operation of inputting the triple information corresponding to the arbitrary text into a preset knowledge system framework to construct a knowledge system map containing multi-domain data includes: Inputting the triple information into a preset knowledge system framework, and obtaining the associated information of each triple information; According to the association information of each triple information, the triples are associated and sorted to determine a triple information tree; Based on the triple information tree, a knowledge system map containing multi-domain data is constructed.
7. A triple information extraction device, characterized in that: The triple information extraction device comprises: A memory, a processor, and a triple information extraction program stored in the memory and executable on the processor, wherein the triple information extraction program, when executed by the processor, implements the steps of the triple information extraction method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a triple information extraction program, which, when executed by a processor, implements the steps of the triple information extraction method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Information extraction method and device, electronic equipment and storage medium
CN111291185A