A data query method, device and equipment

By preprocessing and clustering label determination of the text input by the user, the query scope is narrowed, and the problem of low timeliness and accuracy of user input answers in the prior art is solved, thereby achieving efficient and accurate query results.

CN113407700BActive Publication Date: 2024-12-31INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110762089.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-06
Publication Date
2024-12-31
Estimated Expiration
2041-07-06

Smart Images

  • Figure CN113407700B_ABST
    Figure CN113407700B_ABST
Patent Text Reader

Abstract

The embodiments of this specification provide a data query method, device and equipment, which relate to the field of artificial intelligence technology, wherein the method includes: receiving a target text input by a target user; preprocessing the target text to obtain a feature vector of the target text; determining a target cluster label according to the feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs; and determining the query result corresponding to the target text based on the feature vector of the target text and the target cluster label. In the embodiments of this specification, the scope of the query can be determined by the target cluster label, and the query can be performed in the determined query scope according to the feature vector of the target text, so as to narrow the query scope and improve the query efficiency, and the accuracy of the query results can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of artificial intelligence technology, and more particularly to a data query method, device and equipment. Background Art

[0002] Banking services are diverse and complex, and are still growing rapidly with the development of the Internet. Even with the widespread application of intelligent customer service, bank customer service still inevitably needs to answer a large number of customer questions every day in their daily work.

[0003] In the prior art, when answering customer questions, the required answers are usually retrieved by searching for keywords in the question or searching for related documents. However, this method has high requirements for the timeliness and accuracy of the answer to the question, and because this type of question-and-answer knowledge is often highly discrete and lacks statistical analysis, it is necessary to manually screen the search results to obtain the correct answer. As a result, the final result has certain subjective factors and also increases the time cost. It can be seen that the technical solutions in the prior art cannot accurately determine the corresponding answers based on the questions input by the user.

[0004] To address the above problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of this specification provide a data query method, device and apparatus to solve the problem in the prior art that it is impossible to accurately determine the corresponding answer based on the question input by the user.

[0006] An embodiment of the present specification provides a data query method, including: receiving a target text input by a target user; preprocessing the target text to obtain a feature vector of the target text; determining a target cluster label based on the feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs; and determining a query result corresponding to the target text based on the feature vector of the target text and the target cluster label.

[0007] The embodiment of this specification also provides a data query device, including: a receiving module, used to receive a target text input by a target user; a preprocessing module, used to preprocess the target text to obtain a feature vector of the target text; a first determination module, used to determine a target cluster label according to the feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs; and a second determination module, used to determine a query result corresponding to the target text based on the feature vector of the target text and the target cluster label.

[0008] The embodiments of the present specification also provide a data query device, including a processor and a memory for storing processor executable instructions, wherein the processor implements the steps of any method embodiment in the embodiments of the present specification when executing the instructions.

[0009] The embodiments of the present specification also provide a computer-readable storage medium on which computer instructions are stored. When the instructions are executed, the steps of any method embodiment in the embodiments of the present specification are implemented.

[0010] The embodiments of this specification provide a data query method, which can receive a target text input by a target user, pre-process the target text, and obtain a feature vector of the target text. In order to determine the category to which the target text belongs, a target cluster label can be determined based on the feature vector of the target text. Since the amount of data stored in the database is large, and the question-and-answer knowledge often has the characteristics of high discreteness and lack of statistical analysis, the scope of the query can be determined by the target cluster label, and the query can be performed in the determined query scope based on the feature vector of the target text to determine the query result corresponding to the target text. Thereby, the purpose of narrowing the query scope and improving the query efficiency can be achieved, and the accuracy of the query results can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings described herein are used to provide a further understanding of the embodiments of this specification, constitute a part of the embodiments of this specification, and do not constitute a limitation of the embodiments of this specification. In the drawings:

[0012] Figure 1 It is a schematic diagram of the steps of the data query method provided in the embodiment of this specification;

[0013] Figure 2 is a structural schematic diagram of a data query device provided according to an embodiment of this specification;

[0014] Figure 3 It is a structural diagram of a data query device provided according to an embodiment of this specification. DETAILED DESCRIPTION

[0015] The principles and spirit of the embodiments of this specification will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the embodiments of this specification, and are not intended to limit the scope of the embodiments of this specification in any way. On the contrary, these embodiments are provided to make the disclosure of the embodiments of this specification more thorough and complete, and to fully convey the scope of the disclosure to those skilled in the art.

[0016] Those skilled in the art know that the implementation of the embodiments of this specification can be implemented as a system, device, method or computer program product. Therefore, the embodiments disclosed in this specification can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.

[0017] Although the processes described below include multiple operations that occur in a particular order, it should be clear that these processes may include more or fewer operations, which may be performed sequentially or in parallel (eg, using parallel processors or a multi-threaded environment).

[0018] See also Figure 1 This embodiment can provide a data query method. The data query method can be used to determine the query scope through the target cluster label, and query in the determined query scope according to the feature vector of the target text, and determine the query result corresponding to the target text, so as to narrow the query scope and improve the query efficiency. The above data query method can include the following steps.

[0019] S101: receiving a target text input by a target user.

[0020] In this embodiment, a target text input by a target user may be received. The target text may be text input by the target user in an input box of a search interface when the target user needs to perform a search, and the target text may be used to indicate the search purpose of the target user.

[0021] In this embodiment, the target text may be one or more keywords, a sentence or a paragraph, and the specific target text may be determined according to actual conditions, and this specification does not limit this.

[0022] S102: Preprocess the target text to obtain a feature vector of the target text.

[0023] In this embodiment, since the target text input by the target user is not in the correct format or contains some irrelevant redundant characters, in order to determine the main intention of the target user's query, the target text may be preprocessed to obtain a feature vector of the target text.

[0024] In this embodiment, the feature vector of the target text may include at least one feature word, and the feature vector may be, for example: <Beijing, weather>. Of course, it can be understood that the feature vector of the target text may also be in other possible forms, which may be determined based on actual conditions, and the embodiments of this specification do not limit this.

[0025] In this embodiment, the above-mentioned preprocessing may include: data cleaning, word segmentation, stop word removal and other processing. Of course, the preprocessing method is not limited to the above examples. Technical personnel in the relevant field may make other changes under the inspiration of the technical essence of the embodiments of this specification, but as long as the functions and effects achieved are the same or similar to the embodiments of this specification, they should be covered within the protection scope of the embodiments of this specification.

[0026] S103: Determine a target cluster label according to the feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs.

[0027] In this embodiment, the target cluster label can be determined according to the feature vector of the target text to determine the category corresponding to the target text. The target cluster label can be used to indicate the category to which the target text belongs.

[0028] In this embodiment, cluster analysis can be performed on the historically stored question and answer data in the database in advance to obtain multiple cluster centers, thereby classifying the historical question and answer data. Correspondingly, when a user performs a query, the cluster corresponding to the text input by the user can be determined first.

[0029] In this embodiment, by calculating the similarity between the feature vector of the target text and the feature vector of each historical question and answer data, the cluster to which the historical question and answer data with the highest similarity belongs can be used as the cluster to which the feature vector of the target text belongs. The similarity between feature vectors can be determined by calculating cosine similarity, Minkowski distance, etc. Of course, the calculation method of the similarity between feature vectors is not limited to the above examples. Under the inspiration of the technical essence of the embodiments of this specification, technicians in the relevant field may also make other changes, but as long as the functions and effects achieved are the same or similar to the embodiments of this specification, they should be covered within the protection scope of the embodiments of this specification.

[0030] In this embodiment, the Euclidean distance from the feature vector of the target text to each cluster center can also be calculated, and the cluster center with the shortest path is selected and classified into the class. Of course, it is understandable that other methods can also be used to determine the cluster to which the feature vector of the target text belongs.

[0031] In this embodiment, each cluster center may have a cluster label, which may be used to identify the category of the cluster, and the cluster label may be one or more characteristic words. Of course, it is understandable that the above cluster label may also be in other forms, such as a chart, etc., which may be determined according to actual conditions, and the embodiments of this specification do not limit this.

[0032] S104: Determine the query result corresponding to the target text based on the feature vector of the target text and the target cluster label.

[0033] In this embodiment, the query result corresponding to the target text can be determined based on the feature vector of the target text and the target cluster label, so that the query can be performed under the category corresponding to the target cluster label in the database, thereby narrowing the query scope and improving the query efficiency, thereby improving the accuracy of the query result.

[0034] In this embodiment, since the amount of data stored in the database is large and the question-answering knowledge often has the characteristics of high discreteness and lack of statistical analysis, the scope of the query can be determined by the target cluster label, and the query can be performed within the determined query scope based on the feature vector of the target text.

[0035] In this embodiment, the query result corresponding to the above target text may be one or more, and in some cases the query result may also be empty. When the query result is empty, a default prompt message may be fed back to the target user, and the user may be prompted whether to modify the target text or the target cluster label. The specific information may be determined based on actual conditions, and this specification does not limit this.

[0036] From the above description, it can be seen that the embodiments of this specification achieve the following technical effects: by receiving the target text input by the target user, the target text can be preprocessed to obtain the feature vector of the target text. In order to determine the category to which the target text belongs, the target cluster label can be determined according to the feature vector of the target text. Since the amount of data stored in the database is large, and the question-and-answer knowledge often has the characteristics of high discreteness and lack of statistical analysis, the scope of the query can be determined by the target cluster label, and the query can be performed in the determined query scope according to the feature vector of the target text to determine the query result corresponding to the target text. Thereby, the purpose of narrowing the query scope and improving the query efficiency can be achieved, and the accuracy of the query results can be improved.

[0037] In one embodiment, preprocessing the target text to obtain the feature vector of the target text may include: segmenting the target text to obtain a target segmentation set. Furthermore, stop words in the target segmentation set may be removed to obtain the feature vector of the target text.

[0038] In this embodiment, since the target text input by the target user is not in the correct format or contains some irrelevant redundant characters, the target text may be preprocessed to obtain a feature vector of the target text. Specifically, the target text may be segmented to obtain a target segmentation set of the target text. Furthermore, stop words in the target segmentation set may be removed to obtain a feature vector of the target text.

[0039] In this embodiment, the above word segmentation can be Chinese word segmentation, which is used to segment a sequence of Chinese characters into individual words. Word segmentation is the process of recombining a continuous sequence of characters into a sequence of words according to certain specifications. Stop words refer to certain characters or words that are automatically filtered out before or after processing natural language data (or text) in information retrieval to save storage space and improve search efficiency. For example: "de", "le", etc.

[0040] In this embodiment, a stop word list can be maintained, and the stop words in the target word segmentation set can be removed according to the stop word list.

[0041] In one embodiment, before determining the target cluster label according to the feature vector of the target text, it may further include: obtaining a Q&A knowledge set from a target database; wherein, the Q&A knowledge set contains multiple groups of Q&A data, and each group of Q&A data contains a question text and an answer text. Preprocess each group of Q&A data in the Q&A knowledge set to obtain the feature vectors of multiple groups of Q&A data. Further, clustering analysis can be performed using the K-means clustering algorithm according to the feature vectors of the multiple groups of Q&A data to obtain a clustering result; wherein, the clustering result contains multiple cluster centers, and each cluster center corresponds to a cluster. The cluster labels of each cluster can be determined according to the clustering result, and based on the clustering result and the cluster labels of each cluster, the classification result of the Q&A knowledge set can be obtained.

[0042] In this embodiment, the Q&A knowledge set in the target database can be classified in advance, where the above target database can be the data source for querying, and the query result can be obtained by querying in the target database according to the target text. The Q&A data in the obtained Q&A knowledge set can be historical Q&A data recorded in the target database, and of course, it can also include manually set Q&A data that is often retrieved. Specifically, it can be determined according to the actual situation, and the embodiments of this specification do not limit this.

[0043] In this embodiment, the way to preprocess each group of Q&A data in the Q&A knowledge set can be the same as the way to preprocess the target text, and the repeated parts will not be elaborated.

[0044] In this embodiment, the K-means clustering algorithm can be used to perform cluster analysis on the feature vectors of multiple groups of question and answer data, thereby obtaining multiple cluster centers, each cluster center can correspond to a cluster, and each cluster can contain at least one group of question and answer data. The K-means clustering algorithm (k-means clustering algorithm) is an iterative clustering analysis algorithm, and its steps are to pre-divide the data into K groups, then randomly select K objects as the initial cluster centers, and then calculate the distance between each object and each seed cluster center, and assign each object to the cluster center closest to it. The cluster centers and the objects assigned to them represent a cluster. Each time a sample is assigned, the cluster center of the cluster will be recalculated based on the existing objects in the cluster. This process will be repeated until a certain termination condition is met. The termination condition can be that no (or a minimum number) of objects are reassigned to different clusters, no (or a minimum number) of cluster centers change again, and the error sum of squares is locally minimized.

[0045] In this embodiment, in order to distinguish different clusters, the cluster labels of each cluster can be determined according to the clustering results. The cluster labels can be used to distinguish different classifications. For example, the cluster labels can be feature words such as lending, deposits, etc. The specific ones can be determined according to actual conditions, and this specification embodiment does not limit this.

[0046] In this implementation, the above clustering results and the cluster labels of the clusters may be used as classification results of the question-answer knowledge set.

[0047] In one embodiment, preprocessing each set of question and answer data in the question and answer knowledge set to obtain feature vectors of multiple sets of question and answer data may include: segmenting the question text and the answer text in each set of question and answer data to obtain a segmentation set for each set of question and answer data. Stop words in the segmentation set for each set of question and answer data may be removed to obtain a feature vector for each set of question and answer data.

[0048] In this embodiment, since the format of the question and answer data may be incorrect or there may be some irrelevant redundant characters, each group of question and answer data in the question and answer knowledge set may be preprocessed to obtain a feature vector of each group of question and answer data. Specifically, each group of question and answer data in the question and answer knowledge set may be first segmented to obtain a segmentation set of each group of question and answer data. Furthermore, stop words in the segmentation set of each group of question and answer data may be removed to obtain a feature vector of each group of question and answer data.

[0049] In one embodiment, performing cluster analysis using a K-means clustering algorithm based on the feature vectors of the multiple groups of question and answer data to obtain clustering results may include: calculating a two-dimensional matrix of TF-IDF weights for each feature word in the feature vectors of each group of question and answer data. Furthermore, performing cluster analysis using a K-means clustering algorithm based on the two-dimensional matrix of TF-IDF weights for each feature word in each group of question and answer data to obtain clustering results.

[0050] In this embodiment, TF-IDF (term frequency–inverse document frequency) is a commonly used weighting technique for information retrieval and data mining. TF stands for term frequency and IDF stands for inverse document frequency. TF-IDF is a statistical method used to evaluate the importance of a word to a document set or one of the documents in a corpus. The importance of a word increases in direct proportion to the number of times it appears in the document, but at the same time decreases in inverse proportion to the frequency of its appearance in the corpus. TF-IDF is calculated according to the following formula:

[0051] TF-IDF=TF×IDF

[0052] In this implementation, the word frequency of each feature word in the feature vector of each group of question and answer data can be calculated first, and the calculation formula of the word frequency is as follows:

[0053]

[0054] Among them, tf ij is the frequency of the i-th feature word in the document set j; n i,j is the number of times the i-th feature word appears in the document set j; n kj is the number of times the kth term in file set j appears in file set j; ∑ k n kj is the sum of the number of occurrences of all terms in document set j.

[0055] In this embodiment, the reverse file frequency can be further calculated, and the calculation formula of the reverse file frequency is as follows:

[0056]

[0057] Among them, idf i is the inverse document frequency of the ith feature word; |D| is the total number of records of question-answer data in the target database; t i is the i-th feature word; |{j:t i ∈d j}| is the total number of documents containing the i-th feature word.

[0058] In this embodiment, the calculation results obtained based on the word frequency and the inverse file frequency can obtain the TF-IDF value of each feature word in the feature vector of each group of question and answer data in the file set j, and then the TF-IDF weight two-dimensional matrix ω[i][j] of each feature word in different file sets can be obtained.

[0059] In this embodiment, the TF-IDF weight two-dimensional matrix of each feature word in the feature vector of each group of question and answer data can be calculated to filter out unimportant feature words (TF-IDF is less than a preset threshold) so as to retain important feature words.

[0060] In this embodiment, according to the TF-IDF weight two-dimensional matrix of each feature word in each group of question and answer data, cluster analysis is performed using the K-means clustering algorithm to obtain the clustering results, which may include the following steps:

[0061] Step 300: Set the clustering convergence threshold Delta and the maximum number of iterations N.

[0062] Step 301: Randomly select a set of question and answer data from the question and answer knowledge set as the initial cluster center point.

[0063] Step 302: Calculate the shortest distance between each row in ω[i][j] and the current cluster center (i.e., the Euclidean distance of the nearest cluster center), represented by D(x). Each row in ω[i][j] represents a sample, that is, a set of question-answering data.

[0064] Then the probability of each sample point being selected as the next cluster center is calculated, and the next cluster center is selected according to the roulette wheel method. The roulette wheel method is a proportional selection method, and its basic idea is that the probability of each individual being selected is proportional to the value of its fitness function.

[0065] Step 303: Repeat step 302 until K cluster centers are selected.

[0066] Step 304: Take the selected K cluster centers as initial values, calculate the distance to the K initial cluster centers for each remaining row in ω[i][j], and classify the point into one of the K center points according to the minimum distance. At the same time, record the minimum distance into the array A[k][m], where k is the serial number of the cluster center and m is the serial number of the sample point classified into the cluster center.

[0067] Step 305: Recalculate the centroids of the K clusters. The newly generated K centroids are compared with the cluster center points calculated last time. If the distances are all less than the convergence threshold Delta, it means that the whole process has converged. The average distance a[k] from all sample points in the cluster to the center point is calculated based on A[k][m], and the distance between any two center points is calculated to determine whether it is less than the average distance in the two clusters. If so, the two clusters are merged. If convergence has been achieved, the algorithm ends.

[0068] Otherwise, it is determined whether the number of iterations is greater than N. If so, it can be considered that the K value is not selected properly and only a partial local optimal solution can be obtained. The overall convergence can be made easier by increasing the K value and recalculating. The number of clusters K can be adjusted to K=K+K / 2 and then the starting step 301 can be re-executed until the algorithm ends.

[0069] If the number of iterations is less than or equal to N, if convergence occurs, it can be further determined whether there are clusters that need to be merged. If so, they are merged and the algorithm ends after the merger.

[0070] In this embodiment, two clusters are merged when they are "close", and when they still cannot converge after N iterations, the K value is increased to adjust the cluster center to obtain a more reasonable cluster center value.

[0071] In one embodiment, determining the cluster labels of each cluster according to the clustering results may include: arranging the feature words included in the target cluster in descending order according to the TF-IDF values ​​of the feature words, and using a preset number of feature words before sorting as the cluster labels of the target cluster.

[0072] In this embodiment, since the TF-IDF value can be used to evaluate the importance of a word to a file set or one of the files in a corpus, the feature words included in the target cluster can be arranged in descending order according to the TF-IDF values ​​of the feature words, and a preset number of feature words before sorting can be used as cluster labels of the target cluster. In this way, the cluster labels of each cluster can be obtained.

[0073] In this embodiment, the above-mentioned preset number can be a positive integer, for example: 1, 3, 6, etc., and the specific number can be determined according to actual conditions, and the embodiments of this specification do not limit this.

[0074] In one embodiment, after obtaining the classification result of the question and answer knowledge set based on the clustering result and the cluster labels of the clusters, the method may further include: displaying the classification result of the question and answer knowledge set in a search interface.

[0075] In this embodiment, the classification results of the question-answer knowledge set can be displayed through a front-end page to provide a classification function to provide query services for users or manual customer service.

[0076] In this embodiment, the above classification results may include multiple classifications, and the name of each classification can be represented by the cluster label of each cluster. In some embodiments, only the name of each classification can be displayed in the search interface, or the name of each classification and the corresponding representative question and answer data can be displayed together in the search interface to give users or manual customer service examples, so as to understand the meaning of each classification more intuitively and clearly. Of course, the way of displaying the classification results is not limited to the above examples. Technical personnel in the relevant field may make other changes under the inspiration of the technical essence of the embodiments of this specification, but as long as the functions and effects achieved are the same or similar to the embodiments of this specification, they should be covered within the protection scope of the embodiments of this specification.

[0077] Based on the same inventive concept, a data query device is also provided in the embodiments of this specification, as described in the following embodiments. Since the principle of solving the problem by the data query device is similar to that of the data query method, the implementation of the data query device can refer to the implementation of the data query method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived. Figure 2 is a structural block diagram of a data query device according to an embodiment of this specification, such as Figure 2 As shown, it may include: a receiving module 201, a preprocessing module 202, a first determining module 203, and a second determining module 204. The structure is described below.

[0078] The receiving module 201 may be used to receive a target text input by a target user;

[0079] A preprocessing module 202 may be used to preprocess the target text to obtain a feature vector of the target text;

[0080] The first determination module 203 may be used to determine a target cluster label according to the feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs;

[0081] The second determination module 204 may be configured to determine a query result corresponding to the target text based on the feature vector of the target text and the target cluster label.

[0082] The embodiment of this specification also provides an electronic device, which can be specifically referred to in Figure 3The electronic device composition structure diagram of the data query method provided by the embodiment of the present specification is shown, and the electronic device may specifically include an input device 31, a processor 32, and a memory 33. Among them, the input device 31 can be specifically used to input a target text. The processor 32 can be specifically used to receive a target text input by a target user; preprocess the target text to obtain a feature vector of the target text; determine a target cluster label according to the feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs; based on the feature vector of the target text and the target cluster label, determine the query result corresponding to the target text. The memory 33 can be specifically used to store parameters such as the feature vector of the target text and the target cluster label.

[0083] In this embodiment, the input device may specifically be one of the main devices for information exchange between the user and the computer system. The input device may include a keyboard, a mouse, a camera, a scanner, a light pen, a handwriting input board, a voice input device, etc.; the input device is used to input the original data and the program for processing these numbers into the computer. The input device can also obtain and receive data transmitted from other modules, units, and devices. The processor can be implemented in any appropriate manner. For example, the processor can take the form of a computer-readable medium, a logic gate, a switch, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable logic controller, and an embedded microcontroller, etc., such as a microprocessor or a processor and a computer-readable program code (such as software or firmware) that can be executed by the (micro) processor. The memory may specifically be a memory device used to store information in modern information technology. The memory may include multiple levels. In a digital system, anything that can store binary data can be a memory; in an integrated circuit, a circuit with a storage function without a physical form is also called a memory, such as a RAM, a FIFO, etc.; in a system, a storage device with a physical form is also called a memory, such as a memory stick, a TF card, etc.

[0084] In this embodiment, the functions and effects specifically realized by the electronic device can be explained in comparison with other embodiments and will not be described in detail here.

[0085] The embodiment of the present specification also provides a computer storage medium based on the data query method, wherein the computer storage medium stores computer program instructions, which can achieve the following when executed: receiving a target text input by a target user; preprocessing the target text to obtain a feature vector of the target text; determining a target cluster label based on the feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs; and determining a query result corresponding to the target text based on the feature vector of the target text and the target cluster label.

[0086] In this embodiment, the storage medium includes, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a cache, a hard disk (HDD), or a memory card. The memory may be used to store computer program instructions. The network communication unit may be an interface for network connection communication set in accordance with the standard specified by the communication protocol.

[0087] In this embodiment, the functions and effects specifically implemented by the program instructions stored in the computer storage medium can be explained in comparison with other embodiments and will not be repeated here.

[0088] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of this specification can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of this specification are not limited to any specific combination of hardware and software.

[0089] Although the embodiments of this specification provide method operation steps as described in the above embodiments or flowcharts, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided by the embodiments of this specification. When the device or terminal product of the method described in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or drawings (for example, a parallel processor or a multi-threaded processing environment).

[0090] It should be understood that the above description is for illustration and not for limitation. By reading the above description, many embodiments and many applications beyond the examples provided will be apparent to those skilled in the art. Therefore, the scope of the embodiments of this specification should not be determined with reference to the above description, but should be determined with reference to the full scope of the aforementioned claims and the equivalents possessed by these claims.

[0091] The above is only a preferred embodiment of the embodiment of this specification, and is not intended to limit the embodiment of this specification. For those skilled in the art, the embodiment of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiment of this specification shall be included in the protection scope of the embodiment of this specification.

Claims

1. A data query method, characterized in that: include: Receive target text input by a target user; Preprocessing the target text to obtain a feature vector of the target text; Determining a target cluster label according to the feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs; Determining a query result corresponding to the target text based on the feature vector of the target text and the target cluster label; Before determining the target cluster label according to the feature vector of the target text, the method further includes: obtaining a question-answering knowledge set from a target database; wherein the question-answering knowledge set includes multiple groups of question-answering data, each group of question-answering data includes a question text and an answer text; preprocessing each group of question-answering data in the question-answering knowledge set to obtain feature vectors of multiple groups of question-answering data; calculating a two-dimensional matrix of TF-IDF weights of each feature word in the feature vectors of each group of question-answering data; performing cluster analysis using a K-means clustering algorithm based on the two-dimensional matrix of TF-IDF weights of each feature word in the feature vectors of each group of question-answering data to obtain a clustering result; wherein the clustering result includes multiple cluster centers, each cluster center corresponds to a cluster; determining cluster labels of each cluster according to the clustering result; and obtaining a classification result of the question-answering knowledge set based on the clustering result and the cluster labels of each cluster; The clustering result is determined by the following method: setting a clustering convergence threshold Delta and a maximum number of iterations N; randomly selecting a set of question-answer data from the question-answer knowledge set as the initial cluster center point; calculating the shortest distance between each row in the TF-IDF weight two-dimensional matrix of each feature word and the current existing cluster center; calculating the probability of each sample point being selected as the next cluster center, and selecting the next cluster center according to the roulette method; repeating the selection of cluster centers until K cluster centers are selected; using the selected K cluster centers as initial values, calculating the distance to the K initial cluster centers for each remaining row in the TF-IDF weight two-dimensional matrix of each feature word, and calculating the distance to the K initial cluster centers according to the shortest distance. The smallest distance will classify the corresponding question and answer data group into one of the K center points, and store the minimum distance in an array; recalculate the centroids of the K clusters, and compare the newly generated K centroids with the cluster center points calculated last time. If the distances are all less than the convergence threshold, calculate the average distance from all sample points in any cluster to the center point according to the array as the average distance within the corresponding cluster, and calculate the distance between all any two center points. When the distance between any two center points is less than the average distance within the corresponding two clusters, merge the corresponding two clusters to obtain the clustering result; otherwise, if the number of iterations is greater than N, adjust the number of clusters K=K+K / 2 and re-cluster to obtain the clustering result.

2. The method according to claim 1, characterized in that Preprocessing the target text to obtain a feature vector of the target text includes: Segmenting the target text to obtain a target segmentation set; Stop words in the target word segmentation set are removed to obtain a feature vector of the target text.

3. The method according to claim 1, characterized in that Preprocess each set of question and answer data in the question and answer knowledge set to obtain feature vectors of multiple sets of question and answer data, including: Segmenting the question text and the answer text in each set of question and answer data to obtain a segmentation set for each set of question and answer data; Stop words in the word segmentation set of each group of question and answer data are removed to obtain a feature vector of each group of question and answer data.

4. The method according to claim 1, characterized in that: According to the clustering result, the cluster labels of each cluster are determined, including: Arrange the feature words contained in the target cluster in descending order according to the TF-IDF value of the feature words; A preset number of feature words before sorting are used as cluster labels of the target cluster.

5. The method according to claim 1, characterized in that: After obtaining the classification result of the question-answer knowledge set based on the clustering result and the cluster labels of each cluster, the method further includes: The classification results of the question-answer knowledge set are displayed in the search interface.

6. A data query device, characterized in that: include: A receiving module, used for receiving a target text input by a target user; A preprocessing module, used for preprocessing the target text to obtain a feature vector of the target text; A first determination module is used to determine a target cluster label according to a feature vector of the target text; wherein the target cluster label is used to indicate the category to which the target text belongs; A second determination module, configured to determine a query result corresponding to the target text based on the feature vector of the target text and the target cluster label; The device is also used to: obtain a question-answering knowledge set from a target database; wherein the question-answering knowledge set includes multiple groups of question-answering data, and each group of question-answering data includes a question text and an answer text; pre-process each group of question-answering data in the question-answering knowledge set to obtain feature vectors of the multiple groups of question-answering data; calculate the TF-IDF weight two-dimensional matrix of each feature word in the feature vector of each group of question-answering data; perform cluster analysis using a K-means clustering algorithm based on the TF-IDF weight two-dimensional matrix of each feature word in the feature vector of each group of question-answering data to obtain a clustering result; wherein the clustering result includes multiple cluster centers, and each cluster center corresponds to a cluster; according to the clustering result, determine the cluster labels of each cluster; based on the clustering result and the cluster labels of each cluster, obtain a classification result of the question-answering knowledge set; The clustering result is determined by the following method: setting a clustering convergence threshold Delta and a maximum number of iterations N; randomly selecting a set of question-answer data from the question-answer knowledge set as the initial cluster center point; calculating the shortest distance between each row in the TF-IDF weight two-dimensional matrix of each feature word and the current existing cluster center; calculating the probability of each sample point being selected as the next cluster center, and selecting the next cluster center according to the roulette method; repeating the selection of cluster centers until K cluster centers are selected; using the selected K cluster centers as initial values, calculating the distance to the K initial cluster centers for each remaining row in the TF-IDF weight two-dimensional matrix of each feature word, and calculating the distance to the K initial cluster centers according to the shortest distance. The smallest distance will classify the corresponding question and answer data group into one of the K center points, and store the minimum distance in an array; recalculate the centroids of the K clusters, and compare the newly generated K centroids with the cluster center points calculated last time. If the distances are all less than the convergence threshold, calculate the average distance from all sample points in any cluster to the center point according to the array as the average distance within the corresponding cluster, and calculate the distance between all any two center points. When the distance between any two center points is less than the average distance within the corresponding two clusters, merge the corresponding two clusters to obtain the clustering result; otherwise, if the number of iterations is greater than N, adjust the number of clusters K=K+K / 2 and re-cluster to obtain the clustering result.

7. A data query device, characterized in that: The method comprises a processor and a memory for storing processor-executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 5 when executing the instructions.

8. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed, the steps of the method according to any one of claims 1 to 5 are implemented.