Sample generation method and device of question-answering system, electronic equipment and storage medium
By generating question analysis samples, classification samples and entity link samples, a training data set for the knowledge graph question and answer system is constructed, which solves the problem of low sample generation efficiency in the existing technology and achieves efficient model training and accurate responses of the question and answer system.
Patent Information
- Application Number
- CN202310247102.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-14
- Publication Date
- 2024-09-20
AI Technical Summary
Existing knowledge graph question answering systems require massive sample data for model training, and manual configuration of training samples is inefficient and difficult to meet model training needs.
Provide a sample generation method for the question and answer system. By obtaining the pre-configured synonym set, similar question set, comparison word set, question domain set and standard entity library, it generates question analysis samples, question classification samples and entity link samples, and constructs training data. Set to improve sample generation efficiency.
Use a small amount of pre-configured data to generate a large number of training samples, reduce manual workload, improve data utilization, and improve the response accuracy of the question and answer system.
Smart Images

Figure CN118674059A
Abstract
Description
Technical Field
[0001] The present application relates to the field of knowledge graph technology, and in particular to a sample generation method, device, electronic device and storage medium for a question-answering system. Background Art
[0002] With the development of Internet technology, question-answering systems are becoming more and more widely used. They can automatically answer a variety of questions. Compared with manual answers, they are efficient, fast, and have a high accuracy rate. However, in practical applications, question-answering systems involving knowledge graphs are often highly customized. The amount of sample data required for model training of such question-answering systems is very large. If training samples are manually configured, the efficiency is low and it is difficult to meet the model training requirements. Summary of the invention
[0003] The embodiments of the present application provide a sample generation method, device, electronic device and storage medium for a question-and-answer system to improve sample generation efficiency.
[0004] In a first aspect, an embodiment of the present application provides a sample generation method for a question-answering system, the method comprising:
[0005] Acquire a pre-configured synonym set, similar question set, comparative word set, problem domain set and standard entity library; the synonym set includes a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set includes a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set includes comparative word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes a plurality of standard entities;
[0006] Generate a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set;
[0007] Generate a question classification sample according to the question parsing sample and the question domain set; and generate the entity linking sample according to the question parsing sample and the standard entity library;
[0008] A training data set for the question answering system is constructed based on the question classification samples, the question parsing samples, and the entity linking samples.
[0009] In a second aspect, an embodiment of the present application provides a model training method for a question-answering system, comprising:
[0010] Generate a training data set by using the sample generation method of the question answering system as described in the first aspect; the training data set includes the question classification sample, the question parsing sample and the entity linking sample;
[0011] The question classification samples are input into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; the question parsing samples are input into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; the entity linking samples are input into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0012] In a third aspect, an embodiment of the present application provides a response method, including:
[0013] Get the target questions to be answered;
[0014] Inputting the target question into a question classification model for classification processing to obtain a classification result; the question classification model is obtained by inputting question classification samples in a training data set into an initial question classification model for training; the training data set is generated by the sample generation method of the question answering system as described in the first aspect;
[0015] In the case where the classification result is used to characterize that the target question belongs to the first preset classification, the target question is input into a question parsing model for parsing processing to obtain a corresponding target segment; the question parsing model is obtained by inputting question parsing samples in the training data set into an initial question parsing model for training;
[0016] Inputting the target segment into an entity linking model for prediction processing to obtain a corresponding target entity; the entity linking model is obtained by inputting entity linking samples in the training data set into an initial entity linking model for training;
[0017] An answer to the target question is determined based on the target entity.
[0018] In a fourth aspect, an embodiment of the present application provides a sample generation device of a question-answering system, the device comprising:
[0019] A first acquisition unit is used to acquire a pre-configured synonym set, a similar question set, a comparative word set, a problem domain set, and a standard entity library; the synonym set includes a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set includes a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set includes comparative word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes a plurality of standard entities;
[0020] A first generating unit, configured to generate a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set;
[0021] A second generating unit is used to generate a question classification sample according to the question parsing sample and the question domain set; and to generate the entity linking sample according to the question parsing sample and the standard entity library;
[0022] A construction unit is used to construct a training data set for the question answering system according to the question classification samples, the question parsing samples and the entity linking samples.
[0023] In a fifth aspect, an embodiment of the present application provides a model training device for a question-answering system, comprising:
[0024] A third generating unit, configured to generate a training data set by using the sample generating method of the question answering system as described in the first aspect; the training data set includes the question classification sample, the question parsing sample, and the entity linking sample;
[0025] A training unit is used to input the question classification samples into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; input the question parsing samples into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; input the entity linking samples into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0026] In a sixth aspect, an embodiment of the present application provides a response device, including:
[0027] A second acquisition unit, used to acquire a target question to be answered;
[0028] A classification unit, used for inputting the target question into a question classification model for classification processing to obtain a classification result; the question classification model is obtained by inputting question classification samples in a training data set into an initial question classification model for training; the training data set is generated by the sample generation method of the question answering system according to any one of claims 1 to 7;
[0029] A parsing unit, configured to input the target question into a question parsing model for parsing and obtaining a corresponding target segment when the classification result is used to characterize that the target question belongs to a first preset classification; the question parsing model is obtained by inputting question parsing samples in the training data set into an initial question parsing model for training;
[0030] A prediction unit, used for inputting the target segment into an entity linking model for prediction processing to obtain a corresponding target entity; the entity linking model is obtained by inputting entity linking samples in the training data set into an initial entity linking model for training;
[0031] A determination unit is used to determine an answer to the target question according to the target entity.
[0032] In the seventh aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory configured to store computer-executable instructions, wherein when the computer-executable instructions are executed, the processor executes the sample generation method of the question-answering system as described in the first aspect, or the model training method of the question-answering system as described in the second aspect, or the answering method as described in the third aspect.
[0033] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium for storing computer-executable instructions, which, when executed by a processor, implement the sample generation method for the question-answering system as described in the first aspect, or the model training method for the question-answering system as described in the second aspect, or the answering method as described in the third aspect.
[0034] It can be seen that in the embodiment of the present application, first, a pre-configured synonym set, similar question set, comparison word set, problem domain set and standard entity library are obtained; the synonym set includes multiple standard words and at least one synonym corresponding to each standard word; the similar question set includes multiple first attributes and at least one similar question sentence corresponding to each first attribute; the comparison word set includes comparison word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes multiple standard entities; then, based on at least one of the synonym set, similar question set and comparison word set, a question parsing sample is generated; then, based on the question parsing sample and the problem domain set, a question classification sample is generated; and, based on the question parsing sample and the standard entity library, an entity link sample is generated; finally, based on the question classification sample, the question parsing sample and the entity link sample, a training data set for the question-answering system is constructed. In this way, on the one hand, question parsing samples, question classification samples and entity linking samples are generated according to the pre-configured synonym sets, similar question sets, comparative word sets, problem domain sets and standard entity libraries, so that a large number of training samples can be generated using a small amount of pre-configured data, thereby improving the efficiency of sample generation and reducing manual workload; on the other hand, question parsing samples can not only be used to train the initial question parsing model, but also can be used to generate question classification samples and entity linking samples, thereby improving data utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.
[0036] Figure 1 A processing flow chart of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0037] Figure 2 A schematic diagram of a question-answering system provided in an embodiment of the present application;
[0038] Figure 3 A first processing flow subgraph of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0039] Figure 4 A second processing flow sub-graph of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0040] Figure 5 A third processing flow sub-graph of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0041] Figure 6 A fourth processing flow sub-graph of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0042] Figure 7 A fifth processing flow sub-graph of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0043] Figure 8 A sixth processing flow sub-graph of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0044] Fig. 9 A seventh processing flow sub-graph of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0045] Fig.10 The eighth processing flow sub-graph of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0046] Fig.11 A processing flow chart of a model training method for a question-answering system provided in an embodiment of the present application;
[0047] Fig.12 A processing flow chart of a response method provided in an embodiment of the present application;
[0048] Fig.13 A working principle diagram of a question-and-answer system provided in an embodiment of the present application;
[0049] Fig.14 A schematic diagram of a sample generation device of a question-answering system provided in an embodiment of the present application;
[0050] Fig.15 A schematic diagram of a model training device for a question-answering system provided in an embodiment of the present application;
[0051] Fig.16 A schematic diagram of a response device provided in an embodiment of the present application;
[0052] Fig.17 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0054] Question-answering systems involving knowledge graphs are usually highly customized and require a large number of training samples to participate in model training in order to achieve good model effects and thus achieve efficient and accurate automatic responses. However, if training samples are manually configured, the efficiency is very low and it is difficult to meet the model training requirements. In order to solve the above problems, an embodiment of the present application provides a sample generation method for a question-answering system.
[0055] Figure 1 A processing flow chart of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 1 The sample generation method of the question-answering system can be executed by an electronic device, which can be a terminal device, such as a mobile phone, a laptop computer, an intelligent interactive device, etc.; or, the electronic device can also be a server, such as an independent physical server, a server cluster, or a cloud server capable of cloud computing. Figure 1 The sample generation method of the question-answering system provided in this embodiment specifically includes steps S102 to S108.
[0056] The question answering system may include an initial question classification model, an initial question parsing model, and an initial entity linking model.
[0057] The initial problem classification model can be an untrained OOD (out of the design scope) model.
[0058] In specific implementation, the question domain can be pre-configured. Questions within the question domain are called in-domain questions, and questions outside the question domain are called out-of-domain questions. The question-answering system has the ability to answer in-domain questions, but does not have the ability to answer out-of-domain questions. The OOD model can be used to classify the received questions, and the classification results include at least: in-domain questions and out-of-domain questions.
[0059] The initial question parsing model may be an untrained relation extraction model. The relation extraction model may be used to perform slot recognition processing to obtain slot recognition results, which include but are not limited to: entities, attributes, relations, constraints, and the like.
[0060] Entities can be names of people, places, organizations, pre-set proper nouns, etc. Concepts, also known as classes, are abstract descriptions of a collection of objects with the same characteristics. Concepts can be used to reflect categories. A concept can correspond to multiple entities.
[0061] For example, the concept "plant" can correspond to the following entities: "willow", "cactus", "cherry blossom", and so on.
[0062] Attributes can be used to reflect the characteristics of an entity. A concept can correspond to multiple attributes.
[0063] For example, the concept "plant" can correspond to the following attributes: "name", "type", "shape", "growing environment", "distribution range" and "propagation method", etc.
[0064] For each attribute, you can pre-configure the attribute name, attribute type, and attribute description.
[0065] Among them, attribute types include but are not limited to: text, number, image, rich text, and json.
[0066] Relationships are used to describe the connection between concepts. They are divided into classification relationships and non-classification relationships. There are four basic binary relationships between concepts. Among them, is-a is a classification relationship, and the others are non-classification relationships. In practical applications, the relationship between concepts is not limited to these four relationships. You can customize the corresponding relationship according to the specific field and specific application, such as "cause and effect".
[0067] A constraint may be a restriction condition. For example, in the question “What are the services with an annual interest rate less than x%?”, the slot recognition result of “annual interest rate less than x%” is a constraint.
[0068] The initial entity linking model can be an untrained Bert classification model. The Bert classification model can be used to perform classification prediction processing to link the entity fragment of the input model to an entity node in a pre-configured knowledge graph.
[0069] The knowledge graph includes multiple entity nodes, each of which corresponds to an entity. The knowledge graph can be constructed by extracting knowledge through ontology and corpus to form triples, and knowledgeize business data.
[0070] Figure 2 A schematic diagram of the framework of a question-answering system provided in an embodiment of the present application.
[0071] like Figure 2 As shown, before the question answering system is put into use, it is necessary to first perform model training through the model training part. Specifically, it is necessary to iteratively train the initial question parsing model to obtain the question parsing model 202; it is necessary to iteratively train the initial entity linking model to obtain the entity linking model 204; it is necessary to iteratively train the initial OOD model to obtain the OOD model 206. To this end, data preparation is required before model training. Specifically, the training data set to be generated includes: a question parsing data set 208 for iteratively training the initial question parsing model, an entity linking data set 210 for iteratively training the initial entity linking model, and an OOD data set 212 for iteratively training the initial OOD model.
[0072] Step S102, obtaining a pre-configured synonym set, similar question set, comparison word set, problem domain set and standard entity library; the synonym set includes multiple standard words and at least one synonym corresponding to each standard word; the similar question set includes multiple first attributes and at least one similar question sentence corresponding to each first attribute; the comparison word set includes comparison word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes multiple standard entities.
[0073] During specific implementation, the synonym set may be obtained from a pre-configured synonym template.
[0074] In the synonym template, the following fields can be displayed: standard word, type, synonym, update time, operation, etc. Specifically:
[0075] (a1) Standard words: automatically generated by the system, the values are derived from the entities and attributes defined in the corresponding graph;
[0076] (a2) Type: Automatically generated by the system, the value comes from the type corresponding to the entity and attribute defined in the corresponding graph.
[0077] (a3) Synonyms: Manually enter via "Edit" or batch enter via "Upload Synonyms".
[0078] (a4) Update time: the time when the synonym was last modified.
[0079] The synonym set includes multiple standard words and at least one synonym corresponding to each standard word. For example, the synonym set includes:
[0080] Standard word x1, synonyms x2, x3 and x4 corresponding to the standard word x1;
[0081] Standard word y1, and the synonym y2 corresponding to the standard word y1;
[0082] Standard word z1, synonym z2 and synonym z3 corresponding to the standard word z1, and so on.
[0083] During specific implementation, the similar question set can be obtained from a pre-configured similar question template.
[0084] In the similarity question template, the entity type column corresponds to the concept, the attribute column corresponds to the attribute, and similar questions are constructed for the attributes. When maintaining the similarity question template, pay attention to configuring the mask [e], that is, leaving space for filling in synonyms.
[0085] For example, "How do I apply for this parking space loan?" should be maintained as "How do I apply for this [e]?" in the similar question template.
[0086] Similar question templates can be used in question parsing datasets to form complete sentences together with synonyms and comparative words, simulating user questions in real scenarios.
[0087] In the similarity question template, the following fields can be displayed: concept, attribute name, attribute type, similarity question, update time, operation, etc. Specifically:
[0088] (b1) Concept: corresponds to the concept defined in the graph, which can be searched but cannot be added or edited.
[0089] (b2) Attribute type: corresponds to the attribute defined in the graph and cannot be edited.
[0090] Attribute types include but are not limited to: text, number, image, rich text, Map, etc.
[0091] (b3) Similar questions: Similar questions of a specific attribute can be maintained individually or imported in batches. There can be one or more similar questions.
[0092] (b4) Update time: The time when the similar question was last modified.
[0093] (b5) Operation: Edit, Delete.
[0094] The similar question set includes multiple first attributes and at least one similar question sentence corresponding to each first attribute. For example, the similar question set includes:
[0095] A first attribute A, and similar question A1 and similar question A2 corresponding to the first attribute A;
[0096] The first attribute B, and the similar question sentence B1 corresponding to the first attribute B, and so on.
[0097] During specific implementation, the comparison word set may be obtained from a pre-configured comparison word template.
[0098] The comparison word template can be used to generate a question parsing dataset. The maintainable candidate words are mainly attribute words with the concept attribute type of "number". Its purpose is to ensure that training data of relevant comparison types are generated in the parsing dataset.
[0099] The comparative word information may include a comparative word and a unit.
[0100] Comparative words include but are not limited to: lowest, smallest, least, shortest, cheapest, low, small, few, short, cheap, highest, largest, most, longest, most expensive, high, big, many, long, expensive, etc.
[0101] Units include but are not limited to: yuan, thousand, thousand yuan, ten thousand, ten thousand yuan, hundred million yuan, day, day, month, year, %, percent, etc.
[0102] During specific implementation, the problem domain set may be obtained from a pre-configured problem domain template.
[0103] The question domain template is used to generate OOD model data sets and maintain some questions and small talk that the question-answering system cannot answer. The backend will sample some question parsing data sets to form binary positive and negative samples to ensure the reasonable leakage of question-answering data. Due to certain limitations in generating data, the OOD template provides editing and importing of both in-domain and out-of-domain questions to ensure classification accuracy and data maintainability.
[0104] The question domain set includes in-domain question texts and out-of-domain question texts.
[0105] The question domain set can be generated based on the pre-configured question domain. The question answering system has the ability to answer questions within the domain, but does not have the ability to answer questions outside the domain.
[0106] An in-domain problem may be a problem within the problem domain, and the text used to describe the in-domain problem may be the in-domain problem text. An out-of-domain problem may be a problem outside the problem domain, and the text used to describe the out-of-domain problem may be the out-of-domain problem text.
[0107] In-domain question text, such as "When is the deadline for activity A?"; out-of-domain question text, such as "Should I go out today?"
[0108] Step S104: Generate a question analysis sample according to at least one of the synonym set, the similar question set and the comparative word set.
[0109] The problem analysis samples include but are not limited to: single slot samples, single attribute samples, single entity single attribute samples, single entity dual attribute samples, dual entity single attribute samples, dual entity dual attribute samples, composite attribute constraint samples, comparison type samples, etc. Exemplarily, the generated problem analysis samples can be stored in the following format:
[0110]
[0111] The above storage format is merely exemplary and does not constitute any special limitation to this embodiment.
[0112] The graph attribute may be an attribute of the generated data in the graph, and is used to indicate the storage intention of the generated data in the graph.
[0113] Different types of question parsing samples are generated in different ways, and several of them are described in detail below.
[0114] In a specific implementation, a question parsing sample is generated based on at least one of a synonym set, a similar question set, and a comparative word set, including: filtering the synonym set according to a first preset filtering condition to obtain a candidate word list; the candidate word list includes candidate standard words and candidate synonyms corresponding to the candidate standard words; performing a first sampling process on the candidate word list to obtain a single-slot sample, and determining the single-slot sample as a question parsing sample; or performing a second sampling process on multiple first attributes in the similar question set to obtain a target first attribute; performing a third sampling process on at least one similar question sentence corresponding to the target first attribute to obtain an initial similar question sentence; determining a corresponding single-attribute sample based on the initial similar question sentence, and determining the single-attribute sample as a question parsing sample.
[0115] Problem analysis samples may include single-slot samples or single-attribute samples.
[0116] In specific implementation, when the question analysis sample includes a single-slot sample, the question analysis sample is generated according to at least one of a synonym set, a similar question set and a comparative word set. The synonym set may be filtered according to a first preset filtering condition to obtain a candidate word list; the candidate word list includes candidate standard words and candidate synonyms corresponding to the candidate standard words; and the candidate word list is subjected to a first sampling process to obtain a single-slot sample.
[0117] A single-slot sample may be a text sample that corresponds to only one preset slot type among multiple preset slot types such as entity, attribute, relationship, constraint, etc.
[0118] Each preset slot type corresponds to one of the aforementioned slot identification results.
[0119] For example, the question "What is the price of product A?" is processed by slot recognition through the relationship extraction model, and the obtained slot recognition results include: the slot recognition result of "product A" is "entity", the slot recognition result of "price" is "attribute", and so on.
[0120] The slot recognition result "entity" corresponds to the preset slot type "entity". The single slot samples belonging to the preset slot type "entity" can be "A product", "B activity", "C product and D product", and so on.
[0121] The slot recognition result "attribute" corresponds to the preset slot type "attribute". Single slot samples belonging to the preset slot type "attribute" may be "price", "activity deadline", "interest rate", "discount", and so on.
[0122] The generation of single-slot samples is to simulate questions asked when the user's intention is unclear, and can be used in guided rhetorical questions and continuous rhetorical questions scenarios.
[0123] Exemplarily, a single-slot sample may be a single-entity sample, a double-entity sample, or a single-constraint sample.
[0124] It should be noted that although the "dual-entity sample" includes two entities, the two entities both correspond to a preset slot type, namely the preset slot type "entity", so the "dual-entity sample" is also a single-slot sample.
[0125] Figure 3 This is a first processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 3 An exemplary method of generating a single-slot sample is shown. The single-slot sample includes but is not limited to: single entity data 308 , double entity data 310 , and single constraint data 312 .
[0126] like Figure 3 As shown, the first preset filtering condition may include the filtering condition "entity" and the filtering condition "json key". Based on the filtering condition "entity", the synonym set 302 is filtered to obtain a candidate word list 304, and the candidate word list 304 is subjected to a first sampling process to generate single entity data 308 and / or double entity data 310. The sampling method of the first sampling process may be random sampling or other sampling methods.
[0127] Single entity data 308, for example,
[0128]
[0129] Among them, "Bill Business" in the "text" row may be the generated data, that is, the text corresponding to the single entity data 308. "NULL" may be a graph attribute, used to indicate that the storage intention of the single entity data 308 is empty. "0" may be the start position of the header entity, "4" may be the end position of the header entity, "Business" may be the header entity category, and "Bill Business" in the "value" row may be the standard name of the header entity.
[0130] Based on the filtering condition “json key”, the synonym set 302 is filtered to obtain a candidate word list 306 , and the candidate word list 306 is first sampled to generate single constraint data 312 .
[0131] Single constraint data 312, for example,
[0132]
[0133]
[0134] Among them, "X Branch" in the "text" row may be the generated data, that is, the text corresponding to the single constraint data 312. "Process flow" may be a graph attribute, used to indicate that the storage intention of the single constraint data 312 is the process flow. "0" may be the start position of the header entity, "4" may be the end position of the header entity, "constraint" may be the header entity category, and "X Branch" in the "value" row may be the standard name of the header entity.
[0135] In a specific implementation, when the question parsing sample includes a single-attribute sample, the question parsing sample is generated according to at least one of a synonym set, a similar question set, and a comparative word set. The second sampling process may be performed on multiple first attributes in the similar question set to obtain a target first attribute; a third sampling process may be performed on at least one similar question sentence corresponding to the target first attribute to obtain an initial similar question sentence; and a corresponding single-attribute sample is determined according to the initial similar question sentence, and the single-attribute sample is determined as the question parsing sample.
[0136] Specifically, according to the initial similar question, the corresponding single-attribute sample is determined, and the single-attribute sample is determined as the question parsing sample. It can be: if the initial similar question carries a mask, the mask is deleted in the initial similar question to obtain the single-attribute sample; if the initial similar question does not carry a mask, the initial similar question is determined as a single-attribute sample.
[0137] A single attribute sample can be a text sample that only corresponds to the preset slot type "attribute". A single attribute sample can be a special single slot sample. Since the purpose of a single attribute sample is different from the "single entity sample", "double entity sample" and "single constraint sample" listed above, it is explained separately.
[0138] The generation of single-attribute samples is to simulate questions asked by users when the subject is unknown, and is used in guided rhetorical questions and continuous rhetorical questions scenarios.
[0139] Figure 4 This is a second processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 4 A method of generating a single-attribute sample is exemplarily shown. The single-attribute sample may be the single-attribute data 408 .
[0140] like Figure 4 As shown, a second sampling process is performed on multiple first attributes in the similar question set 402 to obtain a target first attribute; a third sampling process is performed on at least one similar question sentence corresponding to the target first attribute to obtain an initial similar question sentence. If the initial similar question sentence carries a mask, that is, the initial similar question sentence is a similar question sentence 404 with [e], then [e] is deleted to obtain single attribute data 408; if the initial similar question sentence does not carry a mask, that is, the initial similar question sentence is a similar question sentence 406 without [e], then the similar question sentence 406 is determined as single attribute data 408.
[0141] The processing methods of the second sampling process and the third sampling process may be random sampling or other sampling methods.
[0142] Single attribute data 408, for example,
[0143]
[0144] Among them, "What is the handling process?" in the "text" row may be generated data, that is, the text corresponding to the single attribute data 408. "Handling process" may be a graph attribute, used to indicate that the storage intention of the single attribute data 408 is the handling process. The single attribute data 408 has neither a head entity nor a tail entity.
[0145] In a specific implementation, a question parsing sample is generated according to at least one of a synonym set, a similar question set and a comparison word set, including: filtering the synonym set according to a second preset filtering condition to obtain a candidate entity word list; the candidate entity word list includes multiple candidate entity words; screening the similar question set to obtain an intermediate similar question set; the intermediate similar question set includes multiple first attributes and at least one candidate similar question sentence carrying a mask corresponding to each first attribute; determining target candidate entity words and target candidate similar question sentences corresponding to the same attribute category according to the candidate word list and the intermediate similar question set; replacing the mask in the target candidate similar question sentence with the target candidate entity word to obtain a composite sample, and determining the composite sample as a question parsing sample; or filtering the synonym set according to a third preset filtering condition to obtain attribute synonyms and entity synonyms; generating random numbers; splicing the comparison word information, attribute synonyms, entity synonyms, random numbers and preset description words to obtain comparison type samples, and determining the comparison type samples as question parsing samples.
[0146] Problem analysis samples may include composite samples or comparative samples.
[0147] In a specific implementation, when the question parsing sample includes a composite sample, the question parsing sample is generated according to at least one of a synonym set, a similar question set and a comparative word set. The method may be to filter the synonym set according to a second preset filtering condition to obtain a candidate entity word list; the candidate entity word list includes a plurality of candidate entity words; the similar question set is screened to obtain an intermediate similar question set; the intermediate similar question set includes a plurality of first attributes and at least one candidate similar question sentence carrying a mask corresponding to each first attribute; according to the candidate word list and the intermediate similar question set, the target candidate entity words and the target candidate similar question sentence corresponding to the same attribute category are determined; and the mask in the target candidate similar question sentence is replaced by the target candidate entity word to obtain a composite sample.
[0148] A composite sample may be a text sample corresponding to multiple preset slot types among multiple preset slot types such as entity, attribute, relationship, constraint, etc.
[0149] Composite samples include but are not limited to: single-entity single-attribute samples, single-entity dual-attribute samples, dual-entity single-attribute samples, and dual-entity dual-attribute samples, etc.
[0150] Among them, the generation of single-entity single-attribute samples is to simulate the questions when users normally ask about the attributes of a thing, and is used in single-entity single-attribute scenarios. The generation of single-entity dual-attribute samples is to simulate the questions when users ask about two or more attributes of a thing at the same time, and is used in single-entity multi-attribute scenarios. The generation of dual-entity single-attribute samples is to simulate the questions when users ask about the same attribute of multiple things at the same time, and is used in multi-entity single-attribute scenarios. The generation of dual-entity dual-attribute samples is to simulate the questions when users ask about multiple attributes of multiple things at the same time, and is used in multi-entity multi-attribute scenarios.
[0151] Figure 5 This is the third processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 5 The example shows a generation method of a composite sample, and the composite sample may be composite data 512. Composite data 512 includes but is not limited to: single-entity single-attribute data, single-entity dual-attribute data, dual-entity single-attribute data, and dual-entity dual-attribute data.
[0152] like Figure 5 As shown, the second preset filtering condition may include the filtering condition "entity". Based on the filtering condition "entity", the synonym set 502 is filtered to obtain a candidate entity word list; the candidate entity word list includes multiple candidate entity words; the similar question set 504 is screened to obtain an intermediate similar question set; the intermediate similar question set includes multiple first attributes and at least one candidate similar question sentence 506 with a mask corresponding to each first attribute; according to the candidate word list and the intermediate similar question set, the candidate entity word and candidate similar question sentence 508 corresponding to each attribute category are determined; the candidate entity word and candidate similar question sentence 508 corresponding to each attribute category are randomly sampled to obtain the target candidate entity word and target candidate similar question sentence 510 corresponding to the same attribute category; the mask [e] in the target candidate similar question sentence is replaced by the target candidate entity word to obtain composite data 512.
[0153] Determine the target candidate entity words and target candidate similar questions 510 of the same attribute category; replace the mask [e] in the target candidate similar questions with the target candidate entity words to obtain composite data 512, which can be, randomly select a target candidate entity word and a target candidate similar question under the same attribute category, and replace the mask [e] in the target candidate similar questions with the target candidate entity word to obtain single entity single attribute data.
[0154] Single-entity single-attribute data, for example,
[0155]
[0156] Among them, "Where to support the processing of business A" can be the generated data, that is, the text corresponding to the single-entity single-attribute data. "Processing channel" can be a graph attribute, which is used to indicate that the storage intention of the single-entity single-attribute data is the processing channel. "9" can be the starting position of the header entity, "12" can be the ending position of the header entity, "Business" can be the header entity category, and "Business A" can be the standard name of the header entity.
[0157] Determine the target candidate entity words and target candidate similar questions 510 of the same attribute category; replace the mask [e] in the target candidate similar questions through the target candidate entity words to obtain composite data 512. Alternatively, randomly select a target candidate entity word and two target candidate similar questions under the same attribute category, replace the mask [e] in the first target candidate similar question through the target candidate entity words to obtain attribute question 1, and delete [e] in the second target candidate similar question to obtain attribute question 2, and concatenate attribute question 1 and attribute question 2 to obtain single-entity dual-attribute data.
[0158] Single entity dual attribute data, for example,
[0159]
[0160] Among them, "What information do I need to submit to handle business X? What are the application requirements?" can be the generated data, that is, the text corresponding to the single-entity dual-attribute data. "Handling information" and "Handling conditions" can be two different graph attributes, used to indicate that the storage intention of the single-entity dual-attribute data includes handling information and handling conditions. "4" can be the starting position of the header entity, "11" can be the ending position of the header entity, "Business" can be the header entity category, "Export Letter of Credit" can be the first header entity standard name, and "X" can be the second header entity standard name.
[0161] It should be noted that, in the single-entity dual-attribute data, the first header entity and the second header entity are the same entity, so the starting position of the first header entity is the same as the starting position of the second header entity, and the ending position of the first header entity is the same as the ending position of the second header entity.
[0162] Determine the target candidate entity words and target candidate similar questions 510 of the same attribute category; replace the mask [e] in the target candidate similar questions through the target candidate entity words to obtain composite data 512. Alternatively, randomly select two target candidate entity words and a target candidate similar question under the same attribute category, randomly select one of multiple preset splicing methods as the target splicing method, splice the two target candidate entity words through the target splicing method to obtain the target splicing method, and replace the mask [e] in the target candidate similar questions through the target splicing word to obtain dual-entity parametric data.
[0163] A preset splicing method, for example, uses one of “and”, “and”, “,”, “,” to splice two words together.
[0164] Dual-entity single-attribute data, for example,
[0165]
[0166]
[0167] Among them, "How much is the credit limit for business A and business B" can be the generated data, that is, the text corresponding to the dual-entity single-attribute data. "Amount" can be a graph attribute, used to indicate that the storage intention of the dual-entity single-attribute data is the amount. "0" can be the starting position of the first header entity, "6" can be the ending position of the first header entity, "7" can be the starting position of the second header entity, "12" can be the ending position of the second header entity, "Business" can be the header entity category, "A Business" can be the standard name of the first header entity, and "B Business" can be the standard name of the second header entity.
[0168] It should be noted that, in the dual-entity single-attribute data, the first head entity and the second head entity are two different entities, but the graph attributes of the two entities are the same.
[0169] Figure 6 This is the fourth processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 6 A method for generating a dual-entity dual-attribute sample is exemplarily shown. The dual-entity dual-attribute sample may be dual-entity dual-attribute data 606 .
[0170] In specific implementation, multiple data can be randomly selected from the multiple generated single-entity single-attribute data, for example, single-entity single-attribute data 602 and single-entity single-attribute data 604, and single-entity single-attribute data 602 and single-entity single-attribute data 604 can be spliced together through randomly selected connectors to form dual-entity dual-attribute data 606.
[0171] Dual-entity dual-attribute data 606, for example,
[0172]
[0173]
[0174] Among them, "What are the specific ways to use the credit limit of product Y, and what kind of cards can generally be used for business Z" can be the generated data, that is, the text corresponding to the dual-entity and dual-attribute data. "Use of credit limit" and "Type" can be two different graph attributes, used to indicate that the storage intention of the dual-entity and dual-attribute data includes the use of credit limit and the type. "0" can be the starting position of the first header entity, "3" can be the end position of the first header entity, "16" can be the starting position of the second header entity, "24" can be the end position of the second header entity, "Business" can be the header entity category, "Y Product" can be the standard name of the first header entity, and "Z Business" can be the standard name of the second header entity.
[0175] in addition, Figure 7 This is the fifth processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 7 The example shows a method for generating a composite attribute constraint sample. The composite attribute constraint sample may be composite attribute constraint data 716.
[0176] The generation of compound attribute constraint samples is to simulate the questions asked by users when they ask about a certain attribute of a certain thing under certain limited conditions. They are used in compound attribute constraint scenarios and continuous rhetorical question scenarios.
[0177] like Figure 7 As shown, based on the filter condition "json key", the synonym set 702 is filtered to obtain json attribute synonyms 706, and based on the filter condition "entity", the synonym set 702 is filtered to obtain entity synonyms 708.
[0178] The similar question set 704 is screened to obtain similar questions with masks, that is, similar questions 710 with [e].
[0179] According to the json attribute synonyms 706, entity synonyms 708 and similar questions 710 with [e], the entity synonyms, json attribute synonyms and similar questions 712 corresponding to each attribute category can be determined.
[0180] By randomly sampling the entity synonyms, json attribute synonyms, and similar questions 712 corresponding to each attribute category, target entity synonyms, target json attribute synonyms, and target similar questions 714 can be obtained. The [e] in the target similar questions is replaced by the target entity synonyms to obtain the intermediate similar questions, and then the splicing method is randomly determined. The target json attribute synonyms and the intermediate similar questions are spliced according to the determined splicing method to obtain the composite attribute constraint data 716.
[0181] Composite attribute constraint data 716, for example,
[0182]
[0183] Among them, "Can you tell me about the processing flow of business B mobile banking?" can be the generated data, that is, the text corresponding to the composite attribute constraint data 716. "Process flow" can be a graph attribute, used to indicate that the storage intention of the composite attribute constraint data 716 is the processing flow. "3" can be the starting position of the head entity, "6" can be the ending position of the head entity, "11" can be the starting position of the tail entity, "15" can be the ending position of the tail entity, "business" can be the head entity category, "constraint" can be the tail entity category, "business B" can be the head entity standard name, and "mobile banking" can be the tail entity standard name.
[0184] In specific implementation, when the question analysis sample includes a comparison type sample, the question analysis sample is generated according to at least one of a synonym set, a similar question set and a comparison word set. The synonym set can be filtered according to a third preset filtering condition to obtain attribute synonyms and entity synonyms; a random number is generated; and a splicing process is performed based on the comparison word information, attribute synonyms, entity synonyms, random numbers and preset description words to obtain a comparison type sample.
[0185] It should be noted that, in the first preset filtering condition, the second preset filtering condition and the third preset filtering condition, “first”, “second” and “third” are only used to distinguish different filtering conditions and have no actual meaning.
[0186] The generation of comparison type samples is to simulate users asking questions that require numerical comparison, such as the maximum, minimum, greater than, less than, and between, of a certain attribute under a certain category of things, and is used in comparison sentence scenarios.
[0187] Figure 8 This is the sixth processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 8 A method of generating a comparison type sample is exemplarily shown, and the comparison type sample may be the comparison type data 812 .
[0188] like Figure 8 As shown, the synonym set 804 is filtered according to the third preset filtering condition to obtain attribute synonyms 806 and entity synonyms 808.
[0189] A random number 810 is generated.
[0190] Comparison word information 802 , attribute synonyms 806 , entity synonyms 808 , random numbers 810 , and preset description words in the comparison word set are concatenated to obtain comparison type data 812 .
[0191] Comparison type data 812, for example,
[0192]
[0193] Among them, "M product can be up to how many years" can be the generated data, that is, the text corresponding to the comparison type data 812. "Term" can be a graph attribute, used to indicate that the storage intention of the comparison type data 812 is the term. "0" can be the starting position of the header entity, "4" can be the ending position of the header entity, "Business" can be the header entity category, and "Asset Business" can be the standard name of the header entity.
[0194] Preset descriptive words, for example, what are there, what are there, which ones, what are all, what are there, let me tell you about it, etc.
[0195] In specific implementation, the comparison word information can be synchronized from the comparison word template, such as attributes, comparison words, units, etc.; the attribute synonyms of digital type in the synonym template, such as amount, quota, term, etc., are taken, and the entities of the same type of non-leaf nodes are obtained from the entity synonyms; when generating maximum, minimum, greater than, and less than type data, the attribute synonyms, comparison words, generated random numbers, and units are first spliced, and then the spliced string is randomly selected at a position with the entity synonyms and preset description words for splicing.
[0196] Assuming that the above contents are ABC, the possible splicing is: ABC, ACB, BAC, BCA, CBA, CAB, etc., which constitute the attribute question.
[0197] During specific implementation, the data of numerical single constraint may also be composed of comparison words, random numbers, and units, for example, greater than 4.35% and less than 5 years.
[0198] In specific implementation, we can also select entities and synonyms of the same type as leaf nodes in the knowledge graph, randomly select a splicing method to splice two entity synonyms, and then use the conjunction to splice the attribute words and comparison words to form an attribute question. For example, which one has a higher interest rate, A or B; which one has a longer term, A or C?
[0199] Step S106, generating a question classification sample based on the question parsing sample and the question domain set; and generating an entity linking sample based on the question parsing sample and the standard entity library.
[0200] It should be noted that the generation of question classification samples and entity linking samples may use a portion of the question parsing samples generated in step S104.
[0201] The problem classification sample can be an OOD data set, which is used to construct the training data required for the OOD model. The problem classification sample can include positive and negative samples. The positive sample is used to represent out-of-domain problems and is marked with label "1", and the negative sample is used to represent in-domain problems and is marked with label "0".
[0202] For example,
[0203] A positive sample can be {"text":"Hello","label":1}
[0204] Negative samples can be {"text":"What is the transaction time for corporate notice deposits","label":0}, or {"text":"How long can parking space loans last","label":0}
[0205] In a specific implementation, a problem classification sample is generated based on a problem analysis sample and a problem domain set, including: performing a fourth sampling process on the problem analysis sample to obtain a first domain sample; generating a corresponding second domain sample based on the domain problem text; generating a corresponding out-of-domain sample based on the out-of-domain problem text; and generating a problem classification sample based on the first domain sample, the second domain sample and the out-of-domain sample.
[0206] The sampling method of the fourth sampling process may be random sampling or other sampling methods.
[0207] It should be noted that in the first sampling process, the second sampling process, the third sampling process and the fourth sampling process, "first", "second", "third" and "fourth" are for the convenience of distinguishing the sampling operations performed in different steps and have no actual meaning.
[0208] Fig. 9 This is the seventh processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Fig. 9 An exemplary method for generating a problem classification sample is shown, and its specific processing flow includes steps S902 to S906:
[0209] Step S902: extract a first in-domain sample from the problem analysis sample, and obtain a second in-domain sample and an out-of-domain sample from the problem domain set.
[0210] Step S904: adding positive labels to the first domain samples and the second domain samples, and adding negative labels to the out-of-domain samples.
[0211] Step S906: merge all samples and save them into a json file.
[0212] In a specific implementation method, entity linking samples are generated based on question parsing samples and a standard entity library, including: determining a target parsing sample carrying a non-standard entity based on the question parsing sample; calculating the similarity between the non-standard entity and each standard entity in the standard entity library and sorting them; determining a preset number of target standard entities corresponding to the non-standard entity based on the sorting result; constructing positive and negative samples corresponding to the non-standard entity based on the non-standard entity and the preset number of target standard entities, and determining the positive and negative samples as entity linking samples.
[0213] Determining a preset number of target standard entities corresponding to the non-standard entity according to the ranking result may be determining a preset number of standard entities with the greatest similarity as the target standard entities.
[0214] For example, for the non-standard entity “Unit Notice Deposit”, the top 5 most similar entities are recalled in the standard entity library based on similarity, which are “Unit Notice Deposit”, “Unit Regular Deposit”, “Unit Current Deposit”, “Unit Agreement Deposit”, and “Unit Regular Deposit Passbook”.
[0215] According to the non-standard entity and a preset number of target standard entities, positive and negative samples corresponding to the non-standard entity are constructed. The positive sample can be constructed based on the non-standard entity and the target standard entity with the greatest similarity, and the negative sample can be constructed based on the non-standard entity and the target standard entity other than the target standard entity with the greatest similarity.
[0216] For example, the constructed positive sample is {"text":"What is the transaction time of "Unit Notice Deposit" [sep] Unit Notice Deposit","label":1}.
[0217] The constructed negative samples include:
[0218] {"text":"What is the transaction time for "Unit Notice to Deposit Money"[sep]Unit Regular Deposit Money","label":0};
[0219] {"text":"What is the transaction time for "Unit Deposit Notice"[sep]Unit Current Deposit","label":0};
[0220] {"text":"What is the transaction time for "Unit Notice Deposit"[sep]Unit Agreement Deposit","label":0};
[0221] {"text":"What is the transaction time for "Unit Notice to Deposit Money"[sep]Unit Regular Deposit Passbook","label":0}.
[0222] Fig.10 This is the eighth processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Fig.10 An exemplary method for generating entity link samples is shown, and its specific processing flow includes steps S1002 to S1008:
[0223] Step S1002: randomly select a certain number of target parsing samples carrying non-standard entities from the question parsing samples.
[0224] Step S1004: Take out the non-standard entity and recall the top 5 most similar standard entities in the standard entity library.
[0225] Step S1006, constructing positive and negative samples based on the non-standard entities and the recalled standard entities.
[0226] Step S1008: merge all samples and save them into a json file.
[0227] Step S108, constructing a training data set for the question answering system based on the question classification samples, question parsing samples, and entity linking samples.
[0228] This training dataset is used to train the initial question classification model, initial question parsing model, and initial entity linking model in the question answering system.
[0229] In such Figure 1In the illustrated embodiment, first, a preconfigured synonym set, similar question set, comparison word set, problem domain set and standard entity library are obtained; the synonym set includes multiple standard words and at least one synonym corresponding to each standard word; the similar question set includes multiple first attributes and at least one similar question sentence corresponding to each first attribute; the comparison word set includes comparison word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes multiple standard entities; then, a question parsing sample is generated based on at least one of the synonym set, similar question set and comparison word set; then, a question classification sample is generated based on the question parsing sample and the problem domain set; and, an entity link sample is generated based on the question parsing sample and the standard entity library; finally, a training data set for the question-answering system is constructed based on the question classification sample, the question parsing sample and the entity link sample. In this way, on the one hand, question parsing samples, question classification samples and entity linking samples are generated according to the pre-configured synonym sets, similar question sets, comparative word sets, problem domain sets and standard entity libraries, so that a large number of training samples can be generated using a small amount of pre-configured data, thereby improving the efficiency of sample generation and reducing manual workload; on the other hand, question parsing samples can not only be used to train the initial question parsing model, but also can be used to generate question classification samples and entity linking samples, thereby improving data utilization.
[0230] Based on the same technical concept as the aforementioned method embodiment, the embodiment of the present application also provides an embodiment of a model training method for a question-answering system. Fig.11 This is a processing flow chart of a model training method for a question-answering system provided in an embodiment of the present application. Fig.11 The processing flow of the model training method of the question-answering system specifically includes steps S1102 to S1104.
[0231] Step S1102, generating a training data set by a sample generation method of a question-answering system; the training data set includes question classification samples, question parsing samples, and entity linking samples.
[0232] The sample generation method of the question-answering system may be the sample generation method of the question-answering system provided by the aforementioned sample generation method embodiment of the question-answering system.
[0233] Step S1104, input the question classification samples into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; input the question parsing samples into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; input the entity linking samples into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0234] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts may refer to the corresponding description of the method embodiment provided above.
[0235] Based on the same technical concept as the aforementioned method embodiment, the embodiment of the present application also provides an embodiment of a response method. Fig.12 A processing flow chart of a response method provided in an embodiment of the present application. Fig.13 This is a working principle diagram of a question-answering system provided in an embodiment of the present application. Fig.12 The processing flow of the response method specifically includes steps S1202 to S1210.
[0236] like Fig.12 The answering method shown in the embodiment can be applied to a question answering system, which can include a question classification model, a question parsing model, and an entity linking model connected in sequence. The output of the question classification model can be the input of the question parsing model, and the output of the question parsing model can be the input of the entity linking model.
[0237] Step S1202, obtaining the target question to be answered.
[0238] Step S1204, input the target question into the question classification model for classification processing to obtain a classification result; the question classification model is obtained by inputting the question classification samples in the training data set into the initial question classification model for training; the training data set is generated by the sample generation method of the question answering system.
[0239] The sample generation method of the question-answering system may be the sample generation method of the question-answering system provided by the aforementioned sample generation method embodiment of the question-answering system.
[0240] Step S1206, when the classification result is used to characterize that the target question belongs to the first preset classification, the target question is input into the question parsing model for parsing processing to obtain the corresponding target segment; the question parsing model is obtained by inputting the question parsing samples in the training data set into the initial question parsing model for training.
[0241] Step S1208, inputting the target segment into the entity linking model for prediction processing to obtain the corresponding target entity; the entity linking model is obtained by inputting the entity linking samples in the training data set into the initial entity linking model for training;
[0242] Step S1210, determining the answer to the target question according to the target entity.
[0243] In a specific implementation, the answer to the target question is determined according to the target entity, including: performing slot filling processing according to the target entity to obtain a slot filling result for the target question; and querying the corresponding answer in a pre-configured knowledge graph according to the slot filling result to obtain the answer to the target question.
[0244] According to the target entity, slot filling processing is performed. For the target entity obtained in step S1028, first, at least one slot template that may correspond to the target entity is determined, and then, for each slot template, slot filling processing is performed on the slot template through the target entity to obtain the filled slot template, and the filled slot template is determined as the slot filling result corresponding to the target problem.
[0245] Each slot template may include one or more slots to be filled.
[0246] For example, slot template 1 is:
[0247] What is the (attribute slot) of (entity slot)?
[0248] Slot template 2 is:
[0249] (Entity slot)(Relationship slot)(Entity slot)?
[0250] Slot template 3 is:
[0251] What are the (constraint slots) (physical slots)?
[0252] It should be emphasized that the target entity can be used not only to fill the "entity slot", but also to fill multiple slots such as "attribute slot", "relationship slot" and "constraint slot".
[0253] In a specific implementation, a corresponding answer is queried in a preconfigured knowledge graph based on the slot filling result, including: if the slot filling result cannot be used to query the knowledge graph to obtain a unique corresponding answer, then determining the slot missing information corresponding to the slot filling result; generating a rhetorical question based on the slot missing information; receiving user input in response to the rhetorical question; performing slot filling processing based on the user input; and querying the corresponding answer in a preconfigured knowledge graph based on the slot filling result after the slot filling processing to obtain an answer to the target question.
[0254] For example, the slot filling result of the target question includes the filled slot template 1: What is the (attribute slot) of (product A)? The filled slot template 1 cannot be used to query in the knowledge graph to obtain a unique corresponding answer. It can be determined that the slot missing information corresponding to the filled slot template 1 is attribute missing. According to the slot missing information "attribute missing", a corresponding rhetorical question "What information do you want to inquire about product A?" is generated. The user input "price" is received in response to the rhetorical question. The slot filling process is performed according to the user input, that is, the attribute slot in "What is the (attribute slot) of (product A)" is filled to obtain the slot template 1 after secondary filling: What is the (price) of (product A)? According to the slot filling result after the slot filling process, the answer corresponding to "What is the price of product A" is queried in the pre-configured knowledge graph to obtain the answer to the target question.
[0255] Next, combine Fig.13 The working principle diagram of the question-answering system shown in the figure can be used as an example to illustrate Fig.12 The processing flow of the response method shown is:
[0256] In actual use, when a user's question enters the question-and-answer system, the OOD model is first used to determine whether the user's question is an out-of-domain question or an in-domain question. If it is an in-domain question, the process continues; if it is an out-of-domain question, the system will uniformly reply with the pre-configured out-of-domain question response script.
[0257] Next, the question parsing model is used to identify slots in the domain question, including but not limited to: entities, attributes, relations, constraints, etc. After the entity recognition is completed through the question parsing model, one or more entity fragments will be obtained.
[0258] In the pre-configured knowledge graph, the entity node corresponding to the currently recognized entity fragment can be recalled, and the entity fragment can be linked to the unique entity in the knowledge graph using the entity linking model.
[0259] After the question parsing model is used for analysis, DM (Dialog Management) can ask counter-questions based on the missing slots. Users can personalize the relevant counter-question scripts in the counter-question template.
[0260] If the entity is missing, such as: How to apply? DM can ask: What product do you want to consult? If the attribute is missing, such as: Parking space loan. DM can ask: What specific questions do you want to consult about parking space loan?
[0261] The slot filling process can be performed through multiple rounds of strategies until a unique answer can be queried and returned through the knowledge graph.
[0262] exist Fig.13In the question-answering system shown, the OOD model can be obtained by iteratively training the initial OOD model based on the OOD training set; the question parsing model can be obtained by iteratively training the initial question parsing model based on the question parsing training set; and the entity linking model can be obtained by iteratively training the initial entity linking model based on the entity linking training set.
[0263] Among them, the question parsing training set can be generated based on synonym templates, similar question templates, comparative word templates and rhetorical question templates; the entity linking training set can be generated based on the standard entity library and the question parsing training set; the OOD training set can be generated based on the OOD template and the question parsing training set. The synonym template, similar question template, comparative word template, OOD template and rhetorical question template can be generated based on the customer knowledge base.
[0264] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts may refer to the corresponding description of the method embodiment provided above.
[0265] In the above-mentioned embodiment, a sample generation method of a question-answering system is provided. Correspondingly, based on the same technical concept, an embodiment of the present application also provides a sample generation device of a question-answering system, which is described below in conjunction with the accompanying drawings.
[0266] Fig.14 A schematic diagram of a sample generation device of a question-answering system provided in an embodiment of the present application.
[0267] This embodiment provides a sample generation device 1400 of a question-answering system, including:
[0268] The first acquisition unit 1402 is used to acquire a pre-configured synonym set, a similar question set, a comparative word set, a problem domain set, and a standard entity library; the synonym set includes a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set includes a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set includes comparative word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes a plurality of standard entities;
[0269] A first generating unit 1404 is used to generate a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set;
[0270] A second generating unit 1406 is configured to generate a question classification sample according to the question parsing sample and the question domain set; and to generate the entity linking sample according to the question parsing sample and the standard entity library;
[0271] The construction unit 1408 is used to construct a training data set for the question answering system according to the question classification samples, the question parsing samples and the entity linking samples.
[0272] Optionally, the first generating unit 1404 is specifically configured to:
[0273] According to the first preset filtering condition, the synonym set is filtered to obtain a candidate word list; the candidate word list includes candidate standard words and candidate synonyms corresponding to the candidate standard words;
[0274] Performing a first sampling process on the candidate word list to obtain a single slot sample, and determining the single slot sample as the question parsing sample;
[0275] or,
[0276] Performing a second sampling process on a plurality of the first attributes in the similar question set to obtain a target first attribute;
[0277] Performing a third sampling process on at least one similar question sentence corresponding to the first attribute of the target to obtain an initial similar question sentence;
[0278] According to the initial similar question, a corresponding single attribute sample is determined, and the single attribute sample is determined as the question parsing sample.
[0279] Optionally, the first generating unit 1404 is specifically configured to:
[0280] According to the second preset filtering condition, the synonym set is filtered to obtain a candidate entity word list; the candidate entity word list includes a plurality of candidate entity words;
[0281] The similar question set is screened to obtain an intermediate similar question set; the intermediate similar question set includes a plurality of first attributes and at least one candidate similar question sentence carrying a mask corresponding to each of the first attributes;
[0282] Determine target candidate entity words and target candidate similar question sentences corresponding to the same attribute category according to the candidate word list and the intermediate similar question set;
[0283] Using the target candidate entity word, the mask in the target candidate similar question is replaced to obtain a composite sample, and the composite sample is determined as the question parsing sample;
[0284] or,
[0285] Filter the synonym set according to a third preset filtering condition to obtain attribute synonyms and entity synonyms;
[0286] Generate random numbers;
[0287] A splicing process is performed according to the comparison word information, the attribute synonyms, the entity synonyms, the random number and the preset description word to obtain a comparison type sample, and the comparison type sample is determined as the problem parsing sample.
[0288] Optionally, the second generating unit 1406 is specifically configured to:
[0289] Performing a fourth sampling process on the problem analysis sample to obtain a first domain sample;
[0290] Generating a corresponding second in-domain sample according to the in-domain question text;
[0291] Generate corresponding out-of-domain samples according to the out-of-domain question text;
[0292] The question classification sample is generated according to the first in-domain sample, the second in-domain sample and the out-of-domain sample.
[0293] Optionally, the second generating unit 1406 is specifically configured to:
[0294] Determine a target parsing sample carrying a non-standard entity according to the problem parsing sample;
[0295] Calculating the similarity between the non-standard entity and each of the standard entities in the standard entity library and sorting them;
[0296] According to the sorting result, determining a preset number of target standard entities corresponding to the non-standard entity;
[0297] According to the non-standard entity and the preset number of target standard entities, positive and negative samples corresponding to the non-standard entity are constructed, and the positive and negative samples are determined as the entity link samples.
[0298] The sample generation device of the question-answering system provided in the embodiment of the present application includes a first acquisition unit, which is used to acquire a pre-configured synonym set, a similar question set, a comparison word set, a problem domain set and a standard entity library; the synonym set includes multiple standard words and at least one synonym corresponding to each standard word; the similar question set includes multiple first attributes and at least one similar question sentence corresponding to each first attribute; the comparison word set includes comparison word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes multiple standard entities; a first generation unit, which is used to generate a question parsing sample based on at least one of the synonym set, the similar question set and the comparison word set; a second generation unit, which is used to generate a question classification sample based on the question parsing sample and the problem domain set; and, based on the question parsing sample and the standard entity library, an entity link sample is generated; a construction unit, which is used to construct a training data set for the question-answering system based on the question classification sample, the question parsing sample and the entity link sample. On the one hand, question parsing samples, question classification samples and entity linking samples are generated according to pre-configured synonym sets, similar question sets, comparative word sets, problem domain sets and standard entity libraries. A large number of training samples can be generated using a small amount of pre-configured data, thereby improving sample generation efficiency and reducing manual workload. On the other hand, question parsing samples can not only be used to train the initial question parsing model, but also to generate question classification samples and entity linking samples, thereby improving data utilization.
[0299] In the above-mentioned embodiment, a model training method for a question-answering system is provided. Correspondingly, based on the same technical concept, an embodiment of the present application also provides a model training device for a question-answering system, which is described below in conjunction with the accompanying drawings.
[0300] Fig.15 A schematic diagram of a model training device for a question-answering system provided in an embodiment of the present application.
[0301] This embodiment provides a model training device 1500 for a question-answering system, including:
[0302] The third generating unit 1502 is used to generate a training data set by using a sample generating method of a question-answering system; the training data set includes the question classification sample, the question parsing sample, and the entity linking sample;
[0303] The training unit 1504 is used to input the question classification samples into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; input the question parsing samples into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; input the entity linking samples into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0304] The model training device of the question-answering system provided in the embodiment of the present application includes a third generation unit, which is used to generate a training data set through a sample generation method of the question-answering system; the training data set includes a question classification sample, a question parsing sample and an entity linking sample; the training unit is used to input the question classification sample into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; input the question parsing sample into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; input the entity linking sample into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model. In this way, on the one hand, according to the pre-configured synonym set, similar question set, comparison word set, problem domain set and standard entity library, a large number of training samples can be generated by using a small amount of pre-configured data, the sample generation efficiency is improved, and the manual workload is reduced; on the other hand, the question parsing sample can not only be used for the training of the initial question parsing model, but also can be used to generate question classification samples and entity linking samples, which improves the data utilization rate. On this basis, a large number of training samples can be efficiently generated for model training, thereby improving the answer accuracy of the question-answering system.
[0305] In the above-mentioned embodiment, a response method is provided. Correspondingly, based on the same technical concept, an embodiment of the present application also provides a response device, which will be described below in conjunction with the accompanying drawings.
[0306] Fig.16 A schematic diagram of a response device provided in an embodiment of the present application.
[0307] This embodiment provides a response device 1600, including:
[0308] The second acquisition unit 1602 is used to acquire a target question to be answered;
[0309] The classification unit 1604 is used to input the target question into the question classification model for classification processing to obtain a classification result; the question classification model is obtained by inputting the question classification samples in the training data set into the initial question classification model for training; the training data set is generated by the sample generation method of the question answering system;
[0310] A parsing unit 1606 is used to input the target question into a question parsing model for parsing to obtain a corresponding target segment when the classification result is used to characterize that the target question belongs to a first preset classification; the question parsing model is obtained by inputting question parsing samples in the training data set into an initial question parsing model for training;
[0311] The prediction unit 1608 is used to input the target fragment into the entity linking model for prediction processing to obtain the corresponding target entity; the entity linking model is obtained by inputting the entity linking samples in the training data set into the initial entity linking model for training. The determination unit 1610 is used to determine the answer to the target question based on the target entity.
[0312] Optionally, the determining unit 1610 is specifically configured to:
[0313] Perform slot filling processing according to the target entity to obtain a slot filling result of the target problem;
[0314] According to the slot filling result, the corresponding answer is queried in the pre-configured knowledge graph to obtain the answer to the target question.
[0315] Optionally, the determining unit 1610 is further specifically configured to:
[0316] If the slot filling result cannot be used to query in the knowledge graph to obtain a unique corresponding answer, then determining the slot missing information corresponding to the slot filling result;
[0317] Generate a rhetorical question according to the slot missing information;
[0318] receiving a user input in response to the rhetorical question;
[0319] Perform slot filling processing according to the user input;
[0320] According to the slot filling results after the slot filling process, the corresponding answer is queried in the pre-configured knowledge graph to obtain the answer to the target question.
[0321] The answering device provided in the embodiment of the present application includes: a second acquisition unit, which is used to acquire a target question to be answered; a classification unit, which is used to input the target question into a question classification model for classification processing to obtain a classification result; the question classification model is obtained by inputting the question classification samples in the training data set into the initial question classification model for training; the training data set is generated by the sample generation method of the question-answering system; a parsing unit, which is used to input the target question into the question parsing model for parsing processing to obtain a corresponding target fragment when the classification result is used to characterize that the target question belongs to a first preset classification; the question parsing model is obtained by inputting the question parsing samples in the training data set into the initial question parsing model for training; a prediction unit, which is used to input the target fragment into the entity linking model for prediction processing to obtain the corresponding target entity; the entity linking model is obtained by inputting the entity linking samples in the training data set into the initial entity linking model for training; a determination unit, which is used to determine the answer to the target question according to the target entity. In this way, on the one hand, question parsing samples, question classification samples and entity linking samples are generated according to the pre-configured synonym sets, similar question sets, comparative word sets, problem domain sets and standard entity libraries, so that a large number of training samples can be generated using a small amount of pre-configured data, thereby improving the efficiency of sample generation and reducing manual workload; on the other hand, question parsing samples can not only be used to train the initial question parsing model, but also can be used to generate question classification samples and entity linking samples, thereby improving data utilization. On this basis, a large number of training samples can be efficiently generated for model training, thereby improving the response accuracy of the question and answer system.
[0322] Corresponding to the sample generation method of a question-answering system described above, or, corresponding to the model training method of a question-answering system described above, or, corresponding to the answering method described above, based on the same technical concept, an embodiment of the present application also provides an electronic device, which is used to execute the sample generation method of the question-answering system provided above, or, the model training method of the question-answering system provided above, or, the answering method provided above. Fig.17 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0323] like Fig.17As shown, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 1701 and memory 1702, and the memory 1702 may store one or more storage applications or data. Among them, the memory 1702 may be a short-term storage or a persistent storage. The application stored in the memory 1702 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 1701 may be configured to communicate with the memory 1702 to execute a series of computer executable instructions in the memory 1702 on the electronic device. The electronic device may also include one or more power supplies 1703, one or more wired or wireless network interfaces 1704, one or more input / output interfaces 1705, one or more keyboards 1706, etc.
[0324] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs configured to be executed by one or more processors include the following computer executable instructions:
[0325] Acquire a pre-configured synonym set, similar question set, comparative word set, problem domain set and standard entity library; the synonym set includes a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set includes a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set includes comparative word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes a plurality of standard entities;
[0326] Generate a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set;
[0327] Generate a question classification sample according to the question parsing sample and the question domain set; and generate the entity linking sample according to the question parsing sample and the standard entity library;
[0328] A training data set for the question answering system is constructed based on the question classification samples, the question parsing samples, and the entity linking samples.
[0329] In another specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following:
[0330] Generate a training data set by using a sample generation method of a question-answering system; the training data set includes the question classification sample, the question parsing sample, and the entity linking sample;
[0331] The question classification samples are input into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; the question parsing samples are input into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; the entity linking samples are input into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0332] In another specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the electronic device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following:
[0333] Get the target questions to be answered;
[0334] Input the target question into the question classification model for classification processing to obtain a classification result; the question classification model is obtained by inputting the question classification samples in the training data set into the initial question classification model for training; the training data set is generated by the sample generation method of the question answering system;
[0335] In the case where the classification result is used to characterize that the target question belongs to the first preset classification, the target question is input into a question parsing model for parsing processing to obtain a corresponding target segment; the question parsing model is obtained by inputting question parsing samples in the training data set into an initial question parsing model for training;
[0336] Inputting the target segment into an entity linking model for prediction processing to obtain a corresponding target entity; the entity linking model is obtained by inputting entity linking samples in the training data set into an initial entity linking model for training;
[0337] An answer to the target question is determined based on the target entity.
[0338] An embodiment of a computer-readable storage medium provided in this specification is as follows:
[0339] Corresponding to the sample generation method of a question-answering system described above, based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium.
[0340] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented:
[0341] Acquire a pre-configured synonym set, similar question set, comparative word set, problem domain set and standard entity library; the synonym set includes a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set includes a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set includes comparative word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes a plurality of standard entities;
[0342] Generate a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set;
[0343] Generate a question classification sample according to the question parsing sample and the question domain set; and generate the entity linking sample according to the question parsing sample and the standard entity library;
[0344] A training data set for the question answering system is constructed based on the question classification samples, the question parsing samples, and the entity linking samples.
[0345] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the sample generation method of the question-and-answer system in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned corresponding method, and the repeated parts will not be repeated.
[0346] Corresponding to the model training method of a question-answering system described above, based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium.
[0347] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented:
[0348] Generate a training data set by using a sample generation method of a question-answering system; the training data set includes the question classification sample, the question parsing sample, and the entity linking sample;
[0349] The question classification samples are input into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; the question parsing samples are input into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; the entity linking samples are input into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0350] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the model training method for the question-answering system in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned corresponding method, and the repeated parts will not be repeated.
[0351] Corresponding to the response method described above, based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium.
[0352] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented:
[0353] Get the target questions to be answered;
[0354] Input the target question into the question classification model for classification processing to obtain a classification result; the question classification model is obtained by inputting the question classification samples in the training data set into the initial question classification model for training; the training data set is generated by the sample generation method of the question answering system;
[0355] In the case where the classification result is used to characterize that the target question belongs to the first preset classification, the target question is input into a question parsing model for parsing processing to obtain a corresponding target segment; the question parsing model is obtained by inputting question parsing samples in the training data set into an initial question parsing model for training;
[0356] Inputting the target segment into an entity linking model for prediction processing to obtain a corresponding target entity; the entity linking model is obtained by inputting entity linking samples in the training data set into an initial entity linking model for training;
[0357] An answer to the target question is determined based on the target entity.
[0358] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the response method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding method mentioned above, and the repeated parts will not be repeated.
[0359] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0360] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may adopt the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0361] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0362] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0363] These computer program instructions may also be loaded onto a computer or other programmable device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0364] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0365] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0366] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0367] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0368] Embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0369] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0370] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. A sample generation method for a question-answering system, characterized in that: The method comprises: Acquire a pre-configured synonym set, similar question set, comparative word set, problem domain set and standard entity library; the synonym set includes a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set includes a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set includes comparative word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes a plurality of standard entities; Generate a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set; Generate a question classification sample according to the question parsing sample and the question domain set; and generate the entity linking sample according to the question parsing sample and the standard entity library; A training data set for the question answering system is constructed based on the question classification samples, the question parsing samples, and the entity linking samples.
2. The method according to claim 1, characterized in that The generating of a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set comprises: According to the first preset filtering condition, the synonym set is filtered to obtain a candidate word list; the candidate word list includes candidate standard words and candidate synonyms corresponding to the candidate standard words; Performing a first sampling process on the candidate word list to obtain a single-slot sample, and determining the single-slot sample as a question parsing sample; or, Performing a second sampling process on a plurality of the first attributes in the similar question set to obtain a target first attribute; Performing a third sampling process on at least one similar question sentence corresponding to the first attribute of the target to obtain an initial similar question sentence; According to the initial similar question, a corresponding single attribute sample is determined, and the single attribute sample is determined as the question parsing sample.
3. The method according to claim 1, characterized in that The generating of a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set comprises: According to the second preset filtering condition, the synonym set is filtered to obtain a candidate entity word list; the candidate entity word list includes a plurality of candidate entity words; Screening the similar question set to obtain an intermediate similar question set; the intermediate similar question set includes a plurality of first attributes and at least one candidate similar question sentence with a mask corresponding to each of the first attributes; Determine target candidate entity words and target candidate similar question sentences corresponding to the same attribute category according to the candidate word list and the intermediate similar question set; Using the target candidate entity word, the mask in the target candidate similar question is replaced to obtain a composite sample, and the composite sample is determined as the question parsing sample; or, Filter the synonym set according to a third preset filtering condition to obtain attribute synonyms and entity synonyms; Generate random numbers; A splicing process is performed according to the comparison word information, the attribute synonyms, the entity synonyms, the random number and the preset description word to obtain a comparison type sample, and the comparison type sample is determined as the problem parsing sample.
4. The method according to claim 1, characterized in that: The step of generating a problem classification sample according to the problem parsing sample and the problem domain set includes: Performing a fourth sampling process on the problem analysis sample to obtain a first domain sample; Generating a corresponding second in-domain sample according to the in-domain question text; Generate corresponding out-of-domain samples according to the out-of-domain question text; The question classification sample is generated according to the first in-domain sample, the second in-domain sample and the out-of-domain sample.
5. The method according to claim 1, characterized in that The generating the entity link sample according to the problem parsing sample and the standard entity library comprises: Determine a target parsing sample carrying a non-standard entity according to the problem parsing sample; Calculating the similarity between the non-standard entity and each of the standard entities in the standard entity library and sorting them; According to the sorting result, determining a preset number of target standard entities corresponding to the non-standard entity; According to the non-standard entity and the preset number of target standard entities, positive and negative samples corresponding to the non-standard entity are constructed, and the positive and negative samples are determined as the entity link samples.
6. A model training method for a question-answering system, characterized in that: include: Generate a training data set by using the sample generation method of the question answering system according to any one of claims 1 to 5; The training data set includes the question classification samples, the question parsing samples and the entity linking samples; Inputting the question classification samples into the initial question classification model in the question answering system for iterative training to obtain a question classification model; The question parsing samples are input into the initial question parsing model in the question answering system for iterative training to obtain a question parsing model; the entity linking samples are input into the initial entity linking model in the question answering system for iterative training to obtain an entity linking model.
7. A response method, characterized in that: include: Get the target questions to be answered; Inputting the target problem into the problem classification model for classification processing to obtain a classification result; The question classification model is obtained by inputting question classification samples in the training data set into the initial question classification model for training; The training data set is generated by the sample generation method of the question-answering system according to any one of claims 1 to 5; In a case where the classification result is used to characterize that the target question belongs to the first preset classification, inputting the target question into the question parsing model for parsing processing to obtain a corresponding target segment; The question parsing model is obtained by inputting the question parsing samples in the training data set into the initial question parsing model for training; Inputting the target segment into an entity linking model for prediction processing to obtain a corresponding target entity; the entity linking model is obtained by inputting entity linking samples in the training data set into an initial entity linking model for training; An answer to the target question is determined according to the target entity.
8. The method according to claim 7, characterized in that Determining the answer to the target question according to the target entity includes: Perform slot filling processing according to the target entity to obtain a slot filling result of the target problem; According to the slot filling result, the corresponding answer is queried in the pre-configured knowledge graph to obtain the answer to the target question.
9. The method according to claim 8, characterized in that The step of searching a pre-configured knowledge graph for a corresponding answer based on the slot filling result includes: If the slot filling result cannot be used to query in the knowledge graph to obtain a unique corresponding answer, then determining the slot missing information corresponding to the slot filling result; Generate a rhetorical question according to the slot missing information; receiving a user input in response to the rhetorical question; Perform slot filling processing according to the user input; According to the slot filling results after the slot filling process, the corresponding answer is queried in the pre-configured knowledge graph to obtain the answer to the target question.
10. A sample generation device for a question-answering system, characterized in that: The device comprises: A first acquisition unit is used to acquire a pre-configured synonym set, a similar question set, a comparative word set, a problem domain set, and a standard entity library; the synonym set includes a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set includes a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set includes comparative word information; the problem domain set includes in-domain question text and out-of-domain question text; the standard entity library includes a plurality of standard entities; A first generating unit, configured to generate a question parsing sample according to at least one of the synonym set, the similar question set and the comparative word set; A second generating unit is used to generate a question classification sample according to the question parsing sample and the question domain set; and to generate the entity linking sample according to the question parsing sample and the standard entity library; A construction unit is used to construct a training data set for the question answering system according to the question classification samples, the question parsing samples and the entity linking samples.
11. A response device, characterized in that: include: A second acquisition unit, used to acquire a target question to be answered; A classification unit, used for inputting the target problem into a problem classification model for classification processing to obtain a classification result; The question classification model is obtained by inputting question classification samples in the training data set into the initial question classification model for training; The training data set is generated by the sample generation method of the question-answering system according to any one of claims 1 to 6; A parsing unit, configured to input the target question into a question parsing model for parsing to obtain a corresponding target segment when the classification result is used to characterize that the target question belongs to a first preset classification; The question parsing model is obtained by inputting the question parsing samples in the training data set into the initial question parsing model for training; A prediction unit, used for inputting the target segment into an entity linking model for prediction processing to obtain a corresponding target entity; the entity linking model is obtained by inputting entity linking samples in the training data set into an initial entity linking model for training; A determination unit is used to determine an answer to the target question according to the target entity.
12. An electronic device, characterized in that: The device comprises: A processor; and a memory configured to store computer-executable instructions, wherein when the computer-executable instructions are executed, the processor executes the sample generation method for the question-answering system as described in any one of claims 1 to 5, or the model training method for the question-answering system as described in claim 6, or the answering method as described in any one of claims 7 to 9.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer-executable instructions, which, when executed by a processor, implement the sample generation method of the question-answering system as described in any one of claims 1 to 5, or the model training method of the question-answering system as described in claim 6, or the answering method as described in any one of claims 7 to 9.
Citation Information
Patent Citations
Chinese question and answer information extraction method, system and equipment and storage medium
CN115357692A
Lightweight hand joint prediction method and apparatus for real-time hand motion interface implementation of ar glasses device
KR1020220164376A
Generation of text classifier training data
US10853580B1
