Knowledge base question answering method and device, storage medium, and electronic device

Through the improved named entity recognition model and matching model, combined with the fusion of entity categories and named entities, the problem of degradation in the accuracy of question-and-answer in the prior art is solved, and a higher accuracy rate and better processing flow is achieved.

CN115357701BActive Publication Date: 2025-02-18CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211007481.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-22
Publication Date
2025-02-18
Estimated Expiration
2042-08-22

AI Technical Summary

Technical Problem

In the existing knowledge base question and answer system, the method of predicting the recombination of entity head and entity tail respectively leads to a decrease in model accuracy.

Method used

Using the improved named entity recognition model and matching model, we realize intent classification and named entity recognition through a model, and integrate entity categories and named entities to search for answers to the question statement.

Benefits of technology

The processing process is simplified, the accuracy of the named entity recognition model is improved, the intent classification effect is optimized, the accuracy of answer search in the Q&A method is improved, and the answer filtering time is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115357701B_ABST
    Figure CN115357701B_ABST
Patent Text Reader

Abstract

The present disclosure belongs to the technical field of natural language processing, and relates to a knowledge base question-answering method and device, a storage medium, and an electronic device. The method includes: obtaining a question statement and a database, and using an improved named entity recognition model to identify a first entity category and a first named entity in the question statement; using a matching model to identify a second entity category and a second named entity in the question statement, and fusing the first entity category and the second entity category to obtain a target entity category; fusing the first named entity and the second named entity to obtain a target named entity, and searching for an answer statement to the question statement in the database according to the target entity category and the target named entity. The present disclosure implements intent classification and named entity recognition through a model, simplifies the processing flow, improves the accuracy of the improved named entity recognition model, improves the accuracy of intent classification, optimizes the classification effect, improves the accuracy of answer search, and reduces the answer screening time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of natural language processing, and in particular to a knowledge base question and answer method and a knowledge base question and answer device, a computer-readable storage medium, and an electronic device. Background Art

[0002] Existing knowledge base question-answering systems generally include question classifiers (intent classification, named entity recognition), question parsers, and answer generators. Among them, intent recognition and named entity recognition are implemented using two models respectively, and the common named entity recognition algorithm generally uses a model in the form of a combination of BERT (Bidirectional Encoder Representations from Transformer) and CRF (Conditional Random Fields), or a reading comprehension model, to predict the startspan (entity head) and end span (entity tail) of an entity respectively.

[0003] However, using the method of predicting the entity head and entity tail separately and then combining them will lead to a decrease in model accuracy.

[0004] In view of this, there is an urgent need in this field to develop a new knowledge base question answering method and device.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] The purpose of the present disclosure is to provide a knowledge base question and answer method, a knowledge base question and answer device, a computer-readable storage medium and an electronic device, thereby overcoming the technical problem of reduced question and answer accuracy due to limitations of related technologies, at least to a certain extent.

[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0008] According to a first aspect of an embodiment of the present invention, a knowledge base question answering method is provided, the method comprising:

[0009] Acquire a question statement and a database, and use an improved named entity recognition model to identify a first entity category and a first named entity in the question statement;

[0010] Using the matching model to identify a second entity category and a second named entity in the question sentence, and fusing the first entity category and the second entity category to obtain a target entity category;

[0011] The first named entity and the second named entity are fused to obtain a target named entity, and an answer statement to the question statement is searched in the database according to the target entity category and the target named entity.

[0012] In an exemplary embodiment of the present invention, the step of identifying the first entity category and the first named entity in the question sentence by using the improved named entity recognition model includes:

[0013] Encoding the question statement to obtain a vector sequence, and linearly transforming the vector sequence to obtain an entity score, wherein the entity score represents a scoring result of multi-label classification;

[0014] A first named entity in the question sentence is identified according to the entity score, and a first entity category is determined according to the first named entity.

[0015] In an exemplary embodiment of the present invention, the identifying the second entity category and the second named entity in the question sentence by using a matching model includes:

[0016] Obtain an existing subject entity in the knowledge graph, and use the existing subject entity to match the question statement to obtain a second named entity;

[0017] Acquire intent keywords, and use the intent keywords to match the question statement to obtain a second entity category.

[0018] In an exemplary embodiment of the present invention, the step of fusing the first entity category and the second entity category to obtain a target entity category includes:

[0019] A union operation is performed on the first entity category and the second entity category to obtain a target entity category.

[0020] In an exemplary embodiment of the present invention, the step of fusing the first named entity and the second named entity to obtain a target named entity includes:

[0021] A union operation is performed on the first named entity and the second named entity to obtain a target named entity.

[0022] In an exemplary embodiment of the present invention, searching the database for an answer statement to the question statement according to the target entity category and the target named entity includes:

[0023] Converting the question statement into a query statement according to the target entity category and the target named entity, and using the query statement to search the database to obtain an initial answer;

[0024] A reply template corresponding to the initial answer is called, and an answer statement to the question statement is obtained according to the initial answer and the reply template.

[0025] In an exemplary embodiment of the present invention, the method further comprises:

[0026] When the initial answer is not found in the database by using the query statement, a fuzzy match is performed in the database using the target named entity to obtain a matching entity, so as to perform a query by using the matching entity.

[0027] According to a second aspect of an embodiment of the present invention, a knowledge base question-answering device is provided, comprising:

[0028] An entity recognition module is configured to obtain a question statement and a database, and use an improved named entity recognition model to recognize a first entity category and a first named entity in the question statement;

[0029] an intention recognition module, configured to use a matching model to recognize a second entity category and a second named entity in the question sentence, and fuse the first entity category and the second entity category to obtain a target entity category;

[0030] The answer search module is configured to fuse the first named entity and the second named entity to obtain a target named entity, and search the database for an answer statement to the question statement based on the target entity category and the target named entity.

[0031] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a processor and a memory; wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the knowledge base question-and-answer method in any of the above exemplary embodiments is implemented.

[0032] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the knowledge base question-answering method in any of the above exemplary embodiments is implemented.

[0033] It can be seen from the above technical solutions that the knowledge base question and answer method, knowledge base question and answer device, computer storage medium and electronic device in the exemplary embodiments of the present disclosure have at least the following advantages and positive effects:

[0034] In the method and apparatus provided by the exemplary embodiments of the present disclosure, an improved named entity recognition model is used to identify entity categories and named entities in question sentences, and intent classification and named entity recognition are achieved through one model, which simplifies the processing flow and improves the accuracy of the improved named entity recognition model. Furthermore, on the basis of adding intent classification and named entity recognition achieved by the matching model, the entity categories and named entities of the two dimensions are fused to search for answer sentences corresponding to the question sentences, which improves the accuracy of intent classification, optimizes the intent classification effect, improves the accuracy of answer search in the question-and-answer mode, and reduces the answer screening time.

[0035] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0037] Figure 1 A schematic diagram schematically illustrates a flow chart of a knowledge base question-answering method in an exemplary embodiment of the present disclosure;

[0038] Figure 2 A flowchart schematically illustrating a method for identifying a first entity category and a first named entity in an exemplary embodiment of the present disclosure;

[0039] Figure 3 A flowchart schematically illustrating a method for identifying a second entity category and a second named entity in an exemplary embodiment of the present disclosure;

[0040] Figure 4 A flowchart schematically illustrating a method for searching for an answer statement in a database in an exemplary embodiment of the present disclosure;

[0041] Figure 5 A schematic diagram schematically illustrates a flow chart of a knowledge base question-answering method in an application scenario in an exemplary embodiment of the present disclosure;

[0042] Figure 6 A schematic diagram schematically shows the structure of a knowledge base question-answering device in an exemplary embodiment of the present disclosure;

[0043] Figure 7 The present invention schematically illustrates an electronic device for implementing a knowledge base question answering method in an exemplary embodiment of the present disclosure;

[0044] Figure 8 The present invention schematically illustrates a computer-readable storage medium for implementing a knowledge base question answering method in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0045] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0046] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.

[0047] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings represent the same or similar parts, and their repeated descriptions will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities.

[0048] Existing knowledge base question-answering systems generally include question classifiers (intent classification, named entity recognition), question parsers, and answer generators, among which intent recognition and named entity recognition are implemented using two models respectively. Common named entity recognition algorithms generally use a model in the form of a combination of BERT and CRF or a reading comprehension model to predict the start span and end span of an entity respectively.

[0049] In fact, the intent classification problem can also be converted into a named entity recognition problem and implemented using a model. That is, the named entity recognition model is used to identify intent classifiers and distinguish the intents corresponding to different intent classifiers.

[0050] This processing method has three advantages: first, it simplifies the model process and uses one model to replace the tasks of the original two models; second, the identified intent classification words can be manually filtered and put into the matching retrieval algorithm as keywords to improve the accuracy of the model; third, the non-intent word entities of named entity recognition generally exist in the database or are similar, with high recognition accuracy. Excluding these words and stop words, the remaining words are generally intent words.

[0051] The accuracy of identifying entities of non-intended words using the named entity recognition model is extremely high. Therefore, the accuracy of identifying intended words by excluding these words is also very high. Classifying these intended words excludes some useless information compared to classifying the entire sentence, so the intent classification effect achieved by named entity recognition is better than that of general classification models.

[0052] In view of the problems existing in the related technologies, the present disclosure proposes a knowledge base question-answering method. Figure 1 A flow chart of the knowledge base question answering method is shown in FIG. Figure 1 As shown, the knowledge base question answering method includes at least the following steps:

[0053] Step S110: Obtain a question statement and a database, and use an improved named entity recognition model to identify a first entity category and a first named entity in the question statement.

[0054] Step S120: Use the matching model to identify the second entity category and the second named entity in the question sentence, and fuse the first entity category and the second entity category to obtain the target entity category.

[0055] Step S130: Fusing the first named entity and the second named entity to obtain a target named entity, and searching for an answer statement to the question statement in a database according to the target entity category and the target named entity.

[0056] In an exemplary embodiment of the present disclosure, an improved named entity recognition model is used to identify entity categories and named entities in question sentences, and intent classification and named entity recognition are achieved through one model, which simplifies the processing flow and improves the accuracy of the improved named entity recognition model. Furthermore, on the basis of adding intent classification and named entity recognition achieved by the matching model, the entity categories and named entities of the two dimensions are fused to search for answer sentences corresponding to the question sentences, which improves the accuracy of intent classification, optimizes the intent classification effect, improves the accuracy of answer search in the question-and-answer mode, and reduces the answer screening time.

[0057] The following is a detailed description of each step of the knowledge base question answering method.

[0058] In step S110, a question sentence and a database are obtained, and the first entity category and the first named entity in the question sentence are identified using an improved named entity recognition model.

[0059] In an exemplary embodiment of the present disclosure, the question statement may be a question input by a user, and the database may store an answer statement corresponding to the question statement.

[0060] Furthermore, the improved named entity recognition model can be used to achieve intent classification and named entity recognition.

[0061] In an alternative embodiment, Figure 2 A flow chart of a method for identifying a first entity category and a first named entity is shown, Figure 2 As shown, the method may at least include the following steps: in step S210, the question statement is encoded to obtain a vector sequence, and the vector sequence is linearly transformed to obtain an entity score, and the entity score represents the scoring result of the multi-label classification.

[0062] When the length of the question sentence input by the user is n, the possible entities are n(n+1) / 2.

[0063] For example, when the user inputs the question sentence "Are you XX?", then the possible entities may be "you", "you are", "you are X", "you are XX", "are you XX", ..., "?", so the number of entities is (5*6) / 2=15.

[0064] When the entity category is k, it is a k+1 classification problem of these candidate entities, where "1" includes the case where the candidate entity is not an entity.

[0065] Therefore, the BERT model is used to encode the question sentence to obtain a vector sequence h. The length of h is n, h i The vector representation of the i-th position of the vector sequence converted from the question sentence input by the user.

[0066] Furthermore, the vector sequence is transformed by α times linear transformation to obtain α groups m i and n j , the inner product of the two in group α is the score of the segment from i to j being an entity of type α To obtain the entity score.

[0067] Here, α may be equal to k+1, or may be set to other values ​​according to actual conditions, and this exemplary embodiment does not specifically limit this.

[0068] The loss function may be n(n+1) / 2 binary classification problems, or other loss functions for multi-label classification, which is not specifically limited in this exemplary embodiment.

[0069] In step S220, a first named entity in the question sentence is identified according to the entity score, and a first entity category is determined according to the first named entity.

[0070] After the entity scores are obtained, the candidate entity corresponding to the highest entity score may be determined as the first named entity in the question sentence.

[0071] Further, the corresponding first entity category is queried according to the category of the first named entity to serve as the user intention.

[0072] For example, the improved named entity recognition model is used to extract the subject entity and intent entity in the question sentence.

[0073] Among them, the main entity may include the cause of the fault, the fault phenomenon, the fault description, the fault solution and the location of occurrence, etc.; the intent entity may include an entity for checking the cause, an entity for checking the solution, an entity for checking the location and an entity for checking the number of occurrences, etc.

[0074] Furthermore, the final intent classification is confirmed based on the specific category of the extracted intent entity. For example, for the question “What is the reason for the high number of connection failures?”, “high number of connection failures” is the subject entity (fault phenomenon), while “reason” and “what is the reason” are intent entities (entities for checking the reason). Based on the category of the intent entity, it can be identified that the user’s intention is to check the reason.

[0075] In this exemplary embodiment, the results of the improved named entity recognition model are used to manually filter and obtain intended keywords and non-intended entities, thereby reducing model parameters and optimizing the effect of complex tasks.

[0076] In step S120, the matching model is used to identify the second entity category and the second named entity in the question sentence, and the first entity category and the second entity category are fused to obtain the target entity category.

[0077] In an exemplary embodiment of the present disclosure, a matching model is used to implement intent assignment and named entity recognition.

[0078] In an alternative embodiment, Figure 3 A flow chart of a method for identifying a second entity category and a second named entity is shown, such as Figure 3 As shown, the method may at least include the following steps: In step S310, an existing subject entity in the knowledge graph is obtained, and the existing subject entity is matched with the question statement to obtain a second named entity.

[0079] By matching the existing subject entities and other data in the knowledge graph with the question sentence input by the user, the corresponding subject entity can be obtained as the second named entity to achieve named entity recognition.

[0080] Among them, the existing main entities in the knowledge graph may include data such as fault causes, fault phenomena and fault solutions, and may also include other data, which is not specifically limited in this exemplary embodiment.

[0081] In step S320, the intent keywords are obtained, and the intent keywords are matched with the question statement to obtain a second entity category.

[0082] The user's question sentence is matched with the intention keyword to classify the user's question to obtain the second entity category. The matching process can be not only the same matching method, but also fuzzy matching achieved by using the text editing distance, which is not particularly limited in this exemplary embodiment.

[0083] The intent keywords used for matching may initially be historically accumulated intent entities, and then the intent words extracted by the named entity model in step S110 may be periodically used as the intent keywords for matching after manual filtering.

[0084] In this exemplary embodiment, intent classification and named entity recognition implemented by the matching model are added, which provides another dimension of data basis and support for the final target entity category and target named entity, ensuring the accuracy and completeness of the recognition.

[0085] After the first entity category and the second entity category are obtained, the first entity category and the second entity category may be fused to obtain a target entity category.

[0086] In an optional embodiment, a union operation is performed on the first entity category and the second entity category to obtain the target entity category.

[0087] For example, when the first entity category is category 1 and the second entity category is category 2, a union operation may be performed on category 1 and category 2 to obtain a target entity category including category 1 and category 2.

[0088] In step S130, the first named entity and the second named entity are fused to obtain a target named entity, and an answer statement of the question statement is searched in a database according to the target entity category and the target named entity.

[0089] In an exemplary embodiment of the present disclosure, after obtaining the first named entity and the second named entity, the first named entity and the second named entity may be fused to obtain a target named entity.

[0090] In an optional embodiment, a union operation is performed on the first named entity and the second named entity to obtain a target named entity.

[0091] For example, when the first named entity is entity 1 and the second named entity is entity 2, a union operation may be performed on entity 1 and entity 2 to obtain a target named entity including entity 1 and entity 2.

[0092] After the target entity category and the target named entity are obtained through fusion, the answer statement of the question statement can be searched in the database according to the target entity category and the target named entity.

[0093] In an alternative embodiment, Figure 4 A flow chart of a method for searching for an answer statement in a database is shown. Figure 4 As shown, the method may at least include the following steps: In step S410, the question statement is converted into a query statement according to the target entity category and the target named entity, and the query statement is used to search in the database to obtain an initial answer.

[0094] The question statement input by the user is converted into a cypher (a declarative graph query language) query statement sqls (SQL, Structured Query Language) according to the target entity category and the target named entity.

[0095] Furthermore, the cypher query statement of neo4j (a high-performance graph database) is used to search in the database to find the initial answer.

[0096] In step S420, the reply template corresponding to the initial answer is called, and the answer statement of the question statement is obtained according to the initial answer and the reply template.

[0097] After obtaining the initial answer, the reply template can be called to generate an answer statement for the question statement.

[0098] In this exemplary embodiment, the answer sentence of the question sentence is determined by using the target entity category and the target named entity, thereby improving the accuracy of the question-answering system.

[0099] In addition, when searching for the initial answer in the database based on the target entity category and the target named entity, it may be possible that the initial answer cannot be found. Therefore, the query can be performed through fuzzy matching.

[0100] In an optional embodiment, when an initial answer is not found in the database using a query statement, a fuzzy match is performed in the database using the target named entity to obtain a matching entity, so as to perform a query using the matching entity.

[0101] When searching for an initial answer to the question sentence in the database based on the target entity category and the target named entity, no answer may be found.

[0102] Therefore, the target named entity can be used to match the edit distance in the database to match similar matching entities and recommend them to the user, so that the user can query using the matching entities.

[0103] The matching may be performed by using the subject entity in the target named entity, which is not particularly limited in this exemplary embodiment.

[0104] The knowledge base question and answer method in the embodiment of the present disclosure is described in detail below in conjunction with an application scenario.

[0105] Figure 5 A schematic diagram of the process of the knowledge base question answering method in the application scenario is shown, such as Figure 5 As shown, in step S510, a user question is input.

[0106] The user can enter the question statement by typing or selecting.

[0107] In step S520, question classifier.

[0108] In step S521, the improved named entity model recognizes common entities and intended entities.

[0109] The question statement is encoded to obtain a vector sequence, and the vector sequence is linearly transformed to obtain the entity score.

[0110] When the length of the question sentence input by the user is n, the possible entities are n(n+1) / 2.

[0111] For example, when the user inputs the question sentence "Are you XX?", then the possible entities may be "you", "you are", "you are X", "you are XX", "are you XX", ..., "?", so the number of entities is (5*6) / 2=15.

[0112] When the entity category is k, it is a k+1 classification problem of these candidate entities, where "1" includes the case where the candidate entity is not an entity.

[0113] Therefore, the BERT model is used to encode the question sentence to obtain a vector sequence h. The length of h is n, h i The vector representation of the i-th position of the vector sequence converted from the question sentence input by the user.

[0114] Furthermore, the vector sequence is transformed by α times linear transformation to obtain α groups m i and nj , the inner product of the two in group α is the score of the segment from i to j being an entity of type α To obtain the entity score.

[0115] Here, α may be equal to k+1, or may be set to other values ​​according to actual conditions, and this exemplary embodiment does not specifically limit this.

[0116] The loss function may be n(n+1) / 2 binary classification problems, or other loss functions for multi-label classification, which is not specifically limited in this exemplary embodiment.

[0117] After the entity scores are obtained, the candidate entity corresponding to the highest entity score may be determined as the first named entity in the question sentence.

[0118] Further, the corresponding user intention is queried according to the category of the first named entity as the first entity category.

[0119] For example, the improved named entity recognition model is used to extract the subject entity and intent entity in the question sentence.

[0120] Among them, the main entity may include the cause of the fault, the fault phenomenon, the fault description, the fault solution and the location of occurrence, etc.; the intent entity may include an entity for checking the cause, an entity for checking the solution, an entity for checking the location and an entity for checking the number of occurrences, etc.

[0121] Furthermore, the final intent classification is confirmed based on the specific category of the extracted intent entity. For example, for the question “What is the reason for the high number of connection failures?”, “high number of connection failures” is the subject entity (fault phenomenon), while “reason” and “what is the reason” are intent entities (entities for checking the reason). Based on the category of the intent entity, it can be identified that the user’s intention is to check the reason.

[0122] In step S522, the matching model realizes intent recognition and named entity recognition.

[0123] Obtain the existing subject entities in the knowledge graph, and use the existing subject entities to match the question statement to obtain the second named entity.

[0124] By matching the existing subject entities and other data in the knowledge graph with the question sentence input by the user, the corresponding subject entity can be obtained as the second named entity to realize named entity recognition.

[0125] Among them, the existing main entities in the knowledge graph may include data such as fault causes, fault phenomena and fault solutions, and may also include other data, which is not specifically limited in this exemplary embodiment.

[0126] Obtain the intent keywords and use them to match the question statement to obtain the second entity category.

[0127] The user's question sentence is matched with the intention keyword to classify the user's question to obtain the second entity category. The matching process can be not only the same matching method, but also fuzzy matching achieved by using the text editing distance, which is not particularly limited in this exemplary embodiment.

[0128] The intent keywords used for matching can initially be historically accumulated intent entities, and then the intent words extracted by the named entity model are periodically used and manually filtered as the intent keywords used for matching.

[0129] In step S523, the result union is used as the final intent classification and entity recognition result.

[0130] After the first entity category and the second entity category are obtained, the first entity category and the second entity category may be fused to obtain a target entity category.

[0131] A union operation is performed on the first entity category and the second entity category to obtain a target entity category.

[0132] For example, when the first entity category is category 1 and the second entity category is category 2, a union operation may be performed on category 1 and category 2 to obtain a target entity category including category 1 and category 2.

[0133] After obtaining the first named entity and the second named entity, the first named entity and the second named entity may be fused to obtain a target named entity.

[0134] A union operation is performed on the first named entity and the second named entity to obtain a target named entity.

[0135] For example, when the first named entity is entity 1 and the second named entity is entity 2, a union operation may be performed on entity 1 and entity 2 to obtain a target named entity including entity 1 and entity 2.

[0136] In step S530, question parser.

[0137] The question statement entered by the user is converted into a Cypher query statement sqls according to the target entity category and the target named entity.

[0138] In step S540, answer generator.

[0139] Furthermore, the cypher query statement of neo4j is used to search in the database to search for the initial answer.

[0140] In step S550, an entity is recommended.

[0141] When searching for an initial answer to the question sentence in the database based on the target entity category and the target named entity, no answer may be found.

[0142] Therefore, the target named entity can be used to match the edit distance in the database to match similar matching entities and recommend them to the user, so that the user can query using the matching entities.

[0143] The matching may be performed by using the subject entity in the target named entity, which is not particularly limited in this exemplary embodiment.

[0144] In step S560, the question is answered.

[0145] After obtaining the initial answer, the reply template can be called to generate an answer statement for the question statement.

[0146] The knowledge base question-answering method in this application scenario uses an improved named entity recognition model to identify entity categories and named entities in question sentences, and implements intent classification and named entity recognition through one model, which simplifies the processing flow and improves the accuracy of the improved named entity recognition model. Furthermore, on the basis of adding intent classification and named entity recognition implemented by the matching model, the entity categories and named entities of the two dimensions are fused to search for the answer sentence corresponding to the question sentence, which improves the accuracy of intent classification, optimizes the intent classification effect, and improves the accuracy of answer search in the question-answering method.

[0147] This knowledge base question-and-answer method is suitable for network operation and maintenance experts to learn the latest professional knowledge from expert cases, obtain information such as fault phenomena, fault causes, fault solutions, and comparison of fault occurrences in various provinces to assist operation and maintenance.

[0148] In the era of information explosion, directly searching with natural language to get answers greatly reduces the time of information screening.

[0149] Figure 6 The structure diagram of the knowledge base question answering device is shown in FIG. Figure 6 As shown, the knowledge base question-answering device 600 may include: an entity recognition module 610, an intention recognition module 620, and an answer search module 630. Among them:

[0150] The entity recognition module 610 is configured to obtain a question statement and a database, and use an improved named entity recognition model to recognize a first entity category and a first named entity in the question statement;

[0151] The intention recognition module 620 is configured to use the matching model to identify the second entity category and the second named entity in the question sentence, and fuse the first entity category and the second entity category to obtain a target entity category;

[0152] The answer search module 630 is configured to fuse the first named entity and the second named entity to obtain a target named entity, and search the database for an answer statement to the question statement according to the target entity category and the target named entity.

[0153] In an exemplary embodiment of the present invention, the step of identifying the first entity category and the first named entity in the question sentence by using the improved named entity recognition model includes:

[0154] Encoding the question statement to obtain a vector sequence, and linearly transforming the vector sequence to obtain an entity score, wherein the entity score represents a scoring result of multi-label classification;

[0155] A first named entity in the question sentence is identified according to the entity score, and a first entity category is determined according to the first named entity.

[0156] In an exemplary embodiment of the present invention, the identifying the second entity category and the second named entity in the question sentence by using a matching model includes:

[0157] Obtain an existing subject entity in the knowledge graph, and use the existing subject entity to match the question statement to obtain a second named entity;

[0158] Acquire intent keywords, and use the intent keywords to match the question statement to obtain a second entity category.

[0159] In an exemplary embodiment of the present invention, the step of fusing the first entity category and the second entity category to obtain a target entity category includes:

[0160] A union operation is performed on the first entity category and the second entity category to obtain a target entity category.

[0161] In an exemplary embodiment of the present invention, the step of fusing the first named entity and the second named entity to obtain a target named entity includes:

[0162] A union operation is performed on the first named entity and the second named entity to obtain a target named entity.

[0163] In an exemplary embodiment of the present invention, searching the database for an answer statement to the question statement according to the target entity category and the target named entity includes:

[0164] Converting the question statement into a query statement according to the target entity category and the target named entity, and using the query statement to search the database to obtain an initial answer;

[0165] A reply template corresponding to the initial answer is called, and an answer statement to the question statement is obtained according to the initial answer and the reply template.

[0166] In an exemplary embodiment of the present invention, the method further comprises:

[0167] When the initial answer is not found in the database by using the query statement, a fuzzy match is performed in the database using the target named entity to obtain a matching entity, so as to perform a query by using the matching entity.

[0168] The specific details of the above-mentioned knowledge base question and answer device 600 have been described in detail in the corresponding knowledge base question and answer method, so they will not be repeated here.

[0169] It should be noted that although several modules or units of the knowledge base question and answer device 600 are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0170] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.

[0171] Refer to the following Figure 7 An electronic device 700 according to such an embodiment of the present invention is described. Figure 7 The electronic device 700 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0172] like Figure 7 As shown, the electronic device 700 is in the form of a general computing device. The components of the electronic device 700 may include, but are not limited to: the at least one processing unit 710, the at least one storage unit 720, a bus 730 connecting different system components (including the storage unit 720 and the processing unit 710), and a display unit 740.

[0173] The storage unit stores program codes, which can be executed by the processing unit 710, so that the processing unit 710 executes the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification.

[0174] The storage unit 720 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 721 and / or a cache memory unit 722 , and may further include a read-only memory unit (ROM) 723 .

[0175] The storage unit 720 may also include a program / utility 724 having a set (at least one) of program modules 725, such program modules 725 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0176] Bus 730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0177] The electronic device 700 may also communicate with one or more external devices 900 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 700, and / or communicate with any device that enables the electronic device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 750. Furthermore, the electronic device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 760. As shown, the network adapter 760 communicates with other modules of the electronic device 700 via a bus 730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0178] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.

[0179] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible embodiments, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.

[0180] refer to Figure 8 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0181] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0182] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0183] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0184] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0185] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

Claims

1. A knowledge base question answering method, characterized in that: The method comprises: Acquire a question statement and a database, and use an improved named entity recognition model to identify a first named entity in the question statement, and determine a first entity category according to the first named entity; the first named entity includes an intent entity; Using the matching model to identify a second entity category and a second named entity in the question sentence, and fusing the first entity category and the second entity category to obtain a target entity category; Merging the first named entity and the second named entity to obtain a target named entity, and searching the database for an answer statement to the question statement according to the target entity category and the target named entity; The step of using the improved named entity recognition model to identify the first named entity in the question sentence and determining the first entity category according to the first named entity includes: Encoding the question statement to obtain a vector sequence, and linearly transforming the vector sequence to obtain an entity score, wherein the entity score represents a scoring result of multi-label classification; A first named entity in the question sentence is identified according to the entity score, and a first entity category is determined according to the first named entity.

2. The knowledge base question answering method according to claim 1, characterized in that: The method of using a matching model to identify a second entity category and a second named entity in the question sentence includes: Obtain an existing subject entity in the knowledge graph, and use the existing subject entity to match the question statement to obtain a second named entity; Acquire intent keywords, and use the intent keywords to match the question statement to obtain a second entity category.

3. The knowledge base question answering method according to claim 1, characterized in that: The fusing the first entity category and the second entity category to obtain a target entity category includes: A union operation is performed on the first entity category and the second entity category to obtain a target entity category.

4. The knowledge base question answering method according to claim 1, characterized in that: The fusing the first named entity and the second named entity to obtain a target named entity includes: A union operation is performed on the first named entity and the second named entity to obtain a target named entity.

5. The knowledge base question answering method according to claim 1, characterized in that: The step of searching the database for an answer statement to the question statement according to the target entity category and the target named entity comprises: Converting the question statement into a query statement according to the target entity category and the target named entity, and using the query statement to search the database to obtain an initial answer; A reply template corresponding to the initial answer is called, and an answer statement to the question statement is obtained according to the initial answer and the reply template.

6. The knowledge base question answering method according to claim 5, characterized in that: The method further comprises: When the initial answer is not found in the database by using the query statement, a fuzzy match is performed in the database using the target named entity to obtain a matching entity, so as to perform a query by using the matching entity.

7. A knowledge base question-answering device, characterized in that: include: An entity recognition module is configured to obtain a question statement and a database, and use an improved named entity recognition model to recognize a first named entity in the question statement, and determine a first entity category according to the first named entity; the first named entity includes an intent entity; an intention recognition module, configured to use a matching model to recognize a second entity category and a second named entity in the question sentence, and fuse the first entity category and the second entity category to obtain a target entity category; an answer search module, configured to fuse the first named entity and the second named entity to obtain a target named entity, and search the database for an answer statement to the question statement according to the target entity category and the target named entity; The step of using the improved named entity recognition model to identify the first named entity in the question sentence and determining the first entity category according to the first named entity includes: Encoding the question statement to obtain a vector sequence, and linearly transforming the vector sequence to obtain an entity score, wherein the entity score represents a scoring result of multi-label classification; A first named entity in the question sentence is identified according to the entity score, and a first entity category is determined according to the first named entity.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the knowledge base question and answer method described in any one of claims 1 to 6 is implemented.

9. An electronic device, characterized in that: include: processor; A memory, configured to store executable instructions of the processor; The processor is configured to execute the knowledge base question answering method according to any one of claims 1 to 6 by executing the executable instructions.

Citation Information

Patent Citations

  • Question and answer method and device based on knowledge graph, storage medium, and electronic equipment

    CN113886535A

  • Insurance semantic understanding method and device based on knowledge graph, equipment and medium

    CN114372157A