CN117453894A - Intelligent question-answering method and device, electronic equipment and storage medium - Google Patents
Intelligent question-answering method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117453894A CN117453894A CN202311619417.1A CN202311619417A CN117453894A CN 117453894 A CN117453894 A CN 117453894A CN 202311619417 A CN202311619417 A CN 202311619417A CN 117453894 A CN117453894 A CN 117453894A
- Authority
- CN
- China
- Prior art keywords
- question
- text
- answered
- questions
- sequence
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000012549 training Methods 0.000 claims abstract description 59
- 108091026890 Coding region Proteins 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 17
- 238000010276 construction Methods 0.000 claims description 10
- 238000012545 processing Methods 0.000 claims description 9
- 230000011218 segmentation Effects 0.000 claims description 6
- 230000006870 function Effects 0.000 abstract description 10
- 230000008569 process Effects 0.000 description 16
- 238000010586 diagram Methods 0.000 description 10
- 238000004891 communication Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 3
- 238000007781 pre-processing Methods 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 230000003111 delayed effect Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000003058 natural language processing Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Artificial Intelligence (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Computation (AREA)
- Medical Informatics (AREA)
- Human Computer Interaction (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses an intelligent question-answering method, an intelligent question-answering device, electronic equipment and a storage medium, which comprise the following steps: constructing an input characteristic sequence corresponding to the questions to be answered according to the questions to be answered; inputting the input characteristic sequence into a pre-training model to obtain an output characteristic sequence corresponding to the input characteristic sequence; and generating a question answer corresponding to the question to be answered based on the answer text information. The technical scheme of the embodiment of the invention solves the problems that the traditional question-answering system uses keywords to match with the retrieval answers, so that the semantic understanding of the questions proposed by the user is unclear and questions can be answered; the system needs to provide a large number of standard answers to specific questions and needs background users to write the questions; for partial questions, the customer service system can only provide related links and articles, has no difference with the function of a search engine and the like, realizes automatic learning and answering of the questions, does not need to write the questions in advance like a traditional bank customer service robot, and has accurate answers because of model generation.
Description
Technical Field
The invention relates to the technical field of intelligent question and answer, in particular to an intelligent question and answer method, an intelligent question and answer device, electronic equipment and a storage medium.
Background
The conventional customer service robot usually uses a keyword matching mode to judge the problem that the user wants to consult, usually a background manager of the customer service robot needs to write a large number of related keywords and answers, and once the user proposes a problem field which is not pre-written, or the condition that the problem keywords proposed by the user are inaccurate, abbreviated, wrongly written and the like, the pre-defined keywords cannot be matched so that proper answers cannot be found. Meanwhile, as answers to the questions are all pre-written by a background manager, the answers are single and mechanical, and lack of people's taste.
Traditional question-answering systems use keywords to match search answers, so that semantic understanding of questions posed by users is unclear and questions may be answered. The system needs to provide a large number of standard answers to specific questions, requiring background user writing. For some problems, the customer service system can only provide relevant links and articles, and is not different from the search engine function.
Disclosure of Invention
The invention provides an intelligent question-answering method, an intelligent question-answering device, electronic equipment and a storage medium, which are used for realizing automatic learning and answering of user questions by using a small amount of manually written customer service reference texts and question answers based on a fine tuning technology, and the questions do not need to be written in advance like a traditional bank customer service robot, so that the answers of the questions come from model generation, and the answers are accurate, and the mode is more changeable and natural.
According to an aspect of the present invention, there is provided an intelligent question-answering method, including:
constructing an input characteristic sequence corresponding to a to-be-answered question according to the to-be-answered question, wherein the input characteristic sequence comprises a question text coding sequence and a reference text coding sequence of the to-be-answered question;
inputting the input feature sequence into a pre-training model to obtain an output feature sequence corresponding to the input feature sequence, wherein the output feature sequence comprises answer text information of the questions to be answered;
and generating a question answer corresponding to the question to be answered based on the answer text information.
According to another aspect of the present invention, there is provided an intelligent question-answering apparatus, including:
the input feature sequence construction module is used for constructing an input feature sequence corresponding to the to-be-answered question according to the to-be-answered question, wherein the input feature sequence comprises a question text coding sequence and a reference text coding sequence of the to-be-answered question;
the output characteristic sequence determining module is used for inputting the input characteristic sequence into a pre-training model to obtain an output characteristic sequence corresponding to the input characteristic sequence, wherein the output characteristic sequence comprises answer text information of the questions to be answered;
And the question answer determining module is used for generating a question answer corresponding to the to-be-answered question based on the answer text information.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor;
and a memory communicatively coupled to the at least one processor;
the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor, so that the at least one processor can execute the intelligent question-answering method according to any embodiment of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement the intelligent question-answering method according to any one of the embodiments of the present invention when executed.
According to the technical scheme of the embodiment of the invention, an input characteristic sequence corresponding to the to-be-answered question is constructed according to the to-be-answered question; inputting the input characteristic sequence into a pre-training model to obtain an output characteristic sequence corresponding to the input characteristic sequence; and generating a question answer corresponding to the question to be answered based on the answer text information. The problem that the traditional question-answering system uses keywords to match with the retrieval answers is solved, the semantic understanding of the questions proposed by the user is unclear, and questions can be answered in the absence of questions; the system needs to provide a large number of standard answers to specific questions and needs background users to write the questions; for partial questions, the customer service system can only provide related links and articles, has no difference with the function of a search engine and the like, realizes automatic learning and answering of user questions based on a fine tuning technology by using a small amount of manually written customer service reference texts and question answers, does not need to write the questions in advance like a traditional bank customer service robot, has accurate answers and is more changeable and natural in mode.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an intelligent question-answering method provided by an embodiment of the invention;
FIG. 2 is a training flow chart of pretraining model fine tuning for the embodiment of the present invention;
FIG. 3 is a schematic diagram of training and application process input sequence coding and feature construction;
FIG. 4 is a schematic diagram of model predictive answer details during training and application;
FIG. 5 is a flowchart of an application process according to an embodiment of the present invention;
FIG. 6 is a diagram showing the overall architecture of an intelligent question-answering system according to the present embodiment;
fig. 7 is a schematic structural diagram of an intelligent question-answering device according to an embodiment of the present invention;
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
To further clarify the technical effects of the present invention, prior art will be further described below with reference to the following examples:
when a user wants to loan, deposit, or purchase a financial product, the user often needs to contact the customer service due to insufficient clarity or accuracy of the financial information description, but the manual customer service seat is often insufficient, so an intelligent customer service robot is often used to automatically answer some general questions of the user, such as "how much is the deposit interest rate? "what is the most recently earned foundation? "etc. The embodiment of the invention aims to improve the humanization of the bank customer service robot for answering the questions, solve the problems that the traditional bank customer service robot needs to manually write a large number of answers, answer questions and the like caused by insufficient intelligence, and improve the performance of the bank customer service robot by utilizing an ALBERT model.
The conventional customer service robot for banks generally performs word segmentation and splitting on the problems proposed by users and matches the problems according to keywords in a database, and a background manager of the robot generally needs to write some problems and keywords.
The key words and answers are written in the background and input into a database:
keyword: interest/interest rate/annual rate
Answer: parent-me running interest rate 5.5% to the upper
When a user presents a problem to the customer service robot:
the user: how much is the loan age longest?
The bank customer service robot will segment the questions presented by the user, such as:
is loan/year/longest/how much?
And inquiring the database of each vocabulary, wherein the loan is matched with the pre-written keywords, and the customer service robot answers the pre-set answers.
But this may also result in a non-interview or no answer being retrieved. When no answer is retrieved, such banking robots typically use fixed speech techniques such as: the parent does not understand the question of the user, or directly calls the search engine to return the search result of the question of the user to the user, so that the user can screen the question by himself, and the experience is poor.
1. Traditional question-answering systems use keywords to match search answers, so that semantic understanding of questions posed by users is unclear and questions may be answered.
2. The system needs to provide a large number of standard answers to specific questions, requiring background user writing.
3. For some problems, the customer service system can only provide relevant links and articles, and is not different from the search engine function.
Fig. 1 is a flowchart of an intelligent question answering method according to an embodiment of the present invention, where the method may be implemented by an intelligent question answering device, which may be implemented in hardware and/or software, and the device may be configured in an intelligent question answering system, such as an intelligent customer service system of a bank. As shown in fig. 1, the method includes:
S110, constructing an input characteristic sequence corresponding to the questions to be answered according to the questions to be answered.
The input feature sequence comprises a question text coding sequence and a reference text coding sequence of the questions to be answered. The question text code sequence refers to a code sequence corresponding to a text of a question to be answered, and the reference text code sequence refers to a code sequence corresponding to a reference text for answering the question to be answered.
In the embodiment of the present invention, before constructing the input feature sequence corresponding to the to-be-answered question, the method further includes: and determining the question text of the questions to be answered, and dividing the questions to be answered into effective questions and ineffective questions according to the word number of the question text and a preset word number threshold value.
Specifically, if the input mode of the question to be answered is that the customer inputs the question through the input device, the input text can be used as the question text; if the question to be answered is entered by the customer's voice, the entered audio may be converted to text as the question text. Further, determining the word number of the question text, if the word number is smaller than the preset word number threshold, the question text can be regarded as an invalid question, and the question text is not processed. If the word number of the text is larger than the preset word number threshold, the text can be used as a valid question and answered.
On the basis of the above scheme, if the to-be-answered question is a valid question, before the input feature sequence corresponding to the to-be-answered question is constructed, the method further includes: word segmentation processing is carried out on the question text corresponding to the question to be answered, a question phrase corresponding to the question text is obtained, and the question phrase is matched with a preset keyword; if the question phrase is consistent with the preset keyword, starting a manual customer service system to solve the questions to be answered; otherwise, constructing an input feature sequence corresponding to the to-be-answered question based on the question text.
The question phrase refers to a phrase contained in the question text.
Specifically, if the question is a valid question, the representative may answer the question, and the text may be divided into phrases by the jieba word segmentation technique, and the phrases may be matched with the preset keywords. The preset keywords are preset keywords, if the question words are matched with the preset keywords, the questions to be answered can be answered through a manual customer service system, if the questions cannot be matched with the preset keywords, the questions to be answered need to be answered through a pre-training model, and at the moment, an input feature sequence of the questions to be answered can be constructed based on the questions and the texts.
In the embodiment of the present invention, the constructing the input feature sequence corresponding to the question to be answered based on the question text includes: according to the problem phrase corresponding to the problem text, searching a reference text matched with the problem phrase in a reference text database; converting the question text into the question text code sequence, converting the reference text into the reference text code sequence, and constructing the input feature sequence based on the question text code sequence and the reference text code sequence.
The reference text database refers to a database containing a large number of reference texts, the reference text database is matched with the field or application scene of the questions to be answered, for example, the application scene is the banking field, and the reference text database can be constructed according to the content of banking regulations and the like, so that when a customer gives a question, the customer can answer based on the reference texts in the reference text database, and the reference texts are usually answers of the questions containing the questions to be answered.
Specifically, a text matched with the question phrase is searched in a database according to the question phrase and used as a reference text, for example, a text containing the question phrase is searched, or a text with higher association degree with the question phrase is used as a reference text. Further, the problem text is converted into a problem text code sequence through a conversion mode of the code sequence, the reference text is converted into a reference text code sequence through a conversion mode of the code sequence, and the reference text code sequence and the problem text code sequence are integrated into an input feature sequence.
S120, inputting the input feature sequence into a pre-training model to obtain an output feature sequence corresponding to the input feature sequence.
The output feature sequence includes answer text information of the questions to be answered, and the pre-training model refers to a pre-trained language model, such as an ALBERT model.
Specifically, an input characteristic sequence is input into a pre-training model, and the pre-training model performs reasoning prediction according to the input characteristic sequence to obtain a corresponding output result, namely an output characteristic sequence; and outputting the text information of the answers of the questions to be answered contained in the feature sequence, and determining the answers of the questions corresponding to the questions to be answered according to the information.
In an embodiment of the present invention, before inputting the input feature sequence into the pre-training model, the method further includes: acquiring a reference text to be used, and constructing an input characteristic sequence to be used and an output characteristic sequence to be used based on the reference text to be used; and training an initial pre-training model by taking the to-be-used characteristic input characteristic sequence and the to-be-used output characteristic sequence as training samples so as to obtain the pre-training model.
Wherein, the pre-acquired data associated with the customer service answering system, documents related to the service regulation and the like are to be referred to by the reference text; the feature sequence to be used and the output feature sequence to be used refer to the coding sequence constructed based on the reference text to be used. And taking the input characteristic sequence to be used as the input of the initial pre-training model, taking the output characteristic sequence to be used as the target output value of the initial pre-training model, and training the initial pre-training model for iteration to obtain the pre-training model. That is, the initial pre-training model is trained by the feature input feature sequence to be used and the output feature sequence to be used in the embodiment, so as to obtain the pre-training model.
On the basis of the above embodiment, the constructing an input feature sequence to be used and an output feature sequence to be used based on the reference text to be used includes: determining a to-be-used question text according to the to-be-used reference text, and determining a to-be-used answer text corresponding to the to-be-used question text in the to-be-used reference text; and constructing the input feature sequence to be used according to the reference text to be used and the coding sequence corresponding to the question text to be used, and constructing the output feature sequence to be used based on paragraph information of the answer text to be used.
Specifically, a plurality of questions can be edited according to the reference text to be used, the text of the questions is determined as the text of the questions to be used, and corresponding answers, namely the text of the answers to be used, are determined. The construction of the input feature sequence to be used may be to convert the reference text to be used and the answer text to be used into a code sequence form, and the construction of the output feature sequence to be used may be to convert paragraph position information into a code sequence form based on paragraph position information of the answer text to be used in the reference text to be used, so as to obtain the output feature sequence to be used.
S130, generating a question answer corresponding to the to-be-answered question based on the answer text information.
The answer text information is used for representing specific position information of the answer text in the reference text.
On the basis of the foregoing embodiment, the generating, based on the answer text information, a question answer corresponding to the question to be answered includes: determining paragraph information of the answer text in the reference text based on the answer text information; and according to the paragraph information, extracting the answer text from the answer text to serve as a question answer corresponding to the question to be answered.
Specifically, the answer text information is used to indicate a specific location of the answer text, such as what line and what word the answer text is in the reference text. And extracting a text capable of answering the questions to be answered from the reference text as a question answer for answering according to the answer text information.
According to the technical scheme of the embodiment of the invention, an input characteristic sequence corresponding to the to-be-answered question is constructed according to the to-be-answered question; inputting the input characteristic sequence into a pre-training model to obtain an output characteristic sequence corresponding to the input characteristic sequence; and generating a question answer corresponding to the question to be answered based on the answer text information. The problem that the traditional question-answering system uses keywords to match with the retrieval answers is solved, the semantic understanding of the questions proposed by the user is unclear, and questions can be answered in the absence of questions; the system needs to provide a large number of standard answers to specific questions and needs background users to write the questions; for partial questions, the customer service system can only provide related links and articles, has no difference with the function of a search engine and the like, realizes automatic learning and answering of user questions based on a fine tuning technology by using a small amount of manually written customer service reference texts and question answers, does not need to write the questions in advance like a traditional bank customer service robot, has accurate answers and is more changeable and natural in mode.
Fig. 2 is a training flow chart of fine tuning of a pre-training model, which is applicable to the embodiment of the present invention, and this embodiment is a preferred embodiment of the foregoing embodiment, and a specific implementation manner of this embodiment may be referred to the technical solution of this embodiment. Wherein, the technical terms identical to or corresponding to the above embodiments are not repeated herein. As shown in fig. 2, the method includes:
in the actual application scene of the manual customer service, the customer service needs to recite or temporarily inquire a large amount of reference data texts when answering the user questions. When a user presents a question, the human customer service needs to consult the data to construct a proper answer for the user, so as to solve the problem of the user.
In this embodiment, the method is implemented by two processes of training a model and applying the model. Deep learning technology is applied, the most complex version of the ALBERT-based pre-training model is pre-trained on a large amount of Chinese text material, i.e. the grammar and semantic knowledge of the Chinese language are fully learned, so that the model is called as. The model is used in this embodiment as the main body for semantic understanding and answer generation of user questions.
The overall architecture of the intelligent question-answering system applicable to the embodiment is shown in fig. 6. Wherein the fine-tuning based training process is implemented by the model training module 205.
As previously stated, human customer service needs to refer to a large amount of reference data text as a basis for user questions. In the training process, the system needs to write the questions and the reference answer data sets manually aiming at the reference data text, and train the albert model based on the fine tuning technology, so that the system has the capability of analyzing the questions presented by the user in the customer service scene and giving the proper answers by referring to the data text. The training process includes constructing model training data, constructing input features, and the like, and the flow chart is shown in fig. 2.
Taking the following paragraphs as an example:
the present financial product is a fixed profit class (net open) financial product, which is opened 1 time per quarter for 10 years (depending on whether the present product is terminated early or delayed). The specification comprises a risk disclosure part, a product description part and an investor right and interest special page part, and forms a financial product sales file together with a financial product agreement. In order to maintain legal rights and interests, prevent investment risks, please carefully read sales documents of financial products and know specific conditions of the financial products; if the factors affecting the risk tolerance capability change, the risk tolerance capability assessment is completed in time, and the risk disclosure is carefully read before investment. If there is a question, please consult with the sales mechanism client manager or financial manager. "
Manual writing is required:
the user: is the financial product a fixed collection product?
Answer: the financial product is a fixed profit class (open net value) financial product.
The user: how much is the financial product deadline?
Answer: the term 10 years (depending on whether the product is terminated early or delayed) is opened 1 time per quarter.
Wherein the questions are manually written and the answers must be abstracted from the customer reference data sections.
After the model training data is constructed for the customer service personnel with reference to the data text, a data set of a text segment and related problems is obtained. At this time, it is required to construct an input sequence, and then convert the input sequence from a natural language that cannot be understood by a computer into an encoded form that can be processed by the computer through the berttoken module. As shown in fig. 3, fig. 3 is a schematic diagram of training and application process input sequence coding and feature construction.
The input sequence is constructed such that the beginning is a special character "[ CLS ]", which indicates the beginning position of the sequence and does not have an actual meaning. Then the manually constructed question text sequence and customer reference data text follow and are segmented with special symbols "[ SEP ]". And an additional token_type_ids sequence is constructed, the length of which is identical to that of the input sequence, and the input sequence is identified by positions with 1 and 0 for distinguishing whether the code belongs to the part of the input question text sequence or the part of the customer service reference data text sequence. Wherein "[ SEP ]" is a special symbol commonly used in the NLP (natural language processing) field, used to separate different input sequences. During text preprocessing, the text sequence is typically segmented according to "[ SEP ]" symbols to facilitate model training and prediction.
The constructed input features are then input to an albert model, the output of which is consistent with the length of the input sequence, and the portion of the output sequence corresponding to the customer service reference data coding sequence is used to predict the scope of the answer. Thus, during the training process, the answer portion of the manually composed training data set is structured in the same form as the portion of the output sequence (a piece of text of customer service parameter data is identified with answer start position and answer end position), the gap is evaluated using the loss function, and the model is optimized. The final model prediction effect is shown in fig. 4, and fig. 4 is a detailed schematic diagram of model prediction answers in the training and application process. The training process ends so far.
The application process flow of the embodiment of the invention is shown in fig. 5. When the system receiving module 200 receives a problem of a user, it needs to determine whether the problem is a valid problem, and the decision is: a word number threshold a is preset, and when the number of the problem words is smaller than the threshold, the problem is regarded as an invalid problem, and the problem is ignored. When the effective question is judged, the effective question is input to the preprocessing module 201, and the preprocessing module splits the input of the user into phrases based on the j ieba word segmentation system. And then input to the intention discriminating module 202 and judge whether keywords for starting the manual service are included therein or not phrase by phrase (keywords are to be preset in the system configuration). If so, starting the manual customer service system. If not, these phrases are passed to the segment retrieval module process 203. The text retrieval module firstly establishes full text indexes for all customer service reference data texts based on an elastic icSearch (which can be regarded as a full text search engine), and when the text receives a phrase, the phrase is used as a keyword to retrieve a reference data text most relevant to the user problem. The text and the original text of the question are then input to the answer generation module 204, which constructs the input features of the question and the retrieved reference data text according to the same input sequence and feature construction method as the training process, and gives the input features to the albert model for predicting the answer, and finally returns the answer to the user.
According to the technical scheme of the embodiment of the invention, an input characteristic sequence corresponding to the to-be-answered question is constructed according to the to-be-answered question; inputting the input characteristic sequence into a pre-training model to obtain an output characteristic sequence corresponding to the input characteristic sequence; and generating a question answer corresponding to the question to be answered based on the answer text information. The problem that the traditional question-answering system uses keywords to match with the retrieval answers is solved, the semantic understanding of the questions proposed by the user is unclear, and questions can be answered in the absence of questions; the system needs to provide a large number of standard answers to specific questions and needs background users to write the questions; for partial questions, the customer service system can only provide related links and articles, has no difference with the function of a search engine and the like, realizes automatic learning and answering of user questions based on a fine tuning technology by using a small amount of manually written customer service reference texts and question answers, does not need to write the questions in advance like a traditional bank customer service robot, has accurate answers and is more changeable and natural in mode.
Fig. 7 is a schematic structural diagram of an intelligent question-answering device according to an embodiment of the present invention. As shown in fig. 7, the apparatus includes:
an input feature sequence construction module 310, configured to construct an input feature sequence corresponding to a question to be answered according to the question to be answered, where the input feature sequence includes a question text coding sequence and a reference text coding sequence of the question to be answered;
An output feature sequence determining module 320, configured to input the input feature sequence to a pre-training model, and obtain an output feature sequence corresponding to the input feature sequence, where the output feature sequence includes answer text information of the to-be-answered question;
and the question answer determining module 330 is configured to generate a question answer corresponding to the question to be answered based on the answer text information.
According to the technical scheme of the embodiment of the invention, an input characteristic sequence corresponding to the to-be-answered question is constructed according to the to-be-answered question; inputting the input characteristic sequence into a pre-training model to obtain an output characteristic sequence corresponding to the input characteristic sequence; and generating a question answer corresponding to the question to be answered based on the answer text information. The problem that the traditional question-answering system uses keywords to match with the retrieval answers is solved, the semantic understanding of the questions proposed by the user is unclear, and questions can be answered in the absence of questions; the system needs to provide a large number of standard answers to specific questions and needs background users to write the questions; for partial questions, the customer service system can only provide related links and articles, has no difference with the function of a search engine and the like, and realizes a method for automatically learning and answering user questions by using a small amount of manually written customer service reference texts and question answers based on a fine tuning technology, the questions do not need to be written in advance like a traditional bank customer service robot, the question answers come from model generation, and the answers are accurate and more changeable and natural.
Optionally, the device further includes a question dividing module, configured to determine a question text of the question to be answered before the input feature sequence corresponding to the question to be answered is constructed, and divide the question to be answered into a valid question and an invalid question according to the word number of the question text and a preset word number threshold.
Optionally, the device further includes a preset keyword matching module, configured to:
if the to-be-answered question is an effective question, before the input feature sequence corresponding to the to-be-answered question is constructed, word segmentation processing is carried out on a question text corresponding to the to-be-answered question, a question phrase corresponding to the question text is obtained, and the question phrase is matched with a preset keyword;
if the question phrase is consistent with the preset keyword, starting a manual customer service system to solve the questions to be answered; otherwise, constructing an input feature sequence corresponding to the to-be-answered question based on the question text.
Optionally, the input feature sequence construction module 310 includes:
the reference text determining module is used for searching a reference text matched with the question phrase in a reference text database according to the question phrase corresponding to the question text;
And the construction module is used for converting the question text into the question text coding sequence, converting the reference text into the reference text coding sequence and constructing the input characteristic sequence based on the question text coding sequence and the reference text coding sequence.
Optionally, the device further includes a training module, configured to obtain a reference text to be used before the input feature sequence is input into the pre-training model, and construct an input feature sequence to be used and an output feature sequence to be used based on the reference text to be used;
and training an initial pre-training model by taking the to-be-used characteristic input characteristic sequence and the to-be-used output characteristic sequence as training samples so as to obtain the pre-training model.
Optionally, the training module includes:
the answer text to be used determining module is used for determining a question text to be used according to the reference text to be used and an answer text to be used corresponding to the question text to be used in the reference text to be used;
the to-be-used characteristic sequence constructing module is used for constructing the input characteristic sequence according to the to-be-used reference text and the coding sequence corresponding to the to-be-used question text, and constructing the to-be-used output characteristic sequence based on paragraph information of the to-be-used answer text.
Optionally, the answer to question determination module 330 includes:
a paragraph information determining module, configured to determine paragraph information of the answer text in the reference text based on the answer text information;
and the question answer extracting module is used for extracting the answer text from the answer text as the question answer corresponding to the question to be answered according to the paragraph information.
The intelligent question-answering device provided by the embodiment of the invention can execute the intelligent question-answering method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 8, the electronic device 40 includes at least one processor 41, and a memory communicatively connected to the at least one processor 41, such as a Read Only Memory (ROM) 42, a Random Access Memory (RAM) 43, etc., in which the memory stores a computer program executable by the at least one processor, and the processor 41 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 42 or the computer program loaded from the storage unit 48 into the Random Access Memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 may also be stored. The processor 41, the ROM 42 and the RAM 43 are connected to each other via a bus 44. An input/output (I/O) interface 45 is also connected to bus 44.
Various components in electronic device 40 are connected to I/O interface 45, including: an input unit 46 such as a keyboard, a mouse, etc.; an output unit 47 such as various types of displays, speakers, and the like; a storage unit 48 such as a magnetic disk, an optical disk, or the like; and a communication unit 49 such as a network card, modem, wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 41 may be various general and/or special purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 41 performs the various methods and processes described above, such as the intelligent question-answering method.
In some embodiments, the intelligent question answering method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 40 via the ROM 42 and/or the communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the intelligent question-answering method described above can be performed. Alternatively, in other embodiments, processor 41 may be configured to perform the intelligent question-answering method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.
Claims (10)
1. An intelligent question-answering method is characterized by comprising the following steps:
constructing an input characteristic sequence corresponding to a to-be-answered question according to the to-be-answered question, wherein the input characteristic sequence comprises a question text coding sequence and a reference text coding sequence of the to-be-answered question;
inputting the input feature sequence into a pre-training model to obtain an output feature sequence corresponding to the input feature sequence, wherein the output feature sequence comprises answer text information of the questions to be answered;
And generating a question answer corresponding to the question to be answered based on the answer text information.
2. The method of claim 1, further comprising, prior to said constructing the input feature sequence corresponding to the question to be answered:
and determining the question text of the questions to be answered, and dividing the questions to be answered into effective questions and ineffective questions according to the word number of the question text and a preset word number threshold value.
3. The method of claim 2, further comprising, before said constructing the input feature sequence corresponding to the question to be answered, if the question to be answered is a valid question:
word segmentation processing is carried out on the question text corresponding to the question to be answered, a question phrase corresponding to the question text is obtained, and the question phrase is matched with a preset keyword;
if the question phrase is consistent with the preset keyword, starting a manual customer service system to solve the questions to be answered; otherwise, constructing an input feature sequence corresponding to the to-be-answered question based on the question text.
4. A method according to claim 3, wherein said constructing an input feature sequence corresponding to said question to be answered based on said question text comprises:
According to the problem phrase corresponding to the problem text, searching a reference text matched with the problem phrase in a reference text database;
converting the question text into the question text code sequence, converting the reference text into the reference text code sequence, and constructing the input feature sequence based on the question text code sequence and the reference text code sequence.
5. The method of claim 1, further comprising, prior to inputting the input feature sequence into a pre-training model:
acquiring a reference text to be used, and constructing an input characteristic sequence to be used and an output characteristic sequence to be used based on the reference text to be used;
and training an initial pre-training model by taking the to-be-used characteristic input characteristic sequence and the to-be-used output characteristic sequence as training samples so as to obtain the pre-training model.
6. The method of claim 5, wherein constructing an input feature sequence to be used and an output feature sequence to be used based on the reference text to be used comprises:
determining a to-be-used question text according to the to-be-used reference text, and determining a to-be-used answer text corresponding to the to-be-used question text in the to-be-used reference text;
And constructing the input feature sequence to be used according to the reference text to be used and the coding sequence corresponding to the question text to be used, and constructing the output feature sequence to be used based on paragraph information of the answer text to be used.
7. The method of claim 1, wherein generating a question answer corresponding to the question to be answered based on the answer text information comprises:
determining paragraph information of the answer text in the reference text based on the answer text information;
and according to the paragraph information, extracting the answer text from the answer text to serve as a question answer corresponding to the question to be answered.
8. An intelligent question-answering device, comprising:
the input feature sequence construction module is used for constructing an input feature sequence corresponding to the to-be-answered question according to the to-be-answered question, wherein the input feature sequence comprises a question text coding sequence and a reference text coding sequence of the to-be-answered question;
the output characteristic sequence determining module is used for inputting the input characteristic sequence into a pre-training model to obtain an output characteristic sequence corresponding to the input characteristic sequence, wherein the output characteristic sequence comprises answer text information of the questions to be answered;
And the question answer determining module is used for generating a question answer corresponding to the to-be-answered question based on the answer text information.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the intelligent question-answering method according to any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to implement the intelligent question-answering method of any one of claims 1-7 when executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311619417.1A CN117453894A (en) | 2023-11-29 | 2023-11-29 | Intelligent question-answering method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311619417.1A CN117453894A (en) | 2023-11-29 | 2023-11-29 | Intelligent question-answering method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117453894A true CN117453894A (en) | 2024-01-26 |
Family
ID=89594925
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311619417.1A Pending CN117453894A (en) | 2023-11-29 | 2023-11-29 | Intelligent question-answering method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117453894A (en) |
-
2023
- 2023-11-29 CN CN202311619417.1A patent/CN117453894A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110377911B (en) | Method and device for identifying intention under dialog framework | |
CN111241237B (en) | Intelligent question-answer data processing method and device based on operation and maintenance service | |
US10755048B2 (en) | Artificial intelligence based method and apparatus for segmenting sentence | |
US10916242B1 (en) | Intent recognition method based on deep learning network | |
US20230394247A1 (en) | Human-machine collaborative conversation interaction system and method | |
WO2020052069A1 (en) | Method and apparatus for word segmentation | |
CN111414746B (en) | Method, device, equipment and storage medium for determining matching statement | |
CN117609444B (en) | Searching question-answering method based on large model | |
WO2021051514A1 (en) | Speech identification method and apparatus, computer device and non-volatile storage medium | |
WO2020052061A1 (en) | Method and device for processing information | |
US20220165257A1 (en) | Neural sentence generator for virtual assistants | |
WO2023034020A1 (en) | Sentence level dialogue summaries using unsupervised machine learning for keyword selection and scoring | |
CN114579104A (en) | Data analysis scene generation method, device, equipment and storage medium | |
CN113342948A (en) | Intelligent question and answer method and device | |
CN115470313A (en) | Information retrieval and model training method, device, equipment and storage medium | |
CN114611625A (en) | Language model training method, language model training device, language model data processing method, language model data processing device, language model data processing equipment, language model data processing medium and language model data processing product | |
US20230206007A1 (en) | Method for mining conversation content and method for generating conversation content evaluation model | |
CN116881730A (en) | Chat scene matching system, method, equipment and storage medium based on context | |
US20230298615A1 (en) | System and method for extracting hidden cues in interactive communications | |
CN116049370A (en) | Information query method and training method and device of information generation model | |
CN113743126B (en) | Intelligent interaction method and device based on user emotion | |
CN115292492A (en) | Method, device and equipment for training intention classification model and storage medium | |
CN117453894A (en) | Intelligent question-answering method and device, electronic equipment and storage medium | |
CN112559697A (en) | Method and device for recognizing conversational intention | |
CN116737888B (en) | Training method of dialogue generation model and method and device for determining reply text |
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 |