CN112100360A - Dialog response method, device and system based on vector retrieval - Google Patents

Dialog response method, device and system based on vector retrieval Download PDF

Info

Publication number
CN112100360A
CN112100360A CN202011192950.0A CN202011192950A CN112100360A CN 112100360 A CN112100360 A CN 112100360A CN 202011192950 A CN202011192950 A CN 202011192950A CN 112100360 A CN112100360 A CN 112100360A
Authority
CN
China
Prior art keywords
conversation
vector
topics
theme
matching
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.)
Granted
Application number
CN202011192950.0A
Other languages
Chinese (zh)
Other versions
CN112100360B (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.)
Beijing Qiyu Information Technology Co Ltd
Original Assignee
Beijing Qiyu Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qiyu Information Technology Co Ltd filed Critical Beijing Qiyu Information Technology Co Ltd
Priority to CN202011192950.0A priority Critical patent/CN112100360B/en
Publication of CN112100360A publication Critical patent/CN112100360A/en
Application granted granted Critical
Publication of CN112100360B publication Critical patent/CN112100360B/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/31Indexing; Data structures therefor; Storage structures
    • G06F16/316Indexing structures
    • G06F16/322Trees
    • 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/35Clustering; Classification
    • G06F16/355Class or cluster creation or modification
    • 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/04Architecture, e.g. interconnection topology
    • G06N3/049Temporal neural networks, e.g. delay elements, oscillating neurons or pulsed inputs
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention discloses a dialogue response method, a device and a system based on vector retrieval, wherein the method comprises the following steps: summarizing conversation topics responded by the intelligent robot, calculating vectors of the conversation topics, and constructing a conversation topic database of a tree structure until the number of the conversation topics in leaf nodes of the tree structure is less than N, wherein N is a natural number; acquiring input content of a user, calculating a vector of the input content, and matching a closest conversation theme based on the vector of the input content; and selecting corresponding language materials according to the matched conversation subjects to carry out conversation with the user. By adopting the technical scheme, the vector input by the user is calculated, the retrieval and the matching are carried out based on the obtained vector, the required conversation theme can be quickly and accurately found, and the corpus corresponding to the conversation theme is used for communicating with the user. The waiting time of the user is reduced, the accuracy is improved, and the feeling of the user is better improved.

Description

Dialog response method, device and system based on vector retrieval
Technical Field
The invention relates to the field of computer information processing, in particular to a dialogue response method, a dialogue response device and a dialogue response system based on vector retrieval.
Background
The customer service center is a main bridge for communication between enterprises and users, and a main channel for improving the satisfaction degree of the users. In the past, a customer service center mainly takes manual customer service as a main part and professional customer service personnel serve users.
With the development of computer information processing technology, more and more customer service centers begin to adopt intelligent voice robots to serve users, and the problem of overlong waiting time of manual customer service is solved.
At present, a method for carrying out conversation with a user by using an intelligent voice robot is to search through keywords of user input contents, match the closest conversation theme and communicate with the user by using a corpus corresponding to the matched conversation theme. The content processed by the intelligent voice robot is more and more, the conversation theme library is more and more huge, and the problems of long retrieval time and inaccurate retrieval obtained conversation theme exist when the intelligent voice robot is used for retrieving through keywords.
Disclosure of Invention
The invention aims to solve the problems that the conventional intelligent voice robot has long search time for searching the conversation theme through the keyword and the conversation theme obtained by searching is inaccurate.
In order to solve the above technical problem, a first aspect of the present invention provides a dialog response method based on vector search, including:
summarizing conversation topics responded by an intelligent robot, calculating vectors of the conversation topics, and constructing a conversation topic database of a tree structure based on vector values of the conversation topics until the number of the conversation topics in leaf nodes of the tree structure is less than N, wherein the conversation topics and linguistic data corresponding to the conversation topics are stored in the conversation topic database, and N is a natural number;
acquiring input content of a user, calculating a vector of the input content, and matching a closest conversation theme based on the vector of the input content;
and selecting corresponding language materials according to the matched conversation subjects to carry out conversation with the user.
According to a preferred embodiment of the present invention, the tree structure is a binary tree structure.
According to a preferred embodiment of the present invention, the constructing of the dialog topic database of the tree structure based on the vector values of the dialog topics is specifically:
taking the collected conversation topics responded by the intelligent robot as root nodes, inputting vectors of the collected conversation topics into a classification model for classification, and forming nodes by the classified conversation topics;
inputting the vectors of the conversation topics contained in the nodes into a classification model for classification to obtain a next-layer new node;
and repeating the steps until the number of the conversation topics contained in the next layer of new nodes is less than N.
According to a preferred embodiment of the present invention, based on the vector of the input content, matching the closest dialog topic is specifically:
retrieving the closest node according to the vector of the input content;
matching the input content and the conversation theme input theme contained in the closest node with the closest conversation theme.
According to a preferred embodiment of the present invention, the topic matching model includes a coding layer for converting an input sentence into a sentence vector and a matching layer for matching calculation between the sentence vectors.
According to a preferred embodiment of the present invention, the coding layer employs a bidirectional long-term memory network model.
According to a preferred embodiment of the present invention, the matching layer calculates the matching degree between the sentence vectors of the user question and the sentence vectors of the standard question by using a cosine algorithm.
The second aspect of the present invention provides a dialog response device based on vector search, including:
the system comprises a conversation theme database construction module, a conversation theme database construction module and a database management module, wherein the conversation theme database construction module is used for summarizing conversation themes responded by the intelligent robot, calculating vectors of the conversation themes, and constructing a tree-structure conversation theme database based on vector values of the conversation themes until the number of the conversation themes in leaf nodes of the tree-structure is less than N, the conversation themes and linguistic data corresponding to the conversation themes are stored in the conversation theme database, and N is a natural number;
the conversation topic matching module is used for acquiring input content of a user, calculating a vector of the input content, and matching the closest conversation topic based on the vector of the input content;
and the dialogue module is used for selecting corresponding linguistic data according to the matched dialogue theme to carry out dialogue with the user.
According to a preferred embodiment of the present invention, the tree structure is a binary tree structure.
According to a preferred embodiment of the present invention, the constructing of the dialog topic database of the tree structure based on the vector values of the dialog topics is specifically:
taking the collected conversation topics responded by the intelligent robot as root nodes, inputting vectors of the collected conversation topics into a classification model for classification, and forming nodes by the classified conversation topics;
inputting the vectors of the conversation topics contained in the nodes into a classification model for classification to obtain a next-layer new node;
and repeating the steps until the number of the conversation topics contained in the next layer of new nodes is less than N.
According to a preferred embodiment of the present invention, based on the vector of the input content, matching the closest dialog topic is specifically:
retrieving the closest node according to the vector of the input content;
matching the input content and the conversation theme input theme contained in the closest node with the closest conversation theme.
According to a preferred embodiment of the present invention, the topic matching model includes a coding layer for converting an input sentence into a sentence vector and a matching layer for matching calculation between the sentence vectors.
According to a preferred embodiment of the present invention, the coding layer employs a bidirectional long-term memory network model.
According to a preferred embodiment of the present invention, the matching layer calculates the matching degree between the sentence vectors of the user question and the sentence vectors of the standard question by using a cosine algorithm.
The third aspect of the present invention provides a dialog response system based on vector retrieval, including:
a storage unit for storing a computer executable program;
and the processing unit is used for reading the computer executable program in the storage unit so as to execute the dialogue response method based on vector retrieval.
A fourth aspect of the present invention is directed to a computer readable medium storing a computer readable program for executing the dialog response method based on vector retrieval.
By adopting the technical scheme, the vector input by the user is calculated, the retrieval and the matching are carried out based on the obtained vector, the required conversation theme can be quickly and accurately found, and the corpus corresponding to the conversation theme is used for communicating with the user. The waiting time of the user is reduced, the accuracy is improved, and the feeling of the user is better improved.
Drawings
In order to make the technical problems solved by the present invention, the technical means adopted and the technical effects obtained more clear, the following will describe in detail the embodiments of the present invention with reference to the accompanying drawings. It should be noted, however, that the drawings described below are only illustrations of exemplary embodiments of the invention, from which other embodiments can be derived by those skilled in the art without inventive step.
FIG. 1 is a flow chart of a dialog response method based on vector retrieval according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a process of constructing a database of conversation topics in an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a topic matching model in an embodiment of the invention;
FIG. 4 is a schematic structural diagram of a dialog response device based on vector search according to an embodiment of the present invention;
FIG. 5 is a block diagram of a dialog response system based on vector retrieval according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a computer-readable storage medium in an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will now be described more fully hereinafter with reference to the accompanying drawings, in which exemplary embodiments of the invention may be embodied in many specific forms, and should not be construed as limited to the embodiments set forth herein. Rather, these exemplary embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the invention to those skilled in the art.
The structures, properties, effects or other characteristics described in a certain embodiment may be combined in any suitable manner in one or more other embodiments, while still complying with the technical idea of the invention.
In describing particular embodiments, specific details of structures, properties, effects, or other features are set forth in order to provide a thorough understanding of the embodiments by one skilled in the art. However, it is not excluded that a person skilled in the art may implement the invention in a specific case without the above-described structures, performances, effects or other features.
The flow chart in the drawings is only an exemplary flow demonstration, and does not represent that all the contents, operations and steps in the flow chart are necessarily included in the scheme of the invention, nor does it represent that the execution is necessarily performed in the order shown in the drawings. For example, some operations/steps in the flowcharts may be divided, some operations/steps may be combined or partially combined, and the like, and the execution order shown in the flowcharts may be changed according to actual situations without departing from the gist of the present invention.
The block diagrams in the figures generally represent functional entities and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different network and/or processing unit devices and/or microcontroller devices.
The same reference numerals denote the same or similar elements, components, or parts throughout the drawings, and thus, a repetitive description thereof may be omitted hereinafter. It will be further understood that, although the terms first, second, third, etc. may be used herein to describe various elements, components, or sections, these elements, components, or sections should not be limited by these terms. That is, these phrases are used only to distinguish one from another. For example, a first device may also be referred to as a second device without departing from the spirit of the present invention. Furthermore, the term "and/or", "and/or" is intended to include all combinations of any one or more of the listed items.
Fig. 1 is a timing chart of a dialog response method based on vector search according to the present invention, as shown in fig. 1.
In the process that the customer service center uses the intelligent robot to communicate with the user, the conversation theme of the user needs to be determined according to the input content of the user. And then retrieving the nearest conversation topic from the database and carrying out conversation with the user by using the corpus of the conversation topic.
And how to judge whether the input of the user is close to the conversation theme is determined by calculating the vectors of the input of the user and the conversation theme and judging whether the vectors of the input of the user and the conversation theme are close to each other. The closer the vectors of the two are, the higher the similarity of the contents of the two is.
Therefore, the invention provides a dialogue response method based on vector retrieval, which comprises the following steps:
s101, summarizing conversation topics responded by the intelligent robot, calculating vectors of the conversation topics, and constructing a conversation topic database of a tree structure based on vector values of the conversation topics until the number of the conversation topics in leaf nodes of the tree structure is less than N, wherein the conversation topics and linguistic data corresponding to the conversation topics are stored in the conversation topic database, and N is a natural number.
In the embodiment, by constructing the conversation topic database with the tree structure, the closest node can be quickly positioned, and then the closest conversation topic is matched from the node, so that time is saved and accuracy is guaranteed.
On the basis of the above technical solution, further, the tree structure is specifically a binary tree structure.
In this embodiment, the tree structure is a binary tree structure, that is, each node of each layer has only two subtree branches at most. And the binary tree structure is adopted to quickly search.
On the basis of the above technical solution, further, constructing a tree-structured conversation topic database based on the vector values of the conversation topics specifically includes:
taking the collected conversation topics responded by the intelligent robot as root nodes, inputting vectors of the collected conversation topics into a classification model for classification, and forming nodes by the classified conversation topics;
inputting the vectors of the conversation topics contained in the nodes into a classification model for classification to obtain a next-layer new node;
and repeating the steps until the number of the conversation topics contained in the next layer of new nodes is less than N.
In the embodiment, a large amount of historical corpora are accumulated in daily work of the customer service center, and the historical corpora are the basis for constructing the conversation topic database. And inputting all accumulated historical linguistic data into a conversation theme recognition model to obtain the conversation theme of the historical linguistic data.
The conversation topic identification model is a TextCNN model based on deep learning. The TextCNN model based on deep learning can be established in a supervised learning mode or an unsupervised learning mode. In the present embodiment, model training is performed by a supervised learning method.
And manually indexing part of the historical linguistic data by adopting a manual auditing mode, and giving a conversation theme. And dividing the indexed historical corpus into two parts, wherein one part is a training sample, and the other part is a testing sample. And training the dialogue topic recognition model by using the training samples, and adjusting model parameters, such as regularization parameters. And stopping training until the conversation topic recognition model converges.
And then testing the dialogue theme recognition model by using the test sample, and completing the training if the test is passed, otherwise, re-training the dialogue theme recognition model.
The dialogue topic recognition model can be used in various ways, and when the intention recognition model uses the deep learning text classification based model TextCNN, the model comprises a convolutional layer, a pooling layer and an output layer. Converting the historical corpus into a text, performing word segmentation processing on the converted text, calculating through a convolution layer and a pooling layer, finally outputting a conversation theme label by an output layer, and determining the conversation theme of the current corpus according to the finally output conversation theme label.
In this embodiment, the process of constructing the conversation topic database is shown in fig. 2, and specifically includes the following steps:
s1011, all the summarized conversation themes to be used are used as root nodes of the tree structure.
And S1012, converting all conversation topics into vectors.
Vectorization of text, i.e., representing text using numerical features, because computers cannot directly understand human-created languages and words. In order to make a computer understand text, the text information needs to be mapped into a numerical semantic space, which we can refer to as a word vector space. There are many algorithms for converting text into vectors, such as TF-IDF, BOW, One-Hot, word2vec, etc. In the embodiment, the vectorization of the text adopts a word2vec algorithm, the word2vec model is an unsupervised learning model, and the mapping of the text information to the semantic space can be realized by using the training of an unmarked corpus.
And S1013, inputting the vectors of all the conversation topics into a classification model for classification, and obtaining a new node of the next layer after classification.
Since the root node is classified at this step, the left and right subtree nodes of the second level are obtained.
And S1014, inputting the vectors of the conversation topics contained in the new nodes into a classification model for classification, and obtaining the next layer of new nodes after classification.
In the step, the conversation topics contained in the left subtree node and the right subtree node of the second layer are classified to obtain a new node of the third layer.
And S1015, repeating the above steps until the number of the conversation topics contained in the next layer of new nodes is less than N.
In this step, the nodes in the third and subsequent layers are classified until the number of conversation topics included in the next new node is less than N, where N is preset as needed, and is usually set to 5 or 10.
Therefore, the binary tree structure of the conversation topic database is built, and subsequent operation is convenient to search according to the vector input by the user.
S102, obtaining input content of a user, calculating a vector of the input content, and matching the closest conversation theme based on the vector of the input content.
In the present embodiment, the input content to the user is converted into a vector, and the algorithm is consistent with the text vectorization algorithm of the dialog topic.
On the basis of the above technical solution, further, based on the vector of the input content, matching the closest dialog topic specifically is:
retrieving the closest node according to the vector of the input content;
matching the input content and the conversation theme input theme contained in the closest node with the closest conversation theme.
A similarity calculation method, a manhattan distance algorithm, a mahalanobis distance algorithm, a landau distance algorithm, and the like, and one or more of them may be selected for calculation in the present embodiment. similarity algorithm, Cosine in this embodiment, after obtaining the vector of the user's input content, the comparison is made in the binary tree structure of the conversation topic database. Based on the fast search characteristic of the binary tree, leaf nodes closest to the vector of the input content of the user can be quickly located. There are many ways to determine vector similarity, including Pearson's correlation coefficient algorithm, Euclidean distance (Euclidean distance) algorithm, Cosine
Since the leaf nodes include a plurality of conversation topics, after the nearest leaf node is found, the nearest conversation topic needs to be determined, and at this time, a topic matching model needs to be used for final matching.
On the basis of the above technical solution, further, the topic matching model includes a coding layer and a matching layer, the coding layer is used to convert an input sentence into a sentence vector, and the matching layer is used to perform matching calculation between the sentence vectors. The schematic structure of the topic matching model is shown in fig. 3.
On the basis of the technical scheme, further, the coding layer adopts a bidirectional long-term and short-term memory network model.
The bidirectional long and short term memory network model is one of the cyclic neural networks, and can better consider words before and after a statement, such as 'I do not feel good weather of today', wherein 'not' is to limit the following 'good weather' and shows negation of the good weather, the dependence relationship of a longer distance can be better captured by adopting the bidirectional long and short term memory network model, and the bidirectional long and short term memory network model can also consider the limitation of the following words to the preceding words, such as 'cold incapability of the day', wherein 'incapability' is the modification and limitation of 'cold'. In the present embodiment, the bidirectional long-term and short-term memory network model is trained by using a history dialogue record as training data in a supervised learning manner.
In this embodiment, since the number of the dialog topics contained in the leaf nodes is less than 5 or 10, the number of the input interfaces of the coding layer is five, the first input interface is used for inputting the question of the user, and the last four input interfaces are used for inputting the dialog topics contained in the nearest leaf nodes. Through the operation of the bidirectional long-term and short-term memory network model, the coding layer outputs sentence vectors corresponding to five conversation topics. In other embodiments, the input interfaces may be provided in other numbers.
On the basis of the technical scheme, further, the matching layer calculates the matching degree between the sentence vectors of the question sentences of the user and the sentence vectors of the standard question sentences by adopting a cosine algorithm.
In the embodiment, the input content of the user is ' how much money the computer is, and the input content of the user is calculated to have the highest matching degree with the first conversation topic ' the notebook selling price 4999 ', so that the first conversation topic in the leaf node is the closest conversation topic, and the corpus corresponding to the conversation topic is selected to communicate with the user.
S103, selecting corresponding linguistic data according to the matched conversation theme to carry out conversation with the user.
In the embodiment, after the closest conversation topic is matched through the topic matching model, the intelligent voice robot extracts the corpus corresponding to the conversation topic to perform communication with the user.
According to the method, the leaf node which is closest to the leaf node is quickly determined by utilizing the characteristic of quick search of the binary tree, and then the closest conversation theme is determined by using the theme matching model, so that the time cost is considered, the conversation accuracy is ensured, and the use experience of a user is improved.
Fig. 4 is a schematic structural diagram of a dialog response device based on vector search according to an embodiment of the present invention, and as shown in fig. 4, the present invention provides a schematic structural diagram 400 of a dialog response device based on vector search, including:
the conversation topic database building module 401 is configured to summarize conversation topics responded by the intelligent robot, calculate vectors of the conversation topics, and build a tree-structured conversation topic database based on vector values of the conversation topics until the number of the conversation topics in leaf nodes of the tree-structured conversation topic database is less than N, where the conversation topics and corpus corresponding to the conversation topics are stored in the conversation topic database, and N is a natural number.
In the embodiment, by constructing the conversation topic database with the tree structure, the closest node can be quickly positioned, and then the closest conversation topic is matched from the node, so that time is saved and accuracy is guaranteed.
On the basis of the above technical solution, further, the tree structure is specifically a binary tree structure.
In this embodiment, the tree structure is a binary tree structure, that is, each node of each layer has only two subtree branches at most. And the binary tree structure is adopted to quickly search.
On the basis of the above technical solution, further, constructing a tree-structured conversation topic database based on the vector values of the conversation topics specifically includes:
taking the collected conversation topics responded by the intelligent robot as root nodes, inputting vectors of the collected conversation topics into a classification model for classification, and forming nodes by the classified conversation topics;
inputting the vectors of the conversation topics contained in the nodes into a classification model for classification to obtain a next-layer new node;
and repeating the steps until the number of the conversation topics contained in the next layer of new nodes is less than N.
In the embodiment, a large amount of historical corpora are accumulated in daily work of the customer service center, and the historical corpora are the basis for constructing the conversation topic database. And inputting all accumulated historical linguistic data into a conversation theme recognition model to obtain the conversation theme of the historical linguistic data.
The conversation topic identification model is a TextCNN model based on deep learning. The TextCNN model based on deep learning can be established in a supervised learning mode or an unsupervised learning mode. In the present embodiment, model training is performed by a supervised learning method.
And manually indexing part of the historical linguistic data by adopting a manual auditing mode, and giving a conversation theme. And dividing the indexed historical corpus into two parts, wherein one part is a training sample, and the other part is a testing sample. And training the dialogue topic recognition model by using the training samples, and adjusting model parameters, such as regularization parameters. And stopping training until the conversation topic recognition model converges.
And then testing the dialogue theme recognition model by using the test sample, and completing the training if the test is passed, otherwise, re-training the dialogue theme recognition model.
The dialogue topic recognition model can be used in various ways, and when the intention recognition model uses the deep learning text classification based model TextCNN, the model comprises a convolutional layer, a pooling layer and an output layer. Converting the historical corpus into a text, performing word segmentation processing on the converted text, calculating through a convolution layer and a pooling layer, finally outputting a conversation theme label by an output layer, and determining the conversation theme of the current corpus according to the finally output conversation theme label.
In this embodiment, the process of constructing the conversation topic database is shown in fig. 2, and specifically includes the following steps:
s1011, all the summarized conversation themes to be used are used as root nodes of the tree structure.
And S1012, converting all conversation topics into vectors.
Vectorization of text, i.e., representing text using numerical features, because computers cannot directly understand human-created languages and words. In order to make a computer understand text, the text information needs to be mapped into a numerical semantic space, which we can refer to as a word vector space. There are many algorithms for converting text into vectors, such as TF-IDF, BOW, One-Hot, word2vec, etc. In the embodiment, the vectorization of the text adopts a word2vec algorithm, the word2vec model is an unsupervised learning model, and the mapping of the text information to the semantic space can be realized by using the training of an unmarked corpus.
And S1013, inputting the vectors of all the conversation topics into a classification model for classification, and obtaining a new node of the next layer after classification.
Since the root node is classified at this step, the left and right subtree nodes of the second level are obtained.
And S1014, inputting the vectors of the conversation topics contained in the new nodes into a classification model for classification, and obtaining the next layer of new nodes after classification.
In the step, the conversation topics contained in the left subtree node and the right subtree node of the second layer are classified to obtain a new node of the third layer.
And S1015, repeating the above steps until the number of the conversation topics contained in the next layer of new nodes is less than N.
In this step, the nodes in the third and subsequent layers are classified until the number of conversation topics included in the next new node is less than N, where N is preset as needed, and is usually set to 5 or 10.
Therefore, the binary tree structure of the conversation topic database is built, and subsequent operation is convenient to search according to the vector input by the user.
A conversation topic matching module 402, configured to obtain input content of a user, calculate a vector of the input content, and match a closest conversation topic based on the vector of the input content.
In the present embodiment, the input content to the user is converted into a vector, and the algorithm is consistent with the text vectorization algorithm of the dialog topic.
On the basis of the above technical solution, further, based on the vector of the input content, matching the closest dialog topic specifically is:
retrieving the closest node according to the vector of the input content;
matching the input content and the conversation theme input theme contained in the closest node with the closest conversation theme.
A similarity calculation method, a manhattan distance algorithm, a mahalanobis distance algorithm, a landau distance algorithm, and the like, and one or more of them may be selected for calculation in the present embodiment. similarity algorithm, Cosine in this embodiment, after obtaining the vector of the user's input content, the comparison is made in the binary tree structure of the conversation topic database. Based on the fast search characteristic of the binary tree, leaf nodes closest to the vector of the input content of the user can be quickly located. There are many ways to determine vector similarity, including Pearson's correlation coefficient algorithm, Euclidean distance (Euclidean distance) algorithm, Cosine
Since the leaf nodes include a plurality of conversation topics, after the nearest leaf node is found, the nearest conversation topic needs to be determined, and at this time, a topic matching model needs to be used for final matching.
On the basis of the above technical solution, further, the topic matching model includes a coding layer and a matching layer, the coding layer is used to convert an input sentence into a sentence vector, and the matching layer is used to perform matching calculation between the sentence vectors. The schematic structure of the topic matching model is shown in fig. 3.
On the basis of the technical scheme, further, the coding layer adopts a bidirectional long-term and short-term memory network model.
The bidirectional long and short term memory network model is one of the cyclic neural networks, and can better consider words before and after a statement, such as 'I do not feel good weather of today', wherein 'not' is to limit the following 'good weather' and shows negation of the good weather, the dependence relationship of a longer distance can be better captured by adopting the bidirectional long and short term memory network model, and the bidirectional long and short term memory network model can also consider the limitation of the following words to the preceding words, such as 'cold incapability of the day', wherein 'incapability' is the modification and limitation of 'cold'. In the present embodiment, the bidirectional long-term and short-term memory network model is trained by using a history dialogue record as training data in a supervised learning manner.
In this embodiment, since the number of the dialog topics contained in the leaf nodes is less than 5 or 10, the number of the input interfaces of the coding layer is five, the first input interface is used for inputting the question of the user, and the last four input interfaces are used for inputting the dialog topics contained in the nearest leaf nodes. Through the operation of the bidirectional long-term and short-term memory network model, the coding layer outputs sentence vectors corresponding to five conversation topics. In other embodiments, the input interfaces may be provided in other numbers.
On the basis of the technical scheme, further, the matching layer calculates the matching degree between the sentence vectors of the question sentences of the user and the sentence vectors of the standard question sentences by adopting a cosine algorithm.
In the embodiment, the input content of the user is ' how much money the computer is, and the input content of the user is calculated to have the highest matching degree with the first conversation topic ' the notebook selling price 4999 ', so that the first conversation topic in the leaf node is the closest conversation topic, and the corpus corresponding to the conversation topic is selected to communicate with the user.
And the dialogue module 403 is configured to select a corresponding corpus according to the matched dialogue theme to perform dialogue with the user.
In the embodiment, after the closest conversation topic is matched through the topic matching model, the intelligent voice robot extracts the corpus corresponding to the conversation topic to perform communication with the user.
According to the method, the leaf node which is closest to the leaf node is quickly determined by utilizing the characteristic of quick search of the binary tree, and then the closest conversation theme is determined by using the theme matching model, so that the time cost is considered, the conversation accuracy is ensured, and the use experience of a user is improved.
As shown in fig. 5, a dialog response system based on vector retrieval is also disclosed in an embodiment of the present invention, and the dialog response system based on vector retrieval shown in fig. 5 is only an example and should not bring any limitation to the function and the scope of application of the embodiment of the present invention.
The vector retrieval based dialog response system 500 includes a storage unit 520 for storing a computer executable program; a processing unit 510 for reading the computer executable program in the storage unit to perform the steps of various embodiments of the present invention.
The vector search based dialogue response system 500 in this embodiment further includes a bus 530 connecting different system components (including the storage unit 520 and the processing unit 510), a display unit 540, and the like.
The storage unit 520 stores a computer readable program, which may be a code of a source program or a read-only program. The program may be executed by the processing unit 510 such that the processing unit 510 performs the steps of various embodiments of the present invention. For example, the processing unit 510 may perform the steps as shown in fig. 1.
The memory unit 520 may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM) 5201 and/or a cache memory unit 5202, and may further include a read only memory unit (ROM) 5203. The memory unit 520 may also include a program/utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 530 may be one or more of any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The vector retrieval based dialog response system 500 may also communicate with one or more external devices 570 (e.g., keyboard, display, network device, bluetooth device, etc.) such that a user may interact with the processing unit 510 via input/output (I/O) interfaces 550 via these external devices 570, and with one or more networks (e.g., Local Area Network (LAN), Wide Area Network (WAN), and/or a public network such as the internet) via network adapter 560. The network adapter 560 may communicate with other modules of the vector retrieval based dialog response system 500 via the bus 530. It should be appreciated that, although not shown in the figures, other hardware and/or software modules may be used in the conversation analysis system 300 based on call behavior, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
FIG. 6 is a schematic diagram of one computer-readable medium embodiment of the present invention. As shown in fig. 6, the computer program may be stored on one or more computer readable media. The computer readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory unit (RAM), a read-only memory unit (ROM), an erasable programmable read-only memory unit (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory unit (CD-ROM), an optical storage unit, a magnetic storage unit, or any suitable combination of the foregoing. The computer program, when executed by one or more data processing devices, enables the computer-readable medium to implement the above-described method of the invention, namely:
s101, summarizing conversation topics responded by an intelligent robot, calculating vectors of the conversation topics, and constructing a conversation topic database of a tree structure based on vector values of the conversation topics until the number of the conversation topics in leaf nodes of the tree structure is less than N, wherein the conversation topics and linguistic data corresponding to the conversation topics are stored in the conversation topic database, and N is a natural number;
s102, acquiring input content of a user, calculating a vector of the input content, and matching a closest conversation theme based on the vector of the input content;
s103, selecting corresponding linguistic data according to the matched conversation theme to carry out conversation with the user.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments of the present invention described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to make a data processing device (which can be a personal computer, a server, or a network device, etc.) execute the above-mentioned method according to the present invention.
The computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable storage medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
In summary, the present invention can be implemented as a method, an apparatus, an electronic device, or a computer-readable medium executing a computer program. Some or all of the functions of the present invention may be implemented in practice using general purpose data processing equipment such as a micro-processing unit or a digital signal processing unit (DSP).
While the foregoing embodiments have described the objects, aspects and advantages of the present invention in further detail, it should be understood that the present invention is not inherently related to any particular computer, virtual machine or electronic device, and various general-purpose machines may be used to implement the present invention. The invention is not to be considered as limited to the specific embodiments thereof, but is to be understood as being modified in all respects, all changes and equivalents that come within the spirit and scope of the invention.

Claims (10)

1. A dialogue response method based on vector retrieval is characterized by comprising the following steps:
summarizing conversation topics responded by an intelligent robot, calculating vectors of the conversation topics, and constructing a conversation topic database of a tree structure based on vector values of the conversation topics until the number of the conversation topics in leaf nodes of the tree structure is less than N, wherein the conversation topics and linguistic data corresponding to the conversation topics are stored in the conversation topic database, and N is a natural number;
acquiring input content of a user, calculating a vector of the input content, and matching a closest conversation theme based on the vector of the input content;
and selecting corresponding language materials according to the matched conversation subjects to carry out conversation with the user.
2. The dialog response method according to claim 1, characterized in that the tree structure is in particular a binary tree structure.
3. The dialog response method according to claim 2, wherein constructing a tree-structured database of dialog topics based on the vector values of the dialog topics is specifically:
taking the collected conversation topics responded by the intelligent robot as root nodes, inputting vectors of the collected conversation topics into a classification model for classification, and forming nodes by the classified conversation topics;
inputting the vectors of the conversation topics contained in the nodes into a classification model for classification to obtain a next-layer new node;
and repeating the steps until the number of the conversation topics contained in the next layer of new nodes is less than N.
4. The dialog response method according to claim 1, characterized in that matching the closest dialog topic, based on the vector of input contents, is in particular:
retrieving the closest node according to the vector of the input content;
matching the input content and the conversation theme input theme contained in the closest node with the closest conversation theme.
5. The dialogue response method of claim 4, wherein the topic matching model includes a coding layer for converting an input sentence into a sentence vector and a matching layer for matching calculation between the sentence vectors.
6. The dialog response method of claim 5 wherein the coding layer employs a two-way long term memory network model.
7. The dialog response method according to claim 5, characterized in that the matching layer calculates the degree of matching between the sentence vectors of the user question and the sentence vectors of the standard question using a cosine algorithm.
8. A dialog response device based on vector retrieval, the device comprising:
the system comprises a conversation theme database construction module, a conversation theme database construction module and a database management module, wherein the conversation theme database construction module is used for summarizing conversation themes responded by the intelligent robot, calculating vectors of the conversation themes, and constructing a tree-structure conversation theme database based on vector values of the conversation themes until the number of the conversation themes in leaf nodes of the tree-structure is less than N, the conversation themes and linguistic data corresponding to the conversation themes are stored in the conversation theme database, and N is a natural number;
the conversation topic matching module is used for acquiring input content of a user, calculating a vector of the input content, and matching the closest conversation topic based on the vector of the input content;
and the dialogue module is used for selecting corresponding linguistic data according to the matched dialogue theme to carry out dialogue with the user.
9. A dialog response system based on vector retrieval, comprising:
a storage unit for storing a computer executable program;
a processing unit for reading the computer executable program in the storage unit to execute the dialog response method based on vector retrieval according to any of claims 1 to 7.
10. A computer-readable medium for storing a computer-readable program for executing the vector search based dialog response method of any of claims 1 to 7.
CN202011192950.0A 2020-10-30 2020-10-30 Dialogue response method, device and system based on vector retrieval Active CN112100360B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011192950.0A CN112100360B (en) 2020-10-30 2020-10-30 Dialogue response method, device and system based on vector retrieval

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011192950.0A CN112100360B (en) 2020-10-30 2020-10-30 Dialogue response method, device and system based on vector retrieval

Publications (2)

Publication Number Publication Date
CN112100360A true CN112100360A (en) 2020-12-18
CN112100360B CN112100360B (en) 2024-02-02

Family

ID=73785724

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011192950.0A Active CN112100360B (en) 2020-10-30 2020-10-30 Dialogue response method, device and system based on vector retrieval

Country Status (1)

Country Link
CN (1) CN112100360B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722452A (en) * 2021-07-16 2021-11-30 上海通办信息服务有限公司 Semantic-based quick knowledge hit method and device in question-answering system
CN115062630A (en) * 2022-07-25 2022-09-16 北京云迹科技股份有限公司 Method and device for confirming nickname of robot

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20110090354A (en) * 2010-02-03 2011-08-10 고려대학교 산학협력단 Portable communication device and method for extracting user interest
CN103020111A (en) * 2012-10-29 2013-04-03 苏州大学 Image retrieval method based on vocabulary tree level semantic model
CN106598999A (en) * 2015-10-19 2017-04-26 北京国双科技有限公司 Method and device for calculating text theme membership degree
WO2018186599A1 (en) * 2017-04-06 2018-10-11 네이버 주식회사 Automatic extraction and structurization, by subject, of sub-topic of query
CN109271477A (en) * 2018-09-05 2019-01-25 杭州数湾信息科技有限公司 A kind of method and system by internet building taxonomy library
CN111191000A (en) * 2019-12-20 2020-05-22 北京淇瑀信息科技有限公司 Dialog management method, device and system of intelligent voice robot
CN111212190A (en) * 2019-12-20 2020-05-29 北京淇瑀信息科技有限公司 Conversation management method, device and system based on conversation strategy management
CN112017660A (en) * 2020-10-30 2020-12-01 北京淇瑀信息科技有限公司 Dialogue strategy construction method, device and system for intelligent voice robot
CN113742471A (en) * 2021-09-15 2021-12-03 重庆大学 Vector retrieval type dialogue method of general question-answering system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20110090354A (en) * 2010-02-03 2011-08-10 고려대학교 산학협력단 Portable communication device and method for extracting user interest
CN103020111A (en) * 2012-10-29 2013-04-03 苏州大学 Image retrieval method based on vocabulary tree level semantic model
CN106598999A (en) * 2015-10-19 2017-04-26 北京国双科技有限公司 Method and device for calculating text theme membership degree
WO2018186599A1 (en) * 2017-04-06 2018-10-11 네이버 주식회사 Automatic extraction and structurization, by subject, of sub-topic of query
CN109271477A (en) * 2018-09-05 2019-01-25 杭州数湾信息科技有限公司 A kind of method and system by internet building taxonomy library
CN111191000A (en) * 2019-12-20 2020-05-22 北京淇瑀信息科技有限公司 Dialog management method, device and system of intelligent voice robot
CN111212190A (en) * 2019-12-20 2020-05-29 北京淇瑀信息科技有限公司 Conversation management method, device and system based on conversation strategy management
CN112017660A (en) * 2020-10-30 2020-12-01 北京淇瑀信息科技有限公司 Dialogue strategy construction method, device and system for intelligent voice robot
CN113742471A (en) * 2021-09-15 2021-12-03 重庆大学 Vector retrieval type dialogue method of general question-answering system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
SANDA HARABAGIU ET AL.: "Using topic themes for multi-document summarization", 《ACM TRANSACTIONS ON INFORMATION SYSTEMS》, pages 1 - 48 *
韩宇: "检索与生成模型相融合的目标导向型对话系统", 《中国优秀硕士学位论文全文数据库 信息科技辑》, pages 138 - 2370 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722452A (en) * 2021-07-16 2021-11-30 上海通办信息服务有限公司 Semantic-based quick knowledge hit method and device in question-answering system
CN113722452B (en) * 2021-07-16 2024-01-19 上海通办信息服务有限公司 Semantic-based rapid knowledge hit method and device in question-answering system
CN115062630A (en) * 2022-07-25 2022-09-16 北京云迹科技股份有限公司 Method and device for confirming nickname of robot
CN115062630B (en) * 2022-07-25 2023-01-06 北京云迹科技股份有限公司 Method and device for confirming nickname of robot

Also Published As

Publication number Publication date
CN112100360B (en) 2024-02-02

Similar Documents

Publication Publication Date Title
CN108363790B (en) Method, device, equipment and storage medium for evaluating comments
CN111191030B (en) Method, device and system for identifying single sentence intention based on classification
CN111090987B (en) Method and apparatus for outputting information
CN109145294B (en) Text entity identification method and device, electronic equipment and storage medium
CN107832299B (en) Title rewriting processing method and device based on artificial intelligence and readable medium
CN111177186B (en) Single sentence intention recognition method, device and system based on question retrieval
CN112464641A (en) BERT-based machine reading understanding method, device, equipment and storage medium
CN111191000B (en) Dialogue management method, device and system of intelligent voice robot
CN112015859A (en) Text knowledge hierarchy extraction method and device, computer equipment and readable medium
CN111930792B (en) Labeling method and device for data resources, storage medium and electronic equipment
CN111144120A (en) Training sentence acquisition method and device, storage medium and electronic equipment
CN111125317A (en) Model training, classification, system, device and medium for conversational text classification
CN111177350A (en) Method, device and system for forming dialect of intelligent voice robot
CN115516447A (en) Hot news intention identification method, device and equipment and readable storage medium
CN113569578B (en) User intention recognition method and device and computer equipment
CN112434161B (en) Aspect-level emotion analysis method adopting bidirectional long-short term memory network
CN112100360B (en) Dialogue response method, device and system based on vector retrieval
CN117807482B (en) Method, device, equipment and storage medium for classifying customs clearance notes
CN111241273A (en) Text data classification method and device, electronic equipment and computer readable medium
CN108920715B (en) Intelligent auxiliary method, device, server and storage medium for customer service
CN116450943A (en) Artificial intelligence-based speaking recommendation method, device, equipment and storage medium
CN116361511A (en) Video retrieval method, device and equipment of composite semantics and storage medium
CN113362809B (en) Voice recognition method and device and electronic equipment
CN115238077A (en) Text analysis method, device and equipment based on artificial intelligence and storage medium
CN112017660B (en) Dialogue strategy construction method, device and system for intelligent voice robot

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