A data query method and device
Through knowledge graph matching and data topic rating optimization query, the problems of low efficiency and insufficient flexibility of data query in the database are solved, and multi-dimensional data query and efficient retrieval are realized.
Patent Information
- Application Number
- CN202410943165.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-15
AI Technical Summary
In the era of big data, there is a lot of data in the database, and it is difficult for users to quickly extract effective data information when querying. The query results of existing technology are single, inefficient, and lack flexibility and intelligence.
By obtaining the user's query corpus, after word segmentation, matching with the pre-constructed knowledge graph, generating search tags, forming search fields, and generating data quality vectors based on the rating of the data topic, sorting the search fields to optimize query results.
It improves the flexibility and intelligence of data query, can query multi-dimensional data, and prioritizes high-quality data based on data quality, improving query efficiency.
Smart Images

Figure CN118467572B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of information query, and in particular to a data query method and device. Background Art
[0002] In the era of big data, databases contain a large amount of data. When users query the required data, it is difficult to quickly and centrally extract effective data information from the database.
[0003] Currently, users can query required data based on relational databases, but this requires high accuracy of user input, resulting in relatively simple query results, low data query efficiency, and lack of flexibility and intelligence. Summary of the invention
[0004] The present application proposes a data query method and device, which improves the data query series and increases flexibility and intelligence.
[0005] In a first aspect, an embodiment of the present application proposes a data query method, which is applied to a server, and the method includes:
[0006] Obtain query corpus from users;
[0007] Segmenting the query corpus to obtain at least one conceptual word and at least one non-conceptual word;
[0008] Matching the target concept word with the label concept word in the pre-constructed knowledge graph to obtain at least one search tag, wherein the target concept word is any one of the at least one concept word, and the at least one search tag is the label concept word associated with the target concept word in the knowledge graph;
[0009] Composing a plurality of search fields based on the at least one search tag and the at least one non-concept word;
[0010] Rating the data topics based on the data content of the data topics in the database, generating a data quality vector corresponding to each data topic, wherein the data quality vector is used to evaluate the reliability of the data topic, and the higher the value of the data quality vector, the higher the reliability of the data topic;
[0011] sorting the plurality of search fields based on the plurality of data quality vectors to obtain a search field sequence, wherein in the search field sequence, the higher the value of the data quality vector is, the more the search field related to the corresponding data subject is positioned at the front;
[0012] Query the database based on the search field sequence to obtain at least one search data, wherein the at least one search data is a data subject in the database;
[0013] A feedback result is generated according to the at least one retrieval data to answer the query corpus.
[0014] In a second aspect, an embodiment of the present application provides a data query device, which is applied to a server, and the device includes:
[0015] An acquisition unit, used for acquiring query corpus from a user;
[0016] A word segmentation unit, used for performing word segmentation on the query corpus to obtain at least one conceptual word and at least one non-conceptual word;
[0017] A matching unit, used for matching a target concept word with a label concept word in a pre-constructed knowledge graph to obtain at least one search tag, wherein the target concept word is any one of the at least one concept word, and the at least one search tag is a label concept word in the knowledge graph associated with the target concept word;
[0018] A composition unit, configured to compose a plurality of search fields based on the at least one search tag and the at least one non-concept word;
[0019] A rating unit, used to rate the data subject based on the data content of the data subject in the database, and generate a data quality vector corresponding to each data subject, wherein the data quality vector is used to evaluate the reliability of the data subject, and the higher the value of the data quality vector, the higher the reliability of the data subject;
[0020] a sorting unit, configured to sort the plurality of search fields based on the plurality of data quality vectors to obtain a search field sequence, wherein in the search field sequence, the higher the value of the data quality vector is, the higher the search field related to the corresponding data subject is;
[0021] A query unit, configured to query the database based on the search field sequence to obtain at least one search data;
[0022] A generating unit is used to generate a feedback result according to the at least one retrieval data, wherein the feedback result is used to answer the query corpus.
[0023] In a third aspect, an embodiment of the present application proposes a server, comprising a processor, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the one or more programs include instructions for executing the steps in the method as described above.
[0024] In a fourth aspect, an embodiment of the present application proposes a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute any of the methods described above.
[0025] It can be seen that in this example, the server first obtains the query corpus from the user, then performs word segmentation on the query corpus to obtain at least one concept word and at least one non-concept word, and then matches the target concept word with the label concept word in the pre-built knowledge graph to obtain at least one retrieval tag, the target concept word is any one of the at least one concept word, and at least one retrieval tag is a label concept word associated with the target concept word in the knowledge graph, and then multiple retrieval fields are formed based on at least one retrieval tag and at least one non-concept word, and then the data subject is rated based on the data content of the data subject in the database, and a data quality vector corresponding to each data subject is generated, and then multiple retrieval fields are sorted based on the multiple data quality vectors to obtain a retrieval field sequence, and then the database is queried based on the retrieval field sequence to obtain at least one retrieval data, and finally a feedback result is generated based on the at least one retrieval data to answer the query corpus.
[0026] In this way, the concept words in the query corpus are obtained through the knowledge graph to obtain the search tags related to the concept words, and then the search tags and non-concept words are combined into search fields, and the data topics in the database can be rated to form the corresponding data quality vector. Then, the search fields can be sorted according to the data quality vector, so that the search fields with the most reliable search results can be queried first, and finally the database is queried according to the sorted search field sequence to generate feedback results. The knowledge graph enriches the query corpus, allowing users to query multi-dimensional data, and can prioritize the retrieval of high-quality data based on data quality, which improves the efficiency of data query and improves the flexibility and intelligence of data query. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 It is a structural block diagram of a server provided in an embodiment of the present application;
[0029] Figure 2 It is a flowchart of a data query method provided in an embodiment of the present application;
[0030] Figure 3 It is a block diagram of the functional units of a data query device provided in an embodiment of the present application;
[0031] Figure 4It is a block diagram of the functional units of another data query device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0034] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0035] In the embodiments of the present application, "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B can represent the following three situations: A exists alone; A and B exist at the same time; B exists alone. Among them, A and B can be singular or plural.
[0036] In the embodiment of the present application, the symbol " / " can indicate that the objects associated with each other are in an "or" relationship. In addition, the symbol " / " can also indicate a division sign, that is, performing a division operation. For example, A / B can indicate A divided by B.
[0037] In the embodiments of the present application, "equal to" can be used in conjunction with greater than, and is applicable to the technical solution adopted when greater than, and can also be used in conjunction with less than, and is applicable to the technical solution adopted when less than. When equal to is used in conjunction with greater than, it is not used in conjunction with less than; when equal to is used in conjunction with less than, it is not used in conjunction with greater than.
[0038] Currently, users can query required data based on relational databases, but this requires high accuracy of user input, resulting in relatively simple query results, low data query efficiency, and lack of flexibility and intelligence.
[0039] In view of the above problems, the present application proposes a data query method and device, and the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0040] Please participate Figure 1 , Figure 1 is a structural block diagram of a server provided in an embodiment of the present application. Figure 1As shown, the server 10 may include one or more of the following components: a processor 101, a memory 102, a communication interface 103, and one or more programs 104, wherein the one or more programs 104 are stored in the memory 102 and are configured to be executed by the processor 101, and the one or more programs 104 include functions for executing any step in the following scheme. In a specific implementation, the processor 101 is used to execute any step performed by an electronic device in the following method embodiment, and when performing data transmission such as sending, the communication interface 103 may be selectively called to complete the corresponding operation. The server 10 may specifically be a server, or a server cluster composed of several servers, or a cloud computing service center. Among them, the processor 101 may include one or more processing cores. The processor 101 uses various interfaces and lines to connect various parts within the entire server 10, and executes various functions and processes data of the server 10 by running or executing instructions, programs, code sets or instruction sets stored in the memory 102, and calling data stored in the memory 102. Optionally, the processor 101 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 101 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It is understandable that the above-mentioned modem may not be integrated into the processor 101, but may be implemented separately through a communication chip. Among them, the memory 102 may include a random access memory (RAM) or a read-only memory (ROM). The memory 102 can be used to store instructions, programs, codes, code sets, or instruction sets. The memory 102 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the server 10 during use, etc. It is understandable that the server 10 may include more or fewer structural elements than those in the above-mentioned structural block diagram, which is not limited here.
[0041] A data query method provided by an embodiment of the present application is introduced below.
[0042] Please participate Figure 2 , Figure 2 Schematic diagram of a data query method provided by an embodiment of the present application. Figure 1 In the server 10 shown, Figure 2 The data query method comprises:
[0043] S201, obtaining query corpus from a user.
[0044] S202: Segment the query corpus to obtain at least one conceptual word and at least one non-conceptual word.
[0045] The query corpus may be a sentence input by the user. For example, when a user wants to query certain data, the query corpus may be "What is the asset of Bank A in 2022"; or when a user wants to query an analysis report, the query corpus may be "Financial analysis report of Bank A in 2022".
[0046] Among them, conceptual words can refer to words with clear meanings that can independently express a certain concept or category, and non-conceptual words refer to words that do not directly express a specific concept. Non-conceptual words can be place names, institution names, or time expressions, etc. For example, conceptual words can be "assets" and "current assets". "Assets" and "current assets" have specific meanings in the financial field, referring to the financial resources of an enterprise and the assets that can be converted into cash in the short term; non-conceptual words can be "Bank A", "time", and "region". "Bank A" is a specific bank name, and "time" and "region" are more general words that do not directly express a specific concept, but they have grammatical functions such as connection and limitation in sentences.
[0047] Among them, there are many ways to segment the query corpus, for example, it can be segmented based on dictionary matching, based on statistical models, or based on neural network models, and it can also be segmented using tools such as Jieba segmenter. For example, when the query corpus entered by the user is "How many patients were hospitalized for heart disease in Hospital B in 2022", the query corpus is segmented, and the conceptual words obtained are "heart disease", "hospitalization", and "number of patients", and the non-conceptual words are "2022" and "Hospital B". By segmenting the query into conceptual words and non-conceptual words, the user's query intent can be understood more accurately.
[0048] S203, matching the target concept word with the label concept word in the pre-constructed knowledge graph to obtain at least one search label.
[0049] Among them, the target concept word is any one of the at least one concept word, and the at least one search tag is a tag concept word associated with the target concept word in the knowledge graph.
[0050] S204: forming a plurality of search fields based on the at least one search tag and the at least one non-concept word.
[0051] S205, rating the data topics based on the data contents of the data topics in the database, and generating a data quality vector corresponding to each data topic.
[0052] Among them, from the above, it can be seen that the search tags corresponding to the concept word "heart disease" are "cardiovascular disease" and "heart disease", and the non-concept words are "2022" and "Hospital B". The search field sequence can be "The number of inpatients with heart disease in Hospital B in 2022" or "The number of inpatients with cardiovascular disease in Hospital B in 2022".
[0053] The data quality vector is used to evaluate the reliability of the data subject. The higher the value of the data quality vector is, the higher the reliability of the data subject is.
[0054] S206: Sort the multiple search fields based on the multiple data quality vectors to obtain a search field sequence.
[0055] Among them, in the retrieval field sequence, the higher the value of the data quality vector, the higher the retrieval field related to the corresponding data subject. For example, the value of the data quality vector of "heart disease" is 8, and the value of the data quality vector of "cardiovascular disease" is 10, indicating that the quality of "cardiovascular disease" is higher and more reliable. The above retrieval fields can be sorted, and the resulting retrieval field sequence can be {"The number of inpatients with cardiovascular disease in Hospital B in 2022", "The number of inpatients with heart disease in Hospital B in 2022"}. In this way, it can be ensured that the most relevant and reliable data are given priority. The ability to prioritize retrieval of high-quality data based on data quality improves data query efficiency and improves the flexibility and intelligence of data query.
[0056] S207: query the database based on the search field sequence to obtain at least one search data.
[0057] Wherein, the at least one retrieval data is a data subject in the database.
[0058] Among them, when querying the database, you can first query the database according to the first search field of the search field sequence to obtain the corresponding search data. For example, the search field sequence is {"the number of inpatients with cardiovascular disease in Hospital B in 2022", "the number of inpatients with heart disease in Hospital B in 2022"}, you can first query the database according to "the number of inpatients with cardiovascular disease in Hospital B in 2022" to obtain the first search data, and then query the database according to "the number of inpatients with heart disease in Hospital B in 2022" to obtain the second search data. In this way, querying the database according to the optimized search field improves the data query efficiency, and through the precise query mechanism, the system reduces the processing of irrelevant data, improves the efficiency of resource utilization, and improves the data query efficiency.
[0059] S208: Generate a feedback result according to the at least one search data to answer the query corpus.
[0060] It can be seen that in this example, the concept words in the query corpus are obtained through the knowledge graph to obtain the search tags related to the concept words, and then the search tags and non-concept words are combined into search fields, and the data topics in the database can be rated to form the corresponding data quality vector. Then, the search fields can be sorted according to the data quality vector, so that the search fields with the most reliable search results can be queried first, and finally, the database is queried according to the sorted search field sequence to generate feedback results. The knowledge graph enriches the query corpus, allowing users to query multi-dimensional data, and can prioritize the retrieval of high-quality data based on data quality, which improves the efficiency of data query and improves the flexibility and intelligence of data query.
[0061] In a possible embodiment, the knowledge graph also includes a semantic primitive space, and the matching of the target concept word with the label concept word in the pre-constructed knowledge graph to obtain at least one retrieval tag includes: projecting the target concept word to the semantic primitive space to obtain a first semantic primitive vector; mapping the label concept word to the semantic primitive space to obtain a second semantic primitive vector; matching and calculating the first semantic primitive vector and the second semantic primitive vector to obtain a matching value, wherein the matching value is used to indicate the degree of association between the label concept word and the target concept word; if the matching value is greater than a first preset threshold, using the label concept word as a retrieval tag.
[0062] Among them, the semantic space is the smallest indivisible semantic space that represents the semantic unit. The semantic space contains several semantics, and a concept word can be composed of several semantics. For example, in the financial field, the definition of "asset" refers to the resources formed by the company's past transactions or events, owned or controlled by the company, and expected to bring economic benefits to the company. Resources that cannot bring economic benefits cannot be used as assets and are the rights of the enterprise; the definition of "current assets" refers to assets that can be converted into cash or consumed within one year or one operating cycle of more than one year, including cash, bank deposits, short-term investments, accounts receivable and prepaid, deferred expenses, inventory, etc., so "assets" can be expressed by the following semantic primitives: {enterprise, economic benefits, resources}; "current assets" can be expressed by the following semantic primitives: {within one year, convertible into cash, consumed, assets}; in addition, "resources" belong to the lower-level concept word, and "resources" can be expressed by the following semantic primitives: {region, material}. According to the upper-lower relationship between "assets" and "current assets", the semantic primitive space can be obtained as {enterprise, economic benefits, region, material, within one year, convertible into cash, consumed}. The dimension of the semantic primitive space is the same as the number of semantic primitives. The semantic primitive space is encoded, and the dimension of the semantic primitive space is the same as the number of semantic primitives. Then, according to the projection of the concept word in the semantic primitive space, it is vectorized to form a semantic primitive vector. For example, the concept word C i It can be composed of several sememes, forming {w k}, k = 1, 2, ..., m, where m is an integer greater than 1. Each sememe needs to be mapped to a sememe space of the corresponding dimension, such as W k In the semantic space, the Qth (w k ) bit, Q (w k ) represents a function that maps each sememe to a specific position in the sememe space, then C i The semantic vector of can be expressed as [v1, v2, ..., v n ], where n represents an integer greater than 1, v i =I(Q(W k )=j), i=1,2,…,n, j is an integer starting from 1 and varying to the number of dimensions of the sememe space, I() is an example function used to determine whether the sememe is in the jth position, that is, when Q(w k ) = j, v i =1, otherwise v i = 0. Specifically, the semantic vector of the concept word “asset” is (1,1,1,1,0,0,0), and the semantic vector of the concept word “current assets” is (1,1,1,1,1,1,1,1).
[0063] Among them, the matching calculation of the first sense original vector and the second sense original vector to obtain the matching value can use different similarity or distance measurement methods. For example, the matching value can be the cosine value of the angle between the first sense original vector and the second sense original vector. The closer the cosine value is to 1, the closer the direction of the first sense original vector and the second sense original vector is, the similarity between the target concept word and the label concept word is, and the greater the degree of association is. The closer the cosine value is to -1, the direction of the first sense original vector and the second sense original vector is completely opposite, and the target concept word and the label concept word are opposite. The cosine value is 0, which means that the target concept word and the label concept word are independent. When the target concept word and the label concept word are opposite or independent, it means that the degree of association between the target concept word and the label concept word is small. The larger the matching value, the greater the degree of association between the target concept word and the label concept word. The label concept word can be used as a search tag to expand the multiple expressions of the target concept word. For example, when the concept word is "heart disease", "heart disease" can be matched with the label concept words in the database, and label concept words such as "cardiovascular disease" and "heart disease" can be found as search tags.
[0064] It can be seen that in this example, the relevance expansion of the query corpus input by the user based on the knowledge graph is conducive to further information retrieval and a more accurate understanding of the user's needs, so that the user can query multi-dimensional data, improve the efficiency of data query, and improve the flexibility and intelligence of data query.
[0065] In a possible embodiment, generating a feedback result based on the at least one retrieval data includes: determining a type of the feedback result based on the query corpus, the type of the feedback result including a first type and a second type; when the type of the feedback result is the first type, generating a corresponding feedback result based on the at least one retrieval data.
[0066] Among them, the first type is used to indicate that the feedback result has no calculation process, and the second type is used to indicate that the feedback result has a calculation process. The first type may be that the user wants to query a certain data. For example, when the query corpus is "the number of inpatients with cardiovascular diseases in Hospital B in 2022", it can be determined that the feedback result is of the first type, and the feedback result has no calculation process. The retrieval data is 10,000 people. Then, text content can be generated based on the retrieval data. For example, add the subject, predicate and object to generate the feedback result: The number of inpatients with cardiovascular diseases in Hospital B in 2022 is 10,000 people. The retrieval data is simply processed to form a clear and concise feedback result to answer the user's query corpus, thereby improving the user experience.
[0067] Specifically, when the type of the feedback result is the second type, calculation is performed according to the at least one retrieval data to obtain at least one first calculation result; and a corresponding feedback result is generated based on the at least one first calculation result and the at least one retrieval data.
[0068] Among them, at least one of the first calculation results is a data subject not included in the database. For example, when the query corpus input by the user is "Financial analysis report of Bank A in 2022", the feedback report can be "Bank A's assets in 2022 are X1, Ping An Bank's liabilities in 2022 are X2, and Ping An Bank's debt-to-asset ratio in 2022 is X3", where X1 and X2 can be retrieval data obtained by querying in the database, X3 can be retrieval data obtained by querying in the database, and can also be calculated based on X1 and X2. In addition, based on the above feedback report, analysis content can also be added. For example, in 2022, Bank A's debt-to-asset ratio exceeded X4% of listed companies in the same business field. X4 can be calculated in real time. The specific calculation process is as follows: listed companies can be grouped according to industry or scale, and then the debt-to-asset ratio of Bank A in each group is compared with the debt-to-asset ratio of other listed formulas to determine the ranking of Bank A in each group.
[0069] Among them, the second type can be an analysis report, and the corresponding query result can be the result of superimposing multiple sentences generated by multiple search results. By performing additional calculations on the search data, the system can provide more in-depth analysis results, such as trend prediction, correlation analysis, etc., which can help users make more informed decisions. For example, when the query corpus entered by the user is "B Hospital 2022 Heart Disease Patient Hospitalization Data Analysis Report", the generated feedback result can be "The number of hospitalized heart disease patients in B Hospital in 2022 is 10,000, the average length of stay in B Hospital in 2022 is 7 days, and the main age group of patients is 50-70 years old". The number of hospitalized patients is 10,000, the average length of stay in hospital is 7 days, and the main age group is 50-70 years old. It can be the search result obtained in the database after analysis, matching, combination, sorting, and query operations based on the query corpus. It should be noted that further feedback reports can be obtained based on the search results. For example, the feedback results may also include "Compared with 2021, the number of hospitalized patients with heart disease increased by 15% in 2022, and the proportion of patients aged 50-70 reached 65%, which may be related to the living habits and health status of the population in this age group". By calculating and analyzing the search data, new data knowledge can be discovered, which can provide a more comprehensive perspective, improve resource utilization, and enhance user experience.
[0070] It can be seen that in this example, by determining the type of feedback results and providing personalized information according to the specific needs of users, users can query multi-dimensional data, which improves user experience, improves data query efficiency, and improves the flexibility and intelligence of data query.
[0071] In a possible embodiment, generating feedback results based on the at least one retrieval data includes: generating feedback results based on the number of the at least one retrieval data, wherein when the at least one retrieval data is a first target retrieval data, generating a corresponding feedback result based on the first target retrieval data; when the at least one retrieval data is a plurality of second target retrieval data, performing calculations based on the plurality of second target retrieval data to obtain at least one second calculation result, and generating a corresponding feedback result based on the at least one second calculation result and the plurality of second target retrieval data.
[0072] Among them, the first target retrieval data can be the retrieval data when there is only one retrieval data. For example, when the user's query corpus is "What are the assets of Bank A in 2023", the retrieval data that can be queried is "100 billion", then "100 billion" is the first target retrieval data, and feedback results can be generated based on the first target retrieval data. For example, add subject, predicate and object to generate feedback results: Bank A's assets in 2023 are 100 billion.
[0073] Wherein, the second calculation result is a data subject not included in the database. The second target retrieval data may be retrieval data when there are multiple retrieval data. For example, when the user's query corpus is "Financial analysis report of Bank A in 2023", the retrieval data can be "assets 100 billion" and "liabilities 2 billion", then "assets 100 billion" and "liabilities 2 billion" are the second target retrieval data, and the second calculation result can be generated based on the second target retrieval data. For example, based on "assets 100 billion" and "liabilities 2 billion", the second calculation result "liability ratio 2%" can be obtained. Feedback results can be generated based on the second target retrieval data and the second calculation results. For example, the feedback results that can be generated based on "assets 100 billion", "liabilities 2 billion", and "liability ratio 2%" are: Bank A's assets in 2023 are 100 billion, Bank A's liabilities in 2023 are 2 billion, and Bank A's liability ratio in 2023 is 2%.
[0074] It can be seen that in this example, the corresponding feedback results can be generated according to the number of search data. If there is only one search data, the feedback results can be directly generated based on the search data. If there are multiple search data, calculations can be performed based on these search data to obtain new calculation data, and then feedback results are generated based on these search data and calculation data. According to the different search data, the method of generating feedback results can be flexibly adjusted to meet the needs of different situations, so that users can query multi-dimensional data, improve user experience, improve data query efficiency, and improve the flexibility and intelligence of data query.
[0075] In a possible embodiment, the data subject is rated based on the data content of the data subject in the database to generate a corresponding data quality vector, including: generating a first quality rating according to the authority and vacancy rate of the target data subject; analyzing the data content of the target data subject in terms of richness, fit and knowledge level based on natural language processing (NLP) technology to generate a second quality rating; and performing vectorization processing based on the first quality rating and the second quality rating to obtain the data quality vector.
[0076] The target data subject is any data subject in the database.
[0077] Among them, authority can refer to the reliability and trust of the source of the data subject. Authority can be expressed by an authority score. The higher the authority score, the higher the reliability and trust of the source of the data subject. Specifically, it can be evaluated by analyzing the reputation, history and professionalism of the source institution of the subject data. For example, data published by the most recognized official website is usually considered to be the most authoritative and has the highest authority score. The missing rate can be the proportion of missing values in the subject data. The missing rate can directly calculate the ratio of the number of null values in the data content to the total amount of data content.
[0078] Among them, the first quality rating is generated according to the authority and vacancy rate of the data subject, and the first quality rating can be generated according to the authority score and missing rate of the data subject. The specific calculation formula is as follows:
[0079]
[0080] in, represents the first quality rating, A represents the authoritative score, V represents the missing rate, and V is a value between 0 and 1.
[0081] Among them, richness can be used to evaluate whether the data content contains enough information and whether it can fully reflect the entity or phenomenon being studied. The higher the richness, the more information it contains. Fit can be used to evaluate the relevance of the data content and the data subject. The higher the fit, the greater the relevance of the data content and the data subject. Knowledge level can be used to evaluate the depth and complexity of the information contained in the data content. The higher the knowledge level, the higher the depth and complexity of the information contained in the data content.
[0082] Wherein, the data content is analyzed based on the richness, fit and knowledge level of the data content based on natural language processing (NLP) technology to generate a second quality rating. The richness score, fit score and knowledge level score can be obtained based on the NLP technology, and then the second quality rating is generated according to the richness score, fit score and knowledge level score. The specific calculation formula is as follows:
[0083]
[0084] in, represents the second quality rating, R represents the richness rating, F represents the fit rating, and K represents the knowledge level rating.
[0085] The data quality vector is obtained by vectorizing the first quality rating and the second quality rating. For example, if the first quality rating of the target data topic is 4 and the second quality rating is 8, the data quality vector of the target data topic is [4, 8].
[0086] It can be seen that in this example, starting from the characteristics and content of the data subject, a quantitative data quality rating is obtained through a series of analysis and calculations. By calculating the data quality of the data subject in the database in multiple dimensions, it is helpful to prioritize the query of data with higher data quality, so that users can query multi-dimensional data, improve data query efficiency, and improve the flexibility and intelligence of data query.
[0087] In a possible embodiment, before sorting the multiple search fields based on multiple data quality vectors to obtain a search field sequence, the method further includes: screening the multiple search fields based on the vacancy rate of each search field so that the vacancy rate of the search fields in the search field sequence is higher than a second preset threshold.
[0088] The vacancy rate may refer to the ratio of entries without data (e.g., blank, null, or invalid data) in the search field to the total number of entries in the search field. The second preset threshold may be a threshold set by the user based on experience, or a threshold generated based on a learning model. Before sorting multiple search fields, the vacancy rate of each search field may be calculated. If the vacancy rate of the search field is lower than the second preset threshold, it means that the search field is incomplete and the search field may be eliminated.
[0089] It can be seen that in this example, filtering the search fields according to their vacancy rates can avoid authoritative but incomplete data, so that the search fields are all reliable and complete data, which helps users to query multi-dimensional data, improves user experience, improves data query efficiency, and improves the flexibility and intelligence of data query.
[0090] For the above embodiments, please refer to Figure 3 , Figure 3 1 is a block diagram of the functional units of a data query device provided in an embodiment of the present application. Figure 3 As shown, the data query device 30 includes: an acquisition unit 301, used to acquire a query corpus from a user; a word segmentation unit 302, used to segment the query corpus to obtain at least one concept word and at least one non-concept word; a matching unit 303, used to match a target concept word with a label concept word in a pre-constructed knowledge graph to obtain at least one retrieval tag, wherein the target concept word is any one of the at least one concept word, and the at least one retrieval tag is a label concept word associated with the target concept word in the knowledge graph; a composition unit 304, used to compose a plurality of retrieval fields based on the at least one retrieval tag and the at least one non-concept word; a rating unit 305, used to rank the target concept word based on the number of data topics in the database. The data subject is rated according to the content, and a data quality vector corresponding to each data subject is generated, wherein the data quality vector is used to evaluate the reliability of the data subject, and the higher the value of the data quality vector is, the higher the reliability of the data subject is; a sorting unit 306 is used to sort the multiple search fields based on multiple data quality vectors to obtain a search field sequence, in which the higher the value of the data quality vector is, the closer the search field related to the corresponding data subject is to the front; a query unit 307 is used to query the database based on the search field sequence to obtain at least one search data; a generating unit 308 is used to generate a feedback result based on the at least one search data, and the feedback result is used to answer the query corpus.
[0091] In a possible embodiment, the knowledge graph also includes a semantic primitive space. In matching the target concept word with the label concept word in the pre-constructed knowledge graph to obtain at least one retrieval tag, the matching unit 303 is specifically used to: project the target concept word to the semantic primitive space to obtain a first semantic primitive vector; map the label concept word to the semantic primitive space to obtain a second semantic primitive vector; match the first semantic primitive vector and the second semantic primitive vector to obtain a matching value, and the matching value is used to indicate the degree of association between the label concept word and the target concept word; if the matching value is greater than a first preset threshold, use the label concept word as a retrieval tag.
[0092] In a possible embodiment, in terms of generating a feedback result based on the at least one retrieval data, the generating unit 308 is specifically used to: determine a type of the feedback result based on the query corpus, the type of the feedback result including a first type and a second type, the first type being used to indicate that the feedback result has no calculation process, and the second type being used to indicate that the feedback result has a calculation process; when the type of the feedback result is the first type, generate a corresponding feedback result based on the at least one retrieval data.
[0093] In a possible embodiment, the generation unit 308 is specifically used to: when the type of the feedback result is the second type, perform calculations based on the at least one retrieval data to obtain at least one first calculation result, and the at least one first calculation result is a data subject not included in the database; generate a corresponding feedback result based on the at least one first calculation result and the at least one retrieval data.
[0094] In a possible embodiment, in terms of generating feedback results based on the at least one retrieval data, the generation unit 308 is specifically further used to: generate feedback results based on the number of the at least one retrieval data, wherein when the at least one retrieval data is a first target retrieval data, a corresponding feedback result is generated based on the first target retrieval data; when the at least one retrieval data is a plurality of second target retrieval data, calculation is performed based on the plurality of second target retrieval data to obtain at least one second calculation result, the second calculation result is a data subject not included in the database, and a corresponding feedback result is generated based on the at least one second calculation result and the plurality of second target retrieval data.
[0095] In a possible embodiment, in terms of rating the data subject based on the data content of the data subject in the database and generating the corresponding data quality vector, the rating unit 305 is specifically used to: generate a first quality rating based on the authority and vacancy rate of the target data subject, where the target data subject is any data subject in the database; generate a second quality rating by analyzing the data content of the target data subject in terms of richness, fit and knowledge level based on natural language processing (NLP) technology; and perform vectorization processing based on the first quality rating and the second quality rating to obtain the data quality vector.
[0096] It can be understood that since the method embodiment and the device embodiment are different presentation forms of the same technical concept, the content of the method embodiment part in this application should be synchronously adapted to the device embodiment part and will not be repeated here.
[0097] In the case of integrated units, such as Figure 4 As shown, Figure 4 This is a block diagram of the functional units of another data query device provided by an embodiment of the present application. Figure 4 In the embodiment, the data query device 30 includes a communication module 311 and a processing module 312. The processing module 312 is used to control and manage the actions of the device, for example, to execute the steps of the acquisition unit 301, the word segmentation unit 302, the matching unit 303, the composition unit 304, the rating unit 305, the sorting unit 306, the query unit 307 and the generation unit 308, and / or to execute other processes of the technology described herein. The communication module 311 is used to support the interaction between the device and other devices. Figure 4 As shown, the data query device 30 may further include a storage module 313, and the storage module 313 is used to store program codes and data of the device.
[0098] Among them, the processing module 312 can be a processor or a controller, for example, it can be a central processing unit (CPU), a general processor, a digital signal processor (DSP), an ASIC, an FPGA or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute various exemplary logic boxes, modules and circuits described in combination with the contents disclosed in this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of DSP and microprocessor, and so on. The communication module 311 can be a transceiver, an RF circuit or a communication interface, etc. The storage module 313 can be a memory. Among them, all relevant contents of each scenario involved in the above method embodiments can be referred to the functional description of the corresponding functional module, which will not be repeated here. The above data query devices can all execute the above Figure 2 The data query method shown.
[0099] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media sets. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium may be a solid-state hard disk.
[0100] An embodiment of the present application also provides a computer storage medium, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, part or all of the steps of any method recorded in the above method embodiments are implemented.
[0101] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0102] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0103] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0104] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0105] The above integrated unit implemented in the form of software functional unit can be stored in a computer-readable storage medium. The above software functional unit is stored in a storage medium and includes several instructions for a computer device to execute.
[0106] Part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a volatile memory or a non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), sync link DRAM (SLDRAM) and direct memory bus random access memory (DMARAM), among other media that can store program code.
[0107] Although the present invention is disclosed as above, the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions without departing from the spirit and scope of the present invention, and can make various changes and modifications, including the combination of the above-mentioned different functions and implementation steps, including software and hardware implementation methods, all of which are within the scope of protection of the present invention.
Claims
1. A data query method, characterized in that: Applied to a server, the method comprises: Obtain query corpus from users; Segmenting the query corpus to obtain at least one conceptual word and at least one non-conceptual word; Matching the target concept word with the label concept word in the pre-constructed knowledge graph to obtain at least one search tag, wherein the target concept word is any one of the at least one concept word, and the at least one search tag is the label concept word associated with the target concept word in the knowledge graph; Composing a plurality of search fields based on the at least one search tag and the at least one non-concept word; The first quality rating is generated based on the authority score and missing rate of the data subject in the database. The specific calculation formula is as follows: in, represents the first quality rating, represents the authoritativeness score, represents the missing rate, the A value between 0 and 1; A second quality rating is generated based on the richness score, fit score, and knowledge level score of the data subject, and the specific calculation formula is as follows: in, represents the second quality rating, represents the richness score, represents the fit score, represents the knowledge level score; Vectorizing the first quality rating and the second quality rating to obtain a data quality vector, wherein the data quality vector is used to evaluate the reliability of the data subject, and the higher the value of the data quality vector is, the higher the reliability of the data subject is; sorting the plurality of search fields based on the plurality of data quality vectors to obtain a search field sequence, wherein in the search field sequence, the higher the value of the data quality vector is, the more the search field related to the corresponding data subject is positioned at the front; Query the database based on the search field sequence to obtain at least one search data, wherein the at least one search data is a data subject in the database; generating a feedback result according to the at least one search data to answer the query corpus; The knowledge graph further includes a semantic space, and the target concept word is matched with a label concept word in a pre-constructed knowledge graph to obtain at least one search label, including: Projecting the target concept word into the semantic primitive space to obtain the first semantic primitive vector; Mapping the label concept word to the sememe space to obtain a second sememe vector; Performing matching calculation on the first semantic primitive vector and the second semantic primitive vector to obtain a matching value, wherein the matching value is used to indicate the degree of association between the label concept word and the target concept word; If the matching value is greater than a first preset threshold, the tag concept word is used as a search tag; The step of generating a feedback result according to the at least one search data comprises: Determine the type of the feedback result according to the query corpus, the type of the feedback result including a first type and a second type, the first type is used to indicate that the feedback result has no calculation process, and the second type is used to indicate that the feedback result has a calculation process; When the type of the feedback result is the first type, generating a corresponding feedback result according to the at least one search data; Wherein, when the type of the feedback result is the second type, performing calculation according to the at least one search data to obtain at least one first calculation result, the at least one first calculation result being a data subject not included in the database; A corresponding feedback result is generated based on the at least one first calculation result and the at least one search data.
2. The method according to claim 1, characterized in that The generating of the feedback result according to the at least one retrieval data further comprises: A feedback result is generated according to the quantity of the at least one retrieval data, wherein when the at least one retrieval data is a first target retrieval data, a corresponding feedback result is generated according to the first target retrieval data; when the at least one retrieval data is a plurality of second target retrieval data, calculation is performed according to the plurality of second target retrieval data to obtain at least one second calculation result, the second calculation result is a data subject not included in the database, and a corresponding feedback result is generated according to the at least one second calculation result and the plurality of second target retrieval data.
3. The method according to claim 1 or 2, characterized in that: Before sorting the multiple search fields based on the multiple data quality vectors to obtain a search field sequence, the method further includes: The plurality of search fields are screened based on the vacancy rate of each search field, so that the vacancy rate of the search fields in the search field sequence is higher than a second preset threshold.
4. A data query device, characterized in that: Applied to a server, the device comprises: An acquisition unit, used for acquiring query corpus from a user; A word segmentation unit, used for performing word segmentation on the query corpus to obtain at least one conceptual word and at least one non-conceptual word; A matching unit, used for matching a target concept word with a label concept word in a pre-constructed knowledge graph to obtain at least one search tag, wherein the target concept word is any one of the at least one concept word, and the at least one search tag is a label concept word in the knowledge graph associated with the target concept word; A composition unit, configured to compose a plurality of search fields based on the at least one search tag and the at least one non-concept word; The rating unit is used to generate the first quality rating based on the authority score and missing rate of the data subject in the database. The specific calculation formula is as follows: in, represents the first quality rating, represents the authoritativeness score, represents the missing rate, the A value between 0 and 1; A second quality rating is generated based on the richness score, fit score, and knowledge level score of the data subject, and the specific calculation formula is as follows: in, represents the second quality rating, represents the richness score, represents the fit score, represents the knowledge level score; Vectorizing the first quality rating and the second quality rating to obtain a data quality vector, wherein the data quality vector is used to evaluate the reliability of the data subject, and the higher the value of the data quality vector is, the higher the reliability of the data subject is; a sorting unit, configured to sort the plurality of search fields based on the plurality of data quality vectors to obtain a search field sequence, wherein in the search field sequence, the higher the value of the data quality vector is, the higher the search field related to the corresponding data subject is; A query unit, configured to query the database based on the search field sequence to obtain at least one search data; A generating unit, configured to generate a feedback result according to the at least one retrieval data, wherein the feedback result is used to answer the query corpus; The knowledge graph further includes a semantic space, and the target concept word is matched with a label concept word in a pre-constructed knowledge graph to obtain at least one search label, including: Projecting the target concept word into the semantic primitive space to obtain the first semantic primitive vector; Mapping the label concept word to the sememe space to obtain a second sememe vector; Performing matching calculation on the first semantic primitive vector and the second semantic primitive vector to obtain a matching value, wherein the matching value is used to indicate the degree of association between the label concept word and the target concept word; If the matching value is greater than a first preset threshold, the tag concept word is used as a search tag; The step of generating a feedback result according to the at least one search data comprises: Determine the type of the feedback result according to the query corpus, the type of the feedback result including a first type and a second type, the first type is used to indicate that the feedback result has no calculation process, and the second type is used to indicate that the feedback result has a calculation process; When the type of the feedback result is the first type, generating a corresponding feedback result according to the at least one search data; Wherein, when the type of the feedback result is the second type, performing calculation according to the at least one search data to obtain at least one first calculation result, the at least one first calculation result being a data subject not included in the database; A corresponding feedback result is generated based on the at least one first calculation result and the at least one search data.
5. A server, characterized in that: The method comprises a processor, a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the one or more programs include instructions for executing the steps in the method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: A computer program is stored, wherein the computer program enables a computer to execute the method according to any one of claims 1 to 3.
