Data table searching method and device, storage medium and electronic equipment
By converting the query corpus into text vectors and using inverted indexes to query data table identifiers, the problem of poor flexibility in classification models is solved, and the flexibility and accuracy of data table queries are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-03-16
- Publication Date
- 2026-05-19
AI Technical Summary
Existing classification models that rely on a large number of training samples have poor flexibility when querying data tables and cannot be effectively implemented in business scenarios.
The query corpus of the data query request is converted into text vectors, and vectors with high similarity are retrieved in the target retrieval library. The inverted index is used to query the data table identifier to avoid model retraining.
It improves the flexibility and accuracy of data table queries, reduces the model update cycle, and enhances query efficiency.
Smart Images

Figure CN116467340B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of financial technology, and more specifically, to a method, apparatus, storage medium, and electronic device for retrieving data tables. Background Technology
[0002] Traditional SQL (Structured Query Language, a standard computer language for accessing and manipulating databases) translation techniques are typically based on known data tables. Algorithm systems need to determine the data table the user needs to query based on the user's natural dialogue.
[0003] In related technologies, determining the data table that a user needs to query is usually based on a classification model. However, classification models rely on a large amount of labeled data. Furthermore, when a user needs to add a new data table, the classification model needs to be retrained before it can query the data table that the user needs. This process is time-consuming, so the classification model algorithm cannot be effectively implemented in business scenarios.
[0004] There is currently no effective solution to the above problems. Summary of the Invention
[0005] This invention provides a data table retrieval method, apparatus, storage medium, and electronic device to at least solve the technical problem in related technologies where querying a user's desired data table based on a classification model trained with a large number of training samples results in poor flexibility.
[0006] According to one aspect of the present invention, a data table retrieval method is provided, comprising: responding to a data query request of a target object, converting the query corpus of the data query request into a text vector; retrieving the text vector in a target retrieval library to obtain N first vectors, wherein N is an integer greater than 1; determining a query result based on the similarity between the text vector and each of the first vectors, wherein the query result includes at least: a data table identifier of the data table queried by the data query request.
[0007] Further, determining the query result based on the similarity between the text vector and each of the first vectors includes: calculating the similarity between the text vector and each of the first vectors to obtain N vector similarities; determining whether the similarity of each vector is greater than a preset similarity threshold, and taking the first vector whose similarity is greater than the preset similarity threshold as the second vector; querying the data table identifier associated with the second vector through an inverted index; and determining the query result based on the data table identifier associated with the second vector.
[0008] Furthermore, the inverted index includes at least the association between the target corpus and the data table identifier. Querying the data table identifier associated with the second vector through the inverted index includes: determining the target corpus associated with the second vector; and querying the data table identifier corresponding to the target corpus through the inverted index to obtain the data table identifier associated with the second vector.
[0009] Furthermore, after determining the query result based on the data table identifier associated with the second vector, the method further includes: inserting the data table identifier associated with the second vector and the query corpus into the inverted index; and inserting the text vector into the target retrieval database.
[0010] Further, the similarity between the text vector and each of the first vectors is calculated to obtain N vector similarities, including: calculating the cosine distance between the text vector and each of the first vectors; and determining the N vector similarities based on the cosine distance between the text vector and each of the first vectors.
[0011] Furthermore, before determining the query result based on the similarity between the text vector and each of the first vectors, the method further includes: obtaining the correspondence between historical corpus and each data table identifier, wherein the historical corpus includes at least: relevant corpus of the financial services industry; using the historical corpus as the key of a hash table and the data table identifier corresponding to the historical corpus as the value of the hash table to establish the inverted index.
[0012] Further, determining the query result based on the data table identifier associated with the second vector also includes: determining whether the number of data table identifiers associated with the second vector is greater than a preset value; if the number of data table identifiers associated with the second vector is greater than the preset value, performing deduplication processing on the data table identifiers associated with the second vector, and filtering the data table identifiers obtained after deduplication processing to obtain the query result.
[0013] Further, converting the query corpus of the data query request into a text vector includes: inputting the query corpus of the data query request into a text vectorization model and outputting the text vector.
[0014] According to another aspect of the present invention, a data table retrieval apparatus is also provided, comprising: a conversion unit, configured to convert the query corpus of the data query request into a text vector in response to a data query request of a target object; a retrieval unit, configured to retrieve the text vector in a target retrieval library to obtain N first vectors, wherein N is an integer greater than 1; and a determination unit, configured to determine a query result based on the similarity between the text vector and each of the first vectors, wherein the query result includes at least: a data table identifier of the data table queried by the data query request.
[0015] Further, the determining unit includes: a calculation subunit, used to calculate the similarity between the text vector and each of the first vectors to obtain N vector similarities; a processing subunit, used to determine whether the similarity of each vector is greater than a preset similarity threshold, and to take the first vector whose similarity is greater than the preset similarity threshold as the second vector; a query subunit, used to query the data table identifier associated with the second vector through an inverted index; and a determining subunit, used to determine the query result based on the data table identifier associated with the second vector.
[0016] Furthermore, the inverted index includes at least the association between the target corpus and the data table identifier, and the query subunit includes: a determination module, used to determine the target corpus associated with the second vector; and a query module, used to query the data table identifier corresponding to the target corpus through the inverted index to obtain the data table identifier associated with the second vector.
[0017] Furthermore, the determining unit further includes: a first insertion subunit, used to insert the data table identifier associated with the second vector and the query corpus into the inverted index after determining the query result based on the data table identifier associated with the second vector; and a second insertion subunit, used to insert the text vector into the target retrieval database.
[0018] Furthermore, the calculation subunit includes: a calculation module for calculating the cosine distance between the text vector and each of the first vectors; and a determination module for determining the similarity of N vectors based on the cosine distance between the text vector and each of the first vectors.
[0019] Furthermore, the data table retrieval device further includes: an acquisition unit, configured to acquire the correspondence between historical corpus and each data table identifier before determining the query result based on the similarity between the text vector and each of the first vectors, wherein the historical corpus includes at least: relevant corpus of the financial services industry; and an establishment unit, configured to use the historical corpus as the key of a hash table and the data table identifier corresponding to the historical corpus as the value of the hash table to establish the inverted index.
[0020] Furthermore, the determining subunit also includes: a judgment module, used to judge whether the number of data table identifiers associated with the second vector is greater than a preset value; and a processing module, used to perform deduplication processing on the data table identifiers associated with the second vector when the number of data table identifiers associated with the second vector is greater than the preset value, and to filter the data table identifiers obtained after deduplication processing to obtain the query result.
[0021] Furthermore, the conversion unit includes an input-output subunit, used to input the query corpus of the data query request into the text vectorization model and output the text vector.
[0022] According to another aspect of the present invention, an electronic device is also provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform a method for retrieving a data table of any of the above-mentioned items by executing the executable instructions.
[0023] According to another aspect of the present invention, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program controls the device where the computer-readable storage medium is located to execute the data table retrieval method of any of the above-mentioned methods when it is running.
[0024] In this invention, in response to a data query request from a target object, the query corpus of the data query request is converted into text vectors; the text vectors are retrieved from the target retrieval database to obtain N first vectors, where N is an integer greater than 1; based on the similarity between the text vectors and each first vector, the query result is determined, wherein the query result includes at least: the data table identifier of the data table requested in the data query request. This solves the technical problem of poor flexibility in related technologies that rely on classification models trained with a large number of training samples to query the data table requested by the user. In this invention, by converting the query corpus into text vectors and retrieving them based on the target retrieval database, the data table requested by the target object is determined, avoiding the need to retrain the model after updating the data table, which results in poor flexibility. This improves the flexibility of data table queries. Attached Figure Description
[0025] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0026] Figure 1 This is a flowchart of an optional data table retrieval method according to an embodiment of the present invention;
[0027] Figure 2 This is a flowchart of an optional data table retrieval initialization process according to an embodiment of the present invention;
[0028] Figure 3 This is a flowchart of another optional data table retrieval method according to an embodiment of the present invention;
[0029] Figure 4This is a schematic diagram of an optional data table retrieval device according to an embodiment of the present invention;
[0030] Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0031] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0032] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0033] It should be noted that the data table retrieval method and apparatus in this disclosure can be used in the financial technology field when querying data tables, and can also be used in any field other than the financial technology field when querying data tables. This disclosure does not limit the application field of the data table retrieval method and apparatus.
[0034] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, corpus data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0035] Example 1
[0036] According to an embodiment of the present invention, an optional data table retrieval method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0037] Figure 1 This is a flowchart of an optional data table retrieval method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0038] Step S101: In response to the data query request of the target object, the query corpus of the data query request is converted into a text vector.
[0039] The aforementioned data query request can be a query request for querying a data table in the field of credit business, and the aforementioned query corpus can be a query statement. In this embodiment, the query corpus can be converted into text vectors through a text vectorization model.
[0040] Step S102: Retrieve text vectors in the target retrieval database to obtain N first vectors, where N is an integer greater than 1.
[0041] The aforementioned target retrieval library can store text vectors corresponding to multiple data query statements. Since in related technologies, the query statements for querying the same data table may be different, and the converted text vectors may also be different, but the query statements for querying the same data table have similarities, when retrieving text vectors in the aforementioned target retrieval library, multiple retrieval results can be obtained. That is, multiple vectors similar to the text vectors corresponding to the query request can be found in the target retrieval library. In order to improve query efficiency, the first N vectors found can be taken as the aforementioned N first vectors.
[0042] Step S103: Determine the query results based on the similarity between the text vector and each first vector, wherein the query results include at least the data table identifier of the data table requested in the data query request.
[0043] In this embodiment, the first vectors among N first vectors whose similarity to the text vector is greater than a preset similarity threshold can be selected based on the similarity between the text vector and each first vector. The query results can then be determined based on the data table associated with the first vectors whose similarity is greater than the preset similarity threshold.
[0044] In this embodiment, after determining the data table associated with the first vector whose similarity is greater than the preset similarity threshold, the data table associated with the first vector can be filtered to improve the accuracy of the query results.
[0045] Through the above steps, in this embodiment, by converting the query corpus into text vectors and performing a retrieval based on the target retrieval database, the data table for the target object query is determined. This avoids the situation where retraining the model after updating the data table is required, resulting in poor flexibility, as is the method of querying the data table needed by the user through a classification model. This improves the flexibility of querying the data table. Furthermore, it solves the technical problem of poor flexibility in related technologies that rely on classification models trained with a large number of training samples to query the data table needed by the user.
[0046] Optionally, the query results are determined based on the similarity between the text vector and each first vector, including: calculating the similarity between the text vector and each first vector to obtain N vector similarities; determining whether the similarity of each vector is greater than a preset similarity threshold, and taking the first vector with a similarity greater than the preset similarity threshold as the second vector; querying the data table identifier associated with the second vector through the inverted index; and determining the query results based on the data table identifier associated with the second vector.
[0047] In related technologies, the query statements for querying the same data table may be different, and the converted text vectors may also be different. However, the query statements for querying the same data table are similar, and the higher the similarity, the greater the probability of querying the same data table. Therefore, in this embodiment, the similarity between the text vector and each first vector can be calculated to obtain N vector similarities. It is then determined whether the similarity of each vector is greater than a preset similarity threshold, and the first vector with a similarity greater than the preset similarity threshold is taken as the second vector.
[0048] The aforementioned inverted index can include historical data query corpora and data table identifiers for each historical data query corpus. In this embodiment, the corpus corresponding to the second vector can be determined first, and then, based on the corpus corresponding to the second vector, the inverted index can be used to query the data table identifier associated with the second vector. If multiple data table identifiers are found, deduplication and filtering can be performed to determine the query results, thereby achieving the technical effect of improving the accuracy of data query.
[0049] Optionally, the inverted index may include at least: the association between the target corpus and the data table identifier, and querying the data table identifier associated with the second vector through the inverted index, including: determining the target corpus associated with the second vector; and querying the data table identifier corresponding to the target corpus through the inverted index to obtain the data table identifier associated with the second vector.
[0050] The aforementioned target corpus may include: historical data query corpus within the target industry. In this embodiment, the target corpus associated with the second vector can be determined; the data table identifier associated with the second vector is obtained by querying the data table identifier corresponding to the target corpus through an inverted index. Specifically, the target corpus associated with the second vector can be determined by the association relationship between each second vector and the query corpus corresponding to each second vector. Then, the data table identifier associated with the second vector is obtained by querying the data table identifier corresponding to the target corpus through an inverted index, thereby achieving the technical effect of improving the query accuracy of data queries.
[0051] Optionally, after determining the query results based on the data table identifier associated with the second vector, the method further includes: inserting the data table identifier associated with the second vector and the query corpus into the inverted index; and inserting the text vector into the target retrieval database.
[0052] To improve the efficiency of subsequent data queries, the inverted index and the target retrieval database can be updated. The data table identifier and query corpus associated with the second vector retrieved in this data query request can be added to the inverted index, and the text vector corresponding to the query corpus can be inserted into the target retrieval database.
[0053] Optionally, the similarity between the text vector and each first vector is calculated to obtain N vector similarities, including: calculating the cosine distance between the text vector and each first vector; and determining the N vector similarities based on the cosine distance between the text vector and each first vector.
[0054] In this embodiment, the aforementioned vector similarity can be calculated by calculating the cosine distance between the text vector and the first vector. Based on the cosine distance between the text vector and each first vector, the aforementioned N vector similarities are determined.
[0055] Optionally, before determining the query results based on the similarity between the text vector and each first vector, the method further includes: obtaining the correspondence between historical data and each data table identifier, wherein the historical data includes at least: relevant data in the financial services industry; using the historical data as the key of the hash table and the data table identifier corresponding to the historical data as the value of the hash table to build an inverted index.
[0056] The aforementioned historical data can be relevant to the financial services industry, including query data related to credit business. To improve the efficiency of data query, the historical data can be used as the key of the hash table, and the data table identifier corresponding to the historical data can be used as the value of the hash table to create an inverted index (used to query records based on attribute values).
[0057] Optionally, determining the query results based on the data table identifiers associated with the second vector further includes: determining whether the number of data table identifiers associated with the second vector is greater than a preset value; if the number of data table identifiers associated with the second vector is greater than the preset value, performing deduplication on the data table identifiers associated with the second vector, and filtering the data table identifiers obtained after deduplication to obtain the query results.
[0058] To avoid having multiple second vectors, resulting in multiple associated data tables, it's possible to determine if the number of associated data table identifiers exceeds a preset value. If the number exceeds this value, the identifiers can be deduplicated. The resulting identifiers are then filtered to obtain the final query result. Filtering methods include, but are not limited to, using preset filtering rules or manual selection to update the associated data table identifiers and achieve the aforementioned query result. This improves the accuracy of data queries.
[0059] Optionally, the query corpus of the data query request can be converted into text vectors, including: inputting the query corpus of the data query request into a text vectorization model and outputting text vectors.
[0060] The text vectorization model mentioned above can be an SBERT (semantic similarity) model. By inputting the query corpus corresponding to the data query request into the text vectorization model, it can output the text vector corresponding to the query corpus.
[0061] It should be noted that, in this embodiment, an initialization process can be performed before retrieving the data table. Figure 2 This is a flowchart of an optional data table retrieval initialization process according to an embodiment of the present invention, such as... Figure 2 As shown, the initialization process may include:
[0062] 1. Construct a text similarity calculation model (corresponding to the text vectorization model mentioned above): Collect similar terminology data in the credit business field, use the open-source SBERT model to train the text vectorization model, and construct the text similarity calculation model mentioned above.
[0063] 2. Collect inline table names (corresponding to the data table identifiers mentioned above) related expressions (sentences), and establish an N:1 relationship between sentences and table names: collect inline phrases (Sentences, such as...) Figure 2 The mapping between the `sent` keyword and the table name (many-to-one) is established, with `Sentence` as the key and `Table` as the corresponding value. An inverted index is then created based on this mapping.
[0064] 3. Calculate the vectorized result of the sentence: The collected in-line phrases are vectorized using a text similarity calculation model to obtain Embeddings (text vectors of in-line phrases).
[0065] 4. Insert the vectorized result of sent into the faiss (similarity search library) module: Insert the Embeddings (text vectors of inline phrases) into the faiss search library (corresponding to the target search library mentioned above).
[0066] Figure 3 This is a flowchart of another optional data table retrieval method according to an embodiment of the present invention, such as... Figure 3 As shown, the search process includes:
[0067] 1. Obtain user query questions (corresponding to the query corpus mentioned above) and calculate the question vectorization result: Convert the received user request query into an Embedding vector (text vector) using a text similarity calculation model.
[0068] 2. Query the top N results in the faiss library: Based on the transformed Embedding vector, retrieve the top K similar vectors (corresponding to the N first vectors mentioned above) in the faiss library, and calculate the similarity between the vectors using cosine distance.
[0069] 3. Determine if the similarity is greater than the preset similarity threshold: Identify the sentence corresponding to the first vector with a similarity greater than the preset similarity threshold (e.g., similarity greater than 0.6), and use the inverted index (e.g., ...) Figure 3 The inverted index in the query query will look up the table name (corresponding to the data table identifier of the second vector association) corresponding to the sent (corresponding to the target corpus of the second vector association mentioned above).
[0070] 4. Vectors with a similarity lower than a preset similarity threshold can be removed. For multiple senders pointing to the same table name, deduplication can be performed. The deduplicated table name will then be recommended to the user for selection.
[0071] 5. User interaction data feedback: The data of the table name selected by the user is recorded in the log through front-end data tracking and used for model feedback training to update the text similarity calculation model. The Sentence (user query question) is inserted into the inverted index and the corresponding Embeddings are inserted into the faiss module (faiss retrieval library).
[0072] This embodiment can be applied to the field of credit (credit loan) business. The data query request can include the data query request of credit business. Through this implementation, the technical effect of improving the retrieval efficiency and accuracy of data table retrieval can be achieved, ensuring the algorithm effect of credit business projects in the cold start stage and the efficient data feedback during the algorithm implementation process.
[0073] Example 2
[0074] Embodiment 2 of this application provides an optional data table retrieval device, wherein each implementation unit in the retrieval device corresponds to each implementation step in Embodiment 1.
[0075] Figure 4 This is a schematic diagram of an optional data table retrieval device according to an embodiment of the present invention, such as... Figure 4 As shown, the retrieval device includes: a conversion unit 41, a retrieval unit 42, and a determination unit 43.
[0076] Specifically, the conversion unit 41 is used to respond to the data query request of the target object and convert the query corpus of the data query request into a text vector;
[0077] The retrieval unit 42 is used to retrieve text vectors in the target retrieval database and obtain N first vectors, where N is an integer greater than 1;
[0078] The determining unit 43 is used to determine the query result based on the similarity between the text vector and each first vector, wherein the query result includes at least: the data table identifier of the data table requested by the data query request.
[0079] In the data table retrieval device provided in Embodiment 2 of this application, the conversion unit 41 responds to the data query request of the target object by converting the query corpus of the data query request into text vectors. The retrieval unit 42 retrieves the text vectors in the target retrieval library to obtain N first vectors, where N is an integer greater than 1. The determination unit 43 determines the query result based on the similarity between the text vectors and each first vector. The query result includes at least the data table identifier of the data table requested by the data query request. This solves the technical problem in related technologies where querying the data table that the user needs to query is based on a classification model trained with a large number of training samples, resulting in poor flexibility. In this embodiment, by converting the query corpus into text vectors and retrieving based on the target retrieval library, the data table that the target object is querying is determined. This avoids the situation where the model needs to be retrained after updating the data table, resulting in poor flexibility, which is the case with the method of querying the data table that the user needs to query through a classification model. This improves the flexibility of querying the data table.
[0080] Optionally, in the data table retrieval device provided in Embodiment 2 of this application, the determining unit 43 includes: a calculation subunit, used to calculate the similarity between the text vector and each first vector to obtain N vector similarities; a processing subunit, used to determine whether the similarity of each vector is greater than a preset similarity threshold, and to take the first vector with a similarity greater than the preset similarity threshold as the second vector; a query subunit, used to query the data table identifier associated with the second vector through an inverted index; and a determining subunit, used to determine the query result based on the data table identifier associated with the second vector.
[0081] Optionally, in the data table retrieval device provided in Embodiment 2 of this application, the inverted index includes at least: the association relationship between the target corpus and the data table identifier, and the query subunit includes: a determination module, used to determine the target corpus associated with the second vector; and a query module, used to query the data table identifier corresponding to the target corpus through the inverted index to obtain the data table identifier associated with the second vector.
[0082] Optionally, in the data table retrieval device provided in Embodiment 2 of this application, the determining unit 43 further includes: a first insertion subunit, used to insert the data table identifier associated with the second vector and the query corpus into the inverted index after determining the query result based on the data table identifier associated with the second vector; and a second insertion subunit, used to insert the text vector into the target retrieval library.
[0083] Optionally, in the data table retrieval device provided in Embodiment 2 of this application, the calculation subunit includes: a calculation module for calculating the cosine distance between the text vector and each first vector; and a determination module for determining the similarity of N vectors based on the cosine distance between the text vector and each first vector.
[0084] Optionally, in the data table retrieval device provided in Embodiment 2 of this application, the data table retrieval device further includes: an acquisition unit, used to acquire the correspondence between historical data and each data table identifier before determining the query result based on the similarity between the text vector and each first vector, wherein the historical data includes at least: relevant data of the financial services industry; and an establishment unit, used to establish an inverted index by using the historical data as the key of a hash table and the data table identifier corresponding to the historical data as the value of the hash table.
[0085] Optionally, in the data table retrieval device provided in Embodiment 2 of this application, the determining subunit further includes: a judging module, used to judge whether the number of data table identifiers associated with the second vector is greater than a preset value; and a processing module, used to perform deduplication processing on the data table identifiers associated with the second vector when the number of data table identifiers associated with the second vector is greater than the preset value, and to filter the data table identifiers obtained after deduplication processing to obtain query results.
[0086] Optionally, in the data table retrieval device provided in Embodiment 2 of this application, the conversion unit includes: an input-output subunit, used to input the query corpus of the data query request into the text vectorization model and output the text vector.
[0087] The data table retrieval device described above may also include a processor and a memory. The conversion unit 41, retrieval unit 42, determination unit 43, etc., are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize the corresponding functions.
[0088] The aforementioned processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured. By adjusting kernel parameters, the query corpus is converted into text vectors, and a search is performed based on the target retrieval library to determine the target object query data table. This avoids the inflexibility of retraining the model after updating the data table, which is a common practice in classification models. This significantly improves the flexibility of querying the data table.
[0089] The aforementioned memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0090] According to another aspect of the present invention, an electronic device is also provided, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform a method for retrieving a data table of any of the above-mentioned items by executing the executable instructions.
[0091] According to another aspect of the present invention, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program controls the device where the computer-readable storage medium is located to execute the data table retrieval method of any of the above-mentioned methods when it is running.
[0092] Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present invention, such as... Figure 5 As shown, an embodiment of the present invention provides an electronic device 50, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements a method for retrieving a data table as described above.
[0093] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0094] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0095] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0096] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0097] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0098] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0099] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for retrieving data from a data table, characterized in that, include: In response to a data query request from a target object, the query corpus of the data query request is converted into a text vector, wherein the data query request is a request to query a data table; The text vector is retrieved in the target retrieval library to obtain N first vectors, where N is an integer greater than 1. The first vector is the vector corresponding to the discourse statement of the table name in the target retrieval library, and the discourse statement is the expression corresponding to the table name. Based on the similarity between the text vector and each of the first vectors, a query result is determined, wherein the query result includes at least: the data table identifier of the data table queried in the data query request; Based on the similarity between the text vector and each of the first vectors, the query results are determined, including: Calculate the similarity between the text vector and each of the first vectors to obtain N vector similarity scores; Determine whether the similarity of each vector is greater than a preset similarity threshold, and take the first vector whose similarity is greater than the preset similarity threshold as the second vector; The data table identifier associated with the second vector is retrieved using the inverted index; The query result is determined based on the data table identifier associated with the second vector; The inverted index includes at least the association between the target corpus and the data table identifier. Querying the data table identifier associated with the second vector through the inverted index includes: Determine the target corpus associated with the second vector; The data table identifier associated with the second vector is obtained by querying the data table identifier corresponding to the target corpus through the inverted index; The relationship between the target corpus and the data table identifier is many-to-one.
2. The retrieval method according to claim 1, characterized in that, After determining the query result based on the data table identifier associated with the second vector, the method further includes: Insert the data table identifier associated with the second vector and the query corpus into the inverted index; Insert the text vector into the target retrieval database.
3. The retrieval method according to claim 1, characterized in that, Calculate the similarity between the text vector and each of the first vectors to obtain N vector similarities, including: Calculate the cosine distance between the text vector and each of the first vectors; The similarity of N vectors is determined based on the cosine distance between the text vector and each of the first vectors.
4. The retrieval method according to claim 1, characterized in that, Before determining the query result based on the similarity between the text vector and each of the first vectors, the method further includes: Obtain the correspondence between historical data and each data table identifier, wherein the historical data includes at least: relevant data from the financial services industry; The inverted index is established by using the historical corpus as the key of the hash table and the data table identifier corresponding to the historical corpus as the value of the hash table.
5. The retrieval method according to claim 1, characterized in that, Determining the query result based on the data table identifier associated with the second vector also includes: Determine whether the number of data table identifiers associated with the second vector is greater than a preset value; If the number of data table identifiers associated with the second vector is greater than a preset value, the data table identifiers associated with the second vector are deduplicated, and the data table identifiers obtained after deduplication are filtered to obtain the query result.
6. The retrieval method according to claim 1, characterized in that, Converting the query corpus of the data query request into a text vector includes: The query corpus of the data query request is input into the text vectorization model, and the text vector is output.
7. A data table retrieval device, characterized in that, include: A conversion unit is used to respond to a data query request from a target object and convert the query corpus of the data query request into a text vector, wherein the data query request is a request to query a data table; The retrieval unit is used to retrieve the text vector in the target retrieval library to obtain N first vectors, where N is an integer greater than 1, and the first vectors are vectors corresponding to the discourse sentences of the table names in the target retrieval library, and the discourse sentences are the expressions corresponding to the table names; A determining unit is configured to determine a query result based on the similarity between the text vector and each of the first vectors, wherein the query result includes at least: the data table identifier of the data table queried in the data query request; The determining unit includes: a calculation subunit, used to calculate the similarity between the text vector and each of the first vectors to obtain N vector similarities; a processing subunit, used to determine whether the similarity of each vector is greater than a preset similarity threshold, and to take the first vector whose similarity is greater than the preset similarity threshold as the second vector; a query subunit, used to query the data table identifier associated with the second vector through an inverted index; and a determining subunit, used to determine the query result based on the data table identifier associated with the second vector. The inverted index includes at least the association between the target corpus and the data table identifier. The query sub-unit includes: a determination module for determining the target corpus associated with the second vector; and a query module for querying the data table identifier corresponding to the target corpus through the inverted index to obtain the data table identifier associated with the second vector. The relationship between the target corpus and the data table identifier is many-to-one.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform the data table retrieval method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the data table retrieval method according to any one of claims 1 to 6.