Text processing method and device

By identifying the question entities and candidate entities in the question text, identifying the question type, generating candidate paths and determining the target path, the efficiency and accuracy problems of unlogged relationships and information retrieval scenarios in the open field question answering system are solved, achieving high efficiency and Accurate answer extraction.

CN112784590BActive Publication Date: 2024-09-17BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110137335.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-01
Publication Date
2024-09-17
Estimated Expiration
2041-02-01

AI Technical Summary

Technical Problem

Existing question answering systems have efficiency and accuracy problems when dealing with unregistered relationships and information retrieval scenarios. Especially in knowledge base question answering systems in open fields, they face the problem of explosive growth of candidate relationships and high difficulty in answer screening.

Method used

By identifying question entities in the question text, linking candidate entities, identifying question types, generating candidate paths, and determining the target path based on path similarity, converting into query statements to query answers in the knowledge base, combining multiple identification strategies and similarities Calculation improves the accuracy of entity recognition and path filtering.

Benefits of technology

It improves the answer extraction efficiency and accuracy of the question and answer system, ensures processing efficiency and accuracy while reducing the number of candidate paths, avoiding noise entity interference, and enhancing user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112784590B
    Figure CN112784590B
Patent Text Reader

Abstract

The present application provides a text processing method and device, wherein the text processing method includes: obtaining a question text and identifying a question entity in the question text; linking a plurality of candidate entities corresponding to the question entity in a preset knowledge base, and identifying a question type of the question text according to the question entity; generating at least one candidate path corresponding to the question text based on the plurality of candidate entities and the question type, and determining a target path according to the at least one candidate path; converting the target path into a query statement, and querying the knowledge base for an answer text corresponding to the question text according to the query statement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of text processing technology, and in particular to a text processing method and device. Background Art

[0002] With the development of Internet technology, more and more question-answering systems have emerged. With the support of the underlying complex knowledge base, they can answer questions raised by users. In the existing question-answering systems created based on the knowledge base, semantic parsing and information retrieval methods are basically adopted. Among them, the semantic parsing-based methods usually use dictionaries, rules and machine learning to directly parse entities, relations and logical combinations from the questions. The semantic parsing-based methods usually use classification models to predict relations, which face the problem of unregistered relations, that is, relations that do not appear in the training set are difficult to predict. The information retrieval-based methods usually obtain several candidate entities based on the question, extract the relations connected to the candidate entities from the knowledge base as candidate query paths according to the predefined logical form, and then use the text matching model to select the candidate query path with the highest similarity to the question to retrieve the answer from the knowledge base. The information retrieval-based methods have the problem of small application scenarios, so an effective solution is urgently needed to solve the above problems. Summary of the invention

[0003] In view of this, the embodiment of the present application provides a text processing method to solve the technical defects existing in the prior art. The embodiment of the present application also provides a text processing device, a computing device, and a computer-readable storage medium.

[0004] According to a first aspect of an embodiment of the present application, a text processing method is provided, comprising:

[0005] Obtaining a question text and identifying question entities in the question text;

[0006] Linking a plurality of candidate entities corresponding to the question entity in a preset knowledge base, and identifying the question type of the question text according to the question entity;

[0007] Generate at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type, and determine a target path according to the at least one candidate path;

[0008] The target path is converted into a query statement, and the answer text corresponding to the question text is searched in the knowledge base according to the query statement.

[0009] Optionally, identifying the question entity in the question text includes:

[0010] Performing entity recognition on the question text based on a preset recognition strategy to obtain the question entity;

[0011] The preset recognition strategy includes a model recognition strategy, a dictionary recognition strategy and / or a rule recognition strategy.

[0012] Optionally, performing entity recognition on the question text based on a preset recognition strategy to obtain the question entity includes:

[0013] Inputting the question text into an entity recognition model for entity recognition to obtain a first question entity corresponding to the question text;

[0014] Perform entity recognition on the question text based on the entity dictionary corresponding to the knowledge base to obtain a second question entity corresponding to the question text;

[0015] Perform entity recognition on the question text by using regular matching rules to obtain a third question entity corresponding to the question text;

[0016] The question entity is determined according to the first question entity, the second question entity and the third question entity.

[0017] Optionally, linking multiple candidate entities corresponding to the problem entity in a preset knowledge base includes:

[0018] Querying the entity mapping table corresponding to the knowledge base based on the problem entity, and determining a plurality of initial candidate entities corresponding to the problem entity according to the query result;

[0019] Initial candidate entities of a set data amount are screened out according to the multiple initial candidate entities as the multiple candidate entities.

[0020] Optionally, the step of selecting a set amount of initial candidate entities as the multiple candidate entities based on the multiple initial candidate entities includes:

[0021] Determine, according to the knowledge base, the first-degree relationship corresponding to each of the multiple initial candidate entities;

[0022] Input the multiple initial candidate entities, the question text, and the first-degree relationships corresponding to each initial candidate entity into a calculation module, and calculate the similarity scores corresponding to each initial candidate entity;

[0023] Sort each initial candidate entity based on the similarity score to obtain a sorted entity list;

[0024] A set number of initial candidate entities are screened out from the entity ranking list in order of priority as the multiple candidate entities.

[0025] Optionally, the step of inputting the plurality of initial candidate entities, the question text, and the first-degree relationships corresponding to the initial candidate entities into a calculation module, and calculating the similarity scores corresponding to the initial candidate entities, respectively, includes:

[0026] Inputting the plurality of initial candidate entities, the question text, and the first-degree relationship corresponding to each initial candidate entity into the calculation module;

[0027] By splicing each initial candidate entity with the first-degree relationship corresponding to each initial candidate entity, and inputting the splicing result and the question text into the text processing model in the calculation module to perform text similarity calculation, the text similarity score corresponding to each initial candidate entity is obtained;

[0028] Inputting the question text and each initial candidate entity into the feature processing model in the calculation module to perform feature similarity calculation, and obtaining the feature similarity score corresponding to each initial candidate entity;

[0029] The similarity scores corresponding to the initial candidate entities are determined according to the text similarity scores and the feature similarity scores, and are outputted through the calculation module.

[0030] Optionally, the step of identifying the question type of the question text according to the question entity includes:

[0031] Identify the entity quantity of the question entity, and determine the entity question type corresponding to the question text according to the entity quantity;

[0032] Inputting the question text into a relation recognition model for processing to obtain a relation question type corresponding to the question text;

[0033] Determine the question type according to the entity question type and the relationship question type;

[0034] The question type includes at least one of the following: a single-entity first-degree question type, a single-entity second-degree question type, and a multi-entity first-degree question type.

[0035] Optionally, generating at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type includes:

[0036] In the case where the question type is a single-entity first-degree question type, reading a first-degree relationship corresponding to each candidate entity among the multiple candidate entities in the knowledge base according to the single-entity first-degree question type;

[0037] The at least one candidate path corresponding to the question text is generated based on each candidate entity among the multiple candidate entities and the first-degree relationship corresponding to each candidate entity.

[0038] Optionally, generating at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type includes:

[0039] In the case where the question type is a single-entity second-degree question type, reading a first-degree relationship corresponding to each candidate entity among the multiple candidate entities in the knowledge base according to the single-entity second-degree question type;

[0040] Reading a second-degree relationship corresponding to each candidate entity among the plurality of candidate entities in the knowledge base according to the first-degree relationship corresponding to each candidate entity;

[0041] The at least one candidate path corresponding to the question text is generated based on each candidate entity and the first-degree relationship and the second-degree relationship corresponding to each candidate entity.

[0042] Optionally, reading the second-degree relationship corresponding to each candidate entity among the plurality of candidate entities in the knowledge base according to the first-degree relationship corresponding to each candidate entity includes:

[0043] Inputting the first-degree relationship corresponding to the question text and each candidate entity into a similarity model for processing to obtain a target first-degree relationship corresponding to each candidate entity;

[0044] Reading a second-degree relationship corresponding to each candidate entity among the plurality of candidate entities in the knowledge base according to a target first-degree relationship corresponding to each candidate entity;

[0045] Accordingly, the step of generating the at least one candidate path corresponding to the question text based on each candidate entity and the first-degree relationship and the second-degree relationship corresponding to each candidate entity includes:

[0046] The at least one candidate path corresponding to the question text is generated based on each candidate entity and the target first-degree relationship and second-degree relationship corresponding to each candidate entity.

[0047] Optionally, generating at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type includes:

[0048] In the case where the question type is a multi-entity first-degree question type, splitting the question text into a plurality of single-entity first-degree question texts according to the multi-entity first-degree question type;

[0049] Determine, according to the plurality of candidate entities, a candidate entity corresponding to each single-entity first-order question text in the plurality of single-entity first-order question texts;

[0050] Reading the first-degree relationship of the candidate entity corresponding to each single-entity first-degree question text in the knowledge base;

[0051] The at least one candidate path corresponding to the question text is generated based on the candidate entities corresponding to each single-entity first-degree question text and the first-degree relationship between the candidate entities corresponding to each single-entity first-degree question text.

[0052] Optionally, determining the target path according to the at least one candidate path includes:

[0053] Inputting the question text and the at least one candidate path into a similarity calculation module for processing to obtain a path similarity score between the question text and each candidate path;

[0054] The candidate path with the highest path similarity score is selected as the target path.

[0055] Optionally, the step of inputting the question text and the at least one candidate path into a similarity calculation module for processing to obtain a path similarity score between the question text and each candidate path includes:

[0056] Inputting the question text and the at least one candidate path into the text similarity model in the similarity calculation module to obtain the text path similarity score between the question text and each candidate path;

[0057] Inputting the question text and the at least one candidate path into the feature similarity model in the similarity calculation module to obtain feature path similarity scores between the question text and each candidate path;

[0058] An entity score of a candidate entity corresponding to each candidate path is determined, and the path similarity score is determined according to the entity score, the text path similarity score and the feature path similarity score.

[0059] Optionally, converting the target path into a query statement includes:

[0060] In the case where the problem type is a multi-entity first-degree problem type, determining a plurality of sub-paths according to the target path;

[0061] The multiple sub-paths are concatenated to obtain a target concatenated path, and the target concatenated path is converted into the query statement.

[0062] Optionally, searching the knowledge base for an answer text corresponding to the question text according to the query statement includes:

[0063] Querying the knowledge base for a target entity corresponding to the question text according to the query statement;

[0064] The answer text corresponding to the question text is generated based on the target entity.

[0065] According to a second aspect of an embodiment of the present application, there is provided a text processing device, including:

[0066] An acquisition module is configured to acquire a question text and identify question entities in the question text;

[0067] A linking module is configured to link a plurality of candidate entities corresponding to the question entity in a preset knowledge base, and to identify the question type of the question text according to the question entity;

[0068] A determination module, configured to generate at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type, and determine a target path according to the at least one candidate path;

[0069] The query module is configured to convert the target path into a query statement, and query the knowledge base for an answer text corresponding to the question text according to the query statement.

[0070] According to a third aspect of an embodiment of the present application, a computing device is provided, including:

[0071] Memory and processor;

[0072] The memory is used to store computer-executable instructions, and the processor implements the steps of the text processing method when executing the computer-executable instructions.

[0073] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of text processing are implemented.

[0074] The text processing method provided by the present application, after obtaining the question text, will identify the question entity in the question text, then link multiple candidate entities corresponding to the question text in a preset knowledge base, and at the same time identify the question type of the question text according to the question entity, create a candidate path corresponding to the question text based on multiple candidate entities and question types, and determine the target path in the candidate path, and finally convert the target path into a query statement. The query statement can be used to query the answer text corresponding to the question text in the knowledge base, thereby ensuring the accuracy of the reply to the question text in the process of answering the question text, and also improving the processing efficiency of determining the answer text. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] Figure 1 is a flowchart of a text processing method provided by an embodiment of the present application;

[0076] Figure 2 It is a processing flow chart of a text processing method applied to a single-entity first-order question answering scenario provided by an embodiment of the present application;

[0077] Figure 3 is a structural schematic diagram of a text processing device provided by an embodiment of the present application;

[0078] Figure 4 It is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0079] 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.

[0080] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application 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 the present application refers to and includes any or all possible combinations of one or more associated listed items.

[0081] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, 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 the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.

[0082] First, the terms involved in one or more embodiments of the present invention are explained.

[0083] First-degree question: A question that can be answered with one query can be understood as a relationship, such as "What is A's position?".

[0084] Second-degree questions: The results that can be obtained through two-step queries can be understood as multiple relationships, such as "Who is the son of the chairman of Group B?"

[0085] KBQA: Knowledge base question answering (KB-QA). KBQA is a question-answering system based on knowledge graph. The basic process is to query the knowledge graph according to the question, and then generate an answer based on the information in the knowledge graph and return it to the user.

[0086] Entity linking: Entity linking (EL) maps entity mentions in text to a given knowledge base (KB).

[0087] Knowledge base: refers to a knowledge base that gathers knowledge in specific fields. The knowledge is organized in unstructured natural language. In order to facilitate computer processing and understanding, the knowledge is formalized and simplified in the form of triples. The triples in the knowledge base are (entity entity, entity relationship relation, entity entity).

[0088] Named Entity Recognition: Named Entity Recognition (NER) refers to the identification of entities with specific meanings in text.

[0089] BERT model: (Bidirectional Encoder Representations from Transformer) is a bidirectional encoder representation based on Transformer. The foundation of BERT model is Transformer, which comes from attention is all you need. The bidirectional meaning is that when it processes a word, it can take into account the information of the words before and after the word, so as to obtain the semantics of the context.

[0090] In the present application, a text processing method is provided. The present application also relates to a text processing apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0091] In practical applications, since the KBQA relational entities in open fields are usually more complex, for example, the PKUBASE knowledge base contains more than 64 million triples, more than 10 million entities and more than 400,000 relations. When answering questions raised by users, the answers can only be determined by searching the knowledge base; however, due to the high complexity of the knowledge base, when screening answers to questions, the answer screening is usually completed according to the process of entity recognition, entity linking, path sorting and answer retrieval. This process not only cannot accurately guarantee the correctness of the answer, but also causes the problem of explosive growth of candidate relations due to the complexity of the question. Therefore, when the KBQA system extracts answers in open fields, how to improve the efficiency and accuracy of answer extraction is an important problem that needs to be solved urgently.

[0092] The text processing method provided by the present application, after obtaining the question text, will identify the question entity in the question text, then link multiple candidate entities corresponding to the question text in a preset knowledge base, and at the same time identify the question type of the question text according to the question entity, create a candidate path corresponding to the question text based on multiple candidate entities and question types, and determine the target path in the candidate path, and finally convert the target path into a query statement. The query statement can be used to query the answer text corresponding to the question text in the knowledge base, thereby ensuring the accuracy of the reply to the question text in the process of answering the question text, and also improving the processing efficiency of determining the answer text.

[0093] Figure 1 A flowchart of a text processing method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0094] Step S102, obtaining a question text, and identifying question entities in the question text.

[0095] The text processing method provided in this embodiment is applied to the KBQA question-answering system. In the process of answering the question text, the answer extraction is completed according to the steps of entity recognition>entity linking>question classification>path generation>path sorting>answer retrieval, which can effectively improve the accuracy of answer extraction and the efficiency of answering questions, thereby ensuring the high efficiency of the KBQA question-answering system in handling problems and meeting the user's usage needs.

[0096] Based on this, the entity recognition stage is used to identify the entities and attributes that appear in the question text; the entity linking stage links the entities to the candidate entities in the knowledge base and sorts them; the question classification stage determines the type of question text, such as whether the question text is a single-entity question or a multi-entity question; the path generation stage realizes the recall of candidate paths from the knowledge base and screens them through path similarity calculation; the path sorting stage realizes the reordering of candidate paths for single-entity questions; the answer retrieval node constructs a query statement and retrieves the answer to the question text from the knowledge base; through the above six steps working together, an accurate reply to the question text is achieved to avoid the influence of other factors (too many paths, the type of question cannot be determined, etc.), thereby ensuring processing efficiency while improving the accuracy of the reply.

[0097] Based on this, the question entity refers to the named entities and attributes that appear in the question text; after obtaining the question text, it means that the question text needs to be answered through the KBQA question-answering system. At this time, it is necessary to identify the question entities in the question text in order to prepare for the subsequent extraction of the answer.

[0098] Furthermore, in the process of identifying the question entity in the question text, since the accuracy of question entity recognition determines the accuracy of subsequent answer extraction, that is, correct question entity extraction will improve the accuracy of determining the answer corresponding to the question text, and incorrect question entity extraction will reduce the accuracy of determining the answer corresponding to the question text. Therefore, in order to ensure the accuracy of question entity recognition, the present application adopts a combination of multiple recognition strategies. In this embodiment, the specific implementation method is as follows:

[0099] Performing entity recognition on the question text based on a preset recognition strategy to obtain the question entity;

[0100] The preset recognition strategy includes a model recognition strategy, a dictionary recognition strategy and / or a rule recognition strategy.

[0101] Specifically, the preset recognition strategy specifically refers to a set of one or more recognition strategies. Accordingly, the strategy that can be integrated into the preset recognition strategy may be a model recognition strategy, a dictionary recognition strategy and / or a rule strategy.

[0102] Among them, the model recognition strategy specifically refers to completing entity recognition through a preset named entity recognition model, that is, two entity recognition models can be trained based on BERT+CRF (Conditional Random Fields, which is a conditional probability distribution model that outputs another set of sequences given a set of input sequence conditions). One is a model that trains the boundary of entities on the evaluated training data, and the other is a model that can recognize names and organization names, and recalls name entities and organization name entities to improve the recall rate of entities. The dictionary recognition strategy specifically refers to matching word units in the question text with named entities contained in the dictionary, and using the matched word units as recognized entities, that is, building an entity dictionary based on the link dictionary and the knowledge base, and building an attribute value dictionary based on the knowledge base. On this basis, the entities and attribute values ​​in the question text are recognized by maximizing the match with the dictionary. The rule recognition strategy specifically refers to the rules for recognizing special entities and attribute values ​​such as numbers, dates, and book titles, and the recognition of special entities is completed through regular matching.

[0103] During specific implementation, different methods can be used for entity recognition according to different application scenarios, such as using a model entity strategy, a dictionary recognition strategy or a rule recognition strategy alone; or at least two recognition strategies can be combined, such as using a model recognition strategy + a rule recognition strategy; a dictionary recognition strategy + a rule recognition strategy; or a model recognition strategy + a dictionary recognition strategy; so as to improve the accuracy of identifying problem entities from the question text by integrating multiple recognition strategies. In actual applications, the combination of preset recognition strategies can be set according to the actual application scenario, and this embodiment does not make any limitation here.

[0104] Furthermore, considering the influence of question entities on the accuracy of answer extraction, the three recognition strategies can also be integrated to identify question entities, that is, the recognition results of the model recognition strategy, the dictionary recognition strategy and the rule recognition strategy are integrated to determine the question entity of the question text. In this embodiment, the specific implementation method is as follows:

[0105] Inputting the question text into an entity recognition model for entity recognition to obtain a first question entity corresponding to the question text;

[0106] Perform entity recognition on the question text based on the entity dictionary corresponding to the knowledge base to obtain a second question entity corresponding to the question text;

[0107] Perform entity recognition on the question text by using regular matching rules to obtain a third question entity corresponding to the question text;

[0108] The question entity is determined according to the first question entity, the second question entity and the third question entity.

[0109] Specifically, the first question entity specifically refers to the entity extracted from the question text through the entity recognition model, the second question entity specifically refers to the entity extracted from the question text through the entity dictionary, and the third question entity specifically refers to the entity extracted from the question text through the regular matching rule.

[0110] Based on this, the question text is subjected to entity recognition through an entity recognition model, an entity dictionary and regular matching rules respectively to obtain a first question entity, a second question entity and a third question entity. Then, by integrating the above three question entities, the question entity corresponding to the question text can be accurately determined.

[0111] In practical applications, in the process of determining the problem entity based on the first problem entity, the second problem entity and the third problem entity, the first problem entity output by the entity recognition model can be taken as the main one, and supplemented by the dictionary recognition result and the regular recognition result to achieve the determination of the problem entity; the problem entity can also be determined by taking the intersection of the three, that is, selecting the problem entity contained in the first problem entity, the second problem entity and the third problem entity as the problem entity corresponding to the problem text.

[0112] For example, the question text is "Who is the current chairman of the board of directors of A?" At this time, the question text is input into the entity recognition model for processing, and the first question entity is "A". Then, the question text is subjected to entity recognition according to the entity dictionary corresponding to the knowledge base in the KBQA question-answering system, and the second question entities are "A" and "Chairman". The question text is subjected to entity recognition through regular matching rules, and the third question entities are "A" and "Chairman". By integrating the first question entity, the second question entity and the third question entity, it is determined that the entity "A" appears most frequently, and then "A" can be used as the question entity corresponding to the question text for subsequent question answering processing.

[0113] In summary, by combining multiple recognition strategies for question entity recognition, not only can the accuracy of entity recognition be improved, but also a good foundation can be laid for subsequent answer extraction, thereby ensuring the accuracy of subsequent answer extraction.

[0114] Step S104: linking a plurality of candidate entities corresponding to the question entity in a preset knowledge base, and identifying the question type of the question text according to the question entity.

[0115] Specifically, on the basis of the above-mentioned identification of the question entities in the question text, further, the question entities will be entity linked so that the answer corresponding to the question text can be extracted from the knowledge base; based on this, since the knowledge base contains many entities, and there are also many entities with the same name but different attributes, such as Li Bai, the entities that can be queried in the knowledge base include poet-Li Bai, song-Li Bai, politician-Li Bai, etc., therefore, when performing entity linking, multiple candidate entities will be linked to the question entity, and the multiple candidate entities are entities in the knowledge base that have the same form as the question entity, and the attribute values ​​of each candidate entity are different.

[0116] Furthermore, when performing entity linking, the question text type processing can also be simultaneously identified, that is, the question type of the question text is identified according to the question entity, wherein the question type can include a single-entity first-degree question type, a single-entity second-degree question type, a multi-entity first-degree question type and a multi-entity multi-degree question type. It should be noted that since the question text structures of different question types are different, different processing methods will be used for different question types during subsequent path generation / path sorting to ensure the accuracy of the response to the question text.

[0117] In actual applications, during the process of entity linking and question type identification (question classification), entity linking and question type identification can be performed simultaneously or in parallel in a sequential order. The specific implementation method can be set according to the actual application scenario, and this embodiment does not make any limitation here.

[0118] Furthermore, in the process of entity linking, since the number of entities contained in the knowledge base is relatively large and there may be many duplicate entity names, there may be a large number of candidate entities after entity linking. If subsequent answer extraction is based on a large number of candidate entities, the accuracy of the answer may be affected. In order to improve the accuracy of answer extraction, some entities with low similarity to the question entity may be eliminated during entity linking, and a set number of initial candidate entities may be selected as the multiple candidate entities. In this embodiment, the specific implementation method can be achieved through steps 1 and 2:

[0119] Step 1: query the entity mapping table corresponding to the knowledge base based on the problem entity, and determine multiple initial candidate entities corresponding to the problem entity according to the query result;

[0120] Step 2: Filter out a set amount of initial candidate entities as the multiple candidate entities according to the multiple initial candidate entities.

[0121] Specifically, the entity mapping table refers to a table that records the entity names and attribute values ​​in the knowledge base, and all entities contained in the knowledge base can be queried in the entity mapping table. In practical applications, in order to facilitate the query of the entity mapping table, different entity mapping tables can be constructed according to different entity types when constructing the entity mapping table; or all entities can be filled in the same table, and then the entities can be partitioned according to different types to improve the processing efficiency when linking entities.

[0122] Among them, the multiple initial candidate entities specifically refer to all entities in the entity mapping table that have the same name as the question entity; accordingly, when a set number of initial candidate entities are screened out as the multiple candidate entities, the value of the set number can be 2, 5 or 8, etc. In actual applications, the value of the set number can also be determined according to the processing capability of the KBQA question-and-answer system. The larger the value, the higher the resource consumption for subsequent answer retrieval, and the smaller the value, the smaller the resource consumption for subsequent answer retrieval. The specific value size can be set according to the actual application scenario, and this embodiment does not make any limitation here.

[0123] Based on this, by querying the entity mapping table corresponding to the knowledge base, it is possible to determine how many initial candidate entities in the knowledge base have the same form as the problem entity. In order to ensure the subsequent processing efficiency and accuracy, a set number of entities can be screened out from the multiple initial candidate entities as the multiple candidate entities, thereby speeding up the subsequent processing efficiency by reducing the number of entity links.

[0124] Furthermore, in the process of screening out multiple candidate entities, if a random screening method is used, the accuracy of the subsequent answer text may not be guaranteed. Therefore, in order to improve the efficiency of subsequent processing while ensuring the accuracy of the answer, in this embodiment, the process of screening out the multiple candidate entities in the above step 2 can be implemented by the following steps 2-1 to 2-4:

[0125] Step 2-1, determining, according to the knowledge base, the first-degree relationships corresponding to the respective initial candidate entities in the plurality of initial candidate entities;

[0126] Step 2-2, inputting the multiple initial candidate entities, the question text, and the first-degree relationships corresponding to each initial candidate entity into a calculation module, and calculating the similarity scores corresponding to each initial candidate entity;

[0127] Step 2-3, sorting each initial candidate entity based on the similarity score to obtain an entity sorting list;

[0128] Step 2-4: Screening out a set number of initial candidate entities from the entity ranking list in order of priority as the multiple candidate entities.

[0129] Specifically, the first-degree relationship refers to the relationship between the initial candidate entity and the knowledge base that is directly associated with it; the calculation module specifically refers to a module that calculates the similarity score between the initial candidate entity and the question text. Correspondingly, the similarity score specifically refers to a score that characterizes the degree of similarity between the initial candidate entity and the question text. The higher the similarity score, the higher the correlation between the initial candidate entity and the question text, and the higher the probability that the initial candidate entity and the question entity are the same entity. Conversely, the lower the similarity score, the lower the correlation between the initial candidate entity and the question text, and the lower the probability that the initial candidate entity and the question entity are the same entity. The entity sorting list specifically refers to a list obtained by sorting the initial candidate entities in descending order of similarity scores.

[0130] Based on this, after obtaining multiple initial candidate entities, in order to ensure the subsequent processing efficiency and accuracy, the first-degree relationship corresponding to each initial candidate entity can be determined in the knowledge base, and then the first-degree relationship corresponding to each initial candidate entity is spliced ​​with the corresponding initial candidate entity, and the splicing result and the question text are respectively input into the calculation module to calculate the similarity between each initial candidate entity and the question text, and obtain the similarity score between each initial candidate entity and the question text output by the calculation module, and then sort each initial candidate entity based on the similarity score to obtain the entity sorting list, and finally select a set number of initial candidate entities from the entity sorting list according to the priority order as the multiple candidate entities.

[0131] In the specific implementation, in the process of screening the multiple candidate entities in order of priority, considering that noise entities (initial candidate entities with low relevance to the question text) interfere with the subsequent processing process, and too many candidate entities will lead to time-consuming subsequent calculations, after sorting the initial candidate entities to obtain the entity sorting list, the topN entities can be selected. l initial candidate entities as the multiple candidate entities, among which topN l Initial candidate entities refer to: starting from the top 1 initial candidate entity in the entity sorting list (the initial candidate entity with the highest similarity score), sequentially search for N l initial candidate entities as the multiple candidate entities, N l The value of can be set according to the actual application scenario, and this embodiment does not make any limitation here.

[0132] In practical applications, when the number of initial candidate entities included in the entity ranking list is less than a set number, the initial candidate entities in the entity ranking list can be directly used as the multiple candidate entities for subsequent processing operations.

[0133] In summary, by screening the multiple candidate entities in combination with similarity scores, not only can the number of determined candidate entities be reduced, but also the fit between the candidate entities and the question text can be ensured, thereby improving the accuracy of subsequent retrieval answers.

[0134] Furthermore, in the process of calculating the similarity between the question text and the initial candidate entity by the calculation module, since the similarity score is an important factor in determining whether the initial candidate entity is eliminated, accurately calculating the similarity score is the basis for ensuring accurate screening of the multiple candidate entities. The text processing method provided in this implementation obtains the similarity score by combining the feature similarity score and the text similarity score to ensure screening of multiple candidate entities in a manner combining the semantic level and the structural level. In this embodiment, the process of calculating the similarity score in the above step 2-2 can be implemented by the following steps 2-2-1 to 2-2-4:

[0135] Step 2-2-1, inputting the multiple initial candidate entities, the question text, and the first-degree relationship corresponding to each initial candidate entity into the calculation module;

[0136] Step 2-2-2, by splicing each initial candidate entity with the first-degree relationship corresponding to each initial candidate entity, and inputting the splicing result and the question text into the text processing model in the calculation module to calculate the text similarity, so as to obtain the text similarity score corresponding to each initial candidate entity;

[0137] Step 2-2-3, inputting the question text and each initial candidate entity into the feature processing model in the calculation module to perform feature similarity calculation, and obtaining the feature similarity score corresponding to each initial candidate entity;

[0138] Step 2-2-4, determining the similarity scores corresponding to the respective initial candidate entities according to the text similarity scores and the feature similarity scores, and outputting them through the calculation module.

[0139] Specifically, the text processing model specifically refers to a model for calculating the similarity between the initial candidate entity and the question text in the semantic dimension, and the text processing model can be implemented using a pre-trained BERT model; correspondingly, the feature processing model specifically refers to a model for calculating the similarity between the initial candidate entity and the question text in the feature dimension, and the feature processing model can be implemented using a LightGBM model; wherein the text processing model splices each initial candidate entity with all its corresponding first-degree relationships, and then calculates the text similarity between the splicing result and the question text to obtain the text similarity score between each initial candidate entity and the question text; the feature processing model calculates the feature similarity between each initial candidate entity and the question text by fusing the shallow features of the initial candidate entities (including entity length, distance from question words, position in the question text, popularity, etc.) to obtain the feature similarity score between each initial candidate entity and the question text.

[0140] Based on this, after obtaining all the first-degree relationships corresponding to each initial candidate entity, each initial candidate entity and its corresponding first-degree relationship are spliced, and then the splicing result and the question text are input into the text processing model together for text similarity calculation to obtain the text similarity score between the initial candidate entity and the question text. At the same time, the question text and the initial candidate entity are respectively input into the feature processing model for feature similarity calculation to obtain the feature similarity score between the initial candidate entity and the question text; finally, the feature similarity score and the text similarity score corresponding to each initial candidate entity are summed to obtain the similarity score of each initial candidate entity, which is used for subsequent screening of the multiple candidate entities.

[0141] Continuing with the above example, based on determining that the problem entity is "A", entity linking processing will be required at this time: based on the problem entity "A", the entity mapping table corresponding to the knowledge base is queried, and according to the query results, the initial candidate entities corresponding to the problem entity "A" are determined to include {A1, A2, A3, A4, A5}, where A1 is a person's name, A2 is a factory name, A3 is a supermarket name, and A4 and A5 are company names; based on this, according to the knowledge base, the first-degree relationships of the initial candidate entity A1 are determined to include {relative relationship, occupational relationship, nationality relationship}, the first-degree relationships of the initial candidate entity A2 are determined to include {position relationship, scale relationship, location relationship}, the first-degree relationships of the initial candidate entity A3 are determined to include {position relationship, time relationship, sales relationship}, the first-degree relationships of the initial candidate entity A4 are determined to include {position relationship, position relationship, business relationship}, and the first-degree relationships of the initial candidate entity A5 are determined to include {position relationship, position relationship, business relationship}.

[0142] Furthermore, the initial candidate entity A1 is concatenated with {relative relationship, occupational relationship, nationality relationship} respectively, and the concatenated result and the question text are input into the BERT model for text similarity calculation, and the text similarity score of the initial candidate entity A1 is T1. At the same time, the initial candidate entity A1 and the question text are input into the LightGBM model for feature similarity calculation, and the feature similarity score F1 of the initial candidate entity A1 is obtained; similarly, after calculation, the text similarity score of the initial candidate entity A2 is T2, and the feature similarity score is F2; ​​the text similarity score of the initial candidate entity A3 is T3, and the feature similarity score is F2. F3; the text similarity score of the initial candidate entity A4 is T4, and the feature similarity score is F4; the text similarity score of the initial candidate entity A5 is T5, and the feature similarity score is F5; then the feature similarity scores and text similarity scores of each initial candidate entity are added together to determine that the similarity score of the initial candidate entity A1 is S1=T1+F1; the similarity score of the initial candidate entity A2 is S2=T2+F2; the similarity score of the initial candidate entity A3 is S3=T3+F3; the similarity score of the initial candidate entity A4 is S4=T4+F4; the similarity score of the initial candidate entity A5 is S5=T5+F5.

[0143] Furthermore, each initial candidate entity is sorted according to the similarity score, and it is determined that the order of similarity scores from high to low in the entity sorting list is A5>A4>A2>A3>A1. Finally, the top 3 initial candidate entities are selected as the linked candidate entities, that is, the candidate entities are (A5, A4, A2) for subsequent answer retrieval processing.

[0144] In summary, by screening the multiple candidate entities in a manner combining feature dimensions and semantic dimensions, not only can the influence of noise entities on candidate processing be avoided, but also the accuracy of the screened candidate entities can be ensured, thereby improving subsequent processing efficiency and accuracy.

[0145] While performing entity connection, the type of the question text may also be identified. In the process of identifying the type of the question text, different question types will affect the subsequent retrieval of answers in different ways. Therefore, only by ensuring accurate identification of the question type can the subsequent processing efficiency be improved. In this embodiment, the specific implementation method of identifying the question type is as follows:

[0146] Identify the entity quantity of the question entity, and determine the entity question type corresponding to the question text according to the entity quantity;

[0147] Inputting the question text into a relation recognition model for processing to obtain a relation question type corresponding to the question text;

[0148] Determine the question type according to the entity question type and the relationship question type;

[0149] The question type includes at least one of the following: a single-entity first-degree question type, a single-entity second-degree question type, and a multi-entity first-degree question type.

[0150] Specifically, the entity question type specifically refers to the type of classifying the question text as a single-entity question or a multi-entity question, and the relationship question type specifically refers to the type of classifying the question text as a first-degree question, a second-degree question or a multi-degree question; the question type of the question text can be determined by combining the entity question type and the relationship question type.

[0151] Based on this, the number of identified question entities is first detected to determine the entity question type corresponding to the question text, and then the question text is input into the relationship recognition model for processing to determine the relationship question type corresponding to the question text, and finally the entity question type and the relationship question type are integrated to determine the question type of the question text; in practical applications, the relationship recognition model can be implemented using a pre-trained BERT classification model.

[0152] In addition, if it is determined that the question text is a single-entity question type by identifying the number of question entities, the degree relationship of the question text can be directly identified through the relationship recognition model, so as to determine whether the question text belongs to a single-entity first-degree question type or a single-entity second-degree question type; if it is determined that the question text is a multi-entity question type by identifying the number of question entities, according to daily living habits, the question text of the multi-entity question type can be assumed to be a multi-entity first-degree question type.

[0153] Continuing with the above example, it is determined that there is only one question entity "A" in the question text, so it can be determined that the question text "Who is the current chairman of A?" belongs to the single-entity question type. The question text is then input into the BERT classification model for degree judgment, and it is determined that the question text "Who is the current chairman of A?" belongs to the first-degree question type. By integrating the first-degree question type and the single-entity question type, it is determined that the question type of the question text is a single-entity first-degree question type. When performing subsequent answer retrieval, the answer to the question text can be retrieved by analyzing the first-degree relationship of the candidate entities.

[0154] In summary, by determining the type of the question text, it is possible to assist in the subsequent rapid selection of a corresponding processing method for answer retrieval, thereby improving the efficiency of responding to the question text.

[0155] Step S106: generating at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type, and determining a target path according to the at least one candidate path.

[0156] Specifically, based on the above-mentioned acquisition of multiple candidate entities and determination of the question type, further, a path will be created based on the multiple candidate entities and the question type. Since there is more than one candidate entity and each candidate entity may have multiple first-degree relationships or second-degree relationships, when creating candidate paths based on the question type and the candidate entities, one, two or more candidate paths will be generated. Different candidate paths will map different entities or relationships in the knowledge base. Therefore, only by determining the target path in at least one candidate path can the answer corresponding to the question text be accurately screened out.

[0157] Based on this, since different question types involve different numbers of entities and relationships, different question types will be created in different ways during the process of creating the at least one candidate path. In this embodiment, when the question type is a single-entity first-degree question type, it means that the question text only involves one entity and a first-degree relationship associated with the entity. At this time, the at least one candidate path can be created based on each candidate entity and the first-degree relationship corresponding to each candidate entity. The specific implementation method is as follows:

[0158] In the case where the question type is a single-entity first-degree question type, reading a first-degree relationship corresponding to each candidate entity among the multiple candidate entities in the knowledge base according to the single-entity first-degree question type;

[0159] The at least one candidate path corresponding to the question text is generated based on each candidate entity among the multiple candidate entities and the first-degree relationship corresponding to each candidate entity.

[0160] Specifically, when the question type is a single-entity first-degree question type, it indicates that only the first-degree relationship of each candidate entity needs to be read in the knowledge base to create the at least one candidate path; based on this, the first-degree relationship corresponding to each candidate entity is read in the knowledge base, and then at least one candidate path can be generated based on the candidate entity and its corresponding first-degree relationship.

[0161] In a specific implementation, in the process of creating candidate paths according to candidate entities and their corresponding first-degree relationships, since the candidate entities have different mapping relationships in the knowledge base, a head entity candidate path and a tail entity candidate path may be created according to the candidate entities and their corresponding first-degree relationships. The expression of the head entity candidate path may be <entity><relationship><? x>, and the expression of the tail entity candidate path may be <? x><relationship><entity>; where "? x" represents an entity or relationship that needs to be determined in the knowledge base to determine the answer to the question text.

[0162] For example, the question text "Who is the current chairman of A?" is a single-entity first-degree question type. Through entity linking processing, the candidate entities are determined to be (A2, A5), and by reading the knowledge base, it is determined that the first-degree relationships of A2 include {employment relationship, scale relationship, position relationship}, and the first-degree relationships of A5 include {employment relationship, position relationship, business relationship}. Then, based on the candidate entity A2 and its corresponding first-degree relationship, the candidate path of the head entity is generated as follows: <a2><position><?x> and <a2><scale><? x>, the tail entity candidate path is <? x><position> <a2>; Based on candidate entity A5 and its corresponding first-degree relationship, the candidate path of the head entity is generated as <a5><operation><? x> and <a5><Location><? x>, the tail entity candidate path is <? x><Job> <a5>After the six candidate paths are determined, a candidate path with a high similarity to the question text can be selected from the six candidate paths as the target candidate path for retrieving the answer to the question text.

[0163] In this embodiment, when the question type is a single-entity second-degree question type, it means that the question text only involves one entity and the first-degree relationship and second-degree relationship associated with the entity. At this time, the at least one candidate path can be created based on the candidate entity, the first-degree relationship and the second-degree relationship corresponding to the candidate entity. The specific implementation method is as follows:

[0164] In the case where the question type is a single-entity second-degree question type, reading a first-degree relationship corresponding to each candidate entity among the multiple candidate entities in the knowledge base according to the single-entity second-degree question type;

[0165] Reading a second-degree relationship corresponding to each candidate entity among the plurality of candidate entities in the knowledge base according to the first-degree relationship corresponding to each candidate entity;

[0166] The at least one candidate path corresponding to the question text is generated based on each candidate entity and the first-degree relationship and the second-degree relationship corresponding to each candidate entity.

[0167] Specifically, when the question type is a single-entity second-degree question type, it indicates that it is necessary to read the first-degree relationship that has a specific direct relationship with the candidate entity and the second-degree relationship that has an indirect relationship with the candidate entity in the knowledge base to create the at least one candidate path; based on this, the first-degree relationship corresponding to each candidate entity can be read in the knowledge base first, and then the second-degree relationship corresponding to each candidate entity can be read from the knowledge base based on the first-degree relationship, and finally the at least one candidate path can be created based on the candidate entity and its corresponding first-degree relationship and second-degree relationship.

[0168] In a specific implementation, in the process of creating candidate paths according to the candidate entities and their corresponding first-degree relationships and second-degree relationships, since the candidate entities have different mapping relationships in the knowledge base, the head entity candidate path and the tail entity candidate path can be preferentially determined according to the candidate entities and their corresponding first-degree relationships, and then the second-degree path is expanded on the basis of the head entity candidate path and the tail entity candidate path. The corresponding expressions can be <entity><relationship1><? x><? x><relationship2><? y> and <? x><relationship1><entity><? x><relationship2><? y>, where "? x" represents an entity or relationship that needs to be determined in the knowledge base according to the first-degree relationship, and "? y" represents an entity or relationship that is determined in the knowledge base based on the first-degree relationship and combined with the second-degree relationship.

[0169] In this process, since the first-degree relationship is a relationship with a direct connection to the candidate entity, and the second-degree relationship is a relationship with an indirect connection to the candidate entity, if the candidate entity has many first-degree relationships, the corresponding second-degree relationships will have an explosive growth problem. For example, the candidate entity has 40 first-degree relationships, and on the basis of the first-degree relationship, the entity mapped by each first-degree relationship also has 40 first-degree relationships. In other words, the candidate entity has 40 second-degree relationships based on each first-degree relationship. At this time, 40*40=1600 candidate paths will be created by combining the candidate entity and its corresponding first-degree relationship and second-degree relationship. If subsequent path sorting and answer retrieval are performed, not only will it take a lot of time to complete the path shooting, but also due to the large number of candidate paths, it is likely to affect the accuracy of the answer. Therefore, the problem of excessive growth of candidate paths can be avoided by reducing the first-degree relationships of candidate entities. In this embodiment, the specific implementation method is as follows:

[0170] Inputting the first-degree relationship corresponding to the question text and each candidate entity into a similarity model for processing to obtain a target first-degree relationship corresponding to each candidate entity;

[0171] Reading a second-degree relationship corresponding to each candidate entity among the plurality of candidate entities in the knowledge base according to a target first-degree relationship corresponding to each candidate entity;

[0172] The at least one candidate path corresponding to the question text is generated based on each candidate entity and the target first-degree relationship and second-degree relationship corresponding to each candidate entity.

[0173] Specifically, after obtaining all the first-degree relationships corresponding to the candidate entities, the first-degree relationships and the candidate entities can be concatenated to obtain a first-degree path, and then the first-degree path and the question text are input into a similarity calculation model for processing to determine the similarity between each first-degree path and the question text, and then the first-degree relationship corresponding to the first-degree path with higher similarity is selected as the target first-degree relationship, and then based on the target first-degree relationship, the second-degree relationship corresponding to each candidate entity is read from the knowledge base, and finally, the at least one candidate path can be created based on the target first-degree relationship and the second-degree relationship of each candidate entity.

[0174] In specific implementation, when compressing candidate paths through the similarity model, the similarity model can be used to calculate the similarity score between the first-degree path generated by the candidate entity combined with the first-degree relationship and the question text, and the top N candidates can be selected based on the similarity score. semr1 The candidate first-degree paths are used to expand to second-degree paths, and the similarity model is used to calculate the similarity scores of all the expanded second-degree relationships combined with the second-degree paths generated by the candidate entities and the question text, and the top N are screened out. semr2 These paths are used as candidate second-degree paths, and finally, by combining the top N semr1 candidate first-degree paths and the corresponding top N semr2 candidate second-degree paths, N semr1 *N semr2 candidate paths can be obtained for subsequent determination of the target path for retrieving the answer to the question text.

[0175] For example, the question text is "What's the weather like at A's address?". Through entity linking, the candidate entity is determined to be "A". By reading the knowledge base, the first-degree relationships of the candidate entity "A" are found to include {first-degree relationship 1, first-degree relationship 2, first-degree relationship 3, first-degree relationship 4}. The entity mapped by the first-degree relationship 1 has 1 first-degree relationship, the entity mapped by the first-degree relationship 2 has 3 first-degree relationships, the entity mapped by the first-degree relationship 3 has 1 first-degree relationship, and the entity mapped by the first-degree relationship 4 has 3 first-degree relationships. At this time, if creating candidate paths, 8 candidate paths need to be created. To improve the efficiency of subsequent processing, candidate paths with relatively low relevance can be eliminated by calculating similarity.

[0176] That is: Based on the candidate entity "A" and its corresponding first-degree relationships, 4 first-degree paths are created. Then, the first-degree paths and the question text are input into the similarity model for similarity calculation. It is determined that the similarity score between the first-degree path 1 (associated with the first-degree relationship 1) and the question text is X1, the similarity score between the first-degree path 2 (associated with the first-degree relationship 2) and the question text is X2, the similarity score between the first-degree path 3 (associated with the first-degree relationship 3) and the question text is X3, and the similarity score between the first-degree path 4 (associated with the first-degree relationship 4) and the question text is X4, and X2 > X1 > X3 > X4. At this time, the second-degree relationships can be read based on the first-degree relationship 2. The entity mapped by the first-degree relationship 2 has 3 first-degree relationships. That is to say, there are 3 second-degree relationships that can be read for the candidate entity "A" based on the first-degree relationship 2, namely the second-degree relationship a, the second-degree relationship b, and the second-degree relationship c. At this time, according to the first-degree relationship 2 and the 3 second-degree relationships, 3 candidate paths can be created, namely <relationship 2><?x><?x><relationship a><?y>, <relationship 2><?x><?x><relationship b><?y>, and <?x><relationship 2><?x><relationship c><?y>. After determining the three candidate paths, a candidate path with a relatively high similarity to the question text can be selected from the three candidate paths as the target candidate path for retrieving the answer to the question text.

[0177] In addition, when the question type is a multi-entity first-degree question type, it indicates that the question text is composed of multiple single-entity first-degree questions. At this time, if a candidate path is created for the question text of the multi-entity first-degree question type, it can be created in a split-joining manner, that is, it is created for each single-entity first-degree question, and then the paths corresponding to each single-entity first-degree question are joined to obtain the candidate path corresponding to the question text. In this embodiment, the specific implementation method is as follows:

[0178] In the case where the question type is a multi-entity first-degree question type, splitting the question text into a plurality of single-entity first-degree question texts according to the multi-entity first-degree question type;

[0179] Determine, according to the plurality of candidate entities, a candidate entity corresponding to each single-entity first-order question text in the plurality of single-entity first-order question texts;

[0180] Reading the first-degree relationship of the candidate entity corresponding to each single-entity first-degree question text in the knowledge base;

[0181] The at least one candidate path corresponding to the question text is generated based on the candidate entities corresponding to each single-entity first-degree question text and the first-degree relationship between the candidate entities corresponding to each single-entity first-degree question text.

[0182] Specifically, when the question type is a multi-entity first-degree question type, it indicates that it is necessary to read the first-degree relationship of each question entity in the question text in the knowledge base to create the candidate path; based on this, since the multi-entity first-degree question type contains multiple entities, multiple candidate entities can be connected for each entity during entity linking; further, in order to be able to create a candidate path for the question text of the multi-entity first-degree question type, the question text can be split to obtain multiple single-entity first-degree question texts, and at the same time, the candidate entity corresponding to each single-entity first-degree question is determined. The determination method can refer to the corresponding description content of the above embodiment, and this embodiment is not limited here.

[0183] Then, the first-degree relationships of the candidate entities corresponding to each single-entity first-degree question text are read in the knowledge base, and by splicing the candidate entities corresponding to each single-entity first-degree question text and the first-degree relationships of the candidate entities corresponding to each single-entity first-degree question text, at least one candidate path corresponding to the question text can be created.

[0184] For example, the question text is "What meeting did A and B attend together?". According to the question type, the question text is split into two single-entity first-degree question texts: "What meeting did A attend?" and "What meeting did B attend?". By entity linking, the candidate entities corresponding to the question entity "A" are (A1, A2), and the candidate entities corresponding to the question entity "B" are (B1, B2). Then, by querying the knowledge base, the first-degree relationships corresponding to "A1" are determined to include {first-degree relationship 1, first-degree relationship 2}, and the first-degree relationships corresponding to "A2" are determined to include {first-degree relationship 3, first-degree relationship 4}; and the first-degree relationships corresponding to "B1" are determined to include {first-degree relationship 5, first-degree relationship 6}, and the first-degree relationships corresponding to "B2" are determined to include {first-degree relationship 7, first-degree relationship 8}. Finally, the first-degree relationships corresponding to the candidate entities (A1, A2) are concatenated with the first-degree relationships corresponding to the candidate entities (B1, B2) respectively, obtaining 16 candidate paths. After determining three candidate paths, one candidate path with a relatively high similarity to the question text can be selected from the three candidate paths as the target candidate path for retrieving the answer to the question text.

[0185] In summary, when creating paths for question texts of different question types, in order to improve the efficiency of subsequent answer retrieval, different methods can be used for creation, which can not only ensure the retrieval accuracy but also avoid the influence of noise entities, thus improving the user experience.

[0186] Based on the above to obtain at least one candidate path, further, since the entities or relationships mapped by each candidate path in the knowledge base are different, in order to accurately determine the answer to the question text, it is necessary to determine a target path among at least one candidate path for retrieving the correct answer to the question text. In this embodiment, the specific implementation method for determining the target path is as follows:

[0187] Input the question text and the at least one candidate path into a similarity calculation module for processing to obtain the path similarity scores between the question text and each candidate path.

[0188] Select the candidate path with the highest path similarity score as the target path.

[0189] Specifically, the target path refers to the candidate path with the highest relevance to the question text screened out from the candidate paths, that is, the answer to the question text can be accurately retrieved in the knowledge base according to the target path; based on this, in order to ensure the accuracy of the subsequent response to the question text, it is necessary to ensure the accuracy of screening the target path from the candidate paths, and the similarity calculation module can be used to calculate the similarity between each candidate path and the question text, and by selecting the candidate path with the highest path similarity score as the target path, the accuracy of the subsequent retrieval of the answer can be met.

[0190] Furthermore, in the process of calculating the path similarity score, since there may be candidate paths with high similarity between the candidate paths, in order to screen out the target path, the path similarity score can be calculated by combining the feature dimension and the semantic dimension. In this embodiment, the specific implementation method is as follows:

[0191] Inputting the question text and the at least one candidate path into the text similarity model in the similarity calculation module to obtain the text path similarity score between the question text and each candidate path;

[0192] Inputting the question text and the at least one candidate path into the feature similarity model in the similarity calculation module to obtain feature path similarity scores between the question text and each candidate path;

[0193] An entity score of a candidate entity corresponding to each candidate path is determined, and the path similarity score is determined according to the entity score, the text path similarity score and the feature path similarity score.

[0194] Specifically, the text path similarity score specifically refers to the similarity score between the candidate path and the question text in the semantic dimension, the feature path similarity score specifically refers to the similarity score between the candidate path and the question text in the feature dimension, and the entity score specifically refers to the similarity score between the candidate entity and the question text.

[0195] Based on this, the question text and each candidate path are respectively input into the text similarity model for processing to obtain the text path similarity score between each candidate path and the question text. At the same time, the question text and each candidate path are respectively input into the feature similarity model for processing to obtain the feature path similarity score between each candidate path and the question text. Finally, the text path similarity score, the feature path similarity score and the entity score of the candidate entity are added together to determine the path similarity score between each candidate path and the question text. Finally, the candidate path with the highest path similarity score is selected as the target path to realize the processing of answering the question text.

[0196] In the specific implementation, in the process of determining the target path, the path sorting process is actually performed, that is, the candidate paths are sorted according to the path similarity scores with the question text, and the top 1 in the sorting result is selected as the target path. In the process of similarity scoring through the text similarity model and the feature similarity model, the following features can be integrated to improve the rationality of the path similarity score, and the integrated features may include: the length of the candidate path; the number of identical characters and word-level vector similarity between the candidate path and the question text; the number of identical words and word-level vector similarity between the candidate path and the question text; the popularity of the candidate path in the knowledge base, that is, the number of times it appears in the knowledge base; whether the candidate path appears directly in the original question text; the semantic similarity score between the candidate path and the question text; the relative position of the candidate entity and the candidate path, that is, whether it appears at the head of the triple or the tail of the triple, etc. It should be noted that the above-mentioned features that can be integrated are combined in the text / feature similarity model, that is, when the similarity score is calculated through the model, the above-mentioned features will be combined to give the feature similarity score and path similarity score of each candidate path, so as to ensure that the correct target path is screened out.

[0197] Using the above example, the question text is "Who is the current chairman of A?", the candidate entities are determined to be (A2, A5) through entity linking, and the candidate path A corresponding to the candidate entity A2 is determined through path generation processing. 21 : <a2><Position><? x>, Candidate Path A 22 : <a2><scale><?x> and candidate path A 23 :<? x><Job> <a2>; Candidate path A corresponding to candidate entity A5 51 : <a5><Operation><? x>, candidate path A 52 : <a5><position><?x> and candidate path A 53 :<? x><Job> <a5>; Then, each candidate path and the question text are input into the text similarity model and the feature similarity model respectively;

[0198] After calculation, candidate path A is determined 21 The text path similarity score with the question text is TR 21 , the feature path similarity score is FR 21 ; Candidate path A 22 The text path similarity score with the question text is TR 22 , the feature path similarity score is FR 22 ; Candidate path A 23 The text path similarity score with the question text is TR 23 , the feature path similarity score is FR 23 Candidate Path A 51 The text path similarity score with the question text is TR 51 , the feature path similarity score is FR 51 ; Candidate path A 52 The text path similarity score with the question text is TR 52 , the feature path similarity score is FR 52 ; Candidate path A 53 The text path similarity score with the question text is TR 53 , the feature path similarity score is FR 53 ; At the same time, it is determined that the entity score of candidate entity A2 is ES2, and the entity score of candidate entity A5 is ES5.

[0199] Furthermore, by adding the entity score, feature path similarity score and text path similarity score of each candidate path, the path similarity score of each candidate path and the question text is obtained, and the candidate path A is determined. 21 The path similarity score with the question text is M 21 =TR 21 +FR 21 +ES2; Candidate Path A 22 The path similarity score with the question text is M 22 =TR 22 +FR 22 +ES2; Candidate Path A 23 The path similarity score with the question text is M 23 =TR 23 +FR 23 +ES2; Candidate Path A 51 The path similarity score with the question text is M 51 =TR 51 +FR 51 +ES5; Candidate Path A 52 The path similarity score with the question text is M 52 =TR 52 +FR 52 +ES5; Candidate Path A 53 The path similarity score with the question text is M 53 =TR 53 +FR 53 +ES5; Determine M by comparison 53 >M 52 >M 23 >M 51 >M 21 >M 22 , then candidate path A 53 :<? x><Job Title> <a5>The similarity with the question text "Who is the current chairman of A?" is the highest, so candidate path A is selected 53 Use this as the target path for subsequent answer retrieval.

[0200] In summary, by combining the entity score, feature path similarity score and text path similarity score to determine the target path, the influence of multiple dimensions is taken into consideration, which further ensures the accuracy of screening the target path, thereby improving the accuracy of subsequent answer retrieval.

[0201] Step S108, converting the target path into a query statement, and searching the knowledge base for an answer text corresponding to the question text according to the query statement.

[0202] Specifically, on the basis of the above-mentioned determination of the target path, further, the answer text corresponding to the question text can be queried in the knowledge base according to the target path; wherein the query statement specifically refers to the statement generated according to the query path, and the answer text specifically refers to the text generated by the entity or relationship retrieved in the knowledge base according to the query statement.

[0203] Furthermore, since the knowledge base is constructed by entities and relationships, when searching for answers according to the target path, the target entity can be determined according to the query statement converted from the target path, and the answer text can be generated according to the target entity. In this embodiment, the specific implementation method is as follows:

[0204] Querying the knowledge base for a target entity corresponding to the question text according to the query statement;

[0205] The answer text corresponding to the question text is generated based on the target entity.

[0206] Using the above example, when determining the target path for the question text "Who is the current chairman of A?" 53 :<? x><Job Title> <a5>In this case, the target path A can be 53 :<? x><Job> <a5>Convert to query statement Q 53 , then based on the query statement Q 53 Search in the knowledge base, determine that the target entity of the target path mapping is "C" based on the search results, then determine that the answer text corresponding to the question text "Who is the current chairman of A?" is "The current chairman of A is C" based on the target entity "C", and then feed back the answer text to the user.

[0207] In addition, if the question type of the question text is a single-entity first-degree question type or a single-entity second-degree question type, the answer can be directly retrieved according to the query statement converted by the target path; and if the question type of the question text is a multi-entity first-degree question, it is necessary to satisfy the mapping relationship of the target path pointing to the same entity, that is, the target path will contain multiple sub-paths. At this time, the query statement corresponding to the target path can be converted by bridging. In this embodiment, the specific implementation method is as follows:

[0208] In the case where the problem type is a multi-entity first-degree problem type, determining a plurality of sub-paths according to the target path;

[0209] The multiple sub-paths are concatenated to obtain a target concatenated path, and the target concatenated path is converted into the query statement.

[0210] For example, if the question text is "What meeting did C and D attend together?", multiple sub-paths are obtained through entity recognition > entity linking > question classification > path generation > path sorting, which are <c><Participate><? x1> and <d><Attend><? x2>, and because the question text belongs to a multi-entity first-degree question, it can be determined that "? x 1= ? x2", that is, the subpath <c><Attend><? x1>Mapped entities and subpaths <d><Participate><? x2> The entities mapped are the same, in this case the subpath <c><Participate><? x1> and <d><Join><? x2> to splice and get the target splicing path <c><Participation><?x1><Participation> <d>, then the target splicing path <c><Participation><?x1><Participation> <d>Convert to query statement Q CD , and then through the query statement Q CD Search in the knowledge base, determine that the target entity of the target path mapping is "*** meeting" based on the search results, and finally determine that the answer text corresponding to the question text "What meeting did C and D attend together?" is "C and D attended the *** meeting together" based on the target entity, and then feed the answer text back to the user.

[0211] The text processing method provided by the present application, after obtaining the question text, will identify the question entity in the question text, then link multiple candidate entities corresponding to the question text in a preset knowledge base, and at the same time identify the question type of the question text according to the question entity, create a candidate path corresponding to the question text based on multiple candidate entities and question types, and determine the target path in the candidate path, and finally convert the target path into a query statement. The query statement can be used to query the answer text corresponding to the question text in the knowledge base, thereby ensuring the accuracy of the reply to the question text in the process of answering the question text, and also improving the processing efficiency of determining the answer text.

[0212] The following combination Figure 2 , taking the application of the text processing method provided by the present application in the scenario of answering a single entity first-order question as an example, the text processing method is further explained. Figure 2 A processing flow chart of a text processing method applied to a single-entity first-order question answering scenario provided by an embodiment of the present application is shown, which specifically includes the following steps:

[0213] Step S202, obtaining the question text submitted by the user.

[0214] This embodiment describes the text processing method by taking the question text submitted by the user as a single entity first-degree question "Who discovered Pluto?" as an example.

[0215] Step S204: perform entity recognition on the question text based on a preset recognition strategy to obtain question entities.

[0216] Specifically, after obtaining the question text "Who discovered Pluto?", the entity recognition model of the BERT+CRF model structure is used to perform entity recognition on the question text, and the entity output by the entity recognition model is "Pluto"; at the same time, the question text is again recognized by the entity dictionary corresponding to the KBQA knowledge base, and the entity with the highest match with the dictionary is "Pluto"; then the question text is recognized again according to the regular matching rule, and the entity obtained is "Wangxing"; finally, by analyzing the entities identified by the three recognition methods, it is determined that the question entity corresponding to the question text is "Pluto".

[0217] Step S206, querying the entity mapping table corresponding to the preset knowledge base based on the question entity, and determining a plurality of initial candidate entities corresponding to the question entity according to the query result.

[0218] Specifically, after obtaining that the problem entity is "Pluto", the entity mapping table of the KBQA knowledge base is queried through the problem entity "Pluto", and it is determined that there are three entities with the same name as "Pluto" in the knowledge base, namely "Pluto-1" (indicating that Pluto is a celestial body), "Pluto-2" (indicating that Pluto is a movie) and "Pluto-3" (indicating that Pluto is a name). At this time, it is determined that the problem entity "Pluto" corresponds to three initial candidate entities.

[0219] Step S208: Screening out a set number of candidate entities from the multiple initial candidate entities as candidate entities.

[0220] Specifically, in order to ensure the accuracy of the selected candidate entities, features can be constructed for each initial candidate entity, that is, the features of "Pluto-1" are determined as follows: the entity length is 3 characters, the position in the question text is 1-3, and the frequency of occurrence in the knowledge base is 100 times; then the features of "Pluto-1" are used as input, and the feature similarity score of the initial candidate entity "Pluto-1" is calculated using the LightGBM algorithm, which is P1. At the same time, "Pluto-1" and the question text "Who discovered Pluto?" are used as inputs to the model, and the text similarity score between the question text and the initial candidate entity is calculated using the BERT model, which is S1.

[0221] The features of "Pluto-2" are determined as follows: the entity length is 3 characters, the position in the question text is 1-3, and the frequency of occurrence in the knowledge base is 80 times; then the features of "Pluto-2" are used as input, and the LightGBM algorithm is used to calculate the feature similarity score of the initial candidate entity "Pluto-2", which is P2; at the same time, "Pluto-2" and the question text "Who discovered Pluto?" are used as inputs to the model, and the BERT model is used to calculate the text similarity score between the question text and the initial candidate entity, which is S2.

[0222] The features of "Pluto-3" are determined as follows: the entity length is 3 characters, the position in the question text is 1-3, and the frequency of occurrence in the knowledge base is 20 times; then the features of "Pluto-3" are used as input, and the LightGBM algorithm is used to calculate the feature similarity score of the initial candidate entity "Pluto-3", which is P3; at the same time, "Pluto-3" and the question text "Who discovered Pluto?" are used as inputs to the model, and the BERT model is used to calculate the text similarity score between the question text and the initial candidate entity, which is S3.

[0223] Then, the feature similarity score P1 and the text similarity score S1 are added to obtain the score PS1 of "Pluto-1"; the feature similarity score P2 and the text similarity score S2 are added to obtain the score PS2 of "Pluto-2"; the feature similarity score P3 and the text similarity score S3 are added to obtain the score PS3 of "Pluto-3"; then, the initial candidate entities are sorted according to the score size PS1>PS2>PS3, and the TOP*2 entities are selected as the candidate entities of the question text according to the sorting results, and it is determined that "Pluto-1" and "Pluto-2" are candidate entities for the question text "Who discovered Pluto?"

[0224] Step S210, identifying the question type of the question text as a single entity first-degree question type according to the question entity.

[0225] Specifically, it is determined that the entity number of the question entity "Pluto" is 1, and the question text "Who discovered Pluto?" is determined to be a single-entity question. Then, the question text is used as input, and the BERT classification model is used to predict the degree of the question text. It is determined that the prediction result of the BERT classification model is a first-degree question. Based on the single-entity question and the first-degree question, it is determined that the question type of "Who discovered Pluto?" is a single-entity first-degree question type.

[0226] Step S212, reading the first-degree relationship corresponding to the candidate entity in the knowledge base according to the single-entity first-degree question type, and generating a candidate path according to the candidate entity and the first-degree relationship corresponding to the candidate entity.

[0227] Specifically, when it is determined that "Who discovered Pluto?" is a single-entity first-degree question type, the first-degree relationships corresponding to "Pluto-1" read in the knowledge base are {discoverer relationship, location relationship, naming relationship}, and the first-degree relationships corresponding to "Pluto-2" are {author relationship, shooting relationship, actor relationship}.

[0228] Based on this, according to "Pluto-1" and its corresponding first-degree relationship {discoverer relationship, location relationship, name relationship}, it is determined that the candidate path of "Pluto-1" as the head entity includes: <Pluto-1><discoverer><? x>; the candidate path as the tail entity includes: <? x><location><Pluto-1>, <? x><name><Pluto-1>.

[0229] Based on this, according to "Pluto-2" and its corresponding first-degree relationship {author relationship, shooting relationship, actor relationship}, it is determined that the candidate path of "Pluto-2" as the head entity includes: <Pluto-2><author><? x>, <Pluto-2><actor><? x>; the candidate path as the tail entity includes: <? x><shooting><Pluto-2>.

[0230] Step S214: input the question text and the candidate paths into a similarity calculation module for processing to obtain a path similarity score between the question text and each candidate path.

[0231] Step S216: Select the candidate path with the highest path similarity score as the target path.

[0232] Specifically, after obtaining the six candidate paths corresponding to the above candidate entities, in order to accurately determine the answer text of the question text, the target path will be screened by the text dimension and the feature dimension. The specific implementation method is as follows:

[0233] The question text "Who discovered Pluto?" is combined with each candidate path corresponding to the candidate entity, and the combination results are respectively input into the BERT similarity model and the LightGBM similarity model to calculate text similarity and feature similarity. It should be noted that in the process of calculating text similarity, the semantic similarity between the question text and each candidate path is calculated; in the process of calculating feature similarity, the feature similarity between the question text and each candidate path is calculated, such as the similarity between the length of the candidate path and the length of the question text; the character similarity between the candidate path characters and the question text characters (same number of words); the word unit similarity between the candidate path word units and the question text word units; the popularity of the candidate path in the knowledge base, etc. Finally, by summing the text similarity score and the feature similarity score, the path similarity score between the question text and each candidate path can be obtained.

[0234] That is, the text similarity score between the question text and the head entity candidate path <Pluto-1><discoverer><? x> is W1a1, and the feature similarity score is T1a1; the text similarity score between the question text and the tail entity candidate path <? x><location><Pluto-1> is W1b2, and the feature similarity score is T1b2; the text similarity score between the question text and the tail entity candidate path <? x><name><Pluto-1> is W1b3, and the feature similarity score is T1b3.

[0235] The text similarity score between the question text and the head entity candidate path <Pluto-2><Author><? x> is W2a1, and the feature similarity score is T2a1. The text similarity score between the question text and the head entity candidate path <Pluto-2><Actor><? x> is W2a3, and the feature similarity score is T2a3. The text similarity score between the question text and the tail entity candidate path <? x><Photographing><Pluto-2> is W2b2, and the feature similarity score is T2b2.

[0236] At the same time, it is determined that the entity score of the candidate entity "Pluto-1" is PS1. At this time, the path similarity score between the candidate path <Pluto-1><discoverer><? x> and the question text is PS1+W1a1+T1a1=L1a1; the path similarity score between the candidate path <? x><location><Pluto-1> and the question text is PS1+W1b2+T1b2=L1b2; the path similarity score between the candidate path <? x><name><Pluto-1> and the question text is PS1+W1b3+T1b3=L1b3.

[0237] It is determined that the entity score of the candidate entity "Pluto-2" is PS2. At this time, the path similarity score between the candidate path <Pluto-2><Author><? x> and the question text is PS2+W2a1+T2a1=L2a1; the path similarity score between the candidate path <Pluto-2><Actor><? x> and the question text is PS2+W2a3+T2a3=L2a3; the path similarity score between the candidate path <? x><Photographing><Pluto-2> and the question text is PS2+W2b2+T2b2=L2b2.

[0238] By sorting the path similarities from large to small, the sorting result is determined to be L1a1>L1b3>L1b2>L2a3>L2a1>L2b2; at this time, it is determined that the candidate path <Pluto-1><discoverer><? x> has the highest similarity with the question text "Who discovered Pluto?", so <Pluto-1><discoverer><? x> can be determined as the target path.

[0239] Step S218, converting the target path into a query statement, and searching the knowledge base for the answer text corresponding to the question text according to the query statement to provide feedback to the user.

[0240] Specifically, when the target path is determined to be <Pluto-1><discoverer><? x>, <Pluto-1><discoverer><? x> is converted into a query statement, and the entity pointed to by the target path <Pluto-1><discoverer><? x> is determined to be "Clyde William Tombaugh" through the query statement, that is, the answer to the question text "Who is the discoverer of Pluto?" is determined to be "Clyde William Tombaugh", and the answer is fed back to the user.

[0241] The text processing method provided by the present application, after obtaining the question text, will identify the question entity in the question text, then link multiple candidate entities corresponding to the question text in a preset knowledge base, and at the same time identify the question type of the question text according to the question entity, create a candidate path corresponding to the question text based on multiple candidate entities and question types, and determine the target path in the candidate path, and finally convert the target path into a query statement. The query statement can be used to query the answer text corresponding to the question text in the knowledge base, thereby ensuring the accuracy of the reply to the question text in the process of answering the question text, and also improving the processing efficiency of determining the answer text.

[0242] Corresponding to the above method embodiment, the present application also provides a text processing device embodiment, Figure 3 FIG. 1 shows a schematic diagram of the structure of a text processing device provided by an embodiment of the present application. Figure 3 As shown, the device comprises:

[0243] The acquisition module 302 is configured to acquire a question text and identify question entities in the question text;

[0244] A linking module 304 is configured to link multiple candidate entities corresponding to the question entity in a preset knowledge base, and identify the question type of the question text according to the question entity;

[0245] A determination module 306 is configured to generate at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type, and determine a target path according to the at least one candidate path;

[0246] The query module 308 is configured to convert the target path into a query statement, and query the knowledge base for the answer text corresponding to the question text according to the query statement.

[0247] In an optional embodiment, the acquisition module 302 is further configured to:

[0248] Performing entity recognition on the question text based on a preset recognition strategy to obtain the question entity;

[0249] The preset recognition strategy includes a model recognition strategy, a dictionary recognition strategy and / or a rule recognition strategy.

[0250] In an optional embodiment, the acquisition module 302 is further configured to:

[0251] Input the question text into an entity recognition model for entity recognition to obtain a first question entity corresponding to the question text; perform entity recognition on the question text based on an entity dictionary corresponding to the knowledge base to obtain a second question entity corresponding to the question text; perform entity recognition on the question text through regular matching rules to obtain a third question entity corresponding to the question text; determine the question entity based on the first question entity, the second question entity and the third question entity.

[0252] In an optional embodiment, the link module 304 is further configured to:

[0253] Based on the problem entity, an entity mapping table corresponding to the knowledge base is queried, and a plurality of initial candidate entities corresponding to the problem entity are determined according to the query result; and a set amount of initial candidate entities are screened out according to the plurality of initial candidate entities as the plurality of candidate entities.

[0254] In an optional embodiment, the link module 304 is further configured to:

[0255] Determine the first-degree relationships corresponding to each of the multiple initial candidate entities according to the knowledge base; input the multiple initial candidate entities, the question text and the first-degree relationships corresponding to each initial candidate entity into a calculation module, and calculate the similarity scores corresponding to each initial candidate entity; sort the initial candidate entities based on the similarity scores to obtain an entity sorting list; and select a set number of initial candidate entities from the entity sorting list in order of priority as the multiple candidate entities.

[0256] In an optional embodiment, the link module 304 is further configured to:

[0257] The multiple initial candidate entities, the question text and the first-degree relationships corresponding to the initial candidate entities are input into the calculation module; each initial candidate entity is spliced ​​with the first-degree relationships corresponding to the initial candidate entities, and the splicing result and the question text are input into the text processing model in the calculation module for text similarity calculation to obtain the text similarity score corresponding to each initial candidate entity; the question text and each initial candidate entity are input into the feature processing model in the calculation module for feature similarity calculation to obtain the feature similarity score corresponding to each initial candidate entity; the similarity score corresponding to each initial candidate entity is determined according to the text similarity score and the feature similarity score, and output through the calculation module.

[0258] In an optional embodiment, the link module 304 is further configured to:

[0259] Identify the entity quantity of the question entity, and determine the entity question type corresponding to the question text according to the entity quantity; input the question text into a relationship recognition model for processing to obtain the relationship question type corresponding to the question text; determine the question type according to the entity question type and the relationship question type;

[0260] The question type includes at least one of the following: a single-entity first-degree question type, a single-entity second-degree question type, and a multi-entity first-degree question type.

[0261] In an optional embodiment, the determining module 306 is further configured to:

[0262] In the case where the question type is a single-entity first-degree question type, the first-degree relationship corresponding to each of the multiple candidate entities is read in the knowledge base according to the single-entity first-degree question type; and the at least one candidate path corresponding to the question text is generated based on each of the multiple candidate entities and the first-degree relationship corresponding to each candidate entity.

[0263] In an optional embodiment, the determining module 306 is further configured to:

[0264] In the case where the question type is a single-entity second-degree question type, the first-degree relationship corresponding to each of the multiple candidate entities is read in the knowledge base according to the single-entity second-degree question type; the second-degree relationship corresponding to each of the multiple candidate entities is read in the knowledge base according to the first-degree relationship corresponding to each candidate entity; and the at least one candidate path corresponding to the question text is generated based on each candidate entity and the first-degree relationship and second-degree relationship corresponding to each candidate entity.

[0265] In an optional embodiment, the determining module 306 is further configured to:

[0266] Inputting the first-degree relationship corresponding to the question text and each candidate entity into a similarity model for processing to obtain a target first-degree relationship corresponding to each candidate entity; reading the second-degree relationship corresponding to each candidate entity in the plurality of candidate entities in the knowledge base according to the target first-degree relationship corresponding to each candidate entity;

[0267] Correspondingly, the generating of the at least one candidate path corresponding to the question text based on each candidate entity and the first-degree relationship and second-degree relationship corresponding to each candidate entity includes: generating the at least one candidate path corresponding to the question text based on each candidate entity and the target first-degree relationship and second-degree relationship corresponding to each candidate entity.

[0268] In an optional embodiment, the determining module 306 is further configured to:

[0269] In the case where the question type is a multi-entity first-degree question type, the question text is split into multiple single-entity first-degree question texts according to the multi-entity first-degree question type; the candidate entities corresponding to each single-entity first-degree question text in the multiple single-entity first-degree question texts are determined according to the multiple candidate entities; the first-degree relationships of the candidate entities corresponding to each single-entity first-degree question text are read in the knowledge base; and the at least one candidate path corresponding to the question text is generated based on the candidate entities corresponding to each single-entity first-degree question text and the first-degree relationships of the candidate entities corresponding to each single-entity first-degree question text.

[0270] In an optional embodiment, the determining module 306 is further configured to:

[0271] The question text and the at least one candidate path are input into a similarity calculation module for processing to obtain a path similarity score between the question text and each candidate path; and the candidate path with the highest path similarity score is selected as the target path.

[0272] In an optional embodiment, the determining module 306 is further configured to:

[0273] The question text and the at least one candidate path are input into the text similarity model in the similarity calculation module to obtain the text path similarity score between the question text and each candidate path; the question text and the at least one candidate path are input into the feature similarity model in the similarity calculation module to obtain the feature path similarity score between the question text and each candidate path; the entity score of the candidate entity corresponding to each candidate path is determined, and the path similarity score is determined according to the entity score, the text path similarity score and the feature path similarity score.

[0274] In an optional embodiment, the query module 308 is further configured to:

[0275] In the case where the question type is a multi-entity first-degree question type, a plurality of sub-paths are determined according to the target path; the plurality of sub-paths are concatenated to obtain a target concatenated path, and the target concatenated path is converted into the query statement.

[0276] In an optional embodiment, the query module 308 is further configured to:

[0277] Querying the knowledge base for a target entity corresponding to the question text according to the query statement;

[0278] The answer text corresponding to the question text is generated based on the target entity.

[0279] The text processing device provided in this embodiment, after acquiring the question text, will identify the question entity in the question text, and then link multiple candidate entities corresponding to the question text in a preset knowledge base, and at the same time identify the question type of the question text according to the question entity, create a candidate path corresponding to the question text based on multiple candidate entities and question types, and determine the target path in the candidate path, and finally convert the target path into a query statement. The query statement can be used to query the answer text corresponding to the question text in the knowledge base, thereby ensuring the accuracy of the reply to the question text in the process of answering the question text, and improving the processing efficiency of determining the answer text.

[0280] The above is a schematic scheme of a text processing device of the present embodiment. It should be noted that the technical scheme of the text processing device and the technical scheme of the above-mentioned text processing method belong to the same concept. For details not described in detail in the technical scheme of the text processing device, please refer to the description of the technical scheme of the above-mentioned text processing method. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method, and each functional module is not an actual functional division or separation definition. The device claim defined by such a group of functional modules should be understood as a functional module architecture that mainly implements the solution through the computer program recorded in the specification, and should not be understood as a physical device that mainly implements the solution through hardware.

[0281] Figure 4 The block diagram of a computing device 400 according to an embodiment of the present application is shown. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and the database 450 is used to store data.

[0282] The computing device 400 also includes an access device 440 that enables the computing device 400 to communicate via one or more networks 460. 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 440 may include one or more of any type of network interface (e.g., a network interface card (NIC)) 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.

[0283] In one embodiment of the present application, the above components of the computing device 400 and Figure 4 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 4 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.

[0284] The computing device 400 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 a PC. The computing device 400 may also be a mobile or stationary server. The processor 420 is used to execute computer executable instructions corresponding to the text processing method.

[0285] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above text processing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above text processing method.

[0286] An embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions, which are used to implement the text processing method when executed by the processor; the above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the above text processing method belong to the same concept, and the details of the technical solution of the storage medium that are not described in detail can be found in the description of the technical solution of the above text processing method.

[0287] The above describes specific embodiments of the present application. 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 accompanying 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.

[0288] 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.

[0289] 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.

[0290] 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.

[0291] 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 the present application. The present application 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 only limited by the claims and their full scope and equivalents.< / d> < / c> < / d> < / c> < / d> < / c> < / d> < / c> < / d> < / c>

Claims

1. A text processing method, characterized in that: include: Obtaining a question text and identifying question entities in the question text; Linking multiple candidate entities corresponding to the question entity in a preset knowledge base, and identifying the question type of the question text according to the question entity, wherein the multiple candidate entities are entities in the knowledge base with the same form as the question entity, and the attribute values ​​of each candidate entity are different; Generate at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type, and determine a target path according to the at least one candidate path; The target path is converted into a query statement, and the answer text corresponding to the question text is searched in the knowledge base according to the query statement.

2. The text processing method according to claim 1, characterized in that: The step of identifying the question entity in the question text comprises: Performing entity recognition on the question text based on a preset recognition strategy to obtain the question entity; The preset recognition strategy includes a model recognition strategy, a dictionary recognition strategy and / or a rule recognition strategy.

3. The text processing method according to claim 2, characterized in that: The performing entity recognition on the question text based on a preset recognition strategy to obtain the question entity includes: Inputting the question text into an entity recognition model for entity recognition to obtain a first question entity corresponding to the question text; Perform entity recognition on the question text based on the entity dictionary corresponding to the knowledge base to obtain a second question entity corresponding to the question text; Perform entity recognition on the question text by using regular matching rules to obtain a third question entity corresponding to the question text; The question entity is determined according to the first question entity, the second question entity and the third question entity.

4. The text processing method according to claim 1, characterized in that: The linking of multiple candidate entities corresponding to the problem entity in a preset knowledge base includes: Querying the entity mapping table corresponding to the knowledge base based on the problem entity, and determining a plurality of initial candidate entities corresponding to the problem entity according to the query result; Initial candidate entities of a set data amount are screened out according to the multiple initial candidate entities as the multiple candidate entities.

5. The text processing method according to claim 4, characterized in that: The step of selecting the initial candidate entities of a set data volume as the multiple candidate entities according to the multiple initial candidate entities includes: Determine, according to the knowledge base, the first-degree relationship corresponding to each of the multiple initial candidate entities; Input the multiple initial candidate entities, the question text, and the first-degree relationships corresponding to each initial candidate entity into a calculation module, and calculate the similarity scores corresponding to each initial candidate entity; Sort each initial candidate entity based on the similarity score to obtain a sorted entity list; A set number of initial candidate entities are screened out from the entity ranking list in order of priority as the multiple candidate entities.

6. The text processing method according to claim 5, characterized in that: The step of inputting the plurality of initial candidate entities, the question text, and the first-degree relationships corresponding to the initial candidate entities into a calculation module, and calculating the similarity scores corresponding to the initial candidate entities, comprises: Inputting the plurality of initial candidate entities, the question text, and the first-degree relationship corresponding to each initial candidate entity into the calculation module; By splicing each initial candidate entity with the first-degree relationship corresponding to each initial candidate entity, and inputting the splicing result and the question text into the text processing model in the calculation module to perform text similarity calculation, the text similarity score corresponding to each initial candidate entity is obtained; Inputting the question text and each initial candidate entity into the feature processing model in the calculation module to perform feature similarity calculation, and obtaining the feature similarity score corresponding to each initial candidate entity; The similarity scores corresponding to the initial candidate entities are determined according to the text similarity scores and the feature similarity scores, and are outputted through the calculation module.

7. The text processing method according to claim 1, characterized in that: The step of identifying the question type of the question text according to the question entity comprises: Identify the entity quantity of the question entity, and determine the entity question type corresponding to the question text according to the entity quantity; Inputting the question text into a relation recognition model for processing to obtain a relation question type corresponding to the question text; Determine the question type according to the entity question type and the relationship question type; The question type includes at least one of the following: a single-entity first-degree question type, a single-entity second-degree question type, and a multi-entity first-degree question type.

8. The text processing method according to claim 7, characterized in that: The generating at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type includes: In the case where the question type is a single-entity first-degree question type, reading a first-degree relationship corresponding to each candidate entity among the multiple candidate entities in the knowledge base according to the single-entity first-degree question type; The at least one candidate path corresponding to the question text is generated based on each candidate entity among the multiple candidate entities and the first-degree relationship corresponding to each candidate entity.

9. The text processing method according to claim 7, characterized in that: The generating at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type includes: In the case where the question type is a single-entity second-degree question type, reading a first-degree relationship corresponding to each candidate entity among the multiple candidate entities in the knowledge base according to the single-entity second-degree question type; Reading a second-degree relationship corresponding to each candidate entity among the plurality of candidate entities in the knowledge base according to the first-degree relationship corresponding to each candidate entity; The at least one candidate path corresponding to the question text is generated based on each candidate entity and the first-degree relationship and the second-degree relationship corresponding to each candidate entity.

10. The text processing method according to claim 9, characterized in that: The step of reading the second-degree relationship corresponding to each candidate entity in the plurality of candidate entities in the knowledge base according to the first-degree relationship corresponding to each candidate entity includes: Inputting the first-degree relationship corresponding to the question text and each candidate entity into a similarity model for processing to obtain a target first-degree relationship corresponding to each candidate entity; Reading a second-degree relationship corresponding to each candidate entity among the plurality of candidate entities in the knowledge base according to a target first-degree relationship corresponding to each candidate entity; Accordingly, the step of generating the at least one candidate path corresponding to the question text based on each candidate entity and the first-degree relationship and the second-degree relationship corresponding to each candidate entity includes: The at least one candidate path corresponding to the question text is generated based on each candidate entity and the target first-degree relationship and second-degree relationship corresponding to each candidate entity.

11. The text processing method according to claim 7, characterized in that: The generating at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type includes: In the case where the question type is a multi-entity first-degree question type, splitting the question text into a plurality of single-entity first-degree question texts according to the multi-entity first-degree question type; Determine, according to the plurality of candidate entities, a candidate entity corresponding to each single-entity first-order question text in the plurality of single-entity first-order question texts; Reading the first-degree relationship of the candidate entity corresponding to each single-entity first-degree question text in the knowledge base; The at least one candidate path corresponding to the question text is generated based on the candidate entities corresponding to each single-entity first-degree question text and the first-degree relationship between the candidate entities corresponding to each single-entity first-degree question text.

12. The text processing method according to any one of claims 8 to 11, characterized in that: The determining the target path according to the at least one candidate path comprises: Inputting the question text and the at least one candidate path into a similarity calculation module for processing to obtain a path similarity score between the question text and each candidate path; The candidate path with the highest path similarity score is selected as the target path.

13. The text processing method according to claim 12, characterized in that: The step of inputting the question text and the at least one candidate path into a similarity calculation module for processing to obtain a path similarity score between the question text and each candidate path includes: Inputting the question text and the at least one candidate path into the text similarity model in the similarity calculation module to obtain the text path similarity score between the question text and each candidate path; Inputting the question text and the at least one candidate path into the feature similarity model in the similarity calculation module to obtain feature path similarity scores between the question text and each candidate path; An entity score of a candidate entity corresponding to each candidate path is determined, and the path similarity score is determined according to the entity score, the text path similarity score and the feature path similarity score.

14. The text processing method according to claim 7, characterized in that: The converting the target path into a query statement includes: In the case where the problem type is a multi-entity first-degree problem type, determining a plurality of sub-paths according to the target path; The multiple sub-paths are concatenated to obtain a target concatenated path, and the target concatenated path is converted into the query statement.

15. The text processing method according to claim 1, characterized in that: The step of searching the knowledge base for an answer text corresponding to the question text according to the query statement includes: Querying the knowledge base for a target entity corresponding to the question text according to the query statement; The answer text corresponding to the question text is generated based on the target entity.

16. A text processing device, characterized in that: include: An acquisition module is configured to acquire a question text and identify question entities in the question text; A linking module is configured to link multiple candidate entities corresponding to the question entity in a preset knowledge base, and identify the question type of the question text according to the question entity, wherein the multiple candidate entities are entities in the knowledge base that have the same form as the question entity, and the attribute values ​​of each candidate entity are different; A determination module, configured to generate at least one candidate path corresponding to the question text based on the multiple candidate entities and the question type, and determine a target path according to the at least one candidate path; The query module is configured to convert the target path into a query statement, and query the knowledge base for an answer text corresponding to the question text according to the query statement.

17. A computing device, characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the text processing method according to any one of claims 1 to 15.

18. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by a processor, the steps of the text processing method described in any one of claims 1 to 15 are implemented.