CN110825855B - Response method and device based on artificial intelligence, computer equipment and storage medium - Google Patents

Response method and device based on artificial intelligence, computer equipment and storage medium Download PDF

Info

Publication number
CN110825855B
CN110825855B CN201910881309.9A CN201910881309A CN110825855B CN 110825855 B CN110825855 B CN 110825855B CN 201910881309 A CN201910881309 A CN 201910881309A CN 110825855 B CN110825855 B CN 110825855B
Authority
CN
China
Prior art keywords
sequence
question
answer
word
vector 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.)
Active
Application number
CN201910881309.9A
Other languages
Chinese (zh)
Other versions
CN110825855A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910881309.9A priority Critical patent/CN110825855B/en
Priority to PCT/CN2019/118474 priority patent/WO2021051615A1/en
Publication of CN110825855A publication Critical patent/CN110825855A/en
Application granted granted Critical
Publication of CN110825855B publication Critical patent/CN110825855B/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/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the invention discloses a response method and device based on artificial intelligence, computer equipment and a storage medium. The method belongs to the technical field of artificial intelligence, and comprises the following steps: acquiring a pre-stored training sample set, and performing word segmentation processing on question samples and answer samples of the training sample set respectively to obtain question word segmentation sequences and answer word segmentation sequences respectively; performing word vector training on words in the question word segmentation sequence and words in the answer word segmentation sequence to respectively obtain a question word vector sequence and an answer word vector sequence; training the pre-constructed convolutional neural network model through the question word vector sequence and the answer word vector sequence; if the question to be tested is received, the answer of the question to be tested is predicted through the trained convolutional neural network model and output, so that the question-answer model can be built through the convolutional neural network, and compared with the traditional cyclic neural network, the operation speed is greatly improved.

Description

Response method and device based on artificial intelligence, computer equipment and storage medium
Technical Field
The present invention relates to the field of artificial intelligence technology, and in particular, to an artificial intelligence based response method, apparatus, computer device, and storage medium.
Background
With the development of artificial intelligence technology, the intelligent question-answering assistant is more and more widely applied. The intelligent question-answering assistant can replace manual work to answer some questions of the user quickly, and the efficiency of enterprise customer service is greatly improved.
At present, the existing intelligent question-answering assistant is mainly realized through a sequence model, such as a recurrent neural network, but is limited to the limitation of the operation speed of the recurrent neural network, so that the operation speed of the scheme is low, a user can wait for a long time, and the use experience of the user is greatly reduced.
Disclosure of Invention
The embodiment of the invention provides a response method, a response device, computer equipment and a storage medium based on artificial intelligence, and aims to solve the problem that the existing intelligent question-answering assistant has long waiting time due to low operation speed.
In a first aspect, an embodiment of the present invention provides an artificial intelligence-based response method, which includes:
obtaining a pre-stored training sample set, and performing word segmentation processing on question samples and answer samples of the training sample set respectively to obtain a question word segmentation sequence set and an answer word segmentation sequence set respectively, wherein the question word segmentation sequence set is a set formed by question word segmentation sequences formed by words obtained by segmenting each question sample, and the answer word segmentation sequence set is a set formed by answer word sequences formed by words obtained by segmenting each answer sample;
performing word vector training on words in the question word segmentation sequences of the question word segmentation sequence set and words in the answer word segmentation sequences of the answer word segmentation sequence set to respectively obtain a question word vector sequence set consisting of the question word vector sequences of each question word segmentation sequence and an answer word vector sequence set consisting of the answer word vector sequences of each answer word segmentation sequence, wherein the question word vector sequence is a sequence consisting of word vectors of the words in the question word segmentation sequences, and the answer word vector sequence is a sequence consisting of word vectors of the words in the answer word sequences;
training a pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain a trained convolutional neural network model;
and if a question to be tested is received, predicting the answer sentence of the question to be tested through the trained convolutional neural network model and outputting the answer sentence of the question to be tested.
In a second aspect, an embodiment of the present invention further provides an artificial intelligence based response apparatus, which includes:
the system comprises a first participle unit, a second participle unit and a third participle unit, wherein the first participle unit is used for acquiring a pre-stored training sample set and performing participle processing on a question sample and an answer sample of the training sample set respectively to obtain a question participle sequence set and an answer participle sequence set respectively, the question participle sequence set is a set formed by question participle sequences formed by words obtained by participle of each question sample, and the answer participle sequence set is a set formed by answer participle sequences formed by words obtained by participle of each answer sample;
a first training unit, configured to perform word vector training on words in a question word segmentation sequence of the question word segmentation sequence set and words in an answer word segmentation sequence of the answer word segmentation sequence set, so as to obtain a question word vector sequence set composed of a question word vector sequence of each question word segmentation sequence and an answer word vector sequence set composed of an answer word vector sequence of each answer word segmentation sequence, respectively, where the question word vector sequence is a sequence composed of word vectors of words in the question word segmentation sequence, and the answer word vector sequence is a sequence composed of word vectors of words in the answer word sequence;
the second training unit is used for training the pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain a trained convolutional neural network model;
and the prediction unit is used for predicting the answer of the question to be tested through the trained convolutional neural network model and outputting the answer of the question to be tested if the question to be tested is received.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the above method when executing the computer program.
In a fourth aspect, the present invention also provides a computer-readable storage medium, which stores a computer program, and the computer program can implement the above method when being executed by a processor.
The embodiment of the invention provides an artificial intelligence based response method, an artificial intelligence based response device, computer equipment and a storage medium. Wherein the method comprises the following steps: obtaining a pre-stored training sample set, and performing word segmentation processing on question samples and answer samples of the training sample set respectively to obtain a question word segmentation sequence set and an answer word segmentation sequence set respectively, wherein the question word segmentation sequence set is a set formed by question word segmentation sequences formed by words obtained by segmenting each question sample, and the answer word segmentation sequence set is a set formed by answer word sequences formed by words obtained by segmenting each answer sample; performing word vector training on words in question word segmentation sequences of the question word segmentation sequence set and words in answer word segmentation sequences of the answer word segmentation sequence set to obtain a question word vector sequence set consisting of question word vector sequences of the question word segmentation sequences and an answer word vector sequence set consisting of answer word vector sequences of the answer word segmentation sequences respectively, wherein the question word vector sequence is a sequence consisting of word vectors of the words in the question word segmentation sequence, and the answer word vector sequence is a sequence consisting of word vectors of the words in the answer word segmentation sequence; training a pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain a trained convolutional neural network model; and if a question to be tested is received, predicting the answer sentence of the question to be tested through the trained convolutional neural network model and outputting the answer sentence of the question to be tested. According to the technical scheme of the embodiment of the invention, a pre-stored training sample set is obtained, and the question sample and the answer sample of the training sample set are subjected to word segmentation processing respectively to obtain a question word segmentation sequence and an answer word segmentation sequence respectively; performing word vector training on the words in the question word segmentation sequence and the words in the answer word segmentation sequence to respectively obtain a question word vector sequence and an answer word vector sequence; training a pre-constructed convolutional neural network model through the question word vector sequence and the answer word vector sequence; if a question to be tested is received, the answer sentence of the question to be tested is predicted through the trained convolutional neural network model and is output, so that the question-answer model can be built through the convolutional neural network.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of an artificial intelligence-based response method according to an embodiment of the present invention;
fig. 2 is a schematic sub-flow diagram of an artificial intelligence-based response method according to an embodiment of the present invention;
FIG. 3 is a sub-flow diagram of an artificial intelligence-based response method according to an embodiment of the present invention;
FIG. 4 is a sub-flowchart of an artificial intelligence-based response method according to an embodiment of the present invention;
FIG. 5 is a sub-flowchart of an artificial intelligence-based response method according to an embodiment of the present invention;
FIG. 6 is a schematic block diagram of an artificial intelligence based answering device according to an embodiment of the present invention;
FIG. 7 is a schematic block diagram of a first segmentation unit of an artificial intelligence-based response device according to an embodiment of the present invention;
FIG. 8 is a schematic block diagram of a first training unit of an artificial intelligence based response apparatus according to an embodiment of the present invention;
FIG. 9 is a schematic block diagram of a second training unit of an artificial intelligence based response apparatus according to an embodiment of the present invention;
FIG. 10 is a schematic block diagram of a first returning unit of an artificial intelligence based responding apparatus according to an embodiment of the present invention;
FIG. 11 is a schematic block diagram of a prediction unit of an artificial intelligence based response apparatus according to an embodiment of the present invention; and
fig. 12 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
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 some, not all, embodiments of the present invention. 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.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Referring to fig. 1, fig. 1 is a schematic flow chart of an artificial intelligence based response method according to an embodiment of the present invention. As shown, the method includes the following steps S1-S4.
S1, a pre-stored training sample set is obtained, and word segmentation processing is respectively carried out on question samples and answer samples of the training sample set to respectively obtain a question word segmentation sequence set and an answer word segmentation sequence set, wherein the question word segmentation sequence set is a set formed by question word segmentation sequences formed by words obtained after word segmentation is carried out on each question sample, and the answer word segmentation sequence set is a set formed by answer word sequences formed by words obtained after word segmentation is carried out on each answer sample.
In specific implementation, question and answer records of a user are collected in advance to obtain a training sample set, wherein the training sample set comprises question and answer samples.
In the scheme, word segmentation is performed on the question samples in the training sample set to obtain a question word segmentation sequence, and the question word segmentation sequence is a sequence formed by words obtained after the question samples are segmented. The question word sequences form a question word sequence set.
Correspondingly, word segmentation is carried out on the answer sentence samples of the training sample set to obtain an answer sentence word segmentation sequence, and the question-answer word segmentation sequence is a sequence formed by words obtained after the answer sentence samples are segmented. Each answer sentence word segmentation sequence forms an answer sentence word segmentation sequence set.
Referring to fig. 2, in an embodiment, the above step S1 specifically includes the following steps S11 to S13.
And S11, performing word segmentation on the question sample and the answer sample through a preset word segmentation tool to respectively obtain an initial question sample word segmentation set and an initial answer sample word segmentation set.
In a specific implementation, a common word segmentation tool is a Chinese word segmentation tool. In the embodiment of the invention, the question sample and the answer sample are subjected to word segmentation by a final word segmentation tool so as to respectively obtain an initial question sample word segmentation set and an initial answer sample word segmentation set.
And S12, respectively removing stop words in the initial question sample word segmentation set and the initial answer sample word segmentation set to respectively obtain a question sample word segmentation set and an answer sample word segmentation set.
In specific implementation, stop words in the initial question sample word segmentation set and the initial answer sample word segmentation set are removed respectively to obtain a question sample word segmentation set and an answer sample word segmentation set respectively.
It should be noted that stop words (stop words) are often prepositions, adverbs, conjunctions, etc. For example, "in," "back," "also," "of," "it," "is," and the like are stop words.
S13, sequencing the words in the question sample segmentation set according to the sequence of the words in the question sample to obtain a question sample segmentation sequence, and sequencing the words in the answer sample segmentation set according to the sequence of the words in the answer sample to obtain an answer sample segmentation sequence.
In specific implementation, the words in the question sample participle set are sorted according to the sequence of the words in the question sample to obtain the question sample participle sequence.
Similarly, the words in the answer sentence sample segmentation set are sequenced according to the sequence of the words in the answer sentence sample to obtain the answer sentence sample segmentation sequence.
And S2, performing word vector training on words in the question word sequences of the question word sequence set and words in the answer word sequences of the answer word sequence set to respectively obtain a question word vector sequence set consisting of the question word vector sequences of the question word sequences and an answer word vector sequence set consisting of the answer word vector sequences of the answer word sequences, wherein the question word vector sequence is a sequence consisting of word vectors of the words in the question word sequences, and the answer word vector sequence is a sequence consisting of the word vectors of the words in the answer word sequences.
In specific implementation, word vector training is performed on words in the question word sequences of the question word sequence set to obtain a question word vector sequence, wherein the question word vector sequence is a sequence formed by word vectors of words in the question word sequence, and the sequence of each word vector in the question word vector sequence is the same as the sequence of each corresponding word in the question word sequence. The question word vector sequences form a question word vector sequence set.
Correspondingly, word vector training is carried out on words in the answer sentence segmentation word sequences of the answer sentence segmentation word sequence set to obtain an answer sentence word vector sequence, wherein the answer sentence word vector sequence is a sequence formed by word vectors of words in the answer sentence segmentation word sequence, and the sequence of each word vector in the answer sentence word vector sequence is the same as the sequence of each corresponding word in the answer sentence segmentation word sequence. The answer word vector sequences constitute a set of question word vector sequences.
Referring to fig. 3, in an embodiment, the above step S2 specifically includes the following steps S21 to S22.
And S21, respectively carrying out word vector training on the words in the question word segmentation sequence and the words in the answer word segmentation sequence through a preset word vector training tool to respectively obtain word vectors of the words in the question word segmentation sequence and the words in the answer word segmentation sequence.
In specific implementation, word2vec is used as a word vector training tool, and word2vec is a natural language processing tool and is used for converting words in natural language into word vectors which can be understood by a computer.
Specifically, word vector training is respectively carried out on the words in the question word segmentation sequence and the words in the answer word segmentation sequence through word2vec to respectively obtain word vectors of the words in the question word segmentation sequence and the words in the answer word segmentation sequence.
S22, sequencing word vectors of the words in the question word segmentation sequence according to the sequence of the words in the question word segmentation sequence to obtain the question word vector sequence, and sequencing the word vectors of the words in the answer word segmentation sequence according to the sequence of the words in the answer word segmentation sequence to obtain the answer word vector sequence.
In specific implementation, word vectors of words in the question word segmentation sequence are sequenced according to the sequence of the words in the question word segmentation sequence to obtain the question word vector sequence.
Similarly, the word vectors of the words in the sentence-answering word-segmentation sequence are sequenced according to the sequence of the words in the sentence-answering word-segmentation sequence to obtain the sentence-answering word-vector sequence.
And S3, training the pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain the trained convolutional neural network model.
In specific implementation, the question word vector sequence of the question word vector sequence set is used as the input of a convolutional neural network model, and whether the output of the convolutional neural network model is the same as the corresponding answer word vector sequence is judged. And if not, taking the output of the convolutional neural network model as a new input, and continuing iterative training until the output of the convolutional neural network model is the same as the answer word vector sequence to obtain the trained convolutional neural network model.
Referring to fig. 4, in an embodiment, the above step S3 specifically includes the following steps S31 to S36.
And S31, acquiring a question word vector sequence from the question word vector sequence set as an input word vector sequence.
In specific implementation, the question word vector sequence is firstly used as an input word vector sequence of the trained convolutional neural network.
And S32, sequentially inputting the word vectors of the input word vector sequence into a pre-constructed convolutional neural network model, and sequentially sequencing the output results of the convolutional neural network model to obtain a result vector sequence.
In specific implementation, the input word vector sequence is input into a pre-constructed convolutional neural network model in sequence, and output results of the convolutional neural network model are sequenced in sequence to obtain a result vector sequence.
And S33, judging whether the result vector sequence is the same as the answer word vector sequence corresponding to the input word vector sequence.
In specific implementation, the comparison judges whether the result vector sequence is the same as the answer word vector sequence corresponding to the input word vector sequence.
S34, if the result vector sequence is different from the answer word vector sequence, adjusting parameters of the convolutional neural network model according to the result vector sequence and the answer word vector sequence, returning to the step of inputting the input word vector sequence into the pre-constructed convolutional neural network model in sequence, and sequencing output results of the convolutional neural network model in sequence to obtain the result vector sequence.
In specific implementation, if the result vector sequence is not identical to the answer word vector sequence, adjusting parameters of the convolutional neural network model according to the result vector sequence and the answer word vector sequence, returning to the step of inputting the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing output results of the convolutional neural network model in sequence to obtain the result vector sequence.
In an embodiment, the adjusting parameters of the convolutional neural network model according to the result vector sequence and the answer term vector sequence specifically includes:
and calculating the error of the convolutional neural network model according to the result vector sequence and the answer term vector sequence, and updating the weight of each layer of the convolutional neural network model according to the error. Specifically, the errors of the convolutional layer, the pooling layer and the fully-connected layer of the convolutional neural network model are sequentially calculated according to the errors, and the weights (i.e., parameters of the convolutional neural network) of the layers are updated according to the errors of the layers. Each layer of the convolutional neural network model includes a convolutional layer, a pooling layer, and a fully connected layer.
And S35, if the result vector sequence is the same as the answer word vector sequence, removing the input word vector sequence from the question word vector sequence set, and judging whether a question word vector sequence still exists in the question word vector sequence set.
In specific implementation, if the result vector sequence is the same as the answer word vector sequence, the input word vector sequence is removed from the question word vector sequence set, and it is determined whether a question word vector sequence still exists in the question word vector sequence set.
S36, if a question word vector sequence still exists in the question word vector sequence set, obtaining a question word vector sequence from the question word vector sequence set again to serve as a new input word vector sequence, returning to the step of inputting word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing output results of the convolutional neural network model in sequence to obtain a result vector sequence.
In specific implementation, if a question word vector sequence still exists in the question word vector sequence set, a question word vector sequence is obtained from the question word vector sequence set again to serve as a new input word vector sequence, word vectors of the input word vector sequence are input into a pre-constructed convolutional neural network model in sequence, output results of the convolutional neural network model are sequenced in sequence to obtain a result vector sequence, and the above steps are repeated until the question word vector sequence set is an empty set.
And if the question word vector sequence does not exist in the question word vector sequence set, turning to the step S4.
And S4, if a question to be tested is received, predicting the answer sentence of the question to be tested through the trained convolutional neural network model and outputting the answer sentence of the question to be tested.
In specific implementation, if a question to be tested is received (the question can be input by a user), the answer of the question to be tested is predicted through the trained convolutional neural network model and is output, so that the answer of the question input by the user can be realized.
Referring to fig. 5, in an embodiment, the above step S4 specifically includes the following steps S41 to S43.
S41, performing word segmentation on the question to be detected to obtain a word segmentation sequence of the question to be detected, wherein the word segmentation sequence of the question to be detected is a sequence formed by words obtained after the word segmentation of the question to be detected.
In specific implementation, the word segmentation processing is carried out on the question to be tested to obtain an initial question word segmentation set to be tested. And deleting stop words in the initial question sentence segmentation set to be detected to obtain a question sentence segmentation set to be detected. And sequencing the words in the question word set to be tested according to the sequence of the words in the question to be tested to obtain a question word sequence to be tested. As can be seen, the word segmentation sequence of the question to be detected is a sequence formed by words obtained by segmenting the question to be detected.
And S42, performing word vector training on the words of the to-be-detected question word segmentation sequence to obtain the to-be-detected question word vector sequence, wherein the to-be-detected question word vector sequence is a sequence formed by word vectors of the words in the to-be-detected question word segmentation sequence.
In specific implementation, word vector training is performed on the words of the to-be-detected question word segmentation sequence through word2vec to obtain word vectors of the words of the to-be-detected question word segmentation sequence. And sequencing word vectors of the words in the question word segmentation sequence to be detected according to the sequence of the words in the question word segmentation sequence to be detected so as to obtain the question word vector sequence to be detected. As can be seen, the question word vector sequence to be detected is a sequence formed by word vectors of words in the question word sequence to be detected.
S43, inputting the word vectors of the question word vector sequence to be tested into the trained convolutional neural network model in sequence, sequencing the output results of the convolutional neural network model in sequence to obtain an answer prediction sequence, and taking the answer prediction sequence as the prediction result of the answer of the question to be tested.
In specific implementation, the word vectors of the question word vector sequence to be tested are input into the trained convolutional neural network model in sequence, the output results of the convolutional neural network model are sequenced in sequence to obtain an answer prediction sequence, and the answer prediction sequence is used as the prediction result of the answer of the question to be tested.
According to the technical scheme of the embodiment of the invention, a pre-stored training sample set is obtained, and the question sample and the answer sample of the training sample set are subjected to word segmentation processing respectively to obtain a question word segmentation sequence and an answer word segmentation sequence respectively; performing word vector training on the words in the question word segmentation sequence and the words in the answer word segmentation sequence to respectively obtain a question word vector sequence and an answer word vector sequence; training a pre-constructed convolutional neural network model through the question word vector sequence and the answer word vector sequence; if a question to be tested is received, the answer sentence of the question to be tested is predicted through the trained convolutional neural network model and is output, so that the question-answer model can be built through the convolutional neural network.
Fig. 6 is a schematic block diagram of an artificial intelligence based answering device 60 according to an embodiment of the present invention. As shown in fig. 6, the present invention also provides an artificial intelligence based answering device 60 corresponding to the above artificial intelligence based answering method. The artificial intelligence based answering device 60 includes a unit for performing the above artificial intelligence based answering method, and can be configured in a desktop computer, a tablet computer, a portable computer, etc. Specifically, referring to fig. 6, the artificial intelligence based responding apparatus 60 includes a first segmentation unit 61, a first training unit 62, a second training unit 63, and a prediction unit 64.
A first word segmentation unit 61, configured to obtain a pre-stored training sample set, and perform word segmentation processing on a question sample and an answer sample of the training sample set respectively to obtain a question word segmentation sequence set and an answer word segmentation sequence set, respectively, where the question word segmentation sequence set is a set composed of question word segmentation sequences formed by words obtained by segmenting each question sample, and the answer word segmentation sequence set is a set composed of answer word segmentation sequences formed by words obtained by segmenting each answer sample;
a first training unit 62, configured to perform word vector training on words in a question word segmentation sequence of the question word segmentation sequence set and words in an answer word segmentation sequence of the answer word segmentation sequence set, so as to obtain a question word vector sequence set composed of a question word vector sequence of each question word segmentation sequence and an answer word vector sequence set composed of an answer word vector sequence of each answer word segmentation sequence, respectively, where the question word vector sequence is a sequence composed of word vectors of words in the question word segmentation sequence, and the answer word vector sequence is a sequence composed of word vectors of words in the answer word sequence;
a second training unit 63, configured to train a pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set, to obtain a trained convolutional neural network model;
and the prediction unit 64 is used for predicting the answer sentence of the question to be tested through the trained convolutional neural network model and outputting the answer sentence of the question to be tested if the question to be tested is received.
In one embodiment, as shown in fig. 7, the first word segmentation unit 61 includes a second word segmentation unit 611, a deletion unit 612, and a first sorting unit 613.
A second word segmentation unit 611, configured to perform word segmentation processing on the question sample and the answer sample through a preset word segmentation tool to obtain an initial question sample word segmentation set and an initial answer sample word segmentation set, respectively;
a deleting unit 612, configured to remove stop words in the initial question sample participle set and the initial answer sample participle set respectively to obtain a question sample participle set and an answer sample participle set respectively;
a first ordering unit 613, configured to order the words in the question sample segmentation set according to the order of the words in the question sample to obtain the question sample segmentation sequence, and order the words in the answer sample segmentation set according to the order of the words in the answer sample to obtain the answer sample segmentation sequence.
In one embodiment, as shown in FIG. 8, the first training unit 62 includes a third training unit 621 and
a second sorting unit 622.
A third training unit 621, configured to perform word vector training on the words in the question and answer word segmentation sequence through a preset word vector training tool to obtain word vectors of the words in the question and answer word segmentation sequence and the word vectors of the words in the answer word segmentation sequence, respectively;
a second sorting unit 622, configured to sort the word vectors of the words in the question-sentence segmentation sequence according to the order of the words in the question-sentence segmentation sequence to obtain the question-sentence word vector sequence, and sort the word vectors of the words in the answer-sentence segmentation sequence according to the order of the words in the answer-sentence segmentation sequence to obtain the answer-sentence word vector sequence.
In an embodiment, as shown in fig. 9, the second training unit 63 includes an obtaining unit 631, a first input unit 632, a first judging unit 633, a first returning unit 634, a second judging unit 635, and a second returning unit 636.
The obtaining unit 631 is configured to obtain a question word vector sequence from the question word vector sequence set as an input word vector sequence.
The first input unit 632 is configured to input the word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sort the output results of the convolutional neural network model in sequence to obtain a result vector sequence.
A first judging unit 633, configured to judge whether the result vector sequence is the same as the answer word vector sequence corresponding to the input word vector sequence.
A first returning unit 634, configured to adjust parameters of the convolutional neural network model according to the result vector sequence and the answer word vector sequence if the result vector sequence is different from the answer word vector sequence, return to the step of inputting the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequence output results of the convolutional neural network model in sequence to obtain a result vector sequence.
A second determining unit 635, configured to remove the input word vector sequence from the question word vector sequence set if the result vector sequence is the same as the answer word vector sequence, and determine whether a question word vector sequence still exists in the question word vector sequence set.
A second returning unit 636, configured to, if a question word vector sequence still exists in the question word vector sequence set, obtain a question word vector sequence from the question word vector sequence set again as a new input word vector sequence, return to the step of inputting the word vectors of the input word vector sequence into the pre-constructed convolutional neural network model in sequence, and sort the output results of the convolutional neural network model in sequence to obtain a result vector sequence.
In an embodiment, as shown in fig. 10, the first returning unit 634 includes an updating unit 6341.
An updating unit 6341, configured to calculate an error of the convolutional neural network model according to the result vector sequence and the answer word vector sequence, and update a weight of each layer of the convolutional neural network model according to the error, where each layer of the convolutional neural network model includes a convolutional layer, a pooling layer, and a full connection layer.
In one embodiment, as shown in fig. 11, the prediction unit 64 includes a third segmentation unit 641, a third training unit 642 and a second input unit 643.
A third word segmentation unit 641, configured to perform word segmentation on the question to be detected to obtain a question word segmentation sequence to be detected, where the question word segmentation sequence to be detected is a sequence of words obtained after the question to be detected is segmented;
a fourth training unit 642, configured to perform word vector training on words of the to-be-detected question word segmentation sequence to obtain a to-be-detected question word vector sequence, where the to-be-detected question word vector sequence is a sequence formed by word vectors of words in the to-be-detected question word segmentation sequence;
a second input unit 643, configured to sequentially input word vectors of the question word vector sequence to be tested into the trained convolutional neural network model, sequentially sort output results of the convolutional neural network model to obtain an answer prediction sequence, and use the answer prediction sequence as a prediction result of an answer of the question to be tested.
It should be noted that, as will be clear to those skilled in the art, the specific implementation process of the artificial intelligence based responding apparatus 60 and each unit may refer to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, no further description is provided herein.
The artificial intelligence based answering means 60 described above can be implemented in the form of a computer program which can be run on a computer device as shown in fig. 12.
Referring to fig. 12, fig. 12 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 may be a terminal, wherein the terminal may be an electronic device with a communication function, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device.
Referring to fig. 12, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032, when executed, causes the processor 502 to perform an artificial intelligence based answering method.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503, and when the computer program 5032 is executed by the processor 502, the processor 502 may be caused to perform an artificial intelligence based response method.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 12 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation of the computer device 500 to which the present application may be applied, and that a particular computer device 500 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 502 is configured to run the computer program 5032 stored in the memory to implement the following steps:
obtaining a pre-stored training sample set, and performing word segmentation processing on a question sample and an answer sample of the training sample set respectively to obtain a question word segmentation sequence set and an answer word segmentation sequence set respectively, wherein the question word segmentation sequence set is a set formed by question word segmentation sequences formed by words obtained by segmenting each question sample, and the answer word segmentation sequence set is a set formed by answer word segmentation sequences formed by words obtained by segmenting each answer sample;
performing word vector training on words in the question word segmentation sequences of the question word segmentation sequence set and words in the answer word segmentation sequences of the answer word segmentation sequence set to respectively obtain a question word vector sequence set consisting of the question word vector sequences of each question word segmentation sequence and an answer word vector sequence set consisting of the answer word vector sequences of each answer word segmentation sequence, wherein the question word vector sequence is a sequence consisting of word vectors of the words in the question word segmentation sequences, and the answer word vector sequence is a sequence consisting of word vectors of the words in the answer word sequences;
training a pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain a trained convolutional neural network model;
and if a question to be tested is received, predicting the answer sentence of the question to be tested through the trained convolutional neural network model and outputting the answer sentence of the question to be tested.
In an embodiment, when implementing the step of performing word segmentation processing on the question sample and the answer sample of the training sample set to obtain a question word segmentation sequence set and an answer word segmentation sequence set, respectively, the processor 502 specifically implements the following steps:
performing word segmentation on the question sample and the answer sample through a preset word segmentation tool to respectively obtain an initial question sample word segmentation set and an initial answer sample word segmentation set;
removing stop words in the initial question sample participle set and the initial answer sample participle set respectively to obtain a question sample participle set and an answer sample participle set respectively;
the words in the question sample segmentation set are sequenced according to the sequence of the words in the question sample to obtain a question sample segmentation sequence, and the words in the answer sample segmentation set are sequenced according to the sequence of the words in the answer sample to obtain an answer sample segmentation sequence.
In an embodiment, when implementing the step of performing word vector training on the words in the question word sequences of the question word sequence set and the words in the answer word sequences of the answer word sequence set to obtain a question word vector sequence set composed of the question word vector sequences of each question word sequence and an answer word vector sequence set composed of the answer word vector sequences of each answer word sequence, the processor 502 specifically implements the following steps:
respectively carrying out word vector training on the words in the question sentence segmentation sequence and the words in the answer sentence segmentation sequence through a preset word vector training tool so as to respectively obtain word vectors of the words in the question sentence segmentation sequence and word vectors of the words in the answer sentence segmentation sequence;
and sequencing word vectors of all words in the question word segmentation sequence according to the sequence of all words in the question word segmentation sequence to obtain the question word vector sequence, and sequencing word vectors of all words in the answer word segmentation sequence according to the sequence of all words in the answer word segmentation sequence to obtain the answer word vector sequence.
In an embodiment, when the step of training the pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain the trained convolutional neural network model is implemented by the processor 502, the following steps are specifically implemented:
acquiring a question word vector sequence from the question word vector sequence set as an input word vector sequence;
inputting the word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing the output results of the convolutional neural network model in sequence to obtain a result vector sequence;
judging whether the result vector sequence is the same as the answer word vector sequence corresponding to the input word vector sequence;
if the result vector sequence is not the same as the answer sentence word vector sequence, adjusting parameters of the convolutional neural network model according to the result vector sequence and the answer sentence word vector sequence, returning to the step of inputting the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing output results of the convolutional neural network model in sequence to obtain a result vector sequence;
if the result vector sequence is the same as the answer sentence word vector sequence, removing the input word vector sequence from the question word vector sequence set, and judging whether a question word vector sequence still exists in the question word vector sequence set;
and if a question word vector sequence also exists in the question word vector sequence set, acquiring a question word vector sequence from the question word vector sequence set again to serve as a new input word vector sequence, returning to the step of inputting the word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing the output results of the convolutional neural network model in sequence to obtain a result vector sequence.
In an embodiment, when the processor 502 implements the step of adjusting the parameter of the convolutional neural network model according to the result vector sequence and the answer word vector sequence, the following steps are specifically implemented:
and calculating the error of the convolutional neural network model according to the result vector sequence and the answer sentence word vector sequence, and updating the weight of each layer of the convolutional neural network model according to the error, wherein each layer of the convolutional neural network model comprises a convolutional layer, a pooling layer and a full-connection layer.
In an embodiment, when the step of predicting the question to be tested by the trained convolutional neural network model and outputting the question to be tested by the processor 502 is implemented, the following steps are specifically implemented:
performing word segmentation on the to-be-detected question to obtain a to-be-detected question word segmentation sequence, wherein the to-be-detected question word segmentation sequence is a sequence formed by words obtained after the to-be-detected question is segmented;
performing word vector training on the words of the to-be-detected question word segmentation sequence to obtain a to-be-detected question word vector sequence, wherein the to-be-detected question word vector sequence is a sequence formed by word vectors of the words in the to-be-detected question word segmentation sequence;
and sequentially inputting the word vectors of the question word vector sequence to be detected into the trained convolutional neural network model, sequentially sequencing the output results of the convolutional neural network model to obtain an answer prediction sequence, and taking the answer prediction sequence as the prediction result of the answer of the question to be detected.
It should be understood that in the embodiment of the present Application, the Processor 502 may be a Central Processing Unit (CPU), and the Processor 502 may also be other general purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing relevant hardware. The computer program may be stored in a storage medium that is computer-readable. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. The computer program, when executed by a processor, causes the processor to perform the steps of:
obtaining a pre-stored training sample set, and performing word segmentation processing on a question sample and an answer sample of the training sample set respectively to obtain a question word segmentation sequence set and an answer word segmentation sequence set respectively, wherein the question word segmentation sequence set is a set formed by question word segmentation sequences formed by words obtained by segmenting each question sample, and the answer word segmentation sequence set is a set formed by answer word segmentation sequences formed by words obtained by segmenting each answer sample;
performing word vector training on words in the question word segmentation sequences of the question word segmentation sequence set and words in the answer word segmentation sequences of the answer word segmentation sequence set to respectively obtain a question word vector sequence set consisting of the question word vector sequences of each question word segmentation sequence and an answer word vector sequence set consisting of the answer word vector sequences of each answer word segmentation sequence, wherein the question word vector sequence is a sequence consisting of word vectors of the words in the question word segmentation sequences, and the answer word vector sequence is a sequence consisting of word vectors of the words in the answer word sequences;
training a pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain a trained convolutional neural network model;
and if the question to be tested is received, predicting the answer of the question to be tested through the trained convolutional neural network model and outputting the answer of the question to be tested.
In an embodiment, when the processor executes the computer program to implement the step of performing word segmentation processing on the question sample and the answer sample of the training sample set to obtain a question word segmentation sequence set and an answer word segmentation sequence set, respectively, the following steps are specifically implemented:
performing word segmentation processing on the question sample and the answer sample through a preset word segmentation tool to respectively obtain an initial question sample word segmentation set and an initial answer sample word segmentation set;
removing stop words in the initial question sample participle set and the initial answer sample participle set respectively to obtain a question sample participle set and an answer sample participle set respectively;
the words in the question sample segmentation set are sequenced according to the sequence of the words in the question sample to obtain a question sample segmentation sequence, and the words in the answer sample segmentation set are sequenced according to the sequence of the words in the answer sample to obtain an answer sample segmentation sequence.
In an embodiment, when the processor executes the computer program to implement the step of performing word vector training on words in the question word segmentation sequences of the question word segmentation sequence set and words in the answer word segmentation sequences of the answer word segmentation sequence set to obtain a question word vector sequence set composed of question word vector sequences of each question word segmentation sequence and an answer word vector sequence set composed of answer word vector sequences of each answer word segmentation sequence, the following steps are specifically implemented:
respectively carrying out word vector training on the words in the question sentence segmentation sequence and the words in the answer sentence segmentation sequence through a preset word vector training tool so as to respectively obtain word vectors of the words in the question sentence segmentation sequence and word vectors of the words in the answer sentence segmentation sequence;
the word vectors of the words in the question word segmentation sequence are sequenced according to the sequence of the words in the question word segmentation sequence to obtain the question word vector sequence, and the word vectors of the words in the answer word segmentation sequence are sequenced according to the sequence of the words in the answer word segmentation sequence to obtain the answer word vector sequence.
In an embodiment, when the processor executes the computer program to implement the step of training the pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain the trained convolutional neural network model, the following steps are specifically implemented:
obtaining a question word vector sequence from the question word vector sequence set as an input word vector sequence;
inputting the word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing the output results of the convolutional neural network model in sequence to obtain a result vector sequence;
judging whether the result vector sequence is the same as the answer word vector sequence corresponding to the input word vector sequence;
if the result vector sequence is different from the answer sentence word vector sequence, adjusting parameters of the convolutional neural network model according to the result vector sequence and the answer sentence word vector sequence, returning to the step of inputting the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing output results of the convolutional neural network model in sequence to obtain a result vector sequence;
if the result vector sequence is the same as the answer sentence word vector sequence, removing the input word vector sequence from the question word vector sequence set, and judging whether a question word vector sequence still exists in the question word vector sequence set;
and if a question word vector sequence also exists in the question word vector sequence set, acquiring a question word vector sequence from the question word vector sequence set again to serve as a new input word vector sequence, returning to the step of inputting the word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing the output results of the convolutional neural network model in sequence to obtain a result vector sequence.
In an embodiment, when the step of adjusting the parameters of the convolutional neural network model according to the result vector sequence and the answer word vector sequence is implemented by the processor when executing the computer program, the following steps are specifically implemented:
and calculating the error of the convolutional neural network model according to the result vector sequence and the answer word vector sequence, and updating the weight of each layer of the convolutional neural network model according to the error, wherein each layer of the convolutional neural network model comprises a convolutional layer, a pooling layer and a full-connection layer.
In an embodiment, when the processor executes the computer program to implement the step of predicting the question to be asked through the trained convolutional neural network model and outputting the question to be asked, the following steps are specifically implemented:
performing word segmentation on the question to be detected to obtain a question word segmentation sequence to be detected, wherein the question word segmentation sequence to be detected is a sequence formed by words obtained after the question to be detected is segmented;
performing word vector training on the words of the to-be-detected question word segmentation sequence to obtain a to-be-detected question word vector sequence, wherein the to-be-detected question word vector sequence is a sequence formed by word vectors of the words in the to-be-detected question word segmentation sequence;
and sequentially inputting the word vectors of the question word vector sequence to be detected into the trained convolutional neural network model, sequentially sequencing the output results of the convolutional neural network model to obtain an answer prediction sequence, and taking the answer prediction sequence as the prediction result of the answer of the question to be detected.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media of program codes.
Those of ordinary skill in the art will appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the components and steps of the various examples have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated in another system or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to the related descriptions of other embodiments.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, while the invention has been described with respect to the specific embodiments, it will be understood by those skilled in the art that various changes and modifications may be made therein without departing from the spirit and scope of the invention as defined in the appended claims.
While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (7)

1. An artificial intelligence based response method, comprising:
obtaining a pre-stored training sample set, and performing word segmentation processing on a question sample and an answer sample of the training sample set respectively to obtain a question word segmentation sequence set and an answer word segmentation sequence set respectively, wherein the question word segmentation sequence set is a set formed by question word segmentation sequences formed by words obtained after segmenting each question sample, the answer word segmentation sequence set is a set formed by answer word segmentation sequences formed by words obtained after segmenting each answer sample, and a word segmentation tool is adopted for word segmentation;
performing word vector training on words in question word segmentation sequences of the question word segmentation sequence set and words in answer word segmentation sequences of the answer word segmentation sequence set to obtain a question word vector sequence set consisting of question word vector sequences of the question word segmentation sequences and an answer word vector sequence set consisting of answer word vector sequences of the answer word segmentation sequences respectively, wherein the question word vector sequence is a sequence consisting of word vectors of the words in the question word segmentation sequences, the answer word vector sequence is a sequence consisting of word vectors of the words in the answer word segmentation sequences, and word vector training is performed by using word2 ve;
training a pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain a trained convolutional neural network model;
if a question to be tested is received, predicting an answer of the question to be tested through the trained convolutional neural network model and outputting the answer of the question to be tested;
the method for training the pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain the trained convolutional neural network model includes:
acquiring a question word vector sequence from the question word vector sequence set as an input word vector sequence;
inputting the word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing the output results of the convolutional neural network model in sequence to obtain a result vector sequence;
judging whether the result vector sequence is the same as the answer word vector sequence corresponding to the input word vector sequence or not;
if the result vector sequence is different from the answer sentence word vector sequence, adjusting parameters of the convolutional neural network model according to the result vector sequence and the answer sentence word vector sequence, returning to the step of inputting the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sequencing output results of the convolutional neural network model in sequence to obtain a result vector sequence;
if the result vector sequence is the same as the answer sentence word vector sequence, removing the input word vector sequence from the question word vector sequence set, and judging whether a question word vector sequence still exists in the question word vector sequence set;
if a question word vector sequence still exists in the question word vector sequence set, obtaining a question word vector sequence from the question word vector sequence set again as a new input word vector sequence, returning to input word vectors of the input word vector sequence into a pre-constructed convolution neural network model in sequence, and sequencing output results of the convolution neural network model in sequence to obtain a result vector sequence;
wherein the adjusting the parameter of the convolutional neural network model according to the result vector sequence and the answer word vector sequence comprises:
and calculating the error of the convolutional neural network model according to the result vector sequence and the answer sentence word vector sequence, and updating the weight of each layer of the convolutional neural network model according to the error, wherein each layer of the convolutional neural network model comprises a convolutional layer, a pooling layer and a full-connection layer.
2. The method according to claim 1, wherein the performing word segmentation on the question sample and the answer sample of the training sample set to obtain a question word segmentation sequence set and an answer word segmentation sequence set respectively comprises:
performing word segmentation processing on the question sample and the answer sample through a preset word segmentation tool to respectively obtain an initial question sample word segmentation set and an initial answer sample word segmentation set;
removing stop words in the initial question sample participle set and the initial answer sample participle set respectively to obtain a question sample participle set and an answer sample participle set respectively;
sequencing the words in the question sample segmentation set according to the sequence of the words in the question sample to obtain a question sample segmentation sequence, and sequencing the words in the answer sample segmentation set according to the sequence of the words in the answer sample to obtain an answer sample segmentation sequence.
3. The method according to claim 1, wherein the word vector training of the words in the question word segmentation sequences of the question word segmentation sequence set and the words in the answer word segmentation sequences of the answer word segmentation sequence set is performed to obtain a question word vector sequence set composed of the question word vector sequences of each question word segmentation sequence and an answer word vector sequence set composed of the answer word vector sequences of each answer word segmentation sequence, respectively, and the method comprises:
respectively carrying out word vector training on the words in the question word segmentation sequence and the words in the answer word segmentation sequence through a preset word vector training tool to respectively obtain word vectors of the words in the question word segmentation sequence and the words in the answer word segmentation sequence;
and sequencing word vectors of all words in the question word segmentation sequence according to the sequence of all words in the question word segmentation sequence to obtain the question word vector sequence, and sequencing word vectors of all words in the answer word segmentation sequence according to the sequence of all words in the answer word segmentation sequence to obtain the answer word vector sequence.
4. The method of claim 1, wherein predicting the answer of the question to be tested through the trained convolutional neural network model and outputting the answer of the question to be tested comprises:
performing word segmentation on the to-be-detected question to obtain a to-be-detected question word segmentation sequence, wherein the to-be-detected question word segmentation sequence is a sequence formed by words obtained after the to-be-detected question is segmented;
performing word vector training on the words of the to-be-detected question word segmentation sequence to obtain a to-be-detected question word vector sequence, wherein the to-be-detected question word vector sequence is a sequence formed by word vectors of the words in the to-be-detected question word segmentation sequence;
and sequentially inputting the word vectors of the question word vector sequence to be detected into the trained convolutional neural network model, sequentially sequencing the output results of the convolutional neural network model to obtain an answer prediction sequence, and taking the answer prediction sequence as the prediction result of the answer of the question to be detected.
5. An artificial intelligence based answering device, comprising:
the system comprises a first word segmentation unit, a second word segmentation unit and a third word segmentation unit, wherein the first word segmentation unit is used for acquiring a pre-stored training sample set and respectively performing word segmentation on question samples and answer samples of the training sample set to respectively obtain question word segmentation sequence sets and answer word segmentation sequence sets, the question word segmentation sequence sets are sets formed by question word segmentation sequences formed by words obtained by segmenting each question sample, the answer word segmentation sequence sets are sets formed by answer word segmentation sequences formed by words obtained by segmenting each answer sample, and a word segmentation tool is used for segmenting words;
a first training unit, configured to perform word vector training on words in a question word segmentation sequence of the question word segmentation sequence set and words in an answer word segmentation sequence of the answer word segmentation sequence set, so as to obtain a question word vector sequence set composed of a question word vector sequence of each question word segmentation sequence and an answer word vector sequence set composed of an answer word vector sequence of each answer word segmentation sequence, respectively, where the question word vector sequence is a sequence composed of word vectors of the words in the question word segmentation sequence, the answer word vector sequence is a sequence composed of word vectors of the words in the answer word sequence, and word vector training is performed using word2 ve;
the second training unit is used for training a pre-constructed convolutional neural network model through the question word vector sequence set and the answer word vector sequence set to obtain a trained convolutional neural network model;
the prediction unit is used for predicting the answer of the question to be tested through the trained convolutional neural network model and outputting the answer of the question to be tested if the question to be tested is received;
the acquisition unit is used for acquiring a question word vector sequence from the question word vector sequence set as an input word vector sequence;
the first input unit is used for inputting the word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in sequence and sequencing the output results of the convolutional neural network model in sequence to obtain a result vector sequence;
the first judgment unit is used for judging whether the result vector sequence is the same as the answer word vector sequence corresponding to the input word vector sequence;
a first returning unit, configured to adjust parameters of the convolutional neural network model according to the result vector sequence and the answer word vector sequence if the result vector sequence is different from the answer word vector sequence, return to the step of inputting the input word vector sequence into a pre-constructed convolutional neural network model in sequence, and sort output results of the convolutional neural network model in sequence to obtain a result vector sequence;
a second judging unit, configured to remove the input word vector sequence from the question word vector sequence set if the result vector sequence is the same as the answer word vector sequence, and judge whether a question word vector sequence still exists in the question word vector sequence set;
a second returning unit, configured to, if a question word vector sequence still exists in the question word vector sequence set, obtain a question word vector sequence from the question word vector sequence set again as a new input word vector sequence, return to a step of inputting word vectors of the input word vector sequence into a pre-constructed convolutional neural network model in order, and sort output results of the convolutional neural network model in order to obtain a result vector sequence;
and the updating unit is used for calculating the error of the convolutional neural network model according to the result vector sequence and the answer word vector sequence and updating the weight of each layer of the convolutional neural network model according to the error, wherein each layer of the convolutional neural network model comprises a convolutional layer, a pooling layer and a full-connection layer.
6. A computer arrangement, characterized in that the computer arrangement comprises a memory, on which a computer program is stored, and a processor, which when executing the computer program, carries out the method according to any one of claims 1-4.
7. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when being executed by a processor, is adapted to carry out the method according to any one of claims 1-4.
CN201910881309.9A 2019-09-18 2019-09-18 Response method and device based on artificial intelligence, computer equipment and storage medium Active CN110825855B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910881309.9A CN110825855B (en) 2019-09-18 2019-09-18 Response method and device based on artificial intelligence, computer equipment and storage medium
PCT/CN2019/118474 WO2021051615A1 (en) 2019-09-18 2019-11-14 Response method and apparatus based on artificial intelligence, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910881309.9A CN110825855B (en) 2019-09-18 2019-09-18 Response method and device based on artificial intelligence, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110825855A CN110825855A (en) 2020-02-21
CN110825855B true CN110825855B (en) 2023-02-14

Family

ID=69547991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910881309.9A Active CN110825855B (en) 2019-09-18 2019-09-18 Response method and device based on artificial intelligence, computer equipment and storage medium

Country Status (2)

Country Link
CN (1) CN110825855B (en)
WO (1) WO2021051615A1 (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108573306B (en) * 2017-03-10 2021-11-02 北京搜狗科技发展有限公司 Method for outputting reply information, and training method and device for deep learning model
US10678816B2 (en) * 2017-08-23 2020-06-09 Rsvp Technologies Inc. Single-entity-single-relation question answering systems, and methods
CN108959467B (en) * 2018-06-20 2021-10-15 华东师范大学 Method for calculating correlation degree of question sentences and answer sentences based on reinforcement learning
CN108984655B (en) * 2018-06-28 2021-01-01 厦门快商通信息技术有限公司 Intelligent customer service guiding method for customer service robot
CN109933652A (en) * 2019-01-17 2019-06-25 深圳壹账通智能科技有限公司 Intelligent answer method, apparatus, computer equipment and storage medium
CN110032632A (en) * 2019-04-04 2019-07-19 平安科技(深圳)有限公司 Intelligent customer service answering method, device and storage medium based on text similarity
CN110135551B (en) * 2019-05-15 2020-07-21 西南交通大学 Robot chatting method based on word vector and recurrent neural network

Also Published As

Publication number Publication date
CN110825855A (en) 2020-02-21
WO2021051615A1 (en) 2021-03-25

Similar Documents

Publication Publication Date Title
US9684634B2 (en) Method and apparatus for evaluating predictive model
CN111047563B (en) Neural network construction method applied to medical ultrasonic image
CN109522397B (en) Information processing method and device
CN111914936A (en) Data feature enhancement method and device for corpus data and computer equipment
CN111898739A (en) Data screening model construction method based on meta-learning, data screening method and device, computer equipment and storage medium
CN114861910B (en) Compression method, device, equipment and medium of neural network model
CN111666207B (en) Crowdsourcing test task selection method and electronic device
CN111368051A (en) Dialog generation method and device and computer equipment
CN113204614B (en) Model training method, method for optimizing training data set and device thereof
CN110825855B (en) Response method and device based on artificial intelligence, computer equipment and storage medium
CN112307048A (en) Semantic matching model training method, matching device, equipment and storage medium
CN116168403A (en) Medical data classification model training method, classification method, device and related medium
CN111125379A (en) Knowledge base expansion method and device, electronic equipment and storage medium
CN116166967A (en) Data processing method, equipment and storage medium based on meta learning and residual error network
CN112905743B (en) Text object detection method, device, electronic equipment and storage medium
CN112100378A (en) Text classification model training method and device, computer equipment and storage medium
CN109284354B (en) Script searching method and device, computer equipment and storage medium
CN110458383B (en) Method and device for realizing demand processing servitization, computer equipment and storage medium
JP7173308B2 (en) DETECTION DEVICE, DETECTION METHOD AND DETECTION PROGRAM
CN110929033A (en) Long text classification method and device, computer equipment and storage medium
CN111881694A (en) Chapter point detection method, device, equipment and storage medium
CN110781281A (en) Emerging theme detection method and device, computer equipment and storage medium
CN109522542A (en) A kind of method and device identifying vehicle failure sentence
CN109885811B (en) Article style conversion method, apparatus, computer device and storage medium
US20230281235A1 (en) Generating conversation topics using neural networks

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