A method and device for entity extraction based on knowledge base question answering
By combining the entity recognition model with the rule matching method and using the LightGBM and BERT models, the problem of unregistered relationships and inaccurate entity recognition in the Chinese knowledge base question and answer system is solved, the accuracy of entity extraction and candidate entity sorting is improved, and the system is improved the overall effect.
Patent Information
- Application Number
- CN202110138714.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-01
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-02-01
AI Technical Summary
The existing knowledge base question and answer system has problems in predicting unregistered relationships in the Chinese environment, and the entities recognized by the entity recognition model are inaccurate or incomplete, resulting in the inability to obtain answers, resulting in low system accuracy.
Combining the entity recognition model and rule matching method, the recognition results are corrected through entity fusion and filtering, and the LightGBM and BERT models are used in the entity link part to improve the candidate entity ranking accuracy.
It improves the accuracy and recall rate of entity extraction, enhances the overall effect of the Chinese knowledge base question and answer system, and improves the accuracy of candidate entity ranking.
Smart Images

Figure CN112818675B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a method and apparatus for entity extraction based on knowledge base question and answer, a computing device, and a computer-readable storage medium. Background Art
[0002] The main methods of knowledge base question answering are currently divided into two categories. The first category is based on semantic parsing, which uses dictionaries, rules and machine learning to directly parse entities, relations and logical combinations from questions. Methods based on semantic parsing usually use classification models to predict relations, which will face the problem of unregistered relations, that is, relations that do not appear in the training set are difficult to predict. In addition, the Chinese knowledge base contains hundreds of thousands of relations, which makes it difficult for the training set to cover such a large number, thus limiting the semantic parsing-based methods in Chinese knowledge base question answering.
[0003] The second category is based on information retrieval methods. This type of method requires obtaining several candidate entities based on the question. In the process of extracting candidate entities, the named entity recognition model is generally used to predict the entities that appear in the question. However, the entities recognized by the named entity recognition model may not be the entities in the knowledge base, resulting in the inability to obtain the answer; or the entity recognition model recognizes fewer entities, resulting in the inability to find the correct answer. In addition, when sorting all candidate entities in the entity linking part, the accuracy of sorting candidate entities using only machine learning algorithms using artificially constructed features is low, resulting in a lower accuracy rate for the entire knowledge base question-answering system. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a method and apparatus for entity extraction based on knowledge base question and answer, a computing device and a computer-readable storage medium to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, a method for extracting entities based on knowledge base question answering is provided, comprising:
[0006] Acquire a target question sentence and perform entity recognition on the target question sentence to respectively determine at least one first predicted entity and at least one second predicted entity in the target question sentence;
[0007] Determining at least one target prediction entity corresponding to the target question sentence according to the at least one first prediction entity and the at least one second prediction entity;
[0008] Each of the target prediction entities is mapped to the knowledge base by entity linking, and at least one candidate entity corresponding to the target question sentence stored in the knowledge base is obtained.
[0009] According to a second aspect of an embodiment of this specification, a knowledge base question-answering-based entity extraction device is provided, comprising:
[0010] an entity recognition module, configured to obtain a target question sentence and perform entity recognition on the target question sentence, and respectively determine at least one first predicted entity and at least one second predicted entity in the target question sentence;
[0011] An entity processing module, configured to determine at least one target prediction entity corresponding to the target question sentence according to the at least one first prediction entity and the at least one second prediction entity;
[0012] The entity linking module is configured to map each of the target prediction entities to the knowledge base through entity linking, and obtain at least one candidate entity corresponding to the target question sentence stored in the knowledge base.
[0013] According to the third aspect of the embodiments of this specification, a computing device is provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein when the processor executes the instructions, the steps of the entity extraction method based on knowledge base question and answer are implemented.
[0014] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer instructions, and when the instructions are executed by a processor, the steps of the entity extraction method based on knowledge base question and answer are implemented.
[0015] In the entity extraction part, this application combines the entity recognition model with the rule matching method to solve the problem of incomplete or inaccurate extraction using only the entity recognition model. At the same time, by fusing and filtering the entity recognition model results with the entities matched by the rules in the entity extraction part, the results of the entity recognition model are corrected to a certain extent, and the entities not recognized by the entity recognition model are supplemented.
[0016] In the entity linking part, this application improves the accuracy of entity linking by combining the machine learning algorithm LightGBM and the deep learning algorithm BERT model, improves the candidate entity ranking effect, and thus helps improve the overall effect of Chinese knowledge base question and answer. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a structural block diagram of a computing device provided in an embodiment of the present application;
[0018] Figure 2 is a flow chart of a method for extracting entities based on knowledge base question and answer provided in an embodiment of the present application;
[0019] Figure 3is a flow chart of a method for extracting entities based on knowledge base question and answer provided in an embodiment of the present application;
[0020] Figure 4 is a schematic diagram of a named entity recognition model based on knowledge base question answering provided in an embodiment of the present application;
[0021] Figure 5 is another flow chart of the entity extraction method based on knowledge base question and answer provided in an embodiment of the present application;
[0022] Figure 6 is another flow chart of the entity extraction method based on knowledge base question and answer provided in an embodiment of the present application;
[0023] Figure 7 is another flow chart of the entity extraction method based on knowledge base question and answer provided in an embodiment of the present application;
[0024] Figure 8 is another flow chart of the entity extraction method based on knowledge base question and answer provided in an embodiment of the present application;
[0025] Fig. 9 is another flow chart of the entity extraction method based on knowledge base question and answer provided in an embodiment of the present application;
[0026] Fig.10 It is a structural diagram of the entity extraction device based on knowledge base question and answer provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.
[0028] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0029] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0030] First, the terms involved in one or more embodiments of the present invention are explained.
[0031] Knowledge Base Question Answering (KBQA) is to understand and parse the semantics of a natural language question, and then use the knowledge base to query and reason to get the answer. It generally includes the steps of candidate entity extraction, entity linking, relationship extraction, and answer generation. For example, if the question is: How tall is Zhang San? There is a triple (Zhang San, height, 175cm) in the knowledge base, then the target answer is: 175cm.
[0032] Entity linking: The task of linking the entities mentioned in the question with the corresponding entities in the knowledge base, that is, finding the entity in the knowledge base that best matches the question.
[0033] BERT (Bidirectional Encoder Representations from Transformers) model: a bidirectional attention neural network model. The goal of the BERT model is to use large-scale unlabeled corpus training to obtain a semantic representation of the text that contains rich semantic information, and then fine-tune the semantic representation of the text in a specific natural language processing task, and finally apply it to the natural language processing task.
[0034] Conditional Random Fields (CRF): It is a conditional probability distribution model of another set of output sequences under a given set of input sequences.
[0035] LightGBM (Light Gradient Boosting Machine) algorithm: It is a distributed gradient boosting framework that implements the GBDT (GradientBoosting Decision Tree) algorithm. It supports efficient parallel training and has the advantages of faster training speed, lower memory consumption, better accuracy, and support for distributed processing of massive data.
[0036] Named Entity Recognition (NER): also known as "proper name recognition", refers to the identification of entities with specific meanings in text, mainly including names of people, places, institutions or proper nouns.
[0037] In the present application, a method and apparatus for entity extraction based on knowledge base question and answer, a computing device and a computer-readable storage medium are provided, which are described in detail one by one in the following embodiments.
[0038] Figure 1 The structure block diagram of a computing device 100 according to an embodiment of the present specification is shown. The components of the computing device 100 include but are not limited to a memory 110 and a processor 120. The processor 120 is connected to the memory 110 via a bus 130, and the database 150 is used to store data.
[0039] The computing device 100 also includes an access device 140 that enables the computing device 100 to communicate via one or more networks 160. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 140 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0040] In one embodiment of the present specification, the above components of the computing device 100 and Figure 1 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 1 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0041] The computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 100 may also be a mobile or stationary server.
[0042] Conventional information retrieval-based methods refer to extracting relationships connected to candidate entities from the knowledge base as candidate query paths based on predefined logical forms, and then using text matching models to select the candidate query path with the highest similarity to the question, and finally retrieving the answer from the knowledge base. This type of method focuses on calculating the similarity between the question and the candidate relationship, and has better generalization ability in relationship selection, so it is more suitable for solving Chinese knowledge base question answering.
[0043] As mentioned above, the knowledge base question-answering method based on information retrieval can be summarized into several main steps: candidate entity extraction, entity linking, relationship extraction, relationship sorting and answer generation. This application only involves two steps of entity extraction and entity linking, that is, after entity extraction and entity linking for the given question, all candidate entities in the knowledge base that may match the question are output and sorted for subsequent relationship extraction and other work. In the candidate entity extraction part, the named entity recognition model is generally used to predict the entities appearing in the question, but the entities identified by the named entity recognition model may not be the entities in the knowledge base, resulting in the inability to obtain the answer. For example, in the question "What is the minimum denomination of the fifth set of RMB banknotes?", the entity identified by the named entity recognition model is <Fifth set of RMB>, but the triple existing in the knowledge base is (Fifth set of RMB banknotes, minimum denomination, 1 yuan), that is, the accurate entity should be <Fifth set of RMB banknotes>.
[0044] There is also a situation where the entity recognition model recognizes too few entities, resulting in the inability to find the correct answer. For example, in the question "Who is the Japanese educator who believes in Buddhism?", the entity recognition model recognizes the entities <Buddhism> and <Japan>, but the entity <educator> should also be recognized in order to find the accurate answer.
[0045] When all candidate entities are sorted in the entity linking part, the accuracy of sorting candidate entities using only machine learning algorithms and artificially constructed features is low, resulting in a lower accuracy of the entire knowledge base question answering system. The technical solution of this application mainly solves the above three problems.
[0046] The processor 120 may execute Figure 2 Steps in the method shown. Figure 2 It is a schematic flowchart showing a method for entity extraction based on knowledge base question and answer according to an embodiment of the present application, including steps 202 to 206.
[0047] Step 202: Obtain a target question sentence and perform entity recognition on the target question sentence to respectively determine at least one first predicted entity and at least one second predicted entity in the target question sentence.
[0048] In an embodiment of the present application, the present application first performs entity recognition on the acquired target question sentence in at least two ways, such as extraction based on encyclopedia websites or vertical sites, entity extraction methods based on rules and dictionaries, and entity extraction methods based on statistical machine learning, so as to automatically identify named entities from the target question sentence. Since entities are the most basic elements in the knowledge graph, the completeness, accuracy, and recall rate of their extraction will directly affect the quality of knowledge base question and answer. Therefore, entity extraction is a basic and key step in knowledge base question and answer.
[0049] Step 204: Determine at least one target prediction entity corresponding to the target question sentence based on the at least one first prediction entity and the at least one second prediction entity.
[0050] In an embodiment of the present application, the present application performs an entity fusion operation on the at least one first prediction entity and the at least one second prediction, so as to make up for the loopholes and deficiencies between different entity naming and recognition methods, especially when there is a relationship of inclusion or being included between the prediction entities identified by different entity naming and recognition methods, at least one target prediction entity corresponding to the target question sentence is determined by entity fusion.
[0051] Step 206: Map each of the target prediction entities to the knowledge base through entity linking, and obtain at least one candidate entity corresponding to the target question sentence stored in the knowledge base.
[0052] The present application maps each of the target prediction entities to all possible entities in the knowledge base through entity linking. Specifically, all entities corresponding to each target prediction entity in the knowledge base are queried through a preset entity linking table. The entity linking table is a text file in TXT format. The basic process of table query is: for the target prediction entity "A", start from the first row in the entity linking table, query the entity whose first word is "A", and then query the text information containing the entity "A" and its attribute information.<A1_(xxxxxx)> Return as a candidate entity and then continue the query<A2_(xxxxxx)> ,<A3_(xxxxxx)> ... n _(xxxxxx)> until all entities after entity linking corresponding to the target prediction entity "A" in the entity linking table are found. For example, the target question sentence is "Where is the poet Li Bai's ancestral home?" After steps 202 and 204, the target prediction entity can be obtained. After querying the entity linking table, all possible entities in the knowledge base such as <Li Bai_(famous poet in the Tang Dynasty)>, <Li Bai_(Chinese TV series directed by Shao Jinghui in 2010)>, <Li Bai_(revolutionary martyr)>... can be obtained.
[0053] In one embodiment of the present application, Figure 3 As shown, step 202 specifically includes steps 302 to 304.
[0054] Step 302: Obtain a target question sentence, and determine at least one first predicted entity in the target question sentence using a pre-trained named entity recognition model.
[0055] In the above embodiment, if Figure 4 As shown, the present application predicts at least one first predicted entity in the target question sentence through a pre-trained named entity recognition model. The named entity recognition model adopts a model structure of a BERT model superimposed with a conditional random field (CRF) layer. The target question sentence is characterized by the BERT model, and then the named entity recognition model outputs the probability of each character in the target question sentence corresponding to the first predicted entity through the CRF layer. Specifically, each character can correspond to three labels B, label I and label O, wherein label B represents the beginning of an entity, label I represents belonging to an entity but not the beginning, and label O represents a character in a non-entity. The input of the CRF layer is the probability of each label predicted for each character. For example, the input corresponding to the character "A" may be label B: 0.8, label I: 0.15, label O: 0.05, then the output of the CRF layer is the predicted label of each character, that is, the output corresponding to the character "A" is label B.
[0056] For example, the target question sentence is "Who is the Japanese educator who believes in Buddhism?", and the CRF layer output will output the label corresponding to each character, "Who is the (O) Japanese (B) Japanese (I) educator (O) who believes in (O) Buddhism (B)? (O)", and finally the entity naming recognition model obtains the two first predicted entities of <Japan> and <Buddhism>; for another example, the target question sentence is "How tall is Zhang San?", and the CRF layer output will output the label corresponding to each character, "How (O) much (O) is (O) Zhang (B) San (I) (O) tall (O)? (O)", and finally the entity naming recognition model obtains one first predicted entity of <Zhang San>.
[0057] Step 304: performing rule matching on the target question statement and all entities stored in the knowledge base, and determining at least one second predicted entity in the knowledge base corresponding to the target question statement.
[0058] The present application matches the target question statement with all entities in a preset knowledge base to find out the second predicted entities existing in all knowledge bases that appear in the target question statement. For example, for a Chinese knowledge base, the target question statement is "Who is a Japanese educator who believes in Buddhism?" After rule matching, three second predicted entities, <Japan>, <Buddhism>, and <educator>, will be obtained.
[0059] This application combines the entity recognition model with the rule matching method to solve the problem of incomplete or inaccurate extraction using only the entity recognition model.
[0060] In one embodiment of the present application, Figure 5 As shown, step 204 specifically includes steps 502 to 504.
[0061] Step 502: Entity-fusing the at least one first prediction entity with the at least one second prediction entity to generate at least one third prediction entity.
[0062] In the above embodiment, if Figure 6 As shown, step 502 specifically includes steps 602 to 610.
[0063] Step 602: When there is at least one unpredicted entity different from at least one first prediction entity in the at least one second prediction entity, take the unpredicted entity and the first prediction entity together as a third prediction entity.
[0064] Specifically, when the target question sentence is "Who is the Japanese educator who believes in Buddhism?", the named entity recognition model will output two first predicted entities, <Japan> and <Buddhism>, and after rule matching, three second predicted entities, <Japan>, <Buddhism>, and <educator>, will be obtained. It can be seen that <educator> does not appear in the first predicted entity, so <Japan>, <Buddhism>, and <educator> need to be taken together as the third predicted entity.
[0065] Step 604: When there is an inclusion relationship between the text corpus of any second prediction entity and the text corpus of any first prediction entity, the second prediction entity is merged with the first prediction entity to form a third prediction entity.
[0066] Specifically, if the text corpus of any second prediction entity is different from the text corpus of any first prediction entity only in that the string length of the text corpus of the second prediction entity is greater than the string length of the text corpus of the first prediction entity, then the second prediction entity needs to be merged with the first prediction entity to serve as the third prediction entity. For example, the target question statement is "What is the minimum denomination of the fifth set of RMB banknotes?", the first prediction entity identified by the named entity recognition model is <Fifth set of RMB>, and the second prediction entity found by the rule matching method is <Fifth set of RMB banknotes>. It can be seen that the string length of <Fifth set of RMB banknotes> is greater than <Fifth set of RMB>, that is, "Fifth set of RMB banknotes" contains "Fifth set of RMB", so the entity recognition result needs to be updated to <Fifth set of RMB banknotes>.
[0067] Step 606: When there is an inclusion relationship between the text corpus of any of the first prediction entities and the text corpus of any of the second prediction entities, determine whether the first prediction entity is an entity in the knowledge base; if so, execute step 608; if not, execute step 610.
[0068] Step 608: Keep the first prediction entity as the third prediction entity.
[0069] Step 610: Keep the second prediction entity as the third prediction entity.
[0070] Specifically, if the text corpus of any of the first predicted entities has an inclusion relationship with the text corpus of any of the second predicted entities, it is necessary to determine whether the first predicted entity is an entity in the knowledge base. For example, the target question sentence is "Who is the chairman of Wanda?", the entity identified by the named entity recognition model is <Chairman of Wanda>, the entity found by the rule matching method is <Wanda>, and the triple in the knowledge base is (Wanda, Chairman, Wang Jianlin), that is, <Chairman of Wanda> is not an entity in the knowledge base, and the correct entity is <Wanda>, so the entity recognition result is updated to <Wanda>.
[0071] Step 504: Filter the at least one third prediction entity to select at least one target prediction entity from the at least one third prediction entity.
[0072] Specifically, the present application will filter the third predicted entities corresponding to other data categories other than entity categories according to the knowledge category corresponding to each third predicted entity in the knowledge base. For example, the target question sentence is "Who is the leading actor of Kung Fu?", the first predicted entity obtained by the named entity recognition model is <Kung Fu>, and the second predicted entities obtained by matching the knowledge base rules are <Kung Fu> and <leading actor>. After step 502, <leading actor> may be added to the final result, but in this question, <leading actor> is not an entity but a relationship in the knowledge base, so it is necessary to filter out the redundant <leading actor> entities.
[0073] This application corrects the results of the entity recognition model to a certain extent and supplements the entities that are not recognized by the entity recognition model by fusing and filtering the entity recognition model results with the entities matched by the rules in the entity extraction part.
[0074] In one embodiment of the present application, Figure 7 As shown, after obtaining at least one candidate entity corresponding to the target question sentence stored in the knowledge base, it also includes steps 702 to 704.
[0075] Step 702: Obtain the entity feature score and similarity score corresponding to each candidate entity.
[0076] In the above embodiment, if Figure 8 As shown, step 702 specifically includes steps 802 to 804.
[0077] Step 802: According to the entity features corresponding to each of the candidate entities, determine the entity feature score corresponding to each of the candidate entities through the LightGBM algorithm.
[0078] This application uses the entity features corresponding to each of the candidate entities, including entity length, whether the entity appears in the original text or the frequency of occurrence of the entity in the knowledge base, etc., and then uses a parameter adjustment algorithm (LightGBM algorithm) to take the entity features as input to calculate the entity feature score corresponding to each of the candidate entities. The higher the score, the more likely the entity is to be accurate and the answer can be found.
[0079] Step 804: Obtain a similarity score corresponding to each candidate entity and the target question sentence according to the pre-trained similarity calculation model.
[0080] This application then uses the BERT model and the similarity calculation model obtained through training to calculate the similarity score corresponding to each candidate entity and the target question sentence. Similarly, the higher the score, the more likely the candidate entity is to be accurate and the entity for which the answer can be found.
[0081] Step 704: Sort at least one candidate entity according to the entity feature score and the similarity score corresponding to each candidate entity.
[0082] The present application adds the entity feature score and the similarity score corresponding to each candidate entity, and then uses the final score to sort the candidate entities, that is, the entity with the highest score is most likely to be the target entity.
[0083] In the entity linking part, this application improves the accuracy of entity linking by combining the machine learning algorithm LightGBM and the deep learning algorithm BERT model, improves the candidate entity ranking effect, and thus helps improve the overall effect of Chinese knowledge base question and answer.
[0084] Fig. 9 An entity extraction method based on knowledge base question and answer is shown in accordance with an embodiment of the present specification. The entity extraction method based on knowledge base question and answer is described as an example and includes steps 902 to 916.
[0085] Step 902: Obtain a target question sentence, and determine at least one first predicted entity in the target question sentence using a pre-trained named entity recognition model.
[0086] Step 904: performing rule matching on the target question statement and all entities stored in the knowledge base, and determining at least one second predicted entity in the knowledge base corresponding to the target question statement.
[0087] Step 906: Entity-fusing the at least one first prediction entity with the at least one second prediction entity to generate at least one third prediction entity.
[0088] Step 908: Filter the at least one third prediction entity to select at least one target prediction entity from the at least one third prediction entity.
[0089] Step 910: Map each of the target prediction entities to the knowledge base through entity linking, and obtain at least one candidate entity corresponding to the target question sentence stored in the knowledge base.
[0090] Step 912: The entity feature corresponding to each of the candidate entities is determined by the LightGBM algorithm.
[0091] Step 914: Obtain a similarity score corresponding to each candidate entity and the target question sentence according to the pre-trained similarity calculation model.
[0092] Step 916: Sort at least one candidate entity according to the entity feature score and the similarity score corresponding to each candidate entity.
[0093] Corresponding to the above method embodiment, this specification also provides an entity extraction device embodiment based on knowledge base question and answer, Fig.10 FIG. 1 is a schematic diagram showing the structure of an entity extraction device based on knowledge base question answering according to an embodiment of the present specification. Fig.10 As shown, the device comprises:
[0094] An entity recognition module 1001 is configured to obtain a target question sentence and perform entity recognition on the target question sentence, and respectively determine at least one first predicted entity and at least one second predicted entity in the target question sentence;
[0095] The entity processing module 1002 is configured to determine at least one target prediction entity corresponding to the target question sentence according to the at least one first prediction entity and the at least one second prediction entity;
[0096] The entity linking module 1003 is configured to map each of the target prediction entities to the knowledge base through entity linking, and obtain at least one candidate entity corresponding to the target question sentence stored in the knowledge base.
[0097] Optionally, the device further comprises:
[0098] A score calculation module is configured to obtain an entity feature score and a similarity score corresponding to each candidate entity;
[0099] The entity ranking module is configured to rank at least one candidate entity according to the entity feature score and the similarity score corresponding to each candidate entity.
[0100] Optionally, the entity identification module 1001 includes:
[0101] A named entity recognition unit is configured to obtain a target question sentence and determine at least one first predicted entity in the target question sentence by using a pre-trained named entity recognition model;
[0102] The rule matching unit is configured to perform rule matching on the target question statement and all entities stored in the knowledge base, and determine at least one second predicted entity in the knowledge base corresponding to the target question statement.
[0103] Optionally, the entity processing module 1002 includes:
[0104] an entity fusion unit, configured to perform entity fusion on the at least one first prediction entity and the at least one second prediction entity to generate at least one third prediction entity;
[0105] The entity filtering unit is configured to filter the at least one third prediction entity and select at least one target prediction entity from the at least one third prediction entity.
[0106] Optionally, the entity fusion unit is further configured to:
[0107] In the case that there is at least one unpredicted entity different from at least one first prediction entity in the at least one second prediction entity, taking the unpredicted entity and the first prediction entity together as a third prediction entity;
[0108] In the case that the text corpus of any second prediction entity and the text corpus of any first prediction entity have an inclusion relationship, the second prediction entity is merged with the first prediction entity to form a third prediction entity;
[0109] In the case where there is an inclusion relationship between the text corpus of any of the first prediction entities and the text corpus of any of the second prediction entities, determining whether the first prediction entity is an entity in the knowledge base;
[0110] If yes, retaining the first prediction entity as the third prediction entity;
[0111] If not, retain the second prediction entity as the third prediction entity.
[0112] Optionally, the entity filtering unit is further configured to:
[0113] According to the knowledge category corresponding to each third prediction entity in the knowledge base, the third prediction entities corresponding to other data categories other than the entity category are filtered.
[0114] Optionally, the score calculation module includes:
[0115] A gradient calculation unit is configured to determine the entity feature score corresponding to each candidate entity by using a LightGBM algorithm according to the entity feature corresponding to each candidate entity;
[0116] The similarity calculation unit is configured to obtain a similarity score corresponding to each candidate entity and the target question sentence according to a pre-trained similarity calculation model.
[0117] In the entity extraction part, this application combines the entity recognition model with the rule matching method to solve the problem of incomplete or inaccurate extraction using only the entity recognition model. At the same time, by fusing and filtering the entity recognition model results with the entities matched by the rules in the entity extraction part, the results of the entity recognition model are corrected to a certain extent, and the entities not recognized by the entity recognition model are supplemented.
[0118] In the entity linking part, this application improves the accuracy of entity linking by combining the machine learning algorithm LightGBM and the deep learning algorithm BERT model, improves the candidate entity ranking effect, and thus helps improve the overall effect of Chinese knowledge base question and answer.
[0119] It should be noted that the components in the device claim should be understood as the functional modules that must be established to implement the steps of the program flow or the steps of the method, and the functional modules are not actually divided or separated. The device claim defined by such a group of functional modules should be understood as the functional module architecture of the solution mainly implemented by the computer program recorded in the specification, and should not be understood as the physical device that mainly implements the solution by hardware.
[0120] An embodiment of the present application further provides a computing device, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the instructions:
[0121] Acquire a target question sentence and perform entity recognition on the target question sentence to respectively determine at least one first predicted entity and at least one second predicted entity in the target question sentence;
[0122] Determining at least one target prediction entity corresponding to the target question sentence according to the at least one first prediction entity and the at least one second prediction entity;
[0123] Each of the target prediction entities is mapped to the knowledge base by entity linking, and at least one candidate entity corresponding to the target question sentence stored in the knowledge base is obtained.
[0124] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the entity extraction method based on knowledge base question and answer as described above.
[0125] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the computer-readable storage medium and the technical scheme of the entity extraction method based on knowledge base question and answer belong to the same concept, and the details not described in detail in the technical scheme of the computer-readable storage medium can be found in the description of the technical scheme of the entity extraction method based on knowledge base question and answer.
[0126] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0127] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0128] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0129] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0130] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is limited only by the claims and their full scope and equivalents.
Claims
1. A method for entity extraction based on knowledge base question answering, characterized in that: include: Obtain a target question sentence and perform entity recognition on the target question sentence, and respectively determine at least one first predicted entity and at least one second predicted entity in the target question sentence, wherein the first predicted entity is determined by a pre-trained named entity recognition model, and the second predicted entity is obtained by matching the target question sentence with all entities stored in a knowledge base by rules; In the case that there is at least one unpredicted entity different from at least one first prediction entity in the at least one second prediction entity, taking the unpredicted entity and the first prediction entity together as a third prediction entity; In the case where the text corpus of any of the second prediction entities and the text corpus of any of the first prediction entities have an inclusion relationship, the second prediction entity and the first prediction entity are merged to form a third prediction entity, wherein the inclusion relationship means that the text corpus of the former includes the text corpus of the latter, and the character string length of the text corpus of the former is greater than the character string length of the text corpus of the latter, and the fusion means deleting the text corpus of the first prediction entity included by the text corpus of any of the second prediction entities, and merging the remaining first prediction entity and the second prediction entity; In the case where the text corpus of any of the first prediction entities and the text corpus of any of the second prediction entities have an inclusion relationship, determining whether the first prediction entity is an entity in the knowledge base; if so, retaining the first prediction entity as a third prediction entity; if not, retaining the second prediction entity as a third prediction entity; filtering at least one third prediction entity to select at least one target prediction entity from the at least one third prediction entity; Each of the target prediction entities is mapped to the knowledge base by entity linking, and at least one candidate entity corresponding to the target question sentence stored in the knowledge base is obtained.
2. The method according to claim 1, characterized in that After obtaining at least one candidate entity corresponding to the target question sentence stored in the knowledge base, the method further includes: Obtaining entity feature scores and similarity scores corresponding to each candidate entity; At least one candidate entity is sorted according to the entity feature score and the similarity score corresponding to each candidate entity.
3. The method according to claim 1, characterized in that: Filtering at least one third prediction entity to select at least one target prediction entity from the at least one third prediction entity includes: According to the knowledge category corresponding to each third prediction entity in the knowledge base, the third prediction entities corresponding to other knowledge categories other than the entity category are filtered.
4. The method according to claim 2, characterized in that: Obtaining the entity feature score and similarity score corresponding to each candidate entity, including: According to the entity features corresponding to each of the candidate entities, determining the entity feature score corresponding to each of the candidate entities through a parameter adjustment algorithm; A similarity score corresponding to each candidate entity and the target question sentence is obtained according to a pre-trained similarity calculation model.
5. An entity extraction device based on knowledge base question answering, characterized in that: include: An entity recognition module is configured to obtain a target question sentence and perform entity recognition on the target question sentence, and respectively determine at least one first predicted entity and at least one second predicted entity in the target question sentence, wherein the first predicted entity is determined by a pre-trained named entity recognition model, and the second predicted entity is obtained by matching the target question sentence with all entities stored in a knowledge base by rules; An entity fusion unit is configured to, when there is at least one unpredicted entity different from at least one first predicted entity in the at least one second predicted entity, use the unpredicted entity and the first predicted entity together as a third predicted entity; when there is an inclusive relationship between the text corpus of any of the second predicted entities and the text corpus of any of the first predicted entities, fuse the second predicted entity with the first predicted entity to form a third predicted entity, wherein the inclusive relationship means that the text corpus of the former includes the text corpus of the latter, and the string length of the text corpus of the former is greater than the string length of the text corpus of the latter, and the fusion means deleting the text corpus of the first predicted entity included in the text corpus of any of the second predicted entities, and merging the remaining first predicted entity and the second predicted entity; when there is an inclusive relationship between the text corpus of any of the first predicted entities and the text corpus of any of the second predicted entities, determine whether the first predicted entity is an entity in the knowledge base; if so, retain the first predicted entity as the third predicted entity; if not, retain the second predicted entity as the third predicted entity; an entity filtering unit, configured to filter at least one third prediction entity and select at least one target prediction entity from the at least one third prediction entity; The entity linking module is configured to map each of the target prediction entities to the knowledge base through entity linking, and obtain at least one candidate entity corresponding to the target question sentence stored in the knowledge base.
6. The device according to claim 5, characterized in that Also includes: A score calculation module is configured to obtain an entity feature score and a similarity score corresponding to each candidate entity; The entity ranking module is configured to rank at least one candidate entity according to the entity feature score and the similarity score corresponding to each candidate entity.
7. The device according to claim 5, characterized in that The entity filtering unit is further configured to: According to the knowledge category corresponding to each third prediction entity in the knowledge base, the third prediction entities corresponding to other knowledge categories other than the entity category are filtered.
8. The device according to claim 6, characterized in that The score calculation module comprises: A gradient calculation unit is configured to determine the entity feature score corresponding to each candidate entity through a parameter adjustment algorithm according to the entity feature corresponding to each candidate entity; The similarity calculation unit is configured to obtain a similarity score corresponding to each candidate entity and the target question sentence according to a pre-trained similarity calculation model.
9. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the computer instructions, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
