CN110362665B - Question-answering system and method based on semantic similarity - Google Patents

Question-answering system and method based on semantic similarity Download PDF

Info

Publication number
CN110362665B
CN110362665B CN201910514477.4A CN201910514477A CN110362665B CN 110362665 B CN110362665 B CN 110362665B CN 201910514477 A CN201910514477 A CN 201910514477A CN 110362665 B CN110362665 B CN 110362665B
Authority
CN
China
Prior art keywords
question
standard
user
standard question
questions
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910514477.4A
Other languages
Chinese (zh)
Other versions
CN110362665A (en
Inventor
张竞尧
张文泽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Zhuiyi Technology Co Ltd
Original Assignee
Shenzhen Zhuiyi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Zhuiyi Technology Co Ltd filed Critical Shenzhen Zhuiyi Technology Co Ltd
Priority to CN201910514477.4A priority Critical patent/CN110362665B/en
Publication of CN110362665A publication Critical patent/CN110362665A/en
Application granted granted Critical
Publication of CN110362665B publication Critical patent/CN110362665B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/3332Query translation

Abstract

The invention provides a question-answering system and method based on semantic similarity, wherein the system comprises: the system comprises a customer service access end, a customer service processing end and a standard question-answering library; the customer service access terminal is used for acquiring the user question and sending the user question to the customer service processing terminal; the customer service processing terminal is used for inputting the user question to a pre-trained multi-task deep learning model to obtain a hidden layer vector of the user question, obtaining a standard question corresponding to the user question according to the hidden layer vector of the user question, obtaining a standard answer associated with the standard question corresponding to the user question from a standard question-answer library, and returning the standard answer to the customer service access terminal; and the standard question-answer library is used for storing a plurality of standard questions and standard answers related to each standard question in the plurality of standard questions. The embodiment of the invention can still ensure the accuracy rate of classification and reply of the question of the user by the intelligent question-answering system under the condition of reducing the required quantity of training data.

Description

Question-answering system and method based on semantic similarity
Technical Field
The invention relates to the technical field of semantic recognition, in particular to a question-answering system and a question-answering method based on semantic similarity.
Background
With the development of internet networks, online customer service via social platforms has gained widespread use in various industries, such as: medical, travel, e-commerce, and the like. In order to achieve the purpose of saving labor cost while bringing good service experience to customers, most enterprises select an intelligent question-answering system, because the intelligent question-answering system can answer questions provided by users with simple and accurate natural language. In the related art, the common method is to regard enterprise services as classification tasks, preset some standard questions and standard question answers corresponding to the standard questions, train an interactive log by adopting a deep learning model, provide a set of model for each client, input user question sentences into the model, predict the standard questions with the maximum hit probability through the model, and output the standard question answers corresponding to the standard questions. However, the classification task based on deep learning needs massive training data to ensure accuracy, and enterprise business start-up in the early stage or in medium-sized and small enterprises inevitably faces the situation of too small data amount and cannot construct massive training data, which leads to the reduction of the classification accuracy of question sentences of users, thereby greatly reducing the accuracy of reply of the intelligent question-answering system.
Disclosure of Invention
The invention provides a question-answering system and method based on semantic similarity, which aim to solve the problem that the accuracy of classifying question sentences of a user is reduced by an intelligent question-answering system under the condition of lacking of scaled training data, so that the accuracy of reply is reduced.
According to one aspect of the embodiment of the invention, a question-answering system based on semantic similarity is provided, and the system comprises a customer service access end, a customer service processing end and a standard question-answering library; the customer service processing end comprises a deep learning module and a question-answer matching module;
the customer service access terminal is used for acquiring a user question and sending the user question to the deep learning module;
the deep learning module is used for inputting the user question to a pre-trained multi-task deep learning model to obtain a hidden layer vector of the user question, obtaining a standard question corresponding to the user question according to the hidden layer vector of the user question, and sending the standard question corresponding to the user question to the question-answer matching module;
the question-answer matching module is used for acquiring a standard answer associated with the standard question corresponding to the user question from the standard question-answer library and returning the standard answer to the customer service access end;
the standard question-answer library is used for storing a plurality of standard questions and standard answers related to each standard question in the standard questions.
In one possible embodiment, the deep learning module includes: the first vector acquisition unit is used for inquiring a pre-stored retrieval matrix to obtain a hidden layer vector of each standard question in the plurality of standard questions; wherein the retrieval matrix comprises a hidden layer vector for each of the plurality of canonical questions;
the matching calculation unit is used for calculating a first cosine similarity between the hidden layer vector of the question of the user and the hidden layer vector of each standard question in the plurality of standard questions;
and the result acquisition unit is used for determining a standard question corresponding to the question of the user according to the first cosine similarity.
In a possible embodiment, the deep learning module further includes a second vector acquisition unit and an addition judgment unit; the standard question-answering library is also used for receiving a standard question to be added and sending the standard question to be added to the deep learning module;
the second vector acquisition unit is used for inputting the standard questions to be added into the multi-task deep learning model to obtain hidden layer vectors of the standard questions to be added;
the matching calculation unit is further configured to calculate a second cosine similarity between the hidden layer vector of the to-be-added standard question and the hidden layer vector of each of the plurality of standard questions;
the adding judgment unit is used for allowing the standard question to be added to the standard question-answering library if the target standard question with the second cosine similarity larger than a preset threshold value does not exist in the standard question-answering library; if the target standard question with the second cosine similarity larger than the preset threshold exists in the standard question-and-answer library, judging whether a standard question with the second cosine similarity larger than the second cosine similarity between the standard question to be added and the target standard question still exists in the standard question-and-answer library, if not, allowing the standard question to be added in the standard question-and-answer library, otherwise, refusing to add.
In a possible embodiment, the deep learning module is further configured to:
acquiring a plurality of groups of customer service log data, wherein each group of customer service log data comprises a plurality of historical user question sentences and corresponding historical standard questions;
and performing deep learning training on the multiple groups of customer service log data to obtain the multitask deep learning model.
In one possible embodiment, the deep learning module is further configured to:
inputting each standard question in the plurality of standard questions into the multitask deep learning model to obtain a hidden layer vector of each standard question in the plurality of standard questions;
and obtaining and storing the retrieval matrix according to the hidden vector of each standard question in the plurality of standard questions.
According to another aspect of the embodiments of the present invention, there is provided a question-answering method based on semantic similarity, including:
acquiring a question of a user;
inputting the user question to a pre-trained multi-task deep learning model to obtain a hidden vector of the user question, and obtaining a standard question corresponding to the user question according to the hidden vector of the user question;
acquiring a standard answer associated with a standard question corresponding to the user question from a preset standard question-answer library, and returning the standard answer to the customer service access end; the standard question-answer library stores a plurality of standard questions and standard answers related to each standard question in the standard questions.
In a possible embodiment, the obtaining a standard question corresponding to the user question according to the hidden vector of the user question includes:
querying a pre-stored retrieval matrix to obtain a hidden layer vector of each standard question in the plurality of standard questions; wherein the retrieval matrix comprises a hidden layer vector for each of the plurality of canonical questions;
calculating a first cosine similarity between the hidden layer vector of the user question and the hidden layer vector of each standard question in the plurality of standard questions;
and determining a standard question corresponding to the question of the user according to the first cosine similarity.
In one possible embodiment, the method further comprises:
if a standard question to be added is received, inputting the standard question to be added to the multi-task deep learning model to obtain a hidden layer vector of the standard question to be added;
calculating a second cosine similarity between the hidden layer vector of the standard question to be added and the hidden layer vector of each standard question in the plurality of standard questions;
if the target standard question with the second cosine similarity larger than the preset threshold does not exist in the standard question-answer library, allowing the standard question to be added to the standard question-answer library; if the target standard question with the second cosine similarity larger than the preset threshold exists in the standard question-and-answer library, judging whether a standard question with the second cosine similarity larger than the second cosine similarity between the standard question to be added and the target standard question still exists in the standard question-and-answer library, if not, allowing the standard question to be added in the standard question-and-answer library, otherwise, refusing to add.
In a possible embodiment, before the obtaining of the user question, the method further includes:
acquiring a plurality of groups of customer service log data, wherein each group of customer service log data comprises a plurality of historical user question sentences and corresponding historical standard questions;
and performing deep learning training on the multiple groups of customer service log data to obtain the multitask deep learning model.
In a possible embodiment, before obtaining the standard question corresponding to the user question according to the hidden vector of the user question, the method further includes:
inputting each standard question in the plurality of standard questions into the multitask deep learning model to obtain a hidden layer vector of each standard question in the plurality of standard questions;
and obtaining and storing the retrieval matrix according to the hidden vector of each standard question in the plurality of standard questions.
According to another aspect of the embodiments of the present invention, there is provided an electronic device including: the processor executes the computer program to realize the steps in the question answering method based on the semantic similarity.
According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps in the question-answering method based on semantic similarity.
The scheme of the invention at least comprises the following beneficial effects:
it can be seen that, in the embodiment of the application, the hidden layer vector of the user question is obtained by acquiring the user question, inputting the user question into the pre-trained multitask deep learning model, the standard question corresponding to the user question is obtained according to the hidden layer vector of the user question, the standard answer associated with the standard question corresponding to the user question is acquired from the preset standard question-answer library, and the standard answer is returned to the customer service access end. Due to the fact that the multi-task deep learning model is obtained through data training in different fields of different industries, the applicability of the model is greatly improved, and the accuracy rate of classification and reply of the intelligent question answering system to the question of the user can be guaranteed while the requirement of training data is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram of an application environment provided by an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a question-answering system based on semantic similarity according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of another question-answering system based on semantic similarity according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart of adding a standard question to a standard question-answering library according to an embodiment of the present invention;
fig. 5 is a schematic flow chart of a question-answering method based on semantic similarity according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "comprising" and "having," and any variations thereof, as appearing in the present specification, claims and drawings, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," and "third," etc. are used to distinguish between different objects and are not used to describe a particular order.
Referring to fig. 1, fig. 1 is a schematic diagram of an application environment provided by an embodiment of the present invention, specifically, the application environment relates to a user terminal, a server, and a database, and each of the application environments is connected through a network or a communication link. The customer service robot carries out semantic recognition on the user question through the server so as to match a standard question corresponding to the user question from the database, returns a unique standard answer corresponding to the standard question to the user terminal, and the database is used for storing a large number of preset standard questions and standard answers corresponding to each standard question and has the functions of adding data, deleting data and modifying data according to preset rules. It should be noted that the user terminal may be an intelligent device such as a mobile phone, a tablet computer, a wearable device, and a palm computer, the server may be a common server, or may also be a cloud server or a server cluster, and the database may be a database in the server, or may also be a database independent of the server or a cloud database.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a question-answering system based on semantic similarity according to an embodiment of the present invention, as shown in fig. 2, including a customer service access terminal 100, a customer service processing terminal 200, and a standard question-answering library 300; the customer service processing end 200 comprises a deep learning module 210 and a question-answer matching module 220; the customer service processing end 200 may be a server or a cloud.
The customer service access terminal 100 is configured to obtain a user question, and send the user question to the deep learning module 210.
In the embodiment of the present invention, the customer service access terminal 100 includes, but is not limited to, a web page, Tencent QQ, WeChat, Feiyin, MSN (MSN Messenger), and other tools or applications. The user question sentence refers to some questions which are initiated by the user and relate to specific businesses of the merchant or the enterprise, for example, the user asks the logistics company for 'where my packages go' through a webpage, or the user asks the Taobao merchant for 'how do I buy clothes and how to return goods' through Ary, or the user asks the bank for 'how do the interest of loan' through online customer service, and the like.
The deep learning module 210 is configured to input the user question into a pre-trained multi-task deep learning model to obtain a hidden layer vector of the user question, obtain a standard question corresponding to the user question according to the hidden layer vector of the user question, and send the standard question corresponding to the user question to the question-answer matching module 220.
In the embodiment of the present invention, the business data in different industries and different fields are used as training data, and the classification is performed according to the form of the training data or the content of the question, for example, the corresponding relationship shown in table 1 can be obtained, and table 1 is only an example, and does not limit the embodiment of the present invention. Then, deep learning training is performed to obtain the multi-task deep learning model, for example: the bank field, the insurance field and the securities field in the financial industry, or the building material field, the plane design field, the equipment leasing field in the building industry and the like. In the traditional intelligent question-answering system, the business data (specifically customer service logs) of each merchant or enterprise are collected in a standard mode, a special model is trained for the intelligent question-answering system of each merchant or enterprise, the multi-task deep learning model is trained by utilizing the difference of training data, a large amount of business data are not needed in the same field, only the multi-task deep learning model has the capability of obtaining corresponding standard questions according to user question, and the multi-task deep learning model is suitable for the business of multiple merchants or enterprises. As for the accuracy, the business data generated in the follow-up actual use process of the merchant or the enterprise can be gradually improved, and the demand for the business data is greatly reduced.
Figure BDA0002092508060000071
TABLE 1
In addition, the standard questions are the text descriptions stored in the standard question-answering library 300 for clearly expressing a certain service, such as: the standard question in the refund business of the Taobao merchant may be "manner of refund of goods" in Table 1, and the standard question for the user to modify the password may be "how to modify the password" in Table 1. After the user question is input into the multi-task deep learning model, a hidden layer vector of the user question in a hidden layer can be obtained based on a word vector of the user question, the classification layer is omitted, and the hidden layer vector of the hidden layer is directly regarded as a vector expression of the user question. Based on the hidden layer vector of the user question, the similarity between the user question and the standard question can be measured, and the standard question corresponding to the user question is obtained.
The question-answer matching module 220 is configured to obtain a standard answer associated with a standard question corresponding to the user question from the standard question-answer library 300, and return the standard answer to the customer service access terminal 100.
In the embodiment of the present invention, the deep learning module 210 transmits the standard questions corresponding to the user question obtained by the multitask deep learning model to the question-answer matching module 220, and the question-answer matching module 220 searches the corresponding standard answers from the standard question-answer library 300 by using the standard questions corresponding to the user question as the search conditions. For example, if the user asks "hello, i want to ask a user to modify the password, and the corresponding standard question is" manner of modifying the password ", the associated standard answer" what icon is clicked, what page is opened, what is input, and the user clicks submission and takes effect immediately "can be obtained, and the relevant standard answer is returned to the customer service access terminal 100 and displayed to the user.
The standard question-answer library 300 is used for storing a plurality of standard questions and standard answers related to each standard question in the plurality of standard questions.
In an embodiment of the present invention, the standard question-answering database 300 may be a local database of the customer service processing end 200, or may be a cloud database or a database independent of the customer service processing end 200, and stores a plurality of "standard question-standard answer" pairs, as shown in table 2, where table 2 is merely an example, and does not limit the embodiment of the present invention.
Figure BDA0002092508060000081
TABLE 2
Compared with the prior art, the embodiment of the invention obtains the user question, inputs the user question into the pre-trained multi-task deep learning model to obtain the hidden layer vector of the user question, obtains the standard question corresponding to the user question according to the hidden layer vector of the user question, then obtains the standard answer associated with the standard question corresponding to the user question from the preset standard question-answer library, and returns the standard answer to the customer service access end. Due to the fact that the multi-task deep learning model is obtained through data training in different fields of different industries, the applicability of the model is greatly improved, and the accuracy rate of classification and reply of the intelligent question answering system to the question of the user can be guaranteed while the requirement of training data is reduced.
Referring to fig. 3, fig. 3 is a schematic structural diagram of another question-answering system based on semantic similarity according to an embodiment of the present invention, as shown in fig. 3, including a customer service access terminal 100, a customer service processing terminal 200, and a standard question-answering library 300; the customer service processing end 200 comprises a deep learning module 210 and a question-answer matching module 220;
the customer service access terminal 100 is configured to obtain a user question, and send the user question to the deep learning module 210;
the deep learning module 210 is configured to input the user question into a pre-trained multi-task deep learning model to obtain a hidden layer vector of the user question, obtain a standard question corresponding to the user question according to the hidden layer vector of the user question, and send the standard question corresponding to the user question to the question-answer matching module 220;
the question-answer matching module 220 is configured to obtain a standard answer associated with a standard question corresponding to the user question from the standard question-answer library 300, and return the standard answer to the customer service access terminal 100;
the standard question-answer library 300 is used for storing a plurality of standard questions and standard answers related to each standard question in the plurality of standard questions. Wherein, each merchant or enterprise can preset one standard question-answering library 300 and can maintain by itself.
The deep learning module 210 includes a first vector acquisition unit 2101, a matching calculation unit 2102, and a result acquisition unit 2103.
The first vector obtaining unit 2101 is configured to query a pre-stored search matrix to obtain a hidden layer vector of each standard question in the plurality of standard questions; wherein the retrieval matrix comprises a hidden layer vector for each of the plurality of canonical problems.
In the embodiment of the present invention, after obtaining the above-mentioned multitask deep learning model, all the standard questions in the standard question-and-answer library 300 may be input into the multitask deep learning model in advance to obtain the hidden layer vector of each standard question, and a search matrix of all the standard questions is established to increase the matching calculation speed of the subsequent matching calculation unit 2102. For example: the e-commerce platform relates to services such as logistics inquiry, APP shopping and the like, and standard questions in the standard question-answer library 300 comprise: 1) how is the password modified? 2) How do app login errors? 3) How is a logistics inquiry made? Inputting the latent vectors into a multi-task deep learning model to obtain corresponding hidden vectors which are respectively as follows: [1,0,0],[0,1,0],[0,0,1]. Of course, the hidden layer vectors of all the standard questions in the standard question-answering library 300 can be obtained while inputting the user question into the multitask deep learning model.
The matching calculation unit 2102 is configured to calculate a first cosine similarity between a hidden layer vector of the user question and a hidden layer vector of each of the plurality of standard questions;
the result obtaining unit 2103 is configured to determine a standard question corresponding to the user question according to the first cosine similarity.
In the embodiment of the present invention, the similarity between the user question and all the standard questions is mainly expressed by the first cosine similarity, for example, the user question is "how do you want to modify the password", the multi-task deep learning model is input to obtain the hidden vector [1.1,0.42,0.1], and how do it modify the password with the standard question { 1)? 2) How do app login errors? 3) How is a logistics inquiry made? The first cosine similarity between } is: 0.915, 0.069 and 0.644, and taking the standard question with the maximum first cosine similarity as the standard question corresponding to the question of the user. Of course, the euclidean distances between the user question and all the standard questions may also be calculated, and the similarity between the user question and all the standard questions is determined according to the euclidean distances, where the closer the distance is, the higher the similarity is, and the farther the distance is, the lower the similarity is.
In a possible embodiment, the deep learning module 210 further includes a second vector obtaining unit and an addition judging unit; the standard question-answering library 300 is further configured to receive a standard question to be added, and send the standard question to be added to the deep learning module 210;
the second vector acquisition unit is used for inputting the standard questions to be added into the multi-task deep learning model to obtain hidden layer vectors of the standard questions to be added.
In the embodiment of the present invention, when a merchant or an enterprise maintains a standard question-and-answer database by itself, a case exists in which a standard question is added to the standard question-and-answer database, that is, a standard question is to be added. The standard question to be added needs to be judged whether to allow the standard question to be added to be reserved in the standard question-answer database or not by the deep learning module according to the hidden layer vector of the standard question-answer module.
The matching calculation unit 2102 is further configured to calculate a second cosine similarity between the hidden layer vector of the to-be-added standard question and the hidden layer vector of each of the plurality of standard questions.
The adding judgment unit is configured to allow the standard question to be added to the standard question-and-answer library 300 if the target standard question with the second cosine similarity larger than the preset threshold does not exist in the standard question-and-answer library 300; if the target standard question with the second cosine similarity larger than the preset threshold exists in the standard question-and-answer library 300, judging whether a standard question with the second cosine similarity larger than the second cosine similarity between the standard question to be added and the target standard question still exists in the standard question-and-answer library 300, if not, allowing the standard question to be added in the standard question-and-answer library, otherwise, refusing to add.
In the embodiment of the present invention, the preset threshold may be set according to an actual situation, for example: 0.9 or higher, the target standard question is a standard question already existing in the standard question-and-answer library 300 that semantically points to the same service as the standard question to be added. If the standard question-answer library 300 has a standard question a "what is a fortune city apple", the corresponding standard answer is that "the fortune city apple is a special local product of the fortune city in Shanxi province and is a geographical sign of agricultural products in China", a standard question B to be added "how the Shanxi fortune city apple looks" exists, the corresponding standard answer is that "the fortune city apple is fruity and upright, is fragrant and crisp in taste, full in color and rich in nutrition", and obviously, the A and the B are not the same service semantically, through calculation, the second cosine similarity between hidden layer vectors of the A and the B is also smaller than a preset threshold value 0.9, the standard question-answer library 300 does not have the target standard question, and at the moment, the standard question-answer library 300 can be directly allowed to be added with the standard question B to be added.
If the standard question-answer library already has the standard question A, B, it is found through actual questions of the user that a standard question C to be added needs to be added, namely "how the position of the shanxi fortune city apple is, and the corresponding standard answer is still" the fortune city apple is a special local product of the shanxi province, and a national agricultural product geographic marker ", obviously, the standard question C and the standard a point to the same service semantically, and through calculation, the second cosine similarity between the standard question a and the standard question C also reaches a preset threshold, and it is determined that the target standard question a exists in the standard question-answer library 300. However, the standard question B with the second cosine similarity greater than the second cosine similarity between the target standard question a and the standard question C to be added also exists in the standard question-answering library 300, but the semantics of the standard question B and the standard question C to be added do not refer to the same service, and if the standard question C to be added is allowed to be added in the standard question-answering library 300, the matching logic is confused, so when the standard question with the second cosine similarity greater than the second cosine similarity between the standard question to be added and the target standard question also exists in the standard question-answering library 300, the standard question to be added is refused to be added in the standard question-answering library 300, otherwise, the standard question is allowed to be added. For example: the user asks the sentence D that the apple in the city is Shanxi, the user wants to obtain the answer that the apple in the city is a special local product in the city of the Shanxi province and the geographic sign of agricultural products in the country is matched with the standard question A, and because the standard question C to be added exists, the general rate of the answer is that the user asks the sentence D to be matched with the standard question B, so that the matching accuracy is influenced.
For the convenience of understanding, the customer service processing end 200, when determining whether to allow the standard question to be added to the standard question-answering library 300, may implement the flowchart shown in fig. 4, as shown in fig. 4, including:
s41, receiving a standard question to be added;
s42, acquiring a hidden layer vector to be added with a standard question;
s43, calculating a second cosine similarity between the hidden layer vector of the standard question to be added and the hidden layer vector of each standard question in the standard question-answering library;
s44, judging whether a target standard question with the second cosine similarity larger than a preset threshold exists; if not, go to step S45, if yes, go to step S46;
s45, sending an instruction for allowing to add the standard question to be added to the standard question-answering library;
s46, judging whether a standard question with a second cosine similarity larger than that between the standard question to be added and the target standard question exists in the standard question-answering library; if yes, go to step S47, otherwise go to step S45;
and S47, sending an instruction for refusing to add the standard question to be added to the standard question-answering library.
In a possible embodiment, the deep learning module 210 is further configured to:
acquiring a plurality of groups of customer service log data, wherein each group of customer service log data comprises a plurality of historical user question sentences and corresponding historical standard questions;
and performing deep learning training on the multiple groups of customer service log data to obtain the multitask deep learning model.
In the embodiment of the present invention, the multiple sets of customer service log data refer to customer service log data from different fields of different industries, for example, customer service log data in the banking field of the financial industry may be one set, customer service log data in the security field of the financial industry may be one set, customer service log data in the building field of the building industry may be one set, customer service log data in the car-booking industry may be one set, and the like. In addition, the historical user question and the historical standard question refer to a user question received before the customer service of the merchant or the enterprise and a standard question matched for each user question, such as: the bank field consults a historical user question of 'what information is needed for modifying a password' about consulting a historical user for modifying the password of a bank card, and a corresponding historical standard question can be 'which information is needed to be carried by modifying the password'; the historical user in the bank field about deposit interest asks the sentence "how much interest can be received by me for 5 years of regular deposit", and the corresponding historical standard question can be 'inquiry on a calculation mode of regular deposit interest', and the like. Deep learning training is carried out on the multiple groups of customer service log data to obtain a universal multi-task deep learning model, so that the multi-task deep learning model has the function of matching standard questions according to user question sentences in different industries and different fields, and cost overhead caused by independently training one model for each merchant or enterprise in different industries and different fields is avoided.
In a possible embodiment, the deep learning module 210 is further configured to:
inputting each standard question in the plurality of standard questions into the multitask deep learning model to obtain a hidden layer vector of each standard question in the plurality of standard questions;
and obtaining and storing the retrieval matrix according to the hidden vector of each standard question in the plurality of standard questions.
In the specific embodiment of the present invention, after the multitask deep learning model is trained, all the standard questions in the standard question-and-answer library 300 are input into the multitask deep learning model, and after model processing and output, hidden layer vectors of each standard question in the standard question-and-answer library 300 are obtained, and a search matrix is formed by the hidden layer vectors of each standard question and stored, so that the step of acquiring the hidden layer vector of each standard question in the standard question-and-answer library 300 each time when a subsequent standard question is matched is reduced, and a direct query is adopted, thereby increasing the matching speed to a certain extent. If there is a new standard question in the subsequent standard question-answering database 300, the hidden layer vector of the new standard question can be obtained first, and the retrieval matrix is updated.
Referring to fig. 5, fig. 5 is a schematic flow chart of a question answering method based on semantic similarity according to an embodiment of the present invention, as shown in fig. 5, including the steps of:
s51, obtaining a question of the user;
s52, inputting the user question to a pre-trained multi-task deep learning model to obtain a hidden layer vector of the user question, and obtaining a standard question corresponding to the user question according to the hidden layer vector of the user question;
s53, obtaining a standard answer associated with the standard question corresponding to the user question from a preset standard question-answer library, and returning the standard answer to the customer service access end; the standard question-answer library stores a plurality of standard questions and standard answers related to each standard question in the standard questions.
It should be noted that the question-answering method based on semantic similarity provided in the embodiment of the present invention can be applied to the question-answering systems based on semantic similarity shown in fig. 2 and 3, and can achieve the same or similar beneficial effects, and in order to avoid repetition, the details are not repeated here.
In a possible embodiment, the obtaining a standard question corresponding to the user question according to the hidden vector of the user question includes:
querying a pre-stored retrieval matrix to obtain a hidden layer vector of each standard question in the plurality of standard questions; wherein the retrieval matrix comprises a hidden layer vector for each of the plurality of canonical questions;
calculating a first cosine similarity between the hidden layer vector of the user question and the hidden layer vector of each standard question in the plurality of standard questions;
and determining a standard question corresponding to the question of the user according to the first cosine similarity.
In one possible embodiment, the method further comprises:
if a standard question to be added is received, inputting the standard question to be added to the multi-task deep learning model to obtain a hidden layer vector of the standard question to be added;
calculating a second cosine similarity between the hidden layer vector of the standard question to be added and the hidden layer vector of each standard question in the plurality of standard questions;
if the target standard question with the second cosine similarity larger than the preset threshold does not exist in the standard question-answer library, allowing the standard question to be added to the standard question-answer library; if the target standard question with the second cosine similarity larger than the preset threshold exists in the standard question-and-answer library, judging whether a standard question with the second cosine similarity larger than the second cosine similarity between the standard question to be added and the target standard question still exists in the standard question-and-answer library, if not, allowing the standard question to be added in the standard question-and-answer library, otherwise, refusing to add.
In a possible embodiment, before the obtaining of the user question, the method further includes:
acquiring a plurality of groups of customer service log data, wherein each group of customer service log data comprises a plurality of historical user question sentences and corresponding historical standard questions;
and performing deep learning training on the multiple groups of customer service log data to obtain the multitask deep learning model.
In a possible embodiment, before obtaining the standard question corresponding to the user question according to the hidden vector of the user question, the method further includes:
inputting each standard question in the plurality of standard questions into the multitask deep learning model to obtain a hidden layer vector of each standard question in the plurality of standard questions;
and obtaining and storing the retrieval matrix according to the hidden vector of each standard question in the plurality of standard questions.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, as shown in fig. 6, including a memory 61, a processor 62, and a computer program stored in the memory 61 and capable of running on the processor 62, wherein:
the processor 62 is configured to call the computer program stored in the memory 61 to perform the following steps:
acquiring a question of a user;
inputting the user question to a pre-trained multi-task deep learning model to obtain a hidden vector of the user question, and obtaining a standard question corresponding to the user question according to the hidden vector of the user question;
acquiring a standard answer associated with a standard question corresponding to the user question from a preset standard question-answer library, and returning the standard answer to the customer service access end; the standard question-answer library stores a plurality of standard questions and standard answers related to each standard question in the standard questions.
Optionally, the processor 62 executes the standard question corresponding to the user question obtained according to the hidden vector of the user question, and the standard question includes:
querying a pre-stored retrieval matrix to obtain a hidden layer vector of each standard question in the plurality of standard questions; wherein the retrieval matrix comprises a hidden layer vector for each of the plurality of canonical questions;
calculating a first cosine similarity between the hidden layer vector of the user question and the hidden layer vector of each standard question in the plurality of standard questions;
and determining a standard question corresponding to the question of the user according to the first cosine similarity.
Optionally, the processor 62 is further configured to perform:
if a standard question to be added is received, inputting the standard question to be added to the multi-task deep learning model to obtain a hidden layer vector of the standard question to be added;
calculating a second cosine similarity between the hidden layer vector of the standard question to be added and the hidden layer vector of each standard question in the plurality of standard questions;
if the target standard question with the second cosine similarity larger than the preset threshold does not exist in the standard question-answer library, allowing the standard question to be added to the standard question-answer library; if the target standard question with the second cosine similarity larger than the preset threshold exists in the standard question-and-answer library, judging whether a standard question with the second cosine similarity larger than the second cosine similarity between the standard question to be added and the target standard question still exists in the standard question-and-answer library, if not, allowing the standard question to be added in the standard question-and-answer library, otherwise, refusing to add.
Optionally, the processor 62 is further configured to:
acquiring a plurality of groups of customer service log data, wherein each group of customer service log data comprises a plurality of historical user question sentences and corresponding historical standard questions;
and performing deep learning training on the multiple groups of customer service log data to obtain the multitask deep learning model.
Optionally, the processor 62 is further configured to:
inputting each standard question in the plurality of standard questions into the multitask deep learning model to obtain a hidden layer vector of each standard question in the plurality of standard questions;
and obtaining and storing the retrieval matrix according to the hidden vector of each standard question in the plurality of standard questions.
The electronic device may be a mobile phone, a computer, a notebook computer, a tablet computer, a palm computer, a wearable device, or the like. The electronic device may include, but is not limited to, a processor 62, a memory 61. It will be appreciated by those skilled in the art that the schematic diagrams are merely examples of an electronic device and are not limiting of an electronic device and may include more or fewer components than those shown, or some components in combination, or different components.
It should be noted that, since the processor 62 of the electronic device executes the computer program to implement the steps in the question answering method based on semantic similarity, the embodiments of the question answering method based on semantic similarity are all applicable to the electronic device, and all can achieve the same or similar beneficial effects.
The embodiment of the invention also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program realizes the steps in the question answering method based on semantic similarity.
Illustratively, the computer program of the computer-readable storage medium comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like.
It should be noted that, since the computer program of the computer-readable storage medium is executed by the processor to implement the steps in the question answering method based on semantic similarity, all the embodiments of the question answering method based on semantic similarity are applicable to the computer-readable storage medium, and can achieve the same or similar beneficial effects.
The above embodiments of the present invention are described in detail, and the principle and the implementation of the present invention are explained by applying specific embodiments, and the above description of the embodiments is only used to help understanding the method of the present invention and the core idea thereof; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (4)

1. A question-answering system based on semantic similarity is characterized by comprising a customer service access end, a customer service processing end and a standard question-answering library; the customer service processing end comprises a deep learning module and a question-answer matching module; the deep learning module comprises a first vector acquisition unit, a matching calculation unit and a result acquisition unit;
the customer service access terminal is used for acquiring a user question and sending the user question to the deep learning module;
the deep learning module is used for inputting the user question to a pre-trained multi-task deep learning model to obtain a hidden layer vector of the user question, obtaining a standard question corresponding to the user question according to the hidden layer vector of the user question, and sending the standard question corresponding to the user question to the question-answer matching module; the multi-task deep learning model is obtained by training service data of different industries and different fields;
the question-answer matching module is used for acquiring a standard answer associated with the standard question corresponding to the user question from the standard question-answer library and returning the standard answer to the customer service access end;
the standard question-answer library is used for storing a plurality of standard questions and standard answers related to each standard question in the standard questions;
the deep learning module further comprises a second vector acquisition unit and an addition judgment unit; the standard question-answering library is also used for receiving a standard question to be added and sending the standard question to be added to the deep learning module;
the second vector acquisition unit is used for inputting the standard questions to be added into the multi-task deep learning model to obtain hidden layer vectors of the standard questions to be added;
the matching calculation unit is further configured to calculate a second cosine similarity between the hidden layer vector of the to-be-added standard question and the hidden layer vector of each of the plurality of standard questions;
the adding judgment unit is used for allowing the standard question to be added to the standard question-answering library if the target standard question with the second cosine similarity larger than a preset threshold value does not exist in the standard question-answering library; if the target standard question with the second cosine similarity larger than the preset threshold exists in the standard question-and-answer library, judging whether a standard question with the second cosine similarity larger than the second cosine similarity between the standard question to be added and the target standard question still exists in the standard question-and-answer library, if not, allowing the standard question to be added in the standard question-and-answer library, otherwise, refusing to add; the target standard question and the standard question to be added point to the same service;
the first vector acquisition unit is used for inquiring a pre-stored retrieval matrix to obtain a hidden layer vector of each standard question in the plurality of standard questions; wherein the retrieval matrix comprises a hidden layer vector for each of the plurality of canonical questions;
the matching calculation unit is used for calculating a first cosine similarity between the hidden layer vector of the user question and the hidden layer vector of each standard question in the plurality of standard questions;
the result obtaining unit is used for determining a standard question corresponding to the question of the user according to the first cosine similarity;
the deep learning module is further to:
inputting each standard question in the plurality of standard questions into the multitask deep learning model to obtain a hidden layer vector of each standard question in the plurality of standard questions;
and obtaining and storing the retrieval matrix according to the hidden vector of each standard question in the plurality of standard questions.
2. The system of claim 1, wherein the deep learning module is further configured to:
acquiring a plurality of groups of customer service log data, wherein each group of customer service log data comprises a plurality of historical user question sentences and corresponding historical standard questions;
and performing deep learning training on the multiple groups of customer service log data to obtain the multitask deep learning model.
3. A question-answering method based on semantic similarity is characterized by comprising the following steps:
acquiring a question of a user;
inputting the user question to a pre-trained multi-task deep learning model to obtain a hidden vector of the user question, and obtaining a standard question corresponding to the user question according to the hidden vector of the user question; the multi-task deep learning model is obtained by training service data of different industries and different fields;
acquiring a standard answer associated with a standard question corresponding to the user question from a preset standard question-answer library, and returning the standard answer to the customer service access end; the standard question-answer library is stored with a plurality of standard questions and standard answers related to each standard question in the standard questions;
if a standard question to be added is received, inputting the standard question to be added to the multi-task deep learning model to obtain a hidden layer vector of the standard question to be added;
calculating a second cosine similarity between the hidden layer vector of the standard question to be added and the hidden layer vector of each standard question in the plurality of standard questions;
if the target standard question with the second cosine similarity larger than the preset threshold does not exist in the standard question-answer library, allowing the standard question to be added to the standard question-answer library; if the target standard question with the second cosine similarity larger than the preset threshold exists in the standard question-and-answer library, judging whether a standard question with the second cosine similarity larger than the second cosine similarity between the standard question to be added and the target standard question still exists in the standard question-and-answer library, if not, allowing the standard question to be added in the standard question-and-answer library, otherwise, refusing to add; the target standard question and the standard question to be added point to the same service;
the obtaining of the standard question corresponding to the user question according to the hidden vector of the user question comprises:
querying a pre-stored retrieval matrix to obtain a hidden layer vector of each standard question in the plurality of standard questions; wherein the retrieval matrix comprises a hidden layer vector for each of the plurality of canonical questions;
calculating a first cosine similarity between the hidden layer vector of the user question and the hidden layer vector of each standard question in the plurality of standard questions;
determining a standard question corresponding to the question of the user according to the first cosine similarity;
before the standard question corresponding to the user question is obtained according to the hidden vector of the user question, the method further includes:
inputting each standard question in the plurality of standard questions into the multitask deep learning model to obtain a hidden layer vector of each standard question in the plurality of standard questions;
and obtaining and storing the retrieval matrix according to the hidden vector of each standard question in the plurality of standard questions.
4. The method of claim 3, wherein prior to obtaining the user question, the method further comprises:
acquiring a plurality of groups of customer service log data, wherein each group of customer service log data comprises a plurality of historical user question sentences and corresponding historical standard questions;
and performing deep learning training on the multiple groups of customer service log data to obtain the multitask deep learning model.
CN201910514477.4A 2019-06-12 2019-06-12 Question-answering system and method based on semantic similarity Active CN110362665B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910514477.4A CN110362665B (en) 2019-06-12 2019-06-12 Question-answering system and method based on semantic similarity

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910514477.4A CN110362665B (en) 2019-06-12 2019-06-12 Question-answering system and method based on semantic similarity

Publications (2)

Publication Number Publication Date
CN110362665A CN110362665A (en) 2019-10-22
CN110362665B true CN110362665B (en) 2021-04-30

Family

ID=68216093

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910514477.4A Active CN110362665B (en) 2019-06-12 2019-06-12 Question-answering system and method based on semantic similarity

Country Status (1)

Country Link
CN (1) CN110362665B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111177349B (en) * 2019-12-20 2022-05-17 厦门快商通科技股份有限公司 Question-answer matching method, device, equipment and storage medium
CN111339241B (en) * 2020-02-18 2024-02-13 北京百度网讯科技有限公司 Problem duplicate checking method and device and electronic equipment
CN112507093B (en) * 2020-12-10 2023-08-11 亿企赢网络科技有限公司 Corpus confusion processing method, device and medium
CN113569022B (en) * 2021-06-30 2023-06-09 四川新网银行股份有限公司 Method for realizing dialogue robot response engine based on cascade search

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105608199A (en) * 2015-12-25 2016-05-25 上海智臻智能网络科技股份有限公司 Extension method and device for standard questions in intelligent question answering system
CN109344237A (en) * 2016-08-23 2019-02-15 上海智臻智能网络科技股份有限公司 A kind of method and device of the information processing for human-computer interaction

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10467268B2 (en) * 2015-06-02 2019-11-05 International Business Machines Corporation Utilizing word embeddings for term matching in question answering systems

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105608199A (en) * 2015-12-25 2016-05-25 上海智臻智能网络科技股份有限公司 Extension method and device for standard questions in intelligent question answering system
CN109344237A (en) * 2016-08-23 2019-02-15 上海智臻智能网络科技股份有限公司 A kind of method and device of the information processing for human-computer interaction

Also Published As

Publication number Publication date
CN110362665A (en) 2019-10-22

Similar Documents

Publication Publication Date Title
CN110362665B (en) Question-answering system and method based on semantic similarity
CN104951428B (en) User's intension recognizing method and device
US11757807B2 (en) Interactive chatbot for multi-way communication
CN112527972A (en) Intelligent customer service chat robot implementation method and system based on deep learning
WO2023049635A1 (en) Real-time product environmental impact scoring
CN114090755A (en) Reply sentence determination method and device based on knowledge graph and electronic equipment
KR20220050078A (en) Method, Apparatus and System for Generating Online Shopping Mall
CN110347786B (en) Semantic model tuning method and system
CN111639162A (en) Information interaction method and device, electronic equipment and storage medium
CN110362662A (en) Data processing method, device and computer readable storage medium
CN111625638A (en) Question processing method, device and equipment and readable storage medium
CN111787042B (en) Method and device for pushing information
CN112182126A (en) Model training method and device for determining matching degree, electronic equipment and readable storage medium
CN111882224A (en) Method and device for classifying consumption scenes
CN115687754B (en) Active network information mining method based on intelligent dialogue
CN116204624A (en) Response method, response device, electronic equipment and storage medium
CN115374259A (en) Question and answer data mining method and device and electronic equipment
CN115186192A (en) Information processing method, device, storage medium and equipment
US20210264495A1 (en) Systems and methods for generating price comparisons
CN114519094A (en) Method and device for conversational recommendation based on random state and electronic equipment
CN106095798A (en) The recognition methods of sex characteristics, system and the terminal of a kind of feature based data base
Aytaç et al. Analysis of digital marketing strategies of deposit banks in Turkey via text mining twitter posts
CN111199421A (en) User recommendation method and device based on social relationship and electronic equipment
CN112035613B (en) Information pushing method and device based on multi-round dialogue, storage medium and electronic device
CN114579860B (en) User behavior portrait generation method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant