A data query method and device, electronic equipment and storage medium
By identifying the target query statement, subject, and requirements in the question-answering system, and generating and merging the result set, the problem of inaccurate recall content is solved, and higher retrieval accuracy and efficiency are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GEEKBANG TECH LTD
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-09
AI Technical Summary
In existing question-and-answer systems, the inaccuracy of the recalled content makes it difficult to improve the recall accuracy.
By determining the target query statement, identifying the target query subject and requirements, generating a first result set and a second result set, and combining the two to integrate subject relationships and vector similarity, the accuracy of the search results is improved.
By comprehensively utilizing the first and second result sets, the accuracy and efficiency of data querying are improved, ensuring the accuracy of the retrieval results.
Smart Images

Figure CN122173536A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data retrieval technology, and in particular to a data query method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of generative artificial intelligence technology, question answering systems are widely used in scenarios such as enterprise knowledge bases and intelligent search.
[0003] In existing technologies, question-answering systems typically represent text content using vectorization and retrieve relevant content through vector similarity. However, this retrieval method often suffers from inaccurate content retrieval, making improving retrieval accuracy a key challenge for current question-answering systems. Summary of the Invention
[0004] This invention provides a data query method, apparatus, electronic device, and storage medium to solve the problem that traditional recall methods are difficult to improve recall accuracy.
[0005] According to one aspect of the present invention, a data query method is provided, the method comprising: Determine the target query statement; Based on the target query statement, determine the target query subject and the target query requirements; Based on the target query requirements, a first result set is determined; the first result set is the knowledge data corresponding to the target query statement, and the knowledge data is a sub-data of the total data. Based on the target query subject, determine the second result set; the second result is the relationship to which the target query subject belongs and the sub-data corresponding to that relationship. Based on the first result set and the second result set, determine the target query result corresponding to the target query statement.
[0006] According to another aspect of the present invention, a data query apparatus is provided, the apparatus comprising: The query statement determination module is used to determine the target query statement; The query parsing module is used to determine the target query body and target query requirements based on the target query statement; The first result generation module is used to determine the first result set based on the target query requirements; the first result is the knowledge data corresponding to the target query statement, and the knowledge data is a sub-data of the total data; The second result generation module is used to determine the second result set based on the target query subject; the second result is the relationship to which the target query subject belongs and the sub-data corresponding to that relationship; The query result generation module is used to determine the target query result corresponding to the target query statement based on the first result set and the second result set.
[0007] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and A memory that is communicatively connected to at least one processor; wherein, The memory stores a computer program that can be executed by at least one processor, such that the at least one processor is able to perform the data query method of any embodiment of the present invention.
[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions for causing a processor to execute and implement the data query method of any embodiment of the present invention.
[0009] The technical solution of this invention involves determining a target query statement; determining the target query subject and target query requirements based on the target query statement; determining a first result set based on the target query requirements; determining a second result set based on the target query subject; and determining the target query results corresponding to the target query statement based on the first and second result sets. This integrates the first and second result sets, thereby fusing the subject relationship and the vector similarity of the data, thus improving the accuracy of the retrieval results.
[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart of a data query method provided according to Embodiment 1 of the present invention; Figure 2 This is a flowchart of another data query method provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the structure of a data query device according to Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device that implements the data query method of this invention. Detailed Implementation
[0013] 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.
[0014] 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.
[0015] Example 1 Figure 1 This is a flowchart illustrating a data query method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations requiring data retrieval with guaranteed accuracy. The method can be executed by a data query device, which can be implemented in hardware and / or software and can be configured in an electronic device with data processing capabilities. Figure 1 As shown, the method includes: S110. Determine the target query statement.
[0016] A query statement can be a statement used to describe the content to be queried. The query content can be videos, books, tables, audio, etc., and this application does not impose any restrictions on this. A query statement can consist of keywords and logical connectives, or it can be one or more sentences expressed in spoken or written language. Logical connectives can be symbols used to indicate the logical relationship between keywords, including but not limited to symbols representing AND, OR, and NOT.
[0017] To determine the target query statement, you can directly receive the query statement in text format sent by the user, or you can receive the voice message sent by the user and convert the voice message into text format.
[0018] S120. Based on the target query statement, determine the target query subject and the target query requirements.
[0019] The query subject can be any element contained within the query statement. When the target query statement is one or more sentences expressed in spoken or written language, the subject includes, but is not limited to, occupation, book title, content, and date. When the target query statement consists of keywords and logical connectors, the subject can be keywords. The query requirement can be the content to be retrieved as described in the query statement. The query requirement can be partial data of the content to be retrieved or keywords to be searched.
[0020] After obtaining the target query statement, semantic understanding can be performed on the target query statement to identify the target query subject and target query requirements, and subsequent queries can be performed accordingly.
[0021] This includes determining the target query subject and target query requirements based on the target query statement, including: If the number of characters in the target query statement is greater than the preset number, the target query statement will be semantically segmented to generate at least two target subqueries. Perform semantic understanding on the subquery statement to generate the target subquery body and target subquery requirements; The target subquery body and target subquery requirements corresponding to each subquery statement are merged to generate the target query body and target query requirements.
[0022] During the query process, some users often enter long target query statements to ensure the accuracy of the query results. This may cause some query systems to be unable to quickly and accurately understand the target query statements entered by users, resulting in problems such as large deviations in the data query process or query results.
[0023] To address this, we can first determine whether the number of characters in the target query statement exceeds a preset number, thereby determining whether the target query statement needs to be split. If the number of characters in the target query statement exceeds the preset number, it is considered that the target query statement is too long, which may lead to problems such as large deviations in the data query process or query results. In this case, the target query statement is split to generate at least two target subqueries.
[0024] When splitting the target query statement, it can be done using methods such as punctuation splitting or length limit splitting.
[0025] For example, if the target query is "query the quarterly report of the sales department last year", then the semantic understanding of "query the quarterly report of the sales department last year" will be performed to determine that the target query requirement is "the quarterly report of the sales department last year", and the target query subject is "last year and sales department and quarterly report".
[0026] The segmentation of the target query statement using punctuation marks includes: Identify the punctuation marks in the target query statement; If a target punctuation mark exists, the target query statement will be split at the target punctuation mark. The target punctuation mark can be a pre-defined symbol, such as ";", "、", and ".". This application does not restrict the setting of the target punctuation mark.
[0027] For example, if the target query is "Query the quarterly reports of the sales department last year; the quarterly reports of the sales department this year; and the budget reports of the sales department next year", then the query will be divided into three sub-queries: "Query the quarterly reports of the sales department last year; the quarterly reports of the sales department this year; and the budget reports of the sales department next year" based on the semicolon ";".
[0028] The segmentation of the target query statement using length-limited segmentation includes: Divide the target query statement into target subqueries of the same length.
[0029] In addition to dividing based on target punctuation marks, target query statements can also be divided based on length. For this, the target character length can be preset, and the target query statement can be divided into target subqueries with the same character length in sequence.
[0030] In addition to using the two division methods individually, the two methods can also be used in combination.
[0031] Among these, determining the target query subject and target query requirements based on the target query statement also includes: If the number of characters in the target query statement is less than the preset number, the subquery statement is semantically understood to generate the target query body and target query requirements.
[0032] If the number of characters in the target query statement is less than the preset number, the query statement can be directly semantically understood to determine the target query subject and the target query requirements.
[0033] S130. Based on the target query requirements, determine the first result set; the first result set is the knowledge data corresponding to the target query statement, and the knowledge data is a sub-data of the total data.
[0034] After obtaining the target query requirements, you can search the total data in the database to obtain the sub-data that meets the target query requirements.
[0035] In practical use, there may be multiple results that meet the target query requirements. In this case, multiple first results can be identified, thus forming the first result set.
[0036] Optionally, based on the target query requirements, a first result set is determined, including: Generate a target query vector based on the target query requirements; Based on the target query vector, determine the first result corresponding to the target query vector and the weight coefficient corresponding to the first result in the total data; Construct a first result set based on each first result and its corresponding weight coefficient.
[0037] Optionally, based on the target query vector, determine the first result corresponding to the target query vector and the weight coefficient corresponding to the first result in the total data.
[0038] To improve query efficiency, vector similarity can be used to determine the similarity during the query process.
[0039] In response, after obtaining the target query requirements, a target query vector that needs to be compared for similarity is generated according to the target query requirements. Then, the sub-data with a similarity greater than the preset similarity to the target query vector is found in the total data and used as the first data. The weight coefficient of each first data can be determined based on the similarity between each first data.
[0040] The principle behind matching using vector similarity is that a piece of text can be converted into vectors, and the more semantically similar two sentences are, the higher their vector similarity. For example, "cats catch mice" and "cats catch mice" have a high vector similarity.
[0041] Vector similarity can be calculated by using methods such as cosine similarity and Euclidean distance.
[0042] Cosine similarity is used to determine whether two vectors have the same direction, and its value ranges from -1 to 1. The closer the value is to 1, the more similar they are. For example, the vector describing "sunny day" [0.9, 0.1, 0.05] and the vector describing "bright sun" [0.88, 0.12, 0.03] have a cosine similarity close to 1. Euclidean distance focuses on the straight-line distance between two vectors in space; the smaller the distance, the more similar they are.
[0043] The weighting coefficients can be determined by the vector similarity between each first result and the target query vector, including: Determine the vector similarity between each first result and the target query vector; The weight coefficients of each first result are obtained by normalizing the vector similarity between each first result and the target query vector.
[0044] Optionally, based on the target query vector, determine the first result corresponding to the target query vector in the total data, including: Based on the target query vector, determine several candidate first results from the total data; From all the candidate first results, determine the first result; the first result is the candidate first result whose similarity to the target query vector is greater than the preset similarity.
[0045] When performing the first result query, some candidate first results are obtained from the target query vector. Each candidate first result has a similarity to the target query vector. At this time, in order to further determine a more accurate first result, the candidate first result with a similarity greater than the preset similarity is selected from each candidate result as the first result, thereby improving the efficiency and accuracy of the first result determination.
[0046] S140. Based on the target query subject, determine the second result set; the second result set is the relationship to which the target query subject belongs and the sub-data corresponding to that relationship.
[0047] After obtaining the target query subject, a relation retrieval can be performed based on the target query subject to determine the relationship related to the target query subject, identify the sub-data corresponding to each subject under the relationship, and use each sub-data as the second result set.
[0048] To improve search accuracy, subjects and subject relationships can be introduced during the search process, which can further enhance the accuracy of the final search results.
[0049] S150. Based on the first result set and the second result set, determine the target query result corresponding to the target query statement.
[0050] After obtaining the first result set and the second result set, since the first result in the first result set is determined based on vector similarity, and the second result in the second result set is the relationship with the target query subject and the sub-data corresponding to the relationship, the first result set and the second result set can be combined to obtain a more accurate query result, which can be used as the target query result.
[0051] By determining the target query result corresponding to the target query statement based on the first result set and the second result set, the first result set and the second result set can be integrated to fuse the subject relationship and the vector similarity of the data, thereby improving the accuracy of the retrieval results.
[0052] The technical solution of this application involves determining the target query statement; determining the target query subject and target query requirements based on the target query statement; determining the first result set based on the target query requirements; determining the second result set based on the target query subject; and determining the target query results corresponding to the target query statement based on the first result set and the second result set. This integrates the subject relationship and the vector similarity of the data, thereby improving the accuracy of the retrieval results.
[0053] Example 2 Figure 2 This invention provides a flowchart of another data query method. Based on the above embodiments, this embodiment further optimizes the process of determining the target query result corresponding to the target query statement based on the first result set and the second result set in the aforementioned embodiments. This embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 2 As shown, the data query method in this embodiment may include the following steps: S210. Determine the target query statement.
[0054] S220. Based on the target query statement, determine the target query subject and the target query requirements.
[0055] S230. Based on the target query requirements, determine the first result set; the first result set is the knowledge data corresponding to the target query statement, and the knowledge data is a sub-data of the total data.
[0056] S240. Based on the target query subject, determine the second result set; the second result is the relationship to which the target query subject belongs and the sub-data corresponding to that relationship.
[0057] S250. If the sub-data corresponding to the second result contains the first result, then increase the weight coefficient of the first result.
[0058] S260. If the sub-data corresponding to the second result does not contain the first result, then reduce the weight coefficient of the first result.
[0059] After obtaining the first result set and the second result set, if the second result set contains the first result, it can be determined that both the target query subject and the target query requirement have retrieved the result. In this case, the weight coefficient of the first result can be directly increased.
[0060] For example, if the target query is "query the quarterly reports of the sales department last year", and the first result set contains both "the quarterly reports of the sales department last year" and "the quarterly reports of the human resources department the year before last", and the second result set contains multiple tables associated with the sales department, then if the second result set contains multiple tables that include "the quarterly reports of the sales department last year", the weighting coefficient of "the quarterly reports of the sales department last year" in the first result set can be increased.
[0061] After obtaining the first result set and the second result set, if the second result set does not contain the first result, it can be determined that only the target query requirement has retrieved the result. In this case, the weight coefficient of the first result can be directly reduced.
[0062] For example, if the target query is "query the quarterly reports of the sales department last year", and the first result set contains both "the quarterly reports of the sales department last year" and "the quarterly reports of the human resources department the year before last", and the second result set contains multiple tables associated with the sales department, then if the second result set contains multiple tables that include "the quarterly reports of the sales department last year", the weighting coefficient of "the quarterly reports of the human resources department the year before last" in the first result set can be reduced.
[0063] S270. Determine the target query result corresponding to the target query statement based on the weight coefficients of each first result.
[0064] After obtaining the weight coefficients of each first result, the target query result corresponding to the target query statement can be selected from each first result based on the weight coefficients of each first result.
[0065] Optionally, based on the weight coefficients of each first result, the target query result corresponding to the target query statement is determined, including: Based on the weight coefficients of each first result, sort the first results to generate a sequence of first results; Based on the first result sequence, determine the target query result corresponding to the target query statement.
[0066] To more clearly determine whether each first result better matches the target query result corresponding to the target query statement, the first results can be sorted according to their weight coefficients to obtain a sequence of first results.
[0067] For example, if three first results are obtained, namely A, B and C, with the weight coefficient of first result A being 0.5, the weight coefficient of first result B being 0.3 and the weight coefficient of first result C being 0.2, it can be determined that the weight coefficient of first result A is greater than the weight coefficient of first result B, and the weight coefficient of first result B is greater than the weight coefficient of first result C, thus obtaining the first result sequence of first result C → first result B → first result A.
[0068] After obtaining the first result sequence, the target query result corresponding to the target query statement can be selected from it according to the actual situation.
[0069] Optionally, based on the first result sequence, the target query result corresponding to the target query statement is determined, including: The first result in the first result sequence located at the first preset position is determined as the target query result corresponding to the target query statement.
[0070] In some cases, multiple first results may be required to facilitate user selection. In such cases, the first results located in the preset positions can all be used as the target query results corresponding to the target query statement, so that users can freely choose according to their own needs after receiving the target query results corresponding to these target query statements.
[0071] By determining the first result in the first result sequence at the first preset position as the target query result corresponding to the target query statement, multiple first results are provided to the user to meet the user's needs as much as possible, so that the user can choose the first result according to their own needs.
[0072] Optionally, after determining the first result in the first result sequence located at a preset position as the target query result corresponding to the target query statement, the method further includes: Determine the contextual relationships and degree of information redundancy among the various first results; If there are at least two first results that have a contextual relationship, then the first results that have a contextual relationship will be merged. If at least two first results have a degree of information duplication greater than a preset level, then the first results with a degree of information duplication greater than the preset level will be merged.
[0073] In some cases, the first results of a query may have a contextual relationship. If the first results are only presented separately, the information in the query results may be incomplete. Therefore, it is necessary to determine the contextual relationship between the first results to see if there is a contextual relationship between them. When it is determined that some first results have a contextual relationship, the first results with a contextual relationship can be merged so that the first results presented to the user can contain as much of the data that the user needs as possible.
[0074] In some cases, the first search results may contain a high degree of information duplication. This can lead to overly similar results, potentially exposing users to a large number of identical or similar results simultaneously, negatively impacting the user experience. To address this, the degree of information duplication among the first results can be determined. By assessing the level of information overlap between each first result, it can be determined whether at least two results are identical or excessively similar. If at least two results exhibit a degree of information duplication exceeding a preset threshold, these results are considered excessively similar and are merged to reduce the number of first results pushed to the user.
[0075] By determining the contextual relationship and information duplication degree of each first result; if there are at least two first results with a contextual relationship, then the first results with a contextual relationship are merged; if there are at least two first results with an information duplication degree greater than a preset degree, then the first results with an information duplication degree greater than the preset degree are merged, which can merge first results with a contextual relationship, thereby improving the accuracy of search results. Furthermore, by merging first results with an information duplication degree greater than the preset degree, the problem of too many identical or similar search results affecting user selection can be avoided.
[0076] Optionally, based on the first result sequence, the target query result corresponding to the target query statement is determined, including: The first result in the first result sequence is taken as the target query result corresponding to the target query statement.
[0077] In some cases, users may need to refine their filtering. In this case, they can select only the first result in the first result sequence as the target query result for the target query statement.
[0078] Optionally, after determining the target query subject and target query requirements based on the target query statement, the following steps are also included: Determine the target permissions of the target object corresponding to the target query statement; Determine the target query subject and the corresponding query permissions for the target query requirements; If the target's permissions are less than those of the target query subject and the corresponding query permissions, then the query for the target query statement will be stopped.
[0079] Since different users have different permissions, permission checks are still required.
[0080] First, determine the target object's permissions and the permissions of the content the target object is querying. Then, determine whether the target object's permissions are sufficient to query the content the target object is querying. If it is determined that the target object's permissions are insufficient to query the content the target object is querying, then stop querying the target query statement.
[0081] For example, if the target object has a target permission of 3 and the content queried by the target object requires a permission of 2, then since the target object's target permission is greater than the required permission of the content queried by the target object, the target object will be allowed to continue querying.
[0082] By determining the target permissions of the target object corresponding to the target query statement; determining the query permissions corresponding to the target query subject and the target query requirements; and stopping the query for the target query statement if the target permissions are less than the query permissions corresponding to the target query subject and the target query requirements, it is possible to ensure that users do not access data that they do not have permission to access, thereby ensuring data security.
[0083] The technical solution of this application involves: determining a target query statement; determining the target query subject and target query requirements based on the target query statement; determining a first result set based on the target query requirements; the first result being the knowledge data corresponding to the target query statement, where the knowledge data is a sub-data of the total data; determining a second result set based on the target query subject; the second result being the relationship to which the target query subject belongs and the sub-data corresponding to that relationship; if the sub-data corresponding to the second result contains the first result, then the weight coefficient of the first result is increased; if the sub-data corresponding to the second result does not contain the first result, then the weight coefficient of the first result is decreased; and determining the target query result corresponding to the target query statement based on the weight coefficients of each first result, thereby achieving the fusion of the first result set and the second result set, and thus improving the accuracy of the retrieval results.
[0084] Example 3 Figure 3 This invention provides a structural block diagram of a data query device, applicable to situations requiring data retrieval with guaranteed accuracy. The data query device can be implemented in hardware and / or software and can be configured in an electronic device with data processing capabilities. Figure 3As shown, the data query device of this embodiment may include: a query determination statement module 310, a query statement parsing module 320, a first result generation module 330, a second result generation module 340, and a query result generation module 350. Wherein: The query statement determination module 310 is used to determine the target query statement; The query parsing module 320 is used to determine the target query body and target query requirements based on the target query statement; The first result generation module 330 is used to determine the first result set based on the target query requirements; the first result is the knowledge data corresponding to the target query statement, and the knowledge data is a sub-data of the total data; The second result generation module 340 is used to determine the second result set based on the target query subject; the second result is the relationship to which the target query subject belongs and the sub-data corresponding to that relationship; The query result generation module 350 is used to determine the target query result corresponding to the target query statement based on the first result set and the second result set.
[0085] Based on the above embodiments, optionally, a first result set is determined based on the target query requirements, including: Generate a target query vector based on the target query requirements; Based on the target query vector, determine the first result corresponding to the target query vector and the weight coefficient corresponding to the first result in the total data; Construct a first result set based on each first result and its corresponding weight coefficient.
[0086] Based on the above embodiments, optionally, determining a first result corresponding to the target query vector in the total data according to the target query vector includes: Based on the target query vector, determine several candidate first results from the total data; From all the candidate first results, determine the first result; the first result is the candidate first result whose similarity to the target query vector is greater than the preset similarity.
[0087] Based on the above embodiments, optionally, the target query result corresponding to the target query statement is determined based on the first result set and the second result set, including: If the sub-data corresponding to the second result contains the first result, then increase the weight coefficient of the first result; If the sub-data corresponding to the second result does not contain the first result, then reduce the weight coefficient of the first result; Based on the weight coefficients of each first result, the target query result corresponding to the target query statement is determined.
[0088] Based on the above embodiments, optionally, the target query result corresponding to the target query statement is determined according to the weight coefficients of each first result, including: Based on the weight coefficients of each first result, sort the first results to generate a sequence of first results; Based on the first result sequence, determine the target query result corresponding to the target query statement.
[0089] Based on the above embodiments, optionally, determining the target query result corresponding to the target query statement according to the first result sequence includes: The first result in the first result sequence located at the first preset position is determined as the target query result corresponding to the target query statement.
[0090] Based on the above embodiments, optionally, determining the target query result corresponding to the target query statement according to the first result sequence includes: The first result in the first result sequence is taken as the target query result corresponding to the target query statement.
[0091] The data query device provided in this embodiment of the invention can execute the data query method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0092] Example 4 Figure 4 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0093] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0094] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0095] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as data querying methods.
[0096] In some embodiments, the data query method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the data query method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the data query method by any other suitable means (e.g., by means of firmware).
[0097] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0098] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0099] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0100] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0101] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0102] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0103] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0104] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A data query method, characterized in that, include: Determine the target query statement; Based on the target query statement, the target query subject and target query requirements are determined; Based on the target query requirements, a first result set is determined; The first result is the knowledge data corresponding to the target query statement, and the knowledge data is a sub-data of the total data; Based on the target query subject, a second result set is determined; The second result is the relationship to which the target query subject belongs and the sub-data corresponding to that relationship; Based on the first result set and the second result set, the target query result corresponding to the target query statement is determined.
2. The method according to claim 1, characterized in that, Based on the target query requirements, a first result set is determined, including: Generate a target query vector based on the target query requirements; Based on the target query vector, determine the first result corresponding to the target query vector and the weight coefficient corresponding to the first result from the total data; The first result set is constructed based on each first result and its corresponding weight coefficient.
3. The method according to claim 2, characterized in that, Based on the target query vector, a first result corresponding to the target query vector is determined from the total data, including: Based on the target query vector, several candidate first results are determined from the total data; From all candidate first results, a first result is determined; the first result is a candidate first result whose similarity to the target query vector is greater than a preset similarity.
4. The method according to claim 2, characterized in that, Based on the first result set and the second result set, the target query result corresponding to the target query statement is determined, including: If the sub-data corresponding to the second result contains the first result, then increase the weight coefficient of the first result; If the sub-data corresponding to the second result does not contain the first result, then reduce the weight coefficient of the first result; Based on the weight coefficients of each of the first results, the target query result corresponding to the target query statement is determined.
5. The method according to claim 4, characterized in that, Based on the weight coefficients of each of the first results, the target query result corresponding to the target query statement is determined, including: Based on the weight coefficients of each first result, sort the first results to generate a sequence of first results; Based on the first result sequence, the target query result corresponding to the target query statement is determined.
6. The method according to claim 5, characterized in that, Based on the first result sequence, the target query result corresponding to the target query statement is determined, including: The first result in the first result sequence located at the first preset position is determined as the target query result corresponding to the target query statement.
7. The method according to claim 5, characterized in that, Based on the first result sequence, the target query result corresponding to the target query statement is determined, including: The first result in the first result sequence is taken as the target query result corresponding to the target query statement.
8. A data query device, characterized in that, include: The query statement determination module is used to determine the target query statement; The query statement parsing module is used to determine the target query subject and target query requirements based on the target query statement; The first result generation module is used to determine a first result set based on the target query requirements; The first result is the knowledge data corresponding to the target query statement, and the knowledge data is a sub-data of the total data; The second result generation module is used to determine a second result set based on the target query subject; The second result is the relationship to which the target query subject belongs and the sub-data corresponding to that relationship; The query result generation module is used to determine the target query result corresponding to the target query statement based on the first result set and the second result set.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data query method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the data query method according to any one of claims 1-7.