Question and answer processing method, device, and equipment

By using the Q&A processing method in the online shopping platform, the user's questions are automatically answered through the model, the problem of delayed reply by the seller is solved and the user's willingness to interact is improved.

CN112395398BActive Publication Date: 2025-06-13ALIBABA GROUP HOLDING LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910760258.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-16
Publication Date
2025-06-13
Estimated Expiration
2039-08-16

AI Technical Summary

Technical Problem

In online shopping platforms, sellers often respond to questions raised by buyers in a timely manner, causing buyers to lose their willingness to continue interacting and even no longer consider the seller's products.

Method used

Provide a question-and-answer processing method to automatically answer consulting questions raised by users through a model. The method includes receiving a question statement, obtaining the attributes corresponding to the question statement through the model, and generating a corresponding reply statement.

Benefits of technology

It realizes quick and automatic response to questions raised by users, reduces the delay in sellers' responses, and increases buyers' willingness to interact with products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112395398B_ABST
    Figure CN112395398B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides a question-and-answer processing method, device, and equipment. The question-and-answer processing method includes: receiving a first question statement for a target item at a first time, inputting the first question statement into a model to obtain an attribute corresponding to the first question statement through the model, where the model has already obtained the attribute and the attribute value from the question-and-answer statement pairs associated with the target item; obtaining a first reply statement corresponding to the attribute of the target item, the first reply statement including the attribute value, and outputting the first reply statement, thereby realizing an automatic response to the question raised by the user. In addition, through the joint training of the question-and-answer statements, the model can learn the semantic features between the question-and-answer statements, so that the attribute prediction result of the question statement and the attribute value annotation result of the reply statement in this pair of question-and-answer statements are more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technologies, and in particular, to a question and answer processing method, apparatus, and device. Background Art

[0002] With the development of Internet technologies, people can obtain various items and information they need from the network without leaving home. For example, the emergence of many online shopping platforms (commonly known as e-commerce platforms) enables people to access the servers of shopping platforms by using corresponding shopping APPs or by means of Web access, and perform operations such as searching for, selecting, and placing orders for goods, so as to obtain the goods they need.

[0003] The interaction between buyers and sellers is a key factor in the conclusion of a transaction. In some practical applications, sellers often fail to reply to questions raised by buyers in a timely manner, which may lead to the buyers being very likely to lose the willingness to further interact, or even no longer considering the goods of this seller. Summary of the Invention

[0004] Embodiments of the present invention provide a question and answer processing method, apparatus, and device for automatically answering consultation questions raised by users.

[0005] In a first aspect, an embodiment of the present invention provides a question and answer processing method, which includes:

[0006] Receiving a first question statement for a target item at a first time;

[0007] Inputting the first question statement into a model to obtain an attribute corresponding to the first question statement through the model; wherein, the model has already obtained the attribute and the attribute value from a question and answer statement pair associated with the target item;

[0008] Obtaining a first reply statement corresponding to the attribute of the target item, where the first reply statement includes the attribute value;

[0009] Outputting the first reply statement.

[0010] In a second aspect, an embodiment of the present invention provides a question and answer processing apparatus, which includes:

[0011] A question receiving module, configured to receive a first question statement for a target item at a first time;

[0012] An attribute prediction module, configured to input the first question statement into a model to obtain an attribute corresponding to the first question statement through the model; wherein, the model has already obtained the attribute and the attribute value from a question and answer statement pair associated with the target item;

[0013] A reply acquisition module, configured to acquire a first reply statement corresponding to the attribute of the target item, where the first reply statement includes the attribute value;

[0014] A reply output module, configured to output the first reply statement.

[0015] In a third aspect, an embodiment of the present invention provides an electronic device, which includes a processor and a memory. The memory stores executable code, and when the executable code is executed by the processor, the processor can at least implement the question and answer processing method in the first aspect.

[0016] An embodiment of the present invention provides a non - transitory machine - readable storage medium. The non - transitory machine - readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor can at least implement the question and answer processing method in the first aspect.

[0017] In a fourth aspect, an embodiment of the present invention provides a model training method. The model includes a first input layer, a second input layer, a statement representation layer, a first output layer, and a second output layer. The first input layer and the second input layer are respectively connected to the statement representation layer. The first output layer and the second output layer are respectively connected to the statement representation layer. The model training method includes:

[0018] Acquire a question statement and a reply statement as training samples, where the question statement and the reply statement are a pair of question - and - answer statements;

[0019] Perform word - vector encoding on the question statement through the first input layer to obtain a plurality of first word vectors, and perform word - vector encoding on the reply statement through the second input layer to obtain a plurality of second word vectors;

[0020] Extract a first semantic representation vector corresponding to the plurality of first word vectors through the statement representation layer, and extract a second semantic representation vector corresponding to the plurality of second word vectors through the statement representation layer;

[0021] Perform classification processing on the first semantic representation vector through the first output layer to obtain an attribute classification result corresponding to the question statement, and perform sequence annotation processing on the second semantic representation vector through the second output layer to obtain an attribute value annotation result corresponding to the reply statement;

[0022] Determine a first loss function according to the attribute classification result, and determine a second loss function according to the attribute value annotation result;

[0023] Adjust the parameters of the model according to the superposition result of the first loss function and the second loss function.

[0024] In the embodiments of the present invention, the model used is jointly trained by pairs of generated question-and-answer statements. That is to say, a training sample of the model consists of a pair of generated question-and-answer statements. Through the joint training of the question-and-answer statements, the model can learn the semantic information between the question-and-answer statements. The attribute information learned from the question statement can help to label the attribute values in the answer statement, and the attribute value information learned from the answer statement helps to identify the attributes in the question statement, thereby making the attribute prediction result of the question statement and the attribute value labeling result of the answer statement in this pair of question-and-answer statements more accurate. For a certain target item, the generated question-and-answer statement pairs under the target item can be input into the model, so that the model learns the corresponding attributes and attribute values of the question-and-answer statement pairs, and generates an answer statement corresponding to the attribute based on the attribute value.

[0025] Based on this, when receiving a first question statement proposed by the user for the target item, the first question statement is input into the model to obtain the attribute corresponding to the first question statement through the model, and then obtain a first answer statement corresponding to the attribute of the target item, and output the first answer statement to achieve an automatic response to the question proposed by the user. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0027] Figure 1 Schematic diagram of the model structure provided by an embodiment of the present invention;

[0028] Figure 2 Flowchart of the model training method provided by an embodiment of the present invention;

[0029] Figure 3 Schematic diagram of the principle of the model training process provided by an embodiment of the present invention;

[0030] Figure 4 Schematic diagram of the composition of the item knowledge base provided by an embodiment of the present invention;

[0031] Figure 5 Flowchart of the construction process of the item knowledge base provided by an embodiment of the present invention;

[0032] Figure 6 Schematic diagram of the principle of the construction process of the item knowledge base provided by an embodiment of the present invention;

[0033] Figure 7 The flowchart of the question-answering processing method provided by an embodiment of the present invention;

[0034] Figure 8 The schematic diagram of the principle of the question-answering processing method provided by an embodiment of the present invention;

[0035] Figure 9 The schematic structural diagram of the question-answering processing device provided by an embodiment of the present invention;

[0036] Figure 10 For Figure 9 The schematic structural diagram of the electronic device corresponding to the question-answering processing device provided by the illustrated embodiment. Detailed implementation manners

[0037] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0038] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. "Plural" generally includes at least two.

[0039] Depending on the context, the words "if", "when" as used herein may be interpreted as "when" or "while" or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "if determined" or "if detecting (stated condition or event)" may be interpreted as "when determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)".

[0040] It should also be noted that the term "comprises", "comprising" or any other variant thereof is intended to cover a non-exclusive inclusion, such that a commodity or system comprising a series of elements includes not only those elements but also other elements not expressly listed, or further elements inherent to such commodity or system. Without further limitation, an element defined by the statement "comprising a..." does not exclude the presence of additional identical elements in the commodity or system comprising said element.

[0041] In addition, the step timings in the following method embodiments are only examples and not strictly limited.

[0042] In the embodiments of the present invention, in order to implement an automatic response to a question raised by a user, a model needs to be used, and this model can be a neural network model. The following will be combined with Figure 1 to schematically illustrate the structure of the above model, as Figure 1 shown, this model includes a first input layer, a second input layer, a statement representation layer, a first output layer, and a second output layer. Among them, the first input layer and the second input layer are respectively connected to the statement representation layer, and the first output layer and the second output layer are respectively connected to the statement representation layer. The first input layer corresponds to the first output layer, and the second input layer corresponds to the second output layer. Thus, it can be seen that the statement representation layer is shared by the two input layers and the two output layers.

[0043] In the embodiments of the present invention, the above model is actually used to perform two tasks, namely a classification task and a sequence labeling task. Among them, as Figure 1 shown in, the first input layer, the statement representation layer, and the first output layer constitute an execution unit for the classification task, and the second input layer, the statement representation layer, and the second output layer constitute an execution unit for the sequence labeling task.

[0044] Based on this, the first output layer can be considered to be composed of a classifier, such as a softmax classifier, and the second output model can be implemented as a Conditional Random Fields (CRF) model, for example.

[0045] Both the first input layer and the second input layer can be implemented as word vector models to complete the word vector encoding of their respective input statements, such as a word2vec model.

[0046] The statement representation layer can be implemented using various neural network models, such as: a Bi-directional Long Short-Term Memory (Bi-LSTM) model, a Long Short-Term Memory (LSTM) model, a Recurrent Neural Network (RNN) model, etc.

[0047] The Q&A processing method provided by the embodiments of the present invention can be applied to the scenario of online shopping. Taking the scenario of online shopping as an example, the model that has been trained to convergence can be provided for multiple merchants to use. Based on this, the model can be downloaded by multiple merchants into their respective merchant clients, that is, downloaded into the merchant's terminal device. Thus, the Q&A processing method provided by the embodiments of the present invention can be executed by the merchant's terminal device. Of course, the model can also be deployed in the server or server cluster corresponding to the e-commerce platform, and the server can be located in the cloud. Thus, the Q&A processing method provided by the embodiments of the present invention can also be executed by the server.

[0048] First, the training process of the model will be introduced below, and then the usage process of the model will be introduced.

[0049] Figure 2 It is a flowchart of the model training method provided by an embodiment of the present invention. As Figure 2 shown, the model training method includes the following steps:

[0050] 201. Obtain a second question statement and a second answer statement as training samples. The second question statement and the second answer statement are a pair of Q&A statements.

[0051] 202. Perform word vector encoding on the second question statement through the first input layer to obtain a plurality of first word vectors, and perform word vector encoding on the second answer statement through the second input layer to obtain a plurality of second word vectors.

[0052] 203. Extract a first semantic representation vector corresponding to the plurality of first word vectors through the statement representation layer, and extract a second semantic representation vector corresponding to the plurality of second word vectors through the statement representation layer.

[0053] 204. Perform classification processing on the first semantic representation vector through the first output layer to obtain an attribute classification result corresponding to the second question statement, and perform sequence labeling processing on the second semantic representation vector through the second output layer to obtain an attribute value labeling result corresponding to the second answer statement.

[0054] 205. Determine a first loss function according to the attribute classification result corresponding to the second question statement, and determine a second loss function according to the attribute value labeling result corresponding to the second answer statement. Adjust the parameters of the model according to the superposition result of the first loss function and the second loss function.

[0055] Taking the online shopping scenario as an example, when conducting model training, the training samples used for training the model are from the historical Q&A records of one or more merchants. Specifically, a training sample of the model consists of a pair of generated Q&A statements (i.e., a Q&A statement pair). A pair of Q&A statements refers to a pair of a question statement and a reply statement with a Q&A relationship. For example, if a user once asked question statement X and the merchant's reply statement to question statement X was reply statement Y, then question statement X and reply statement Y are used as a training sample. Specifically, for example, assume a user once asked a clothing merchant: What other colors does this piece of clothing have? The merchant replied: There are blue and white. Then, question statement X: "What other colors does this piece of clothing have?" and reply statement Y: "There are blue and white." This pair of Q&A statements is used as a training sample.

[0056] The exemplified question statement X and reply statement Y here can be used as the second question statement and the second reply statement in step 201 above.

[0057] It should be noted that, as a training sample, question statement X and reply statement Y do not necessarily need to be combined into one sentence. These two sentences still exist independently and are used as the inputs to the first input layer and the second input layer of the model respectively. In addition, the model can be trained in a supervised training manner. Thus, the corresponding attribute label is marked on question statement X, and the attribute value of this attribute is also marked on reply statement Y.

[0058] In addition, in practical applications, there may be the following two situations:

[0059] First, a user issues a question statement and the merchant replies with multiple reply statements, that is, the merchant replies with multiple sentences (each reply statement can be distinguished by a full stop or a line break). At this time, the concatenation result of these multiple sentences replied by the merchant can be used as the reply statement corresponding to this question statement. For example, if the question statement asked by a user is: Q, and the merchant replies with two reply statements a1 and a2, then, a1 and a2 can be concatenated together to form reply statement A = [a1, a2]. Thus, Q and A are regarded as a Q&A statement pair and used as a training sample.

[0060] Second, multiple users or the same user have proposed multiple question statements, while the merchant has only replied with one answer statement. At this time, one can be selected from these multiple question statements to form a pair of question-and-answer statements with this answer statement as a training sample. Of course, assuming there are 3 question statements corresponding to the same answer statement, 3 training samples can be formed, corresponding to these 3 question statements respectively. For example, if the multiple question statements are Q1 and Q2 respectively, corresponding to the same answer statement A, then ultimately Q1 and A can be regarded as a pair of question-and-answer statements as a training sample, and Q2 and A can also be regarded as a pair of question-and-answer statements as another training sample.

[0061] The following will Figure 3 be used to schematically illustrate the process of model training.

[0062] Taking the current training sample as the question statement X and the answer statement Y mentioned above as an example, these two statements can be tokenized first. As Figure 3 shown, for the question statement X: "What other colors does this dress have?", the tokenization result is: this / piece / dress / also / have / what / color. For the answer statement Y: "There are blue and white", the tokenization result is: have / blue / and / white.

[0063] Furthermore, each word contained in the question statement X is input into the first input layer to perform word vector encoding on these words through the first input layer to obtain multiple first word vectors; each word contained in the answer statement Y is input into the second input layer to perform word vector encoding on these words through the second input layer to obtain multiple second word vectors. In Figure 3 assume that the multiple first word vectors are w1, w2, w3, w4, w5, w6, w7 respectively, and the multiple second word vectors are w8, w9, w10, w11 respectively.

[0064] In Figure 3 after the multiple first word vectors are sequentially input into the sentence representation layer, assume that the first semantic representation vector obtained by the sentence representation layer encoding these first word vectors in sequence is represented as C1. After the multiple second word vectors are sequentially input into the sentence representation layer, assume that the second semantic representation vector obtained by the sentence representation layer encoding these second word vectors in sequence is represented as C2. Among them, the context semantic information of the question statement X is included in C1, and the context semantic information of the question statement Y is included in C2. In addition, the sharing of the sentence representation layer in the two input layers is reflected in that the sentence representation layer processes the multiple first word vectors and the multiple second word vectors based on the same parameters.

[0065] The first semantic representation vector C1 is input into the first output layer. After the classification processing of the first output layer, the attribute corresponding to the question statement X is predicted, such as Figure 3As shown in: color. Input the second semantic representation vector C2 into the second output layer. After the sequence annotation process of the second output layer, the attribute values corresponding to the response statement Y are annotated, such as Figure 3 As shown in: there are (O) blue (B) color (I) and (O) white (B) color (I), that is, the attribute values are: blue, white.

[0066] After that, based on the above attributes and attribute values actually output by the model, as well as the tagging information (supervision information) corresponding to the question statement X and the response statement Y, the first loss function corresponding to the question statement X and the second loss function corresponding to the response statement Y can be calculated, and then the parameters of the model can be adjusted according to the superposition result of the first loss function and the second loss function. Among them, the superposition result of the first loss function and the second loss function is, for example, the sum or mean of the two, etc.

[0067] Among them, the attributes corresponding to the question statement X reflect the consultation intention of the question statement X. Multiple attribute categories can be set in advance according to actual application requirements to predict which attributes the user specifically wants to consult related questions. And the attribute values in the response statement Y actually reflect the keywords for answering the question statement X of the user. Thus, the attributes in the question statement X and the attribute values in the response statement Y actually form a key-value relationship pair. During the model training process, a pair of question-and-answer statements with a question-and-answer relationship is used as a training sample. The core purpose is to learn this corresponding relationship between attributes and attribute values. Based on this, when using the model to predict the attributes corresponding to the question statement, this semantic information of the attribute value can be used to assist in the prediction of the attributes, making the attribute prediction result more accurate. Relatively speaking, the attribute information can also help improve the accuracy of the attribute value annotation result.

[0068] The above introduced the training process of the model. Next, the usage process of the model will be introduced. Generally speaking, the usage process of the model is divided into two stages. The first stage is the stage of using the model to build and update the item knowledge base, and the second stage is the stage of automatically answering the questions raised by users based on the latest item knowledge base. Among them, automatic answering means that the robot automatically answers the questions raised by users. This automatic answering by the robot should be understood as a general term for non-artificial answering methods, not limited to the existence of a physical robot device.

[0069] Among them, the item knowledge base refers to, for a certain item, the item knowledge base corresponding to the item. Specifically stored in the item knowledge base are one or more attributes of the item and the response statements corresponding to each attribute. Combined with Figure 4For example, for a certain model of mobile phone of a certain brand, its corresponding multiple attribute categories can include: new or used, color, shipping location, whether free shipping is available, and so on. Suppose the reply statement corresponding to new or used is: 90% new. Suppose the reply statement corresponding to color is: There is black. Suppose the reply statement corresponding to the shipping location is: Shipped from Hangzhou. Suppose the reply statement corresponding to whether free shipping is available is: Dear, free shipping is available. It's already very cost-effective. Please place an order quickly!

[0070] The composition of the above item knowledge base is implemented based on the above model. Specifically, the attributes of the items included in the item knowledge base are identified by the model, and moreover, the reply statements corresponding to the attributes are also obtained based on the annotation results of the attribute values marked by the model. That is to say, the reply statements actually contain the attribute values marked by the model. The reply statements can be understood as being obtained from the conversation templates and the attribute values, that is, filling the corresponding empty slots in the conversation templates with the attribute values to form the reply statements.

[0071] The following combines Figure 5 The illustrated embodiment to illustrate the construction process of the item knowledge base. Generally speaking, this construction process is: collecting the pairs of question-and-answer statements that have been generated for a certain item, inputting the pairs of question-and-answer statements into the already trained model, the model outputs the corresponding attributes and attribute values, generating reply statements based on the attribute values, and then adding the attributes and their corresponding reply statements to the item knowledge base corresponding to the item.

[0072] Figure 5 It is a flowchart of the construction process of the item knowledge base provided by an embodiment of the present invention. As Figure 5 shown, it may include the following steps:

[0073] 501. Receive the third question statement and the third reply statement corresponding to the target item. The third question statement and the third reply statement are a pair of question-and-answer statements.

[0074] To distinguish from the first time when the first question statement triggered by the user is received in the following text, it is assumed here that the time when the third question statement and the third reply statement are obtained is the second time. It can be considered that the third question statement and the third reply statement can be obtained when the third reply statement is generated. Therefore, this second time can also be considered as the generation time of the third reply statement.

[0075] Since in the actual online shopping scenario, users consult regarding a specific item, therefore, the objects that the model is ultimately used for are each item. The above target item can be any item of any seller on the e-commerce platform.

[0076] 502. Obtain the attributes corresponding to the third question statement and the attribute values corresponding to the third reply statement through the model.

[0077] At this time, the model is a model that has been trained to convergence through the training process introduced above. Input the third question statement into the first input layer of the model, and the attribute corresponding to the third question statement can be predicted through the first output layer. Input the third reply statement into the second input layer of the model, and the attribute value corresponding to the third reply statement can be labeled through the second output layer.

[0078] 503. Generate a reply statement corresponding to the attribute according to the attribute value corresponding to the third reply statement.

[0079] Suppose the attribute corresponding to the third question statement is S, and the attribute value corresponding to the attribute S in the third reply statement is T. As described above, the reply statement corresponding to the attribute S can be obtained from the conversation template corresponding to the attribute S (hereinafter referred to as the reply template) and the attribute value T, that is, filling the corresponding empty slot in the reply template with the attribute value T can form the reply statement corresponding to the attribute S.

[0080] The following introduces the process of obtaining the reply template corresponding to the attribute S:

[0081] Obtain multiple historical reply statements corresponding to the attribute S;

[0082] Select at least one historical reply statement with different expressions from the multiple historical reply statements;

[0083] Generate at least one corresponding reply template according to the at least one historical reply statement selected, and empty slots are set at the positions of the attribute values corresponding to the attribute S in the at least one reply template.

[0084] Among them, the multiple historical reply statements corresponding to the attribute S may correspond to the above-mentioned target item. Of course, in addition to the above-mentioned target item, they may also include historical reply statements corresponding to other items and corresponding to the attribute S.

[0085] For a simple example, suppose the items corresponding to the same merchant or different merchants in the e-commerce platform include: item 1, item 2, and item 3. Suppose the target item is item 1, and suppose the attribute S is color. Then, various reply statements that the merchant corresponding to item 1 has replied to the buyer regarding the color attribute can be collected, suppose including reply statement 1 and reply statement 2. Various reply statements that the merchants corresponding to item 2 and item 3 have replied to the buyer regarding the color attribute can also be collected, suppose including reply statement 3, reply statement 4, reply statement 5, and reply statement 6. Then, the multiple historical reply statements corresponding to the color attribute may include: reply statement 1, reply statement 2, reply statement 3, reply statement 4, reply statement 5, and reply statement 6.

[0086] Selecting at least one historical reply statement with different expressions from the multiple historical reply statements means that each historical reply statement reflects the habitual expression of the corresponding seller. Some sellers' expressions may be relatively similar, while others may be quite different. In order to present diverse reply methods for the same attribute during subsequent automatic answering, at least one historical reply statement with different expressions can be selected from the multiple historical reply statements corresponding to a certain attribute, so as to create reply templates corresponding to different expressions.

[0087] In practical applications, the similarity distance between different reply statements can be calculated. If the similarity distance between two reply statements is less than the set threshold, then one of the two reply statements can be filtered out. Thus, the finally remaining historical reply statements among the multiple historical reply statements are used as the above-mentioned at least one historical reply statement. Among them, the similarity distance can be calculated using, for example, the Levenshtein algorithm, so it can also be called the Levenshtein distance or the edit distance.

[0088] The Levenshtein distance describes the minimum number of operations required to transform one string into another, where the operations include insertion, deletion, replacement, etc. For example, to transform eeba into abac, the first e can be deleted first to become eba, then the remaining e can be replaced with a to become aba, and then c can be inserted at the end to become abac. So the Levenshtein distance between eeba and abac is 3.

[0089] Suppose for the attribute S = color, the above-mentioned at least one historical reply statement is the following reply statements with two different expressions: Dear, this product is also available in blue and white. There are still red and black left, and red sells better. Among them, the positions of blue and white, red and black, and red are the positions of the attribute values. These positions are set as empty slots. Thus, the following two reply templates can be obtained:

[0090] Dear, this product is also available in ().

[0091] There are still () left, and () sells better.

[0092] Based on this, generating a reply statement according to the attribute value T corresponding to the attribute S can be implemented as: filling the attribute value T in the empty slots of the reply template to obtain the reply statement corresponding to the attribute S.

[0093] In the above example, the two reply statements corresponding to the attribute S are: Dear, this product is also available in (attribute value T); There are still (attribute value T) left, and (attribute value T) sells better.

[0094] Through the above process, for the target item, the construction of each attribute of the target item and its corresponding reply statement can be achieved, that is, the construction of the item knowledge base of the target item is completed.

[0095] However, it is worth noting that in actual applications, as the seller's items are continuously sold, the inventory will be updated dynamically. For example, if there were originally blue and white left for a certain item, and since the blue ones are sold out, only white ones may be left later. Suppose a user has already asked what colors are available for this item, and the seller replied that only white ones are left. Then, if another user asks what colors are available for this item later, if the reply statement stored in the previous item knowledge base: "Dear, this product is available in blue and white" is used for automatic response, it is obviously incorrect. Therefore, the reply statements corresponding to each attribute in the item knowledge base should also be updated dynamically, and the basis for the update is the reply statement input by the seller under the corresponding attribute.

[0096] Specifically, assume that after the second time of obtaining the above third question statement and the third reply statement, still taking any of the above attributes S as an example, if there is still a fourth question statement corresponding to the attribute S under the target item and a fourth reply statement corresponding to the fourth question statement, then according to the attribute value H corresponding to the fourth reply statement, the reply statement corresponding to the attribute S is updated to: Dear, this product is available in (attribute value H); and, there is still (attribute value H) left, and (attribute value H) sells well.

[0097] Among them, it can be understood that the attribute corresponding to the fourth question statement and the attribute value corresponding to the fourth reply statement are obtained through the above model.

[0098] To more intuitively understand the process of constructing the item knowledge base provided in this embodiment, in combination with Figure 6 it is schematically illustrated as follows.

[0099] In Figure 6 assuming that for a certain item Z, a pair of question-and-answer statements are generated at time T1. The question statement is "Where is the shipping place?", and the reply statement is "Shipped from Hangzhou". After inputting this pair of question-and-answer statements into the model, the model outputs the attribute corresponding to the question statement as: shipping place, and the model outputs the attribute value corresponding to the reply statement as: Hangzhou. Assuming the reply template is: Shipped from (). Thus, the following information is added to the item knowledge base of item Z: Attribute = shipping place, Reply statement = Shipped from Hangzhou.

[0100] After that, it is assumed that at time T2, another pair of question-and-answer statements is generated. The question statement is "Where is the place of shipment?", and the answer statement is "Shipped from Shanghai". After inputting this pair of question-and-answer statements into the model, the model outputs the attribute corresponding to the question statement as: place of shipment, and the model outputs the attribute value corresponding to the answer statement as: Shanghai. At this time, update the above information in the item knowledge base of item Z to: attribute = place of shipment, answer statement = Shipped from Shanghai.

[0101] The construction and update process of the item knowledge base are introduced above. Next, the usage process of the item knowledge base will be introduced in combination, as Figure 7 shown.

[0102] Figure 7 is a flowchart of the question-and-answer processing method provided by an embodiment of the present invention. As Figure 7 shown, the method includes the following steps:

[0103] 701. Receive a first question statement for a target item at a first time.

[0104] 702. Input the first question statement into the model to obtain the attribute corresponding to the first question statement through the model. Among them, a training sample of the model consists of a pair of question-and-answer statements that have been generated, and the model can output the attribute corresponding to the training sample and the annotation result of the attribute value.

[0105] 703. Obtain a first answer statement corresponding to the attribute of the target item. The first answer statement includes an attribute value corresponding to the attribute of the target item.

[0106] 704. Output the first answer statement.

[0107] First of all, it should be noted that compared with the second time in the previous embodiment, the first time in this embodiment is assumed to be later than the second time. That is to say, it is assumed that at a certain time before the first time, such as the second time, the item knowledge base of the latest target item has been formed. Based on this, this embodiment introduces how to automatically answer the first question statement currently proposed by the user based on this item knowledge base and the previously trained model.

[0108] When a user issues a first question statement for a target item, as Figure 8 shown, assume that the first question statement is: Excuse me, what other colors does this cup have. This first question statement can be input into the model, specifically into the first input layer of the model, so as to output the attribute corresponding to the first question statement through the first output layer of the model: color.

[0109] Among them, the processing process of the first question statement can be generally summarized as follows: perform word segmentation on the first question statement, perform word vector encoding on each obtained word through the first input layer, and sequentially input the obtained multiple word vectors into the Bi-LSTM serving as the sentence representation layer for semantic extraction to obtain the semantic representation vector corresponding to the first question statement, and perform classification recognition on the semantic representation vector through the softmax classifier to obtain the attribute corresponding to the first question statement.

[0110] Furthermore, it is possible to query in the item knowledge base corresponding to the target item whether there is a reply statement corresponding to the color attribute, which is called the first reply statement. If it exists, output the first reply statement to the user, such as outputting the first reply statement in the form of voice or text, so as to realize the automatic response to the first question statement proposed by the user.

[0111] Among them, assume that there are two reply statements corresponding to the color attribute in the item knowledge base, which are respectively:

[0112] Dear, this product is also available in red.

[0113] There are still red ones left, and red sells well.

[0114] It is possible to randomly select one of these two reply statements to automatically respond to the user. For example, select "Dear, this product is also available in red".

[0115] In practical applications, optionally, before outputting the first reply statement to the user, that is, the buyer, it is also possible to output a prompt message corresponding to the first reply statement to the owner of the target item, that is, the seller, for the owner to determine whether to adopt the first reply statement. Or, when there are multiple first reply statements, the owner can be allowed to choose whether to adopt one of them. In response to the indication from the owner to confirm the adoption of the first reply statement, then output the first reply statement to the buyer.

[0116] In summary, by using the question-and-answer statement pairs with a question-and-answer relationship as training samples to jointly train the model, the attribute classification result of the question statement and the attribute value annotation result of the reply statement by the model can be made more accurate. Based on the attribute prediction and attribute value annotation of the question-and-answer statement pairs of a certain item, reply statements corresponding to each attribute of the item can be generated for automatic response to the user.

[0117] The following will describe in detail the question-and-answer processing device of one or more embodiments of the present invention. Those skilled in the art can understand that these question-and-answer processing devices can all be configured by using commercially available hardware components through the steps taught by this solution.

[0118] Figure 9The structural schematic diagram of a question-and-answer processing device provided by an embodiment of the present invention is as follows. Figure 9 As shown, the question-and-answer processing device includes: a question receiving module 11, an attribute prediction module 12, a reply obtaining module 13, and a reply output module 14.

[0119] The question receiving module 11 is configured to receive a first question statement for a target item at a first time.

[0120] The attribute prediction module 12 is configured to input the first question statement into a model to obtain an attribute corresponding to the first question statement through the model; wherein, the model has obtained the attribute and the attribute value from the question-and-answer statement pairs associated with the target item.

[0121] The reply obtaining module 13 is configured to obtain a first reply statement corresponding to the attribute of the target item, and the first reply statement includes the attribute value.

[0122] The reply output module 14 is configured to output the first reply statement.

[0123] Wherein, the model includes a first input layer, a second input layer, a statement representation layer, a first output layer, and a second output layer; the first input layer and the second input layer are respectively connected to the statement representation layer; the first output layer and the second output layer are respectively connected to the statement representation layer.

[0124] The device further includes: a training module.

[0125] The training module is configured to obtain a second question statement and a second reply statement as training samples, and the second question statement and the second reply statement are a pair of question-and-answer statements; perform word vector encoding on the second question statement through the first input layer to obtain a plurality of first word vectors, and perform word vector encoding on the second reply statement through the second input layer to obtain a plurality of second word vectors; extract a first semantic representation vector corresponding to the plurality of first word vectors through the statement representation layer, and extract a second semantic representation vector corresponding to the plurality of second word vectors through the statement representation layer; perform classification processing on the first semantic representation vector through the first output layer to obtain an attribute classification result corresponding to the second question statement, and perform sequence labeling processing on the second semantic representation vector through the second output layer to obtain an attribute value labeling result corresponding to the second reply statement; determine a first loss function according to the attribute classification result, and determine a second loss function according to the attribute value labeling result; adjust the parameters of the model according to the superposition result of the first loss function and the second loss function.

[0126] Optionally, if there are multiple question statements corresponding to the second response statement, the second question statement is any one of the multiple question statements.

[0127] Optionally, if there are multiple response statements corresponding to the second question statement, the second response statement is the concatenation result of the multiple response statements.

[0128] Optionally, the apparatus further includes: a generation module, configured to obtain a third question statement and a third response statement corresponding to the target item at a second time, where the third question statement and the third response statement are a pair of question-and-answer statements, and the second time is earlier than the first time; obtain, by using the model, the attribute corresponding to the third question statement and the attribute value corresponding to the third response statement; and generate the first response statement corresponding to the attribute according to the attribute value.

[0129] Optionally, the generation module is further configured to: if there is a fourth question statement corresponding to the attribute and a fourth response statement corresponding to the fourth question statement between the second time and the first time, update the first response statement according to the attribute value corresponding to the fourth response statement, where the attribute corresponding to the fourth question statement and the attribute value corresponding to the fourth response statement are obtained by using the model.

[0130] Optionally, the apparatus further includes: a template construction module, configured to obtain multiple historical response statements corresponding to the attribute; screen at least one historical response statement with different expression forms from the multiple historical response statements; and generate at least one response template corresponding to the at least one historical response statement, where a null slot is set at the position of the attribute value corresponding to the attribute in the at least one response template.

[0131] Accordingly, the generation module is specifically configured to: fill the attribute value in the null slot to obtain the first response statement.

[0132] Figure 9 The illustrated question-and-answer processing apparatus may execute the method provided in the foregoing Figures 1 to 7 For parts not described in detail in this embodiment, reference may be made to the relevant descriptions of the foregoing embodiments, which will not be elaborated herein.

[0133] In a possible design, the structure of the foregoing Figure 9 illustrated question-and-answer processing apparatus may be implemented as an electronic device. As Figure 10 illustrated, the electronic device may include: a processor 21 and a memory 22. Among them, an executable code is stored on the memory 22. When the executable code is executed by the processor 21, at least the processor 21 can be implemented as described in the foregoing Figures 1 to 7The question-and-answer processing method provided in the illustrated embodiment.

[0134] Among them, the structure of the electronic device may further include a communication interface 23 for communicating with other devices or communication networks.

[0135] In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored. When the executable code is executed by a processor of an electronic device, the processor is caused to execute the question-and-answer processing method provided in the foregoing Figures 1 to 7 illustrated embodiment.

[0136] The device embodiments described above are merely illustrative. The various modules described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative effort.

[0137] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of adding a necessary general hardware platform. Of course, it can also be implemented by a combination of hardware and software. Based on such an understanding, the above technical solution, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer product. The present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features. These modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A question and answer processing method, characterized in that, it includes: receiving a first question statement for a target item at a first time; inputting the first question statement into a model to obtain an attribute corresponding to the first question statement through the model; wherein, the model has already obtained the attribute and the attribute value from the question and answer statement pairs associated with the target item; the model includes a first input layer, a second input layer, a statement representation layer, a first output layer and a second output layer, and the first input layer, the statement representation layer and the first output layer constitute an execution unit for a classification task, and the second input layer, the statement representation layer and the second output layer constitute an execution unit for a sequence labeling task. The first input layer is used to perform word vector encoding on a second question statement of a training sample to obtain a plurality of first word vectors, the second input layer is used to perform word vector encoding on a second answer statement of the training sample to obtain a plurality of second word vectors, the statement representation layer is used to extract a first semantic representation vector corresponding to the plurality of first word vectors and a second semantic representation vector corresponding to the plurality of second word vectors, the first output layer is used to perform classification processing on the first semantic representation vector to obtain an attribute classification result corresponding to the second question statement, and the second output layer is used to perform sequence labeling processing on the second semantic representation vector to obtain an attribute value labeling result corresponding to the second answer statement. The attribute classification result and the attribute value labeling result are used to adjust the parameters of the model; obtaining a first answer statement corresponding to the attribute of the target item, where the first answer statement includes the attribute value; outputting the first answer statement.

2. The method according to claim 1, characterized in that, the first input layer and the second input layer are respectively connected to the statement representation layer; the first output layer and the second output layer are respectively connected to the statement representation layer.

3. The method according to claim 2, characterized in that, the method further includes: obtaining a second question statement and a second answer statement as training samples, where the second question statement and the second answer statement are a pair of question and answer statements; performing word vector encoding on the second question statement through the first input layer to obtain a plurality of first word vectors, and performing word vector encoding on the second answer statement through the second input layer to obtain a plurality of second word vectors; extracting a first semantic representation vector corresponding to the plurality of first word vectors through the statement representation layer, and extracting a second semantic representation vector corresponding to the plurality of second word vectors through the statement representation layer; performing classification processing on the first semantic representation vector through the first output layer to obtain an attribute classification result corresponding to the second question statement, and performing sequence labeling processing on the second semantic representation vector through the second output layer to obtain an attribute value labeling result corresponding to the second answer statement; determining a first loss function according to the attribute classification result, and determining a second loss function according to the attribute value labeling result; Adjust the parameters of the model according to the superposition result of the first loss function and the second loss function.

4. The method according to claim 3, wherein, if there are multiple question statements corresponding to the second response statement, the second question statement is any one of the multiple question statements.

5. The method according to claim 3, wherein, if there are multiple response statements corresponding to the second question statement, the second response statement is the concatenation result of the multiple response statements.

6. The method according to claim 3, wherein, the method further includes: obtaining a third question statement and a third response statement corresponding to the target item at a second time, the third question statement and the third response statement being a pair of question and answer statements, and the second time being earlier than the first time; obtaining, by the model, the attribute corresponding to the third question statement and the attribute value corresponding to the third response statement; generating the first response statement corresponding to the attribute according to the attribute value.

7. The method according to claim 6, wherein, the method further includes: if there is also a fourth question statement corresponding to the attribute and a fourth response statement corresponding to the fourth question statement between the second time and the first time, updating the first response statement according to the attribute value corresponding to the fourth response statement, and the attribute corresponding to the fourth question statement and the attribute value corresponding to the fourth response statement are obtained by the model.

8. The method according to claim 6, wherein, the method further includes: obtaining multiple historical response statements corresponding to the attribute; screening out at least one historical response statement with different expressions from the multiple historical response statements; generating at least one response template corresponding to the at least one historical response statement, and setting empty slots at the positions of the attribute values corresponding to the attribute in the at least one response template.

9. The method according to claim 8, wherein, the generating the first response statement corresponding to the attribute according to the attribute value includes: filling the attribute value in the empty slot to obtain the first response statement.

10. The method according to any one of claims 1 to 9, wherein, the outputting the first response statement includes: outputting a prompt message corresponding to the first response statement to the owner corresponding to the target item for the owner to determine whether to adopt the first response statement; responding to the indication of the owner's feedback to adopt the first response statement, and outputting the first response statement.

11. A question and answer processing device, wherein, comprising: a question receiving module, configured to receive a first question statement for a target item at a first time; an attribute prediction module, configured to input the first question statement into a model to obtain, by the model, an attribute corresponding to the first question statement; Among them, the model has obtained the attribute and its value from the question-answer sentence pairs associated with the target item; the model includes a first input layer, a second input layer, a sentence representation layer, a first output layer, and a second output layer. The first input layer, the sentence representation layer, and the first output layer constitute an execution unit for a classification task. The second input layer, the sentence representation layer, and the second output layer constitute an execution unit for a sequence labeling task. The first input layer is used to perform word vector encoding on the second question sentence of the training sample to obtain a plurality of first word vectors. The second input layer is used to perform word vector encoding on the second answer sentence of the training sample to obtain a plurality of second word vectors. The sentence representation layer is used to extract a first semantic representation vector corresponding to the plurality of first word vectors and a second semantic representation vector corresponding to the plurality of second word vectors. The first output layer is used to perform classification processing on the first semantic representation vector to obtain an attribute classification result corresponding to the second question sentence. The second output layer is used to perform sequence labeling processing on the second semantic representation vector to obtain an attribute value labeling result corresponding to the second answer sentence. The attribute classification result and the attribute value labeling result are used to adjust the parameters of the model; A reply acquisition module, configured to acquire a first reply sentence corresponding to the attribute of the target item, where the first reply sentence includes the attribute value; A reply output module, configured to output the first reply sentence.

12. An electronic device, Characterized in that, It includes: A memory and a processor; among them, executable code is stored on the memory, and when the executable code is executed by the processor, the processor executes the question-answer processing method according to any one of claims 1 to 10.

13. A model training method, Characterized in that, The model includes a first input layer, a second input layer, a sentence representation layer, a first output layer, and a second output layer; the first input layer and the second input layer are respectively connected to the sentence representation layer; the first output layer and the second output layer are respectively connected to the sentence representation layer; the first input layer, the sentence representation layer, and the first output layer constitute an execution unit for a classification task, and the second input layer, the sentence representation layer, and the second output layer constitute an execution unit for a sequence labeling task; The training method of the model includes: Acquiring a question sentence and an answer sentence as training samples, where the question sentence and the answer sentence are a pair of question-answer sentences; Performing word vector encoding on the question sentence through the first input layer to obtain a plurality of first word vectors, and performing word vector encoding on the answer sentence through the second input layer to obtain a plurality of second word vectors; Extracting a first semantic representation vector corresponding to the plurality of first word vectors through the sentence representation layer, and extracting a second semantic representation vector corresponding to the plurality of second word vectors through the sentence representation layer; Classify the first semantic representation vector through the first output layer to obtain an attribute classification result corresponding to the question statement, and perform sequence labeling processing on the second semantic representation vector through the second output layer to obtain an attribute value labeling result corresponding to the answer statement; Determine a first loss function according to the attribute classification result, and determine a second loss function according to the attribute value labeling result; Adjust the parameters of the model according to the superposition result of the first loss function and the second loss function.

Citation Information

Patent Citations

  • A question and answer method and system fusing a convolutional neural network and a recurrent neural network

    CN109408627A

  • Method for constructing a task type dialogue system for an e-commerce shopping guide scene

    CN109493166A