Question answering system model training method, and sample generation method
Through the model training method and sample generation method of the question and answer system, the initial question analysis model and the preconfigured data set are used to generate training data, which solves the problem of difficulty in intent recognition and low training efficiency of the question and answer system when dealing with colloquial and one-sided questions. Efficient intent recognition and sample generation are achieved.
Patent Information
- Application Number
- PCT/CN2024/070737
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-14
- Filing Date
- 2024-01-05
- Publication Date
- 2024-09-19
AI Technical Summary
The existing question and answer system becomes more difficult to identify intentions when dealing with colloquial and one-sided questions, and requires a large number of manual configuration of training samples to meet the needs of model training, which is inefficient.
Provide a model training method and sample generation method for the question and answer system, using the initial question analysis model to generate a question analysis model through iterative training, and combining synonym sets, similar question sets and standard entity libraries to generate training data sets to improve intent recognition capabilities and sample generation efficiency.
It improves the intent recognition capability and sample generation efficiency of the question and answer system, reduces manual workload, can effectively handle colloquial and one-sided problems, and reduces the resource requirements for model training.
Smart Images

Figure CN2024070737_19092024_PF_FP_ABST
Abstract
Description
Model training method and sample generation method for question answering system
[0001] Cross-references
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on March 14, 2023, with application number 202310247102.2, entitled “Sample generation method, device, electronic device and storage medium for question-answering system” and the Chinese patent application filed with the China Patent Office on March 14, 2023, with application number 202310247092.2, entitled “Model training method, device, electronic device and storage medium for question-answering system”. The entire contents of that application are incorporated herein by reference. Technical Field
[0003] The present application relates to the field of knowledge graph technology, and in particular to a model training method, sample generation method, device, electronic device and storage medium for a question-answering system. Background Art
[0004] With the development of internet technology, question-answering systems are becoming increasingly popular. Automatically answering user questions through question-answering systems can improve response efficiency and save human resources. However, in real-world applications, user questions can be colloquial, resulting in rich and diverse sentence structures, which increases the difficulty for question-answering systems to identify intent. Furthermore, question-answering systems involving knowledge graphs are often highly customized, requiring a large amount of sample data for model training. Manually configuring training samples is inefficient and difficult to meet model training requirements.
[0005] Summary of the Invention
[0006] This application provides a model training method, sample generation method, device, electronic device and storage medium for a question-answering system to improve the intent recognition capability and sample generation efficiency of the question-answering system.
[0007] On the one hand, the present application provides a model training method for a question-answering system, wherein the question-answering system includes an initial question parsing model; the method includes: obtaining a question text sample; inputting the question text sample into the initial question parsing model for iterative training to obtain a question parsing model; the initial question parsing model includes a first encoding layer and a conversion layer; the first encoding layer is used to perform encoding processing based on the question text sample to obtain a corresponding first sentence vector; the conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each initial intention vector according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text fragment; the text fragment is used to query the answer to the question text sample in the question-answering system.
[0008] On the one hand, the present application provides an answering method, including: obtaining a target question to be answered; inputting the target question into a question parsing model for parsing and processing to obtain a corresponding target fragment; the question parsing model is obtained by training through the model training method of the above-mentioned question-answering system; and determining the answer to the target question based on the target fragment.
[0009] On the one hand, the present application provides a model training device for a question-answering system, wherein the question-answering system includes an initial question parsing model; the device includes: a first acquisition unit for acquiring a question text sample; a first training unit for inputting the question text sample into the initial question parsing model for iterative training to obtain a question parsing model; the initial question parsing model includes a first encoding layer and a conversion layer; the first encoding layer is used to perform encoding processing based on the question text sample to obtain a corresponding first sentence vector; the conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each of the initial intention vectors according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text fragment; the text fragment is used to query the answer to the question text sample in the question-answering system.
[0010] On the one hand, the present application provides an answering device, including: a second acquisition unit, used to obtain a target question to be answered; a first parsing unit, used to input the target question into a question parsing model for parsing and processing to obtain a corresponding target fragment; the question parsing model is obtained by training through the model training method of the above-mentioned question-answering system; a first determination unit, used to determine the answer to the target question based on the target fragment.
[0011] On the one hand, the present application provides a sample generation method for a question-answering system, the method comprising: obtaining 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 comprises a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set comprises a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set comprises comparative word information; the problem domain set comprises in-domain question text and out-of-domain question text; the standard entity library comprises a plurality of standard entities; generating a question parsing sample based on at least one of the synonym set, the similar question set, and the comparative word set; generating a question classification sample based on the question parsing sample and the problem domain set; and generating the entity link sample based on the question parsing sample and the standard entity library; constructing a training data set for the question-answering system based on the question classification sample, the question parsing sample, and the entity link sample.
[0012] On the one hand, the present application provides a model training method for a question-answering system, comprising: generating a training data set by a sample generation method of the question-answering system as described above; the training data set includes the question classification samples, the question parsing samples, and the entity linking samples; inputting the question classification samples into an initial question classification model in the question-answering system for iterative training to obtain a question classification model; inputting the question parsing samples into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; inputting the entity linking samples into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0013] On the one hand, the present application provides an answering method, including: obtaining a target question to be answered; 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 above-mentioned question-answering system; when the classification result is used to characterize that the target question belongs to a first preset classification, inputting the target question into a question parsing model for parsing processing to obtain a corresponding target fragment; the question parsing model is obtained by inputting question parsing samples in the training data set into an initial question parsing model for training; inputting the target fragment 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; and determining the answer to the target question based on the target entity.
[0014] On the one hand, the present application provides a sample generation device for a question-answering system, the device comprising: a third acquisition unit, configured 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 comprises a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set comprises a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set comprises comparative word information; the problem domain set comprises in-domain question text and out-of-domain question text; the standard entity library comprises a plurality of standard entities; a first generation unit, configured to generate a question parsing sample based on at least one of the synonym set, the similar question set, and the comparative word set; a second generation unit, configured to generate a question classification sample based on the question parsing sample and the problem domain set; and, to generate the entity link sample based on the question parsing sample and the standard entity library; a construction unit, configured 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.
[0015] On the one hand, the present application provides a model training device for a question-answering system, comprising: a third generation unit, for generating a training data set through the sample generation method of the question-answering system as described above; the training data set includes the question classification sample, the question parsing sample and the entity linking sample; a second training unit, for inputting the question classification sample into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; inputting the question parsing sample into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; and inputting the entity linking sample into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0016] On the one hand, the present application provides an answering device, including: a fourth acquisition unit, used to acquire a target question to be answered; a classification unit, 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 question classification samples in a training data set into an initial question classification model for training; the training data set is generated by a sample generation method such as the above-mentioned question-answering system; a second parsing unit, used to input the target question into a question parsing model for parsing processing when the classification result is used to characterize that the target question belongs to a first preset classification, to obtain a corresponding target fragment; the question parsing model is obtained by inputting question parsing samples in the training data set into an initial question parsing model for training; a prediction unit, used to input the target fragment 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 second determination unit, used to determine the answer to the target question based on the target entity.
[0017] On the one hand, the present application provides an electronic device comprising: a processor; and a memory configured to store computer-executable instructions, wherein the computer-executable instructions, when executed, cause the processor to execute a model training method for the question-answering system as described above, or, a response method as described above, or, a sample generation method for the question-answering system as described above.
[0018] On the one hand, the present application provides a computer-readable storage medium for storing computer-executable instructions, which, when executed by a processor, implement the model training method of the question-answering system as described above, or the answering method as described above, or the sample generation method of the question-answering system as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments described in this specification. Those skilled in the art can also derive other drawings based on these drawings without inventive work.
[0020] FIG1 is a processing flow chart of a model training method for a question-answering system provided in an embodiment of the present application;
[0021] FIG2 is a data flow diagram of a question parsing model in a model training method for a question-answering system provided in an embodiment of the present application;
[0022] FIG3 is a data flow diagram of an entity linking model in a model training method for a question-answering system provided in an embodiment of the present application;
[0023] FIG4 is a processing flow chart of a response method provided in an embodiment of the present application;
[0024] FIG5 is a flow chart of session management in a response method provided in an embodiment of the present application;
[0025] FIG6 is a schematic diagram of a model training device for a question-answering system provided in an embodiment of the present application;
[0026] FIG7 is a schematic diagram of a response device provided in an embodiment of the present application;
[0027] FIG8 is a processing flow chart of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0028] FIG9 is a schematic diagram of a framework of a question-answering system provided in an embodiment of the present application;
[0029] FIG10 is a first processing flow subgraph of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0030] FIG11 is a second processing flow subgraph of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0031] FIG12 is a third processing flow sub-diagram of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0032] FIG13 is a fourth processing flow subchart of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0033] FIG14 is a fifth processing flow subchart of a sample generation method for a question-answering system provided in an embodiment of the present application;
[0034] FIG15 is a sixth processing flow sub-diagram of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0035] FIG16 is a seventh processing flow sub-diagram of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0036] FIG17 is a sub-diagram of the eighth processing flow of a sample generation method of a question-answering system provided in an embodiment of the present application;
[0037] FIG18 is a process flow chart of another model training method for a question-answering system provided in an embodiment of the present application;
[0038] FIG19 is a processing flow chart of another response method provided in an embodiment of the present application;
[0039] FIG20 is a diagram showing the working principle of a question-answering system provided in an embodiment of the present application;
[0040] FIG21 is a schematic diagram of a sample generation device of a question-answering system provided in an embodiment of the present application;
[0041] FIG22 is a schematic diagram of another model training device for a question-answering system provided in an embodiment of the present application;
[0042] FIG23 is a schematic diagram of another response device provided in an embodiment of the present application;
[0043] FIG24 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] 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 making creative efforts should fall within the scope of protection of this application.
[0045] In the actual application of question-answering systems, on the one hand, the questions asked by users may be colloquial or one-sided, resulting in a rich and diverse sentence structure, which increases the difficulty of the question-answering system in identifying the intention; on the other hand, the information provided by users when asking questions may be one-sided. If answers are given based only on questions with insufficient information, it is likely that no satisfactory answers will be found. To address the above problems, the embodiments of the present application provide a model training method for a question-answering system.
[0046] Figure 1 is a processing flow chart of a model training method for a question-answering system provided in an embodiment of the present application. The model training method for the question-answering system in Figure 1 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. Referring to Figure 1, the model training method for the question-answering system provided in this embodiment specifically includes steps S102 to S104.
[0047] The question answering system may include an initial question parsing model, an initial question classification model, and an initial entity linking model.
[0048] The initial problem classification model can be an untrained OOD (out of the design scope) model.
[0049] During implementation, a question domain can be preconfigured. Questions within this domain are considered in-domain questions, while questions outside this domain are considered out-of-domain questions. The question-answering system is capable of answering in-domain questions but not out-of-domain questions. The OOD model can be used to classify received questions, with the classification results including at least in-domain questions and out-of-domain questions.
[0050] 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, etc.
[0051] Entities can be names of people, places, organizations, or proper nouns. A concept, also known as a class, is an abstract description of a collection of objects with the same characteristics. Concepts can be used to reflect categories. A concept can correspond to multiple entities.
[0052] For example, the concept "plant" can correspond to the following entities: "willow", "cactus", "cherry blossom", etc.
[0053] Attributes can be used to reflect the characteristics of an entity. A concept can correspond to multiple attributes.
[0054] For example, the concept "plant" can correspond to the following attributes: "name", "type", "shape", "growth environment", "distribution range" and "propagation method", etc.
[0055] For each attribute, you can pre-configure the attribute name, attribute type, and attribute description.
[0056] Attribute types include but are not limited to: text, numbers, images, rich text, and JavaScript Object Notation (json).
[0057] Relationships are used to describe the connection between concepts, which can be categorized into both categorical and non-categorical relationships. In practice, relationships can be customized based on specific domains and applications, such as causal relationships.
[0058] Constraints can be restrictions. For example, in the question "What services offer an annual interest rate less than x%?", the slot recognition result for "annual interest rate less than x%" is a constraint.
[0059] The initial entity linking model can be an untrained BERT (Bidirectional Encoder Representation from Transformers) classification model. This BERT classification model can be used to perform classification prediction processing, linking the entity fragment of the input model to an entity node in a pre-configured knowledge graph.
[0060] The knowledge graph consists of multiple entity nodes, each corresponding to an entity. The knowledge graph can be constructed by extracting knowledge from ontologies and corpora to form triples, thus turning business data into knowledge.
[0061] Step S102: Obtain a question text sample.
[0062] The question text sample can be a pre-generated question parsing sample. Each question text sample can be a word, a word combination, an incomplete sentence, or a complete sentence, etc.
[0063] Question parsing samples can be generated in the following ways:
[0064] Obtain a pre-configured synonym set, similar question set, and comparative word set; 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 comparative word set includes comparative word information; generate a question parsing sample based on at least one of the synonym set, similar question set, and comparative word set.
[0065] Among them, the specific implementation method of generating question analysis samples in this embodiment involves the sample generation method of the question-answering system, and can refer to the specific scheme in the following method embodiment.
[0066] In step S104, the question text sample is input into the initial question parsing model for iterative training to obtain the question parsing model; the initial question parsing model includes a first encoding layer and a conversion layer; the first encoding layer is used to perform encoding processing based on the question text sample to obtain a corresponding first sentence vector; the conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each initial intention vector according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text fragment; the text fragment is used to query the answer to the question text sample in the question-answering system.
[0067] It should be noted that the structure of the initial question parsing model is exactly the same as that of the question parsing model obtained after iterative training, but the model parameters involved in the training are different. The question parsing model obtained after iterative training also has a first encoding layer and a conversion layer.
[0068] The first encoding layer can be a Bert encoder or other components that can be used to convert text into sentence vectors. The conversion layer can be composed of a spatial conversion layer and multiple binary classification fully connected layers.
[0069] The output of the first coding layer can be the input of the transformation layer.
[0070] The initial intention vector can be a vector with a fixed number of elements but each element is unknown. Each initial intention vector can be used to represent a corresponding intention space. After the initial intention vector is filled, some elements are known, and the remaining unknown elements can be filled by specified values to obtain the target intention vector corresponding to the initial intention vector.
[0071] When the first sentence vector is received, a preset number of initial intention vectors are generated, and the preset number of initial intention vectors include the same number of elements.
[0072] The number of elements included in each initial intent vector may be a pre-configured fixed value. Specifically, upon receiving the first sentence vector, a preset number of initial intent vectors are generated; the number of elements included in the initial intent vector is a preset value.
[0073] The number of elements included in each initial intent vector can also be determined based on the number of characters corresponding to the first sentence vector. Specifically, upon receiving the first sentence vector, a preset number of initial intent vectors are generated based on the first sentence vector; the number of elements included in the initial intent vector is determined based on the number of characters corresponding to the first sentence vector.
[0074] In a specific implementation method, the first sentence vector includes a semantic feature sub-vector and multiple character sub-vectors; each initial intention vector is filled according to the first sentence vector to obtain the corresponding target intention vector. The specific implementation method is: intent classification is performed on the semantic feature sub-vector to obtain the corresponding intention classification result; based on the intention classification result, each initial intention vector is filled to obtain the corresponding intermediate intention vector; based on each character sub-vector, each intermediate intention vector is filled to obtain the corresponding target intention vector.
[0075] For example, the semantic feature subvector can be represented by [cls]. [cls] is not a vector representing a single character in the text, but a semantic feature vector representing the entire text. It can be directly used for classification.
[0076] The question text sample may include multiple characters. After the question text sample is encoded by the first encoding layer to obtain the corresponding first sentence vector, the first sentence vector may include a character sub-vector corresponding to each character in the question text sample.
[0077] The intent classification result can be used to indicate, for each initial intent vector, whether the first sentence vector has the intent corresponding to that initial intent vector. For example, for initial intent vector 1, if the intent classification result is the first classification result, it means that the first sentence vector does not have the intent corresponding to initial intent vector 1; if the intent classification result is the second classification result, it means that the first sentence vector has the intent corresponding to initial intent vector 1.
[0078] Perform intent classification on the semantic feature subvector to obtain the corresponding intent classification result. Specifically, this can be done by performing intent classification based on [cls] through a binary fully connected layer, i.e., a linear layer (linear). The input value of the linear layer is [cls], and the output value includes multiple intent classification results. Each intent classification result corresponds to an intent initialization vector, and each intent classification result can be either a first classification result or a second classification result.
[0079] Based on the intent classification result, each initial intent vector is filled to obtain a corresponding intermediate intent vector. This can be done by automatically filling each initial intent vector with a value representing the intent classification result of that initial intent vector to obtain an intermediate intent vector. For example, for initial intent vector 1, if the intent classification result is the first classification result, the value "0" representing the first classification result is filled in the specified position of initial intent vector 1; if the intent classification result is the second classification result, the value "1" representing the second classification result is filled in the specified position of initial intent vector 1.
[0080] Exemplarily, filling the specified position of the initial intention vector 1 with the value "0" for representing the first classification result may be performed by replacing the unknown element at the specified position with "0".
[0081] It should be noted that if the intent classification result corresponding to the initial intent vector is the first classification result, it means that the first sentence vector does not have the corresponding intent. Therefore, the character recognition results obtained by entity recognition and constraint recognition in subsequent steps are irrelevant to the initial intent vector. Therefore, after filling "0" in the initial intention vector to obtain the intermediate intention vector, the intermediate intention vector can be determined as the corresponding target intention vector.
[0082] In a specific implementation method, each intermediate intention vector is filled in according to each character sub-vector to obtain the corresponding target intention vector. The specific implementation method is: according to each character sub-vector, entity recognition processing and constraint recognition processing are performed to obtain the corresponding character recognition result; according to the character recognition result, each intermediate intention vector is filled in to obtain the corresponding target intention vector.
[0083] In a specific implementation, a binary fully connected linear layer can be used to perform entity recognition and constraint recognition on each character subvector to obtain a corresponding character recognition result. This character recognition result can be used to indicate the entity type and constraint type corresponding to the character subvector. Entity types include non-entities and multiple preset entity types, and constraint types include non-constraints and multiple preset constraint types.
[0084] By generating character recognition results, it is possible to determine whether each character sub-vector belongs to an entity or a constraint, thereby achieving entity extraction or constraint extraction.
[0085] In a specific implementation method, each intermediate intention vector is filled according to the character recognition result to obtain the corresponding target intention vector. The specific implementation method is: if the character recognition result is used to represent that the character sub-vector belongs to the entity category or constraint category, then according to the character recognition result, the corresponding intermediate intention vector is determined and filled.
[0086] If the character recognition result is used to represent that the character sub-vector belongs to an entity category, entity extraction processing can be performed based on the character recognition result, and intent prediction processing can be performed on the extracted entity to determine the intermediate intent vector corresponding to the entity, and the entity can be automatically filled in the corresponding intermediate intent vector.
[0087] The filling position of the entity in the intermediate intent vector can be determined based on the character position corresponding to the entity in the question text sample.
[0088] If the character recognition result is used to represent that the character sub-vector belongs to the constraint category, constraint extraction processing can be performed based on the character recognition result, and the extracted constraints can be subjected to intention prediction processing to determine the intermediate intention vector corresponding to the constraint, and the constraint can be automatically filled into the corresponding intermediate intention vector.
[0089] The filling position of the constraint in the intermediate intention vector can be determined based on the character position corresponding to the constraint in the question text sample.
[0090] In a specific implementation, the question text sample includes at least one of an entity element, an attribute element, a relationship element, and a constraint element; a preset number of initial intention vectors includes a first intention vector and multiple second intention vectors; the first intention vector corresponds to no intention, and each second intention vector corresponds to an attribute element or a relationship element.
[0091] The question text sample includes at least one of an entity element, an attribute element, a relationship element, and a constraint element. The slot recognition result of the entity element can be "entity", the slot recognition result of the attribute element can be "attribute", the slot recognition result of the relationship element can be "relationship", the slot recognition result of the constraint element can be "constraint", and so on.
[0092] The following are some examples to illustrate the problem text samples.
[0093] The question parsing model can convert question text samples into different intent spaces, each of which corresponds to an initial intent vector.
[0094] If the question text sample includes an attribute element, the attribute element can be used to determine a target initial intention vector corresponding to the attribute element from a preset number of initial intention vectors.
[0095] If the question text sample includes a relation element, the relation element can be used to determine a target initial intention vector corresponding to the relation element from a preset number of initial intention vectors.
[0096] Filling each initial intention vector according to the first sentence vector may be performed by labeling entities and constraints under the initial intention vector corresponding to each intention space. Labeling entities and constraints in the target initial intention vector corresponding to the attribute element can enable the generated target intention vector to reflect at least one of the correspondence between the attribute and the entity, and the correspondence between the attribute and the constraint. Labeling entities and constraints in the target initial intention vector corresponding to the relationship element can enable the generated target intention vector to reflect at least one of the correspondence between the relationship and the entity, and the correspondence between the relationship and the constraint.
[0097] During the slot identification process, in the question text sample, various slot elements such as entity elements, attribute elements, relationship elements, constraint elements, etc. may have certain corresponding relationships with each other.
[0098] For example, consider a sample question like: "What is the price of Product A? When will Product B be released?" "Product A" and "Product B" are entities, and "Price" and "Availability" are attributes. "Product A" corresponds to "Price" and "Product B" corresponds to "Availability." Performing slot recognition for each element separately might misinterpret the user's intent in the sample question, resulting in feedback only showing the prices of Products A and B, and the availability of both.
[0099] In this embodiment, when each initial intent vector corresponds to an attribute element or a relationship element, by annotating entities and constraints under the initial intent vector corresponding to each intent space, slot recognition can be performed simultaneously in different intent spaces, not only identifying each slot element in the question text sample, but also identifying the correspondence between attributes and entities, the correspondence between attributes and constraints, the correspondence between relationships and entities, and the correspondence between relationships and constraints, etc. In this way, there is no need to use a corresponding model for each slot element to perform model training for slot recognition, which reduces the number of models required for the slot recognition processing flow and reduces the time delay in the slot recognition processing flow. In addition, by performing entity and constraint annotation simultaneously in multiple intent spaces, the question text sample can be parsed at one time to obtain the slot recognition results of each slot element therein, thereby improving the efficiency of slot recognition.
[0100] The question text sample can be composed of entity elements and attribute elements. For example, the question text sample is: How is the cost of Product A calculated? Among them, the entity element is "Product A" and the attribute element is "How is the cost calculated?" The attribute element corresponds to the attribute "price".
[0101] A sample question text may consist of an attribute element and a constraint element. For example, the sample question text is: What restaurant activities can I participate in before this Sunday? The attribute element is "restaurant activities" and the constraint element is "before this Sunday."
[0102] A sample question text may be composed of an entity element and a relationship element. For example, what are the processing channels for activity C? The entity element is "activity C" and the relationship element is "processing channel."
[0103] The question text sample can be composed of entity elements, for example, D service. The entity element is "D service". When the question text sample only includes entity elements, the question is usually incomplete and needs to be asked again to guide the user asking the question to supplement the question. In this case, the intent classification result of the first intent vector can be the second classification result, and the intent classification result of each second intent vector can be the first classification result, that is, the first sentence vector does not have any intent.
[0104] The structure of the question parsing model and the data processing method within the question parsing model can be exemplarily described below with reference to Figure 2. Figure 2 is a data flow diagram of the question parsing model in a model training method for a question-answering system provided in an embodiment of the present application.
[0105] As shown in Figure 2, question text sample 202 is "How long does it take for liposuction to heal? How much does a facelift cost?" [sep] is used to delimit two question text samples. [cls] stands for classification, which can be understood as being used for downstream classification tasks. For text classification tasks, the BERT model inserts a [cls] symbol before the text and uses the output vector corresponding to this symbol as the semantic representation of the entire text for text classification.
[0106] The first encoding layer may be a Bert encoder 204 , and the transformation layer may include a spatial transformation layer 208 , a binary classification fully connected layer 210 , and a binary classification fully connected layer 212 .
[0107] The Bert encoder 204 is used to convert the question text sample 202 into a corresponding sentence vector 206 and send it to the spatial conversion layer 208; the spatial conversion layer 208 is used to generate a preset number of initial intention vectors when receiving the sentence vector 206, wherein the initial intention vector 1 corresponds to the intention space Null (null value) 220, the initial intention vector 2 corresponds to the intention space "introduction" 218, the initial intention vector 3 corresponds to the intention space "price" 216, and the initial intention vector 4 corresponds to the intention space "recovery period" 214.
[0108] The binary fully connected layer 210 can be used to perform intent classification processing based on the semantic feature sub-vector H[cls]2062, and obtain the intent classification results corresponding to each intent space and fill them in: the intent space "recovery period" 214 corresponds to the second classification result, and "1" is filled in the first position; the intent space "price" 216 corresponds to the second classification result, and "1" is filled in the first position; the intent space "introduction" 218 corresponds to the first classification result, and "0" is filled in the first position; the intent space Null220 corresponds to the first classification result, and "0" is filled in the first position.
[0109] The binary fully connected layer 212 can be used to perform entity recognition and constraint recognition processing based on each character sub-vector 2064 to obtain the corresponding character recognition results, and then perform entity extraction and constraint extraction processing based on the character recognition results to obtain the entities "liposuction" and "face slimming" corresponding to the first sentence vector.
[0110] Intent prediction processing is performed on the entity "liposuction," and the intent space corresponding to the entity "liposuction" is determined to be the intent space "recovery period" 214, which is then filled in, resulting in a target intent vector corresponding to the intent space "recovery period." Intent prediction processing is performed on the entity "face slimming," and the intent space corresponding to the entity "face slimming" is determined to be the intent space "price" 216, which is then filled in, resulting in a target intent vector corresponding to the intent space "price."
[0111] Based on the target intent vector corresponding to the intent space "recovery period" and the target intent vector corresponding to the intent space "price", the corresponding text segment can be generated. For other intent spaces whose intent classification results are the first classification results, the corresponding target intent vectors can be discarded.
[0112] In a specific implementation, the question-answering system also includes an initial entity linking model; the model training method of the question-answering system also includes: obtaining entity linking samples; inputting the entity linking samples into the initial entity linking model for iterative training to obtain an entity linking model; the entity linking model includes a second encoding layer and a prediction layer; the second encoding layer is used to encode the entity linking samples to obtain a corresponding second sentence vector; the prediction layer is used to perform prediction processing based on the second sentence vector to determine the corresponding target entity.
[0113] Entity link samples can be obtained in the following ways: obtaining a standard entity library; the standard entity library includes multiple standard entities; generating entity link samples based on the question parsing samples and the standard entity library.
[0114] Among them, in this embodiment, the specific implementation method of generating entity link samples based on question parsing samples and standard entity libraries involves the sample generation method of the question-answering system, and can refer to the specific scheme in the following method embodiment.
[0115] The structure of the initial entity linking model is exactly the same as that of the entity linking model obtained after iterative training, but the model parameters involved in the training are different. The entity linking model obtained after iterative training also has a second encoding layer and a prediction layer.
[0116] The second encoding layer can be a Bert transformer or other components that can be used to convert text into sentence vectors. The prediction layer can be a binary fully connected linear layer or other components that can be used to map semantic feature sub-vectors to corresponding entities.
[0117] The prediction layer is used to perform prediction processing based on the second sentence vector to determine the corresponding target entity. Specifically, the prediction layer can be used to perform prediction processing based on the semantic feature subvector in the second sentence vector to determine the corresponding target entity.
[0118] In the training stage, the generated entity linking dataset can be used to train the BERT classification model. In the prediction stage, after entity recognition is completed through the question parsing model, an entity mention segment will be obtained. Entities with relatively high similarity are recalled from the knowledge graph. Similar to when constructing data, the question sentence with the mention segment and the recalled entities are concatenated respectively. When using the entity linking model for prediction, it will be linked to the unique entity in the knowledge graph.
[0119] The structure of the entity linking model and the internal data processing flow of the entity linking model can be exemplarily described in conjunction with FIG. 3 below. FIG. 3 is a data flow diagram of the entity linking model in a model training method of a question answering system provided by an embodiment of the present application.
[0120] As shown in FIG. 3, the entity linking sample 302 is "[SEP] How much does it cost to use $ radiofrequency facial slimming $ [SEP] Radiofrequency lipolysis facial slimming ". The entity linking sample 302 is encoded by the Bert encoder 302 to obtain the corresponding second sentence vector, and the second sentence vector includes the semantic feature sub-vector H[cls]306. The semantic feature sub-vector H[cls]306 is predicted by the binary classification fully connected layer 308 to determine the corresponding entity prediction result 310.
[0121] In a specific implementation manner, the question answering system further includes an initial question classification model; the model training method of the question answering system further includes: obtaining question classification samples; inputting the question classification samples into the initial question classification model for iterative training to obtain the question classification model.
[0122] The question classification samples can be obtained in the following way: obtaining a question domain set; the question domain set includes in-domain question texts and out-of-domain question texts; according to the question parsing samples and the question domain set, question classification samples are generated.
[0123] Among them, the specific implementation manner of obtaining the question domain set and the specific description of the question domain set involve the sample generation method of the question answering system, and the specific solutions in the following method embodiments can be referred to.
[0124] The question classification samples can be an OOD dataset, which is used to construct the training data required for the OOD model. The question classification samples can include positive and negative samples. The positive samples are used to represent out-of-domain questions and are identified by the label "1", and the negative samples are used to represent in-domain questions and are identified by the label "0".
[0125] Exemplarily, a positive sample can be {"text": "Hello", "label": 1}.
[0126] Negative samples can be {"text":"What is the transaction time for unit notice deposits?","label":0}, or {"text":"How long can parking space loans be loaned?","label":0}.
[0127] Among them, the specific implementation method of generating question classification samples based on question analysis samples and question domain sets involves the sample generation method of the question answering system, and can refer to the specific scheme in the following method embodiment.
[0128] In the embodiment shown in Figure 1, first, a question text sample is obtained; then, the question text sample is input into the initial question parsing model for iterative training to obtain a question parsing model; the initial question parsing model includes a first encoding layer and a conversion layer; the first encoding layer is used to perform encoding processing based on the question text sample to obtain a corresponding first sentence vector; the conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each initial intention vector according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text fragment; the text fragment is used to query the answer to the question text sample in the question and answer system. In this way, the initial question parsing model is iteratively trained through the obtained question text samples. During the training process, the question text samples can be encoded to obtain the corresponding first sentence vector through the first encoding layer, and a preset number of initial intent vectors can be generated through the conversion layer, and then each initial intent vector is filled based on the first sentence vector, so that the question text sample is parsed at one time to obtain a text fragment corresponding to at least one target intent vector. The question intent reflected by each text fragment can be determined by the corresponding initial intent vector, and the question text sample can be converted into different intent spaces through the question parsing model, and entities and constraints can be marked under the intent vectors corresponding to each intent space, which is conducive to improving slot recognition efficiency and reducing the number of models required for the slot recognition processing flow, thereby reducing latency. Moreover, slot recognition is performed simultaneously in each intent space, which can increase concurrency and improve the intent recognition capability and recognition efficiency of the question-answering system.
[0129] Based on the same technical concept as the aforementioned method embodiment, the present application embodiment also provides an embodiment of a response method. Figure 4 is a processing flow chart of a response method provided in the present application embodiment. Referring to Figure 4, the processing flow of the response method specifically includes steps S402 to S406.
[0130] S402: Obtain the target question to be answered.
[0131] S404: Input the target question into the question parsing model for parsing and processing to obtain the corresponding target segment; the question parsing model is obtained by training using the model training method of the question-answering system.
[0132] The model training method for the question-answering system in this step may be a model training method for the question-answering system provided by the aforementioned various method embodiments.
[0133] In a specific implementation method, the target problem is input into the problem parsing model for parsing processing to obtain the corresponding target fragment, including: inputting the target problem into the problem classification model for classification processing to obtain the classification result; when the classification result is used to characterize that the target problem belongs to the first preset classification, the target problem is input into the problem parsing model for parsing processing to obtain the corresponding target fragment.
[0134] Step S406: Determine the answer to the target question based on the target segment.
[0135] In a specific implementation method, the answer to the target question is determined based on the target fragment, including: inputting the target fragment into the entity linking model for prediction processing to obtain the corresponding target entity; performing slot filling processing based on the target entity to obtain the slot filling result of the target question; based on the slot filling result, querying the corresponding answer in the pre-configured knowledge graph to obtain the answer to the target question.
[0136] According to the target entity, slot filling processing is performed. This can be for the target fragment obtained in step S404. First, at least one slot template that the target fragment may correspond to is determined. Then, for each slot template, slot filling processing is performed on the slot template through the target fragment to obtain the filled slot template. The filled slot template is determined as the slot filling result corresponding to the target problem.
[0137] Each slot template may include one or more slots to be filled.
[0138] For example, slot template 1 is: What is the (attribute slot) of (entity slot)?
[0139] Slot template 2 is: (entity slot)(relationship slot)(entity slot)?
[0140] Slot template 3 is: (Constraint slot) (Physical slot) What are they?
[0141] 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".
[0142] Based on the slot filling result, the corresponding answer is queried in the pre-configured knowledge graph. If the slot filling result cannot be used to query the knowledge graph to obtain the unique corresponding answer, the slot missing information corresponding to the slot filling result is determined; a rhetorical question is generated based on the slot missing information; user input in response to the rhetorical question is received; slot filling processing is performed based on the user input; and based on the slot filling result after the slot filling processing, the corresponding answer is queried in the pre-configured knowledge graph to obtain the answer to the target question.
[0143] 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 second-filled slot template 1: 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.
[0144] Next, how to determine the corresponding answer in the knowledge graph based on the slot filling result can be exemplified in conjunction with Figure 5. Figure 5 is a flow chart of session management in a response method provided in an embodiment of the present application.
[0145] As shown in Figure 5, after the question input by the user enters the conversation stack, the question-answering system can perform algorithmic analysis on the question to obtain an analysis result, which includes at least one slot identification result.
[0146] Perform parsing result detection. If the parsing result is used to indicate OOD or no result, generate a response text according to the pre-configured response words corresponding to "don't know / cannot answer / flag bit". This response text is used to inform the user that the question-answering system cannot answer the question.
[0147] If the parsing result is used to represent a single result, a session stack check is performed: for the first session, the slot management process is entered; for multiple rounds of conversations, the session management process is entered.
[0148] If the parsing result is used to represent multiple results, the slot management process is entered, and the slot filling process is performed through the slot management process.
[0149] In the slot management process, the question template or answer template to be generated can be determined by whether the composite constraint slot, entity slot, intent slot, and common constraint slot exist, whether the node is a leaf node, and whether the intent slot is a common intent or a multi-valued intent.
[0150] In the conversation management process, how to perform logical inheritance in multiple rounds of conversations can be determined through composite constraint detection, common constraint detection, entity detection, intent detection, node judgment, entity inheritance, constraint inheritance, and intent inheritance.
[0151] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above.
[0152] 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 with reference to the accompanying drawings.
[0153] FIG6 is a schematic diagram of a model training device for a question-answering system provided in an embodiment of the present application.
[0154] This embodiment provides a model training device 600 for a question-answering system, wherein the question-answering system includes an initial question parsing model; the device includes: a first acquisition unit 602, for acquiring a question text sample; a first training unit 604, for inputting the question text sample into the initial question parsing model for iterative training to obtain a question parsing model; the initial question parsing model includes a first encoding layer and a conversion layer; the first encoding layer is used to perform encoding processing based on the question text sample to obtain a corresponding first sentence vector; the conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each of the initial intention vectors according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text segment; the text segment is used to query the answer to the question text sample in the question-answering system.
[0155] Optionally, the first sentence vector includes a semantic feature sub-vector and multiple character sub-vectors; the specific implementation method of filling each of the initial intention vectors according to the first sentence vector to obtain the corresponding target intention vector is: performing intent classification processing on the semantic feature sub-vector to obtain the corresponding intention classification result; filling each of the initial intention vectors according to the intention classification result to obtain the corresponding intermediate intention vector; filling each of the intermediate intention vectors according to each of the character sub-vectors to obtain the corresponding target intention vector.
[0156] Optionally, the intention classification result includes a first classification result and a second classification result; the specific implementation method of filling each of the intermediate intention vectors according to each of the character sub-vectors to obtain the corresponding target intention vector is: performing entity recognition processing and constraint recognition processing according to each of the character sub-vectors to obtain the corresponding character recognition result; filling each of the intermediate intention vectors according to the character recognition result to obtain the corresponding target intention vector.
[0157] Optionally, the specific implementation method of filling each of the intermediate intention vectors according to the character recognition result to obtain the corresponding target intention vector is: if the character recognition result is used to characterize that the character sub-vector belongs to an entity category or a constraint category, then according to the character recognition result, the corresponding intermediate intention vector is determined and filled.
[0158] Optionally, the question text sample includes at least one of entity elements, attribute elements, relationship elements, and constraint elements; the preset number of initial intention vectors includes a first intention vector and multiple second intention vectors; the first intention vector corresponds to no intention, and each of the second intention vectors corresponds to one attribute element or one relationship element.
[0159] Optionally, the question-answering system also includes an initial entity link model; the first acquisition unit 602 is also used to obtain entity link samples; the first training unit 604 is also used to input the entity link samples into the initial entity link model for iterative training to obtain an entity link model; the entity link model includes a second encoding layer and a prediction layer; the second encoding layer is used to encode the entity link samples to obtain a corresponding second sentence vector; the prediction layer is used to perform prediction processing based on the second sentence vector to determine the corresponding target entity.
[0160] Optionally, the question-answering system further includes an initial question classification model; the first acquisition unit 602 is further used to obtain question classification samples; the first training unit 604 is further used to input the question classification samples into the initial question classification model for iterative training to obtain a question classification model.
[0161] The model training device of the question-answering system provided in the embodiment of the present application includes a first acquisition unit and a first training unit, wherein: the first acquisition unit is used to obtain a question text sample; the first training unit is used to input the question text sample into the initial question parsing model for iterative training to obtain a question parsing model; the initial question parsing model includes a first encoding layer and a conversion layer; the first encoding layer is used to perform encoding processing based on the question text sample to obtain a corresponding first sentence vector; the conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each initial intention vector according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text fragment; the text fragment is used to query the answer to the question text sample in the question-answering system. In this way, the initial question parsing model is iteratively trained through the obtained question text samples. During the training process, the question text samples can be encoded to obtain the corresponding first sentence vector through the first encoding layer, and a preset number of initial intent vectors can be generated through the conversion layer, and then each initial intent vector is filled based on the first sentence vector, so that the question text sample is parsed at one time to obtain a text fragment corresponding to at least one target intent vector. The question intent reflected by each text fragment can be determined by the corresponding initial intent vector, and the question text sample can be converted into different intent spaces through the question parsing model, and entities and constraints can be marked under the intent vectors corresponding to each intent space, which is conducive to improving slot recognition efficiency and reducing the number of models required for the slot recognition processing flow, thereby reducing latency. Moreover, slot recognition is performed simultaneously in each intent space, which can increase concurrency and improve the intent recognition capability and recognition efficiency of the question-answering system.
[0162] In the above 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 is described below with reference to the accompanying drawings.
[0163] FIG7 is a schematic diagram of a response device provided in an embodiment of the present application.
[0164] This embodiment provides an answering device 700, including: a second acquisition unit 702, used to obtain a target question to be answered; a first parsing unit 704, used to input the target question into a question parsing model for parsing and processing to obtain a corresponding target segment; the question parsing model is obtained by training using a model training method of a question-answering system; and a first determination unit 706, used to determine the answer to the target question based on the target segment.
[0165] Optionally, the first parsing unit 704 is specifically used to: input the target problem into the problem classification model for classification processing to obtain a classification result; when the classification result is used to characterize that the target problem belongs to the first preset classification, input the target problem into the problem parsing model for parsing processing to obtain a corresponding target fragment.
[0166] Optionally, the first determination unit 706 is specifically used to: input the target fragment into the entity linking model for prediction processing to obtain the corresponding target entity; perform slot filling processing based on the target entity to obtain the slot filling result of the target question; based on the slot filling result, query the corresponding answer in the pre-configured knowledge graph to obtain the answer to the target question.
[0167] The answering device provided in the embodiment of the present application includes: a second acquisition unit, used to obtain a target question to be answered; a first parsing unit, used to input the target question into a question parsing model for parsing and processing to obtain a corresponding target fragment; the question parsing model is obtained by training through a model training method of a question-answering system; a first determination unit, used to determine the answer to the target question based on the target fragment. In this way, during the training process, the question parsing model can encode the question text sample through the first encoding layer to obtain the corresponding first sentence vector. Through the conversion layer, a preset number of initial intent vectors can be generated, and then each initial intent vector is filled based on the first sentence vector, so that the question text sample can be parsed at one time to obtain a text fragment corresponding to at least one target intent vector. The question intent reflected by each text fragment can be determined by the corresponding initial intent vector, and the question parsing model can convert the question text sample into different intent spaces, and annotate entities and constraints under the intent vectors corresponding to each intent space, which is conducive to improving slot recognition efficiency and reducing the number of models required for the slot recognition processing flow, thereby reducing latency. Moreover, slot recognition is performed simultaneously in each intent space, which can increase concurrency and improve the intent recognition capability and recognition efficiency of the question and answer system. Furthermore, the target fragment is generated by the question parsing model, and the answer to the target question is determined by the target fragment, which can improve the intent recognition accuracy and intent recognition efficiency of the question and answer system.
[0168] Question-answering systems involving knowledge graphs are typically highly customized and require a massive amount of training samples to train the model in order to achieve good model results and, in turn, enable efficient and accurate automatic responses. However, manually configuring training samples is highly inefficient and difficult to meet model training requirements. To address the above issues, embodiments of the present application provide a sample generation method for a question-answering system.
[0169] Figure 8 is a processing flow chart of a sample generation method for a question-and-answer system provided in an embodiment of the present application. The sample generation method for the question-and-answer system in Figure 8 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. Referring to Figure 8, the sample generation method for the question-and-answer system provided in this embodiment specifically includes steps S802 to S808.
[0170] The question answering system may include an initial question classification model, an initial question parsing model, and an initial entity linking model.
[0171] Among them, the specific description of the question-answering system, the initial question classification model, the initial question parsing model and the initial entity linking model in this embodiment involves the model training method of the question-answering system, and reference can be made to the specific scheme in the above method embodiment.
[0172] FIG9 is a schematic diagram of a framework of a question-answering system provided in an embodiment of the present application.
[0173] As shown in Figure 9, before the question-answering system is put into use, it is necessary to first perform model training through the model training part. Specifically, the initial question parsing model needs to be iteratively trained to obtain a question parsing model 902; the initial entity linking model needs to be iteratively trained to obtain an entity linking model 904; and the initial OOD model needs to be iteratively trained to obtain an OOD model 906. To this end, data preparation is required before model training. Specifically, the training dataset to be generated includes: a question parsing dataset 908 for iterative training of the initial question parsing model, an entity linking dataset 910 for iterative training of the initial entity linking model, and an OOD dataset 912 for iterative training of the initial OOD model.
[0174] Step S802, obtain 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.
[0175] During specific implementation, the synonym set can be obtained from a pre-configured synonym template.
[0176] In the synonym template, the following fields can be displayed: standard word, type, synonym, update time, operation, etc.
[0177] Specifically: (a1) Standard words: automatically generated by the system, and the values are derived from the entities and attributes defined in the corresponding graph.
[0178] (a2) Type: Automatically generated by the system, the value comes from the type corresponding to the entity and attribute defined in the corresponding graph.
[0179] (a3) Synonyms: Manually enter via "Edit" or batch enter via "Upload Synonyms".
[0180] (a4) Update time: the time when the synonym was last modified.
[0181] The synonym set includes multiple standard words and at least one synonym corresponding to each standard word. For example, the synonym set includes: standard word x1, synonyms x2, x3 and x4 corresponding to the standard word x1; standard word y1, synonym y2 corresponding to the standard word y1; standard word z1, synonym z2 and z3 corresponding to the standard word z1, and so on.
[0182] During specific implementation, the similar question set can be obtained from a pre-configured similar question template.
[0183] In the similarity question template, the entity type column corresponds to the concept, and the attribute column corresponds to the attribute. Similarity 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.
[0184] For example, "How do I apply for a parking space loan?" should be maintained as "How do I apply for [e]?" in a similar question template.
[0185] 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.
[0186] In the similarity question template, the following fields can be displayed: concept, attribute name, attribute type, similarity question, update time, operation, etc.
[0187] Specifically: (b1) Concept: corresponds to the concepts defined in the graph, which can be searched but cannot be added or edited.
[0188] (b2) Attribute type: corresponds to the attribute defined in the graph and cannot be edited.
[0189] Attribute types include but are not limited to: text, number, image, rich text, map, etc.
[0190] (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.
[0191] (b4) Update time: The time when the similar question was last modified.
[0192] (b5) Operation: Edit, Delete.
[0193] The similar question set includes multiple first attributes and at least one similar question corresponding to each first attribute. For example, the similar question set includes: first attribute A, and similar question A1 and similar question A2 corresponding to the first attribute A; first attribute B, and similar question B1 corresponding to the first attribute B, and so on.
[0194] During specific implementation, the comparison word set may be obtained from a pre-configured comparison word template.
[0195] The comparison word template can be used to generate question parsing datasets. The maintainable candidate words are mainly attribute words with the concept attribute type of "number". Its purpose is to ensure that relevant comparison type training data is generated in the parsing dataset.
[0196] The comparative word information may include a comparative word and a unit.
[0197] 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.
[0198] Units include but are not limited to: yuan, thousand, thousand yuan, ten thousand, ten thousand yuan, one hundred million yuan, day, day, month, year, %, percent, etc.
[0199] During specific implementation, the problem domain set can be obtained from a pre-configured problem domain template.
[0200] The question domain template is used to generate OOD model datasets, maintaining questions and chats that the question-answering system cannot answer. The backend samples a portion of the question parsing dataset to form binary positive and negative examples to ensure reasonable leakage of question-answering data. Due to the limitations of generated data, the OOD template provides editing and importing of both in-domain and out-of-domain questions to ensure classification accuracy and data maintainability.
[0201] The question domain set includes in-domain question texts and out-of-domain question texts.
[0202] The question domain set can be generated based on a 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.
[0203] 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.
[0204] 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?"
[0205] Step S804: Generate a question parsing sample based on at least one of the synonym set, the similar question set, and the comparative word set.
[0206] Problem parsing 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. For example, the generated problem parsing samples can be stored in the following format:
[0207] The above storage format is merely exemplary and does not constitute a special limitation to this embodiment.
[0208] 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.
[0209] Different types of problem parsing samples are generated in different ways. The following describes several of them in detail.
[0210] 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 corresponding to the target first attribute to obtain an initial similar question; determining a corresponding single-attribute sample based on the initial similar question, and determining the single-attribute sample as a question parsing sample.
[0211] Problem analysis samples may include single-slot samples or single-attribute samples.
[0212] In specific implementation, when the question parsing sample includes a single-slot sample, a question parsing sample is generated based on at least one of a synonym set, a similar question set, and a comparative word set. The synonym set can 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; the candidate word list is subjected to a first sampling process to obtain a single-slot sample.
[0213] 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.
[0214] Each preset slot type corresponds to one of the aforementioned slot identification results.
[0215] 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.
[0216] The slot recognition result "Entity" corresponds to the preset slot type "Entity". Single slot samples belonging to the preset slot type "Entity" can be "Product A", "Activity B", "Product C and Product D", and so on.
[0217] The slot recognition result "attribute" corresponds to the preset slot type "attribute". Single slot samples belonging to the preset slot type "attribute" can be "price", "activity deadline", "interest rate", "discount", etc.
[0218] Single-slot samples are generated to simulate questions asked when the user's intention is unclear, and can be used in guided rhetorical questions and continuous rhetorical questions scenarios.
[0219] Illustratively, a single-slot sample may be a single-entity sample, a double-entity sample, or a single-constraint sample.
[0220] It should be noted that although the "dual-entity sample" includes two entities, both entities correspond to a preset slot type, namely the preset slot type "entity", so the "dual-entity sample" is also a single-slot sample.
[0221] Figure 10 is a sub-diagram of the first processing flow of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 10 exemplifies a method for generating a single-slot sample, which includes but is not limited to: single-entity data 1008, dual-entity data 1010, and single-constraint data 1012.
[0222] As shown in FIG10 , the first preset filtering condition may include the filtering condition "entity" and the filtering condition "json key (JS object notation keyword)." Based on the filtering condition "entity," a synonym set 1002 is filtered to obtain a candidate word list 1004. A first sampling process is then performed on candidate word list 1004 to generate single-entity data 1008 and / or dual-entity data 1010. The sampling method of the first sampling process may be random sampling or other sampling methods.
[0223] Single entity data 1008, for example,
[0224] The "Bill Business" in the "text" row can be the generated data, namely the text corresponding to single entity data 1008. "NULL" can be a graph attribute, indicating that the storage intention of single entity data 1008 is empty. "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 the "Bill Business" in the "value" row can be the standard name of the header entity.
[0225] Based on the filtering condition “json key”, the synonym set 1002 is filtered to obtain a candidate word list 1006 . The candidate word list 1006 is subjected to a first sampling process to generate single constraint data 1012 .
[0226] Single constraint data 1012, for example,
[0227] In the "text" row, "X Branch" can be the generated data, namely, the text corresponding to single constraint data 1012. "Processing Procedure" can be a graph attribute, indicating that the storage intent of single constraint data 1012 is a processing procedure. "0" can be the starting position of the header entity, "4" can be the ending position of the header entity, "constraint" can be the header entity category, and "X Branch" in the "value" row can be the standard name of the header entity.
[0228] In specific implementation, when the question parsing sample includes a single-attribute sample, the question parsing sample is generated based on at least one of the synonym set, the similar question set and the comparative word set. The second sampling process can be performed on multiple first attributes in the similar question set to obtain the target first attribute; the third sampling process can be performed on at least one similar question sentence corresponding to the target first attribute to obtain an initial similar question sentence; based on the initial similar question sentence, the corresponding single-attribute sample is determined, and the single-attribute sample is determined as the question parsing sample.
[0229] Specifically, based on 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.
[0230] Single-attribute samples are text samples that only correspond to the preset slot type "attribute." Single-attribute samples are a special type of single-slot sample. Because their purpose differs from the "single-entity samples," "dual-entity samples," and "single-constraint samples" listed above, they are described separately.
[0231] 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.
[0232] Figure 11 is a second processing flow chart of a sample generation method of a question-answering system provided by an embodiment of the present application. Figure 11 exemplarily illustrates a method for generating a single-attribute sample, where the single-attribute sample can be single-attribute data 1108 .
[0233] As shown in Figure 11, a second sampling process is performed on multiple first attributes in similar question set 1102 to obtain a target first attribute. A third sampling process is performed on at least one similar question corresponding to the target first attribute to obtain an initial similar question. If the initial similar question carries a mask, that is, the initial similar question is a similar question 1104 with [e], [e] is deleted to obtain single-attribute data 1108. If the initial similar question does not carry a mask, that is, the initial similar question is a similar question 1106 without [e], similar question 1106 is determined as single-attribute data 1108.
[0234] The second sampling process and the third sampling process may be random sampling or other sampling methods.
[0235] Single attribute data 1108, for example,
[0236] The text "What is the handling process?" in the "text" row can be generated data, namely, the text corresponding to single-attribute data 1108. "Handling process" can be a graph attribute, indicating that the storage intent of single-attribute data 1108 is handling process. Single-attribute data 1108 has neither a header entity nor a footer entity.
[0237] 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 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 with a mask corresponding to each first attribute; determining target candidate entity words and target candidate similar questions corresponding to the same attribute category based on 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 a random number; splicing the comparative word information, attribute synonyms, entity synonyms, random numbers, and preset descriptive words to obtain a comparison type sample, and determining the comparison type sample as a question parsing sample.
[0238] Problem analysis samples can include composite samples as well as comparative samples.
[0239] In specific implementation, when the question parsing sample includes a composite sample, the question parsing sample is generated according to at least one of the synonym set, the similar question set and the comparison word set. The method may be to filter the synonym set according to the second preset filtering condition to obtain a candidate entity word list; the candidate entity word list includes multiple candidate entity words; the similar question set 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 with a mask corresponding to each first attribute; the target candidate entity word and the target candidate similar question sentence corresponding to the same attribute category are determined according to the candidate word list and the intermediate similar question set; the mask in the target candidate similar question sentence is replaced by the target candidate entity word to obtain a composite sample.
[0240] 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.
[0241] 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.
[0242] The generation of single-entity, single-attribute samples simulates questions asked by users about the attributes of an object. This is used in single-entity, single-attribute scenarios. The generation of single-entity, dual-attribute samples simulates questions asked by users about two or more attributes of an object simultaneously. This is used in single-entity, multi-attribute scenarios. The generation of dual-entity, single-attribute samples simulates questions asked by users about the same attribute of multiple objects simultaneously. This is used in multi-entity, single-attribute scenarios. The generation of dual-entity, dual-attribute samples simulates questions asked by users about multiple attributes of multiple objects simultaneously. This is used in multi-entity, multi-attribute scenarios.
[0243] Figure 12 is a third sub-diagram of the processing flow of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 12 illustrates an exemplary method for generating a composite sample, which may be composite data 1212. Composite data 1212 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.
[0244] As shown in FIG12 , the second preset filtering condition may include the filtering condition "entity." Based on the filtering condition "entity," a synonym set 1202 is filtered to obtain a candidate entity word list; the candidate entity word list includes multiple candidate entity words; a similar question set 1204 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 1206 with a mask corresponding to each first attribute; candidate entity words and candidate similar question sentences 1208 corresponding to each attribute category are determined based on the candidate word list and the intermediate similar question set; candidate entity words and candidate similar question sentences 1208 corresponding to each attribute category are randomly sampled to obtain target candidate entity words and target candidate similar question sentences 1210 corresponding to the same attribute category; and mask [e] in the target candidate similar question sentences is replaced with the target candidate entity words to obtain composite data 1212.
[0245] Determine the target candidate entity words and target candidate similar questions 1210 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 1212, 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.
[0246] Single-entity single-attribute data, for example,
[0247] "Where is Business A supported?" can be generated data, i.e., text corresponding to single-entity, single-attribute data. "Processing channel" can be a graph attribute, indicating that the storage intent for this single-entity, single-attribute data is a processing channel. "9" can be the start position of the header entity, "12" can be the end position of the header entity, "Business" can be the header entity category, and "Business A" can be the standard name of the header entity.
[0248] Determine the target candidate entity words and target candidate similar questions 1210 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 1212. 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 with the target candidate entity word to obtain attribute question 1, and delete [e] in the second target candidate similar question to obtain attribute question 2; concatenate attribute question 1 and attribute question 2 to obtain single-entity dual-attribute data.
[0249] Single entity dual attribute data, for example,
[0250] Here, "What documents do I need to submit for business X? What are the application requirements?" can be generated data, that is, the text corresponding to single-entity, dual-attribute data. "Processing Documents" and "Processing Conditions" can be two different graph attributes, used to indicate that the storage intent of this single-entity, dual-attribute data includes both processing documents and processing 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 standard name of the first header entity, and "X" can be the standard name of the second header entity.
[0251] It should be noted that in this 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.
[0252] Determine the target candidate entity words and target candidate similar questions 1210 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 1212. Alternatively, randomly select two target candidate entity words and one 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 with the target splicing method to obtain the target splicing times, and replace the mask [e] in the target candidate similar questions with the target splicing words to obtain dual-entity parametric data.
[0253] The preset splicing method, for example, uses one of “and”, “and”, “,”, “,” to splice two words together.
[0254] Dual-entity single-attribute data, e.g.
[0255] Here, "What is the credit limit for Business A and Business B?" can be generated data, that is, the text corresponding to dual-entity, single-attribute data. "Amount" can be a graph attribute, indicating that the storage intent of this dual-entity, single-attribute data is the credit limit. "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, and "Business" can be the header entity category. "Business A" can be the standard name of the first header entity, and "Business B" can be the standard name of the second header entity.
[0256] 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.
[0257] Figure 13 is a fourth processing flow sub-diagram of a sample generation method for a question-answering system provided by an embodiment of the present application. Figure 13 exemplarily illustrates a method for generating a dual-entity dual-attribute sample, which may be dual-entity dual-attribute data 1306 .
[0258] During specific implementation, multiple pieces of data can be randomly selected from the multiple single-entity single-attribute data that have been generated, for example, single-entity single-attribute data 1302 and single-entity single-attribute data 1304, and the single-entity single-attribute data 1302 and the single-entity single-attribute data 1304 can be spliced together using randomly selected connectors to form dual-entity dual-attribute data 1306.
[0259] Dual-entity dual-attribute data 1306, for example,
[0260] Among them, "What are the specific ways to use the credit limit of product Y, and what types 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 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.
[0261] In addition, Figure 14 is a fifth processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 14 exemplifies a method for generating a composite attribute constraint sample. The composite attribute constraint sample can be composite attribute constraint data 1416.
[0262] 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. It is used in compound attribute constraint scenarios and continuous rhetorical question scenarios.
[0263] As shown in FIG14 , the synonym set 1402 is filtered based on the filter condition “json key” to obtain json attribute synonyms 1406 , and the synonym set 1402 is filtered based on the filter condition “entity” to obtain entity synonyms 1408 .
[0264] The similar question set 1404 is screened to obtain similar questions with masks, that is, similar questions 1410 with [e].
[0265] According to the json attribute synonyms 1406, the entity synonyms 1408 and the similar questions 1410 with [e], the entity synonyms, the json attribute synonyms and the similar questions 1412 corresponding to each attribute category can be determined.
[0266] By randomly sampling the entity synonyms, JSON attribute synonyms, and similar questions 1412 corresponding to each attribute category, we can obtain target entity synonyms, target JSON attribute synonyms, and target similar questions 1414. The target entity synonyms are used to replace the [e] in the target similar questions to obtain intermediate similar questions. A randomly determined concatenation method is then used to concatenate the target JSON attribute synonyms and the intermediate similar questions to obtain composite attribute constraint data 1416.
[0267] Composite attribute constraint data 1416, for example,
[0268] Here, "Can you tell me about the application process for Business B (Mobile Banking)?" can be generated data, i.e., the text corresponding to composite attribute constraint data 1416. "Application process" can be a graph attribute, indicating that the storage intent of composite attribute constraint data 1416 is application process. "3" can be the start position of the header entity, "6" can be the end position of the header entity, "11" can be the start position of the tail entity, "15" can be the end position of the tail entity, "Business" can be the header entity category, "Constraint" can be the tail entity category, "Business B" can be the standard name of the header entity, and "Mobile Banking" can be the standard name of the tail entity.
[0269] In specific implementation, when the question parsing sample includes a comparison type sample, the question parsing sample is generated based on at least one of the synonym set, the similar question set and the 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.
[0270] 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 facilitate the distinction between different filtering conditions and have no actual meaning.
[0271] Comparison type samples are generated to simulate users asking questions that require numerical comparison, such as the maximum, minimum, greater than, less than, or between, of a certain attribute under a certain category of things, and are used in comparison sentence scenarios.
[0272] Figure 15 is a sixth processing flow chart of a sample generation method of a question-answering system provided by an embodiment of the present application. Figure 15 exemplarily illustrates a method for generating a comparison type sample, where the comparison type sample can be comparison type data 1512.
[0273] As shown in FIG. 15 , the synonym set 1504 is filtered according to the third preset filtering condition to obtain attribute synonyms 1506 and entity synonyms 1508 .
[0274] Generate a random number 1510.
[0275] Comparison type data 1512 is obtained by performing concatenation processing based on the comparison word information 1502 , attribute synonyms 1506 , entity synonyms 1508 , random numbers 1510 and preset description words in the comparison word set.
[0276] Comparison type data 1512, for example,
[0277] Here, "The maximum number of years for product M" can be generated data, i.e., the text corresponding to comparison type data 1512. "Term" can be a graph attribute, indicating that the storage intention of comparison type data 1512 is a 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.
[0278] Preset descriptive words, such as what are there, what are there, which ones, what are there, what are there, let me tell you about it, etc.
[0279] During 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 data of maximum, minimum, greater than, and less than types, 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.
[0280] Assuming that the above contents are ABC, the possible splicings are: ABC, ACB, BAC, BCA, CBA, CAB, etc., which constitute the attribute question.
[0281] During specific implementation, the data of numerical single constraint may be composed of comparison words, random numbers, and units, for example, greater than 4.35% and less than 5 years.
[0282] In practice, we can also select entities and synonyms that are leaf nodes of the same type in the knowledge graph, randomly select a splicing method to combine two entity synonyms, and then use conjunctions to combine attribute words and comparison words to form attribute questions. For example, who has a higher interest rate, A or B? Who has a longer term, A or C?
[0283] Step S806: Generate question classification samples based on the question parsing samples and the question domain set; and generate entity linking samples based on the question parsing samples and the standard entity library.
[0284] It should be noted that the generation of question classification samples and entity linking samples can use a portion of the question parsing samples generated in step S804.
[0285] The specific description of the question classification samples in this embodiment can refer to the corresponding content in the above method embodiment.
[0286] In a specific implementation method, a question classification sample is generated based on the question parsing sample and the problem domain set, including: performing a fourth sampling process on the question parsing sample to obtain a first in-domain sample; generating a corresponding second in-domain sample based on the in-domain question text; generating a corresponding out-of-domain sample based on the out-of-domain question text; and generating a question classification sample based on the first in-domain sample, the second in-domain sample and the out-of-domain sample.
[0287] The sampling method of the fourth sampling process may be random sampling or other sampling methods.
[0288] 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.
[0289] Figure 16 is a seventh processing flow sub-diagram of a sample generation method for a question-answering system provided in an embodiment of the present application. Figure 16 exemplarily illustrates a method for generating question classification samples, and its specific processing flow includes steps S1602 to S1606:
[0290] Step S1602: extract a first in-domain sample from the problem parsing sample, and obtain a second in-domain sample and an out-of-domain sample from the problem domain set.
[0291] Step S1604: adding positive labels to the first in-domain samples and the second in-domain samples, and adding negative labels to the out-of-domain samples.
[0292] Step S1606: merge all samples and save them into a json file.
[0293] In a specific implementation method, entity link 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 link samples.
[0294] Determining a preset number of target standard entities corresponding to the non-standard entity according to the ranking result may be determining the preset number of standard entities with the greatest similarity as the target standard entities.
[0295] For example, for the non-standard entity “unit notice deposit”, the top 5 most similar entities recalled in the standard entity library based on similarity are “unit notice deposit”, “unit fixed deposit”, “unit current deposit”, “unit agreement deposit”, and “unit fixed deposit passbook”.
[0296] Based on 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.
[0297] For example, the constructed positive sample is {"text":"What is the transaction time of "Unit Notice Deposit" [sep]Unit Notice Deposit","label":1}.
[0298] The constructed negative samples include: {"text":"What is the transaction time of "Unit Notice to Deposit Money"[sep]Unit Fixed Deposit Money","label":0}; {"text":"What is the transaction time of "Unit Notice to Deposit Money"[sep]Unit Current Deposit Money","label":0}; {"text":"What is the transaction time of "Unit Notice to Deposit Money"[sep]Unit Agreement Deposit","label":0}; {"text":"What is the transaction time of "Unit Notice to Deposit Money"[sep]Unit Fixed Deposit Booklet","label":0}.
[0299] Figure 17 is a sub-diagram of the eighth processing flow of a sample generation method of a question-answering system provided by an embodiment of the present application. Figure 17 exemplarily illustrates a method for generating entity link samples, and its specific processing flow includes steps S1702 to S1708.
[0300] Step S1702: randomly select a certain number of target parsing samples carrying non-standard entities from the question parsing samples.
[0301] Step S1704: Take out the non-standard entity and retrieve the top 5 most similar standard entities in the standard entity library.
[0302] Step S1706: construct positive and negative samples based on the non-standard entities and the recalled standard entities.
[0303] Step S1708: merge all samples and save them into a json file.
[0304] Step S808: construct a training data set for the question answering system based on the question classification samples, question parsing samples, and entity linking samples.
[0305] 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.
[0306] In the embodiment shown in Figure 8, 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, and 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.
[0307] Based on the same technical concept as the aforementioned method embodiment, this embodiment of the present application also provides an embodiment of a model training method for a question-answering system. Figure 18 is a processing flow chart of another model training method for a question-answering system provided in this embodiment of the present application. Referring to Figure 18, the processing flow of the model training method for a question-answering system specifically includes steps S1802 to S1804.
[0308] Step S1802: Generate a training data set using a sample generation method of a question-answering system; the training data set includes question classification samples, question parsing samples, and entity linking samples.
[0309] The sample generation method of the question-answering system may be the sample generation method of the question-answering system provided in the aforementioned embodiment of the sample generation method of the question-answering system.
[0310] In step S1804, 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.
[0311] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above.
[0312] Based on the same technical concept as the aforementioned method embodiment, this embodiment of the present application also provides an embodiment of a response method. Figure 19 is a processing flow chart of another response method provided in this embodiment of the present application. Figure 20 is a working principle diagram of a question-and-answer system provided in this embodiment of the present application. Referring to Figure 19, the processing flow of the response method specifically includes steps S1902 to S1910.
[0313] The answering method shown in the embodiment of Figure 19 can be applied to a question-answering system, which may 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.
[0314] Step S1902: Obtain the target question to be answered.
[0315] In step S1904, the target question is input 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.
[0316] The sample generation method of the question-answering system may be the sample generation method of the question-answering system provided in the aforementioned embodiment of the sample generation method of the question-answering system.
[0317] Step S1906, 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.
[0318] Step S1908: Input 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 entity linking samples in the training dataset into the initial entity linking model for training;
[0319] Step S1910: Determine the answer to the target question based on the target entity.
[0320] In a specific implementation method, the answer to the target question is determined based on the target entity, including: performing slot filling processing based on the target entity to obtain a slot filling result for the target question; based on the slot filling result, querying the corresponding answer in a pre-configured knowledge graph to obtain the answer to the target question.
[0321] According to the target entity, slot filling processing is performed. This can be for the target entity obtained in step S1908. First, at least one slot template that the target entity may correspond to is determined. Then, for each slot template, slot filling processing is performed on the slot template through the target entity to obtain the filled slot template. The filled slot template is determined as the slot filling result corresponding to the target problem.
[0322] Among them, the slot template in this embodiment is the same as the slot template in the aforementioned method embodiment, and the specific scheme in the aforementioned method embodiment can be referred to.
[0323] In a specific implementation method, based on the slot filling result, the corresponding answer is queried in the pre-configured knowledge graph, including: if the slot filling result cannot be used to query in the knowledge graph to obtain a unique corresponding answer, then the slot missing information corresponding to the slot filling result is determined; a rhetorical question is generated based on the slot missing information; user input in response to the rhetorical question is received; slot filling processing is performed according to the user input; and based on the slot filling result after the slot filling processing, the corresponding answer is queried in the pre-configured knowledge graph to obtain the answer to the target question.
[0324] 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 second-filled slot template 1: 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.
[0325] The following is an example of the processing flow of the answering method shown in FIG19 , with reference to the working principle diagram of the question-answering system shown in FIG20 :
[0326] 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.
[0327] Next, the question parsing model is used to identify slots in the domain question. Slots include but are not limited to: entities, attributes, relations, constraints, etc. After the question parsing model completes entity recognition, one or more entity fragments will be obtained.
[0328] 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.
[0329] After the question parsing model analyzes the sentence, 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.
[0330] If the entity is missing, such as: How to apply? The DM can ask: What product do you want to inquire about? If the attribute is missing, such as: Parking space loan. The DM can ask: What specific questions do you want to ask about parking space loan?
[0331] 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.
[0332] In the question-answering system shown in Figure 20, 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.
[0333] 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 a standard entity library and the question parsing training set; and the OOD training set can be generated based on an OOD template and the question parsing training set. Synonym templates, similar question templates, comparative word templates, OOD templates, and rhetorical question templates can be generated based on the customer knowledge base.
[0334] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above.
[0335] In the above embodiment, a sample generation method for 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 for a question-answering system, which is described below with reference to the accompanying drawings.
[0336] Figure 21 is a schematic diagram of a sample generation device of a question-answering system provided in an embodiment of the present application.
[0337] This embodiment provides a sample generation device 2100 for a question-answering system, comprising: a third acquisition unit 2102, configured 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 comprises a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set comprises a plurality of first attributes and at least one similar question sentence corresponding to each of the first attributes; the comparative word set comprises comparative word information; the problem domain set comprises in-domain question text and out-of-domain question text; the standard entity library comprises a plurality of standard entities; a first generation unit 2104, configured to generate a question parsing sample based on at least one of the synonym set, the similar question set, and the comparative word set; a second generation unit 2106, configured to generate a question classification sample based on the question parsing sample and the problem domain set; and, to generate the entity link sample based on the question parsing sample and the standard entity library; a construction unit 2108, configured 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.
[0338] Optionally, the first generation unit 2104 is specifically used to: filter the synonym set according to the 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; perform a first sampling process on the candidate word list to obtain a single-slot sample, and determine the single-slot sample as the question parsing sample; or perform a second sampling process on multiple first attributes in the similar question set to obtain a target first attribute; perform a third sampling process on at least one similar question corresponding to the target first attribute to obtain an initial similar question; determine the corresponding single-attribute sample based on the initial similar question, and determine the single-attribute sample as the question parsing sample.
[0339] Optionally, the first generation unit 2104 is specifically used to: filter the synonym set according to the second preset filtering condition to obtain a candidate entity word list; the candidate entity word list includes multiple candidate entity words; screen 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 with a mask corresponding to each first attribute; determine the target candidate entity word and target candidate similar question sentence corresponding to the same attribute category based on the candidate word list and the intermediate similar question set; replace the mask in the target candidate similar question sentence with the target candidate entity word to obtain a composite sample, and determine the composite sample as the problem parsing sample; or filter the synonym set according to the third preset filtering condition to obtain attribute synonyms and entity synonyms; generate a random number; splice 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 determine the comparison type sample as the problem parsing sample.
[0340] Optionally, the second generation unit 2106 is specifically used to: perform a fourth sampling process on the question parsing sample to obtain a first in-domain sample; generate a corresponding second in-domain sample based on the in-domain question text; generate a corresponding out-of-domain sample based on the out-of-domain question text; and generate the question classification sample based on the first in-domain sample, the second in-domain sample and the out-of-domain sample.
[0341] Optionally, the second generation unit 2106 is specifically used to: determine a target parsing sample carrying a non-standard entity based on the problem parsing sample; calculate the similarity between the non-standard entity and each of the standard entities in the standard entity library and sort them; determine a preset number of target standard entities corresponding to the non-standard entity based on the sorting result; construct 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 determine the positive and negative samples as the entity link samples.
[0342] The sample generation device of the question-answering system provided in the embodiment of the present application includes a third acquisition unit, which is used to acquire 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; the first generation unit is used to generate question parsing samples based on at least one of the synonym set, similar question set and comparison word set; the second generation unit is used to generate question classification samples based on the question parsing samples and the problem domain set; and, based on the question parsing samples and the standard entity library, generate entity link samples; the construction unit is used to construct a training data set for the question-answering system based on the question classification samples, question parsing samples and entity link samples. On the one hand, question parsing samples, question classification samples and entity linking samples are generated based on 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.
[0343] 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 with reference to the accompanying drawings.
[0344] Figure 22 is a schematic diagram of a model training device for another question-answering system provided in an embodiment of the present application.
[0345] This embodiment provides a model training device 2200 for a question-answering system, comprising: a third generation unit 2202, for generating a training data set by a sample generation method of the question-answering system; the training data set comprises the question classification sample, the question parsing sample and the entity linking sample; a second training unit 2204, for inputting the question classification sample into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; inputting the question parsing sample into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; and inputting the entity linking sample into the initial entity linking model in the question-answering system for iterative training to obtain an entity linking model.
[0346] The model training device for a question-answering system provided in an embodiment of the present application includes a third generation unit for generating a training data set using a sample generation method for the question-answering system; the training data set includes question classification samples, question parsing samples, and entity linking samples; a second training unit for inputting the question classification samples into an initial question classification model in the question-answering system for iterative training to obtain a question classification model; inputting the question parsing samples into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; and inputting the entity linking samples 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, question parsing samples, question classification samples, and entity linking samples are generated based on a pre-configured synonym set, similar question set, comparative word set, question domain set, and standard entity library, thereby generating a large number of training samples using a small amount of pre-configured data, improving sample generation efficiency and reducing manual workload; on the other hand, the question parsing samples can be used not only for training the initial question parsing model, but also for generating 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 answer accuracy of the question-answering system.
[0347] In the above 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 is described below with reference to the accompanying drawings.
[0348] Figure 23 is a schematic diagram of another response device provided in an embodiment of the present application.
[0349] This embodiment provides an answering device 2300, including: a fourth acquisition unit 2302, used to acquire a target question to be answered; a classification unit 2304, 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 question classification samples in a training data set into an initial question classification model for training; the training data set is generated by a sample generation method of a question-answering system; a second parsing unit 2306, used to input the target question into a question parsing model for parsing processing 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; a prediction unit 2308, used to input 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 second determination unit 2310, used to determine the answer to the target question based on the target entity.
[0350] Optionally, the second determination unit 2310 is specifically used to: perform slot filling processing according to the target entity to obtain a slot filling result for the target question; and query a corresponding answer in a pre-configured knowledge graph according to the slot filling result to obtain an answer to the target question.
[0351] Optionally, the second determination unit 2310 is further specifically used to: if the slot filling result cannot be used to query the knowledge graph to obtain a unique corresponding answer, then determine the slot missing information corresponding to the slot filling result; generate a rhetorical question based on the slot missing information; receive user input in response to the rhetorical question; perform slot filling processing based on the user input; and query the corresponding answer in a pre-configured knowledge graph based on the slot filling result after the slot filling processing to obtain the answer to the target question.
[0352] The answering device provided by the embodiment of the present application includes: a fourth acquisition unit, used to acquire the target question to be answered; a classification unit, 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; a second parsing unit, used to input the target question into the question parsing model for parsing processing when the classification result is used to characterize that the target question belongs to the first preset classification, so as to obtain a corresponding target fragment; 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 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 second determination unit, used to determine the answer to the target question based on 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, which can generate a large number of training samples using a small amount of pre-configured data, improve sample generation efficiency and reduce 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, which improves 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 answering system.
[0353] Corresponding to the model training method of the question-answering system described above, or, corresponding to the answering method described above, or, corresponding to the sample generation method of the question-answering system 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 model training method of the question-answering system provided above, or, the answering method provided above. Figure 24 is a structural schematic diagram of an electronic device provided by an embodiment of the present application.
[0354] As shown in Figure 24, electronic devices may have relatively large differences due to different configurations or performances, and may include one or more processors 2401 and memory 2402. The memory 2402 may store one or more applications or data. Among them, the memory 2402 may be a temporary storage or a persistent storage. The application stored in the memory 2402 may include one or more modules (not shown in the figure), each of which may include a series of computer-executable instructions in the electronic device. Furthermore, the processor 2401 may be configured to communicate with the memory 2402 to execute a series of computer-executable instructions in the memory 2402 on the electronic device. The electronic device may also include one or more power supplies 2403, one or more wired or wireless network interfaces 2404, one or more input / output interfaces 2405, one or more keyboards 2406, etc.
[0355] 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 in the electronic device, and is configured to be executed by one or more processors. The one or more programs include instructions for performing the following computer-executable instructions: obtaining a question text sample; inputting the question text sample into the initial question parsing model for iterative training to obtain a question parsing model; the initial question parsing model includes a first encoding layer and a conversion layer; the first encoding layer is used to perform encoding processing based on the question text sample to obtain a corresponding first sentence vector; the conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each of the initial intention vectors according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text segment; the text segment is used to query the answer to the question text sample in the question-answering system.
[0356] 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, and include computer-executable instructions for performing the following: obtaining 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 a plurality of standard words and at least one synonym corresponding to each of the standard words; the similar question set The set includes multiple first attributes and at least one similar question corresponding to each of the first attributes; 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; based on the synonym set, the similar question set and at least one of the comparison word set, a question parsing sample is generated; 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, the entity link sample is generated; 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.
[0357] In another specific embodiment, an 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 is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following: obtaining a target question to be answered; inputting the target question into a question parsing model for parsing to obtain a corresponding target fragment; the question parsing model is obtained by training through a model training method of a question-answering system; and determining an answer to the target question based on the target fragment.
[0358] 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 is configured to be executed by one or more processors, and the one or more programs include computer-executable instructions for performing the following: generating a training data set by 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 link sample; inputting the question classification sample into the initial question classification model in the question-answering system for iterative training to obtain a question classification model; inputting the question parsing sample into the initial question parsing model in the question-answering system for iterative training to obtain a question parsing model; inputting the entity link sample into the initial entity link model in the question-answering system for iterative training to obtain an entity link model.
[0359] 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 is configured to be executed by one or more processors, including the one or more programs for performing the following computer-executable instructions: obtaining a target question to be answered; 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 a sample generation method of a question-answering system; when the classification result is used to characterize that the target question belongs to a first preset classification, inputting the target question 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; 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; and determining the answer to the target question based on the target entity.
[0360] An embodiment of a computer-readable storage medium provided in this specification is as follows:
[0361] 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.
[0362] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, which implement the following process when executed by a processor: obtaining a question text sample; inputting the question text sample into the initial question parsing model for iterative training to obtain a question parsing model; the initial question parsing model includes a first encoding layer and a conversion layer; the first encoding layer is used to perform encoding processing based on the question text sample to obtain a corresponding first sentence vector; the conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each of the initial intention vectors according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text fragment; the text fragment is used to query the answer to the question text sample in the question-answering system.
[0363] 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 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.
[0364] 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.
[0365] 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: obtaining a target question to be answered; inputting the target question into a question parsing model for parsing and processing to obtain a corresponding target segment; the question parsing model is obtained by training using a model training method of a question-answering system; and determining the answer to the target question based on the target segment.
[0366] 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 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.
[0367] 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.
[0368] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, which implement the following process when executed by a processor: 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 of the standard words; the similar question set includes multiple first attributes and at least one similar question sentence corresponding to each of the first attributes; 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; generating question parsing samples based on at least one of the synonym set, the similar question set and the comparison word set; generating question classification samples based on the question parsing samples and the problem domain set; and generating the entity link samples based on the question parsing samples and the standard entity library; constructing a training data set for the question-answering system based on the question classification samples, the question parsing samples and the entity link samples.
[0369] 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-answering system in this specification are based on the same 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.
[0370] 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.
[0371] 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: a training data set is generated by a sample generation method of a question-answering system; the training data set includes the question classification samples, the question parsing samples and the entity linking samples; 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.
[0372] 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 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.
[0373] 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.
[0374] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions, which implement the following process when executed by a processor: obtaining a target question to be answered; 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 a sample generation method of a question-answering system; when the classification result is used to characterize that the target question belongs to a first preset classification, inputting the target question 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; 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; and determining the answer to the target question based on the target entity.
[0375] 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 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.
[0376] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0377] 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 take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0378] 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 produce a machine, so that the instructions executed by the processor of the computer or other programmable device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0379] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0380] 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, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0381] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0382] 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. Memory is an example of a computer-readable medium.
[0383] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The 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 disc read-only memory (CD-ROM), digital versatile disc (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 transitory media such as modulated data signals and carrier waves.
[0384] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0385] The 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.
[0386] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0387] The foregoing description is merely an example of the present invention and is not intended to limit the present invention. Persons skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims herein.
Claims
1. A model training method for a question-answering system, the question-answering system comprising an initial question parsing model; the method comprising: Get sample question text; Inputting the question text sample into the initial question parsing model for iterative training to obtain a question parsing model; The initial question parsing model includes a first encoding layer and a conversion layer; The first encoding layer is used to perform encoding processing according to the question text sample to obtain a corresponding first sentence vector; The conversion layer is used to generate a preset number of initial intention vectors when receiving the first sentence vector, fill each of the initial intention vectors according to the first sentence vector to obtain a corresponding target intention vector, and convert the target intention vector into a corresponding text fragment; the text fragment is used to query the answer to the question text sample in the question and answer system.
2. The method according to claim 1, wherein: The first sentence vector includes a semantic feature sub-vector and a plurality of character sub-vectors; and the specific implementation methods of performing filling processing on each of the initial intention vectors according to the first sentence vector to obtain a corresponding target intention vector are: Performing intent classification processing on the semantic feature sub-vector to obtain a corresponding intent classification result; According to the intention classification result, each of the initial intention vectors is filled to obtain a corresponding intermediate intention vector; According to each of the character sub-vectors, each of the intermediate intention vectors is filled to obtain a corresponding target intention vector.
3. The method according to claim 2, wherein: The specific implementation methods of performing filling processing on each of the intermediate intention vectors according to each of the character sub-vectors to obtain the corresponding target intention vector are: According to each of the character sub-vectors, entity recognition processing and constraint recognition processing are performed to obtain a corresponding character recognition result; According to the character recognition result, each of the intermediate intention vectors is filled to obtain a corresponding target intention vector.
4. The method according to claim 3, wherein: The specific implementation methods of performing filling processing on each of the intermediate intention vectors according to the character recognition result to obtain the corresponding target intention vector are: If the character recognition result is used to characterize that the character sub-vector belongs to an entity category or a constraint category, then the corresponding intermediate intention vector is determined and filled according to the character recognition result.
5. The method according to any one of claims 1 to 4, wherein: The question text sample includes at least one of an entity element, an attribute element, a relationship element, and a constraint element; The preset number of initial intention vectors include a first intention vector and multiple second intention vectors; the first intention vector corresponds to no intention, and each of the second intention vectors corresponds to one of the attribute elements or one of the relationship elements.
6. The method according to claim 1, wherein: The question answering system further includes an initial entity linking model; and the method further includes: Get entity link samples; Inputting the entity link sample into the initial entity link model for iterative training to obtain an entity link model; the entity link model includes a second encoding layer and a prediction layer; The second encoding layer is used to encode the entity link sample to obtain a corresponding second sentence vector; The prediction layer is used to perform prediction processing according to the second sentence pattern vector to determine the corresponding target entity.
7. The method according to claim 1, wherein: The question answering system further includes an initial question classification model; the method further includes: Obtain problem classification samples; The question classification samples are input into the initial question classification model for iterative training to obtain a question classification model.
8. A response method, comprising: Get the target questions to be answered; Inputting the target problem into the problem parsing model for parsing and processing to obtain a corresponding target segment; The question parsing model is obtained by training through the model training method of the question answering system according to any one of claims 1 to 7; An answer to the target question is determined based on the target segment.
9. The method according to claim 8, wherein: The step of inputting the target problem into the problem parsing model for parsing to obtain a corresponding target segment includes: Inputting the target problem into the problem classification model for classification processing to obtain a classification result; 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 the question parsing model for parsing to obtain a corresponding target segment.
10. The method according to claim 8, wherein: Determining the answer to the target question according to the target segment includes: Inputting the target segment into an entity linking model for prediction processing to obtain a corresponding target entity; 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.
11. A response device, comprising: A second acquisition unit, used to acquire a target question to be answered; A first parsing unit, configured to input the target question into a question parsing model for parsing and processing to obtain a corresponding target segment; The question parsing model is obtained by training through the model training method of the question answering system according to any one of claims 1 to 7; The first determining unit is used to determine an answer to the target question according to the target segment.
12. A sample generation method for a question-answering system, the method comprising: Get pre-configured synonym sets, similar question sets, comparison word sets, problem domain sets, and standard entity libraries; 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 problem texts and out-of-domain problem texts; 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 problem classification sample according to the problem analysis sample and the problem domain set; And, generating the entity link 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.
13. The method according to claim 12, wherein: 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.
14. The method according to claim 12, wherein: 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; 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; 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 question parsing sample.
15. The method according to claim 12, wherein: 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.
16. The method according to claim 12, wherein: 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.
17. A model training method for a question answering system, comprising: Generate a training data set by using the sample generation method of the question answering system according to any one of claims 12 to 16; 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.
18. A response method, comprising: 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 a training data set into an initial question classification model for training; the training data set is generated by a sample generation method of a question answering system according to any one of claims 12 to 16; In a 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 the question parsing model for parsing 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.
19. The method according to claim 18, wherein: 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.
20. The method according to claim 19, wherein: 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 sentence 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.
21. A sample generation device for a question-answering system, the device comprising: A third 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 problem texts and out-of-domain problem texts; 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, configured to generate a problem classification sample according to the problem parsing sample and the problem domain set; And, generating the entity link 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.
22. A response device, comprising: A fourth 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 a training data set into an initial question classification model for training; the training data set is generated by a sample generation method of a question answering system according to any one of claims 12 to 16; A second parsing unit is used to input the target question into the 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 the 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; The second determining unit is used to determine the answer to the target question according to the target entity.
23. An electronic device, comprising: processor; And, a memory configured to store computer-executable instructions, which, when executed, cause the processor to perform the model training method for the question-answering system as described in any one of claims 1-7, or the answering method as described in any one of claims 8-10, or the sample generation method for the question-answering system as described in any one of claims 12-16, or the model training method for the question-answering system as described in claim 17, or the answering method as described in any one of claims 18-20.
24. A computer-readable storage medium, wherein: The computer-readable storage medium is used to store computer-executable instructions, which, when executed by a processor, implement the model training method for the question-answering system as described in any one of claims 1 to 7, or the answering method as described in any one of claims 8 to 10, or the sample generation method for the question-answering system as described in any one of claims 12 to 16, or the model training method for the question-answering system as described in claim 17, or the answering method as described in any one of claims 18 to 20.
Citation Information
Patent Citations
Intelligent question answering method, apparatus, computer device and storage medium
CN109522393A
Associated question recommendation method, device and equipment, and readable storage medium
CN111506719A
Statement reply method, statement reply device and electronic equipment
CN112163067A
Intelligent question and answer method, device and equipment
CN113377936A
Model training method and device of question answering system, electronic equipment and storage medium
CN116306974A
Cited By
Resource processing method and device based on knowledge graph and large model
CN118939790A
Data construction method, code question-answering method, task platform and code question-answering system
CN119149712A
Intelligent filling device and intelligent filling method for contract
CN119647425A
Network configuration generation method and device based on knowledge graph, equipment and medium
CN120528793A
Government affair policy question and answer method based on knowledge graph and related equipment
CN120849569A
