A data retrieval method based on smart city government data
By acquiring input data from target personnel, setting conditional judgment functions, and performing keyword matching, combined with machine learning models and semantic search, the problem of the inability to quickly and accurately retrieve smart city government data in existing technologies has been solved. This has enabled efficient and accurate data retrieval and resource optimization, improving the user experience and data utilization rate of the data sharing platform.
Patent Information
- Application Number
- CN202510713716.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2045-05-30
AI Technical Summary
Existing data retrieval methods based on smart city government data cannot determine whether target users can quickly and accurately determine their query conditions, nor can they provide auxiliary retrieval analysis based on the input of the querying user. As a result, the querying user cannot quickly and accurately find the required documents, and the database stores a large amount of invalid data, thus failing to realize its actual value.
By acquiring the target personnel's conditional input data and descriptive input data, a conditional judgment function is set to determine whether the input is clear. Keyword extraction and matching pattern judgment are performed. If the query conditions cannot be determined, auxiliary retrieval analysis is performed, including historical auxiliary retrieval, semantic auxiliary retrieval, and comprehensive auxiliary retrieval. Machine learning models are used to predict query intent and semantic search to provide relevant results. If the query conditions are successfully determined, a database search is performed directly.
It improves the accuracy and efficiency of data retrieval, reduces irrelevant results, lowers query costs, optimizes resource allocation, improves data storage and access efficiency, enhances the competitiveness and attractiveness of the data sharing platform, promotes data circulation and utilization, and supports the construction and development of smart cities.
Smart Images

Figure CN120610968B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent data processing, in particular to a data retrieval method based on smart city government data. BACKGROUND
[0002] With the continuous expansion of the city size and the rapid growth of the population, the traditional urban management mode is facing many challenges, such as traffic congestion, environmental pollution, uneven resource allocation, etc. Smart city relies on information technology to achieve the fine, intelligent and efficient urban management, and the effective governance of government data is the key foundation to achieve this goal. By integrating and analyzing the government data of each department, the city operation status can be comprehensively understood, the resource allocation can be optimized, and the scientificity and timeliness of decision-making can be improved, so as to improve the efficiency of urban management. The quality and accessibility of public services such as education, medical care and social security are increasingly required by the public. Good governance of government data can realize data sharing and business collaboration between different departments, break the information silos, and make public services more accurately meet the needs of the public.
[0003] The existing data retrieval method based on smart city government data cannot determine whether the target personnel can successfully determine the query condition in a short time. When the target personnel cannot successfully determine the problem they need to query, it cannot perform auxiliary retrieval analysis or query retrieval analysis according to the input condition of the query personnel, and it cannot retrieve the database according to the association between the query problem and the files in the database to determine the content of the retrieval, which may lead to the query personnel being unable to quickly and accurately find the files they need, while the database has accumulated and stored a large number of files, which cannot realize their actual value, and the practicability has certain limitations. SUMMARY
[0004] The present application provides a data retrieval method based on smart city government data to promote the solution to the problems in the background art.
[0005] The present application provides the following technical solution: a data retrieval method based on smart city government data, comprising:
[0006] Obtaining the condition input data of the target personnel:
[0007] ;
[0008] Displaying a function box on the query interface;
[0009] Obtaining the description input data of the target personnel:
[0010] ;
[0011] Recording the time when the target personnel starts inputting:
[0012] ;
[0013] Set a conditional function to determine whether the data input by the target person is explicit:
[0014] ;
[0015] Record the time it takes for the target person to complete the input, denoted as . ;
[0016] Calculate the time spent by the target personnel in determining the query conditions:
[0017] ;
[0018] Set a time-based function to determine whether the data input for the target personnel was successful:
[0019] ;
[0020] By integrating judgment strategies, it can be determined whether the target personnel can successfully determine their query conditions within a short period of time:
[0021] ;
[0022] like If so, it is determined that the target person successfully determined their query criteria within a short period of time;
[0023] like If the target person cannot be determined within a short period of time, then it is determined that the query criteria cannot be established.
[0024] As an optional solution to the data retrieval method based on smart city government data described in this invention, the following steps are performed: Analysis of the conditional input data of the target personnel is conducted:
[0025] Extract keywords from the target personnel's conditional input data, generate a keyword list, and denot it as... :
[0026] ;
[0027] in, This indicates the extraction of keywords from the text;
[0028] Initialize an empty dictionary :
[0029] ;
[0030] in, Represent an empty set;
[0031] Traverse the keyword list :
[0032] ;
[0033] Obtain a set of condition patterns, denoted as ;
[0034] Iterate through the set of condition patterns :
[0035] ;
[0036] For each keyword and each query condition pattern , determine if they match:
[0037] ;
[0038] If , then determine that the keyword matches the query condition pattern;
[0039] If , then determine that the keyword does not match the query condition pattern;
[0040] Extract all query condition patterns from the set of condition patterns that satisfy to form a set of matching patterns, denoted as ;
[0041] Set a matching judgment function to determine if there exists a query condition pattern in the set of condition patterns that matches the keyword :
[0042] ;
[0043] If , then determine that there exists a query condition pattern in the set of condition patterns that matches the keyword ;
[0044] Extract the value of the query condition pattern from the matching keyword :
[0045] ;
[0046] where represents extracting the value from the text in a specific format;
[0047] Store the extracted value in :
[0048] ;
[0049] in, For the pattern key, The extracted value;
[0050] like Then the set of conditional patterns is determined. There is no query condition pattern in it. With keywords Matching;
[0051] The keyword Save to the new keyword list :
[0052] ;
[0053] Remove the original keyword list Update to a new keyword list :
[0054] .
[0055] As an optional solution to the data retrieval method based on smart city government data described in this invention, if the target person cannot determine their query conditions in a short period of time, auxiliary retrieval analysis is performed, including historical auxiliary retrieval, specifically as follows:
[0056] Retrieve the query history of the target personnel, and record it as... ;
[0057] Extract feature vectors from the query history of the target user:
[0058] ;
[0059] in, This means extracting features from the data and transforming the raw data into a feature vector suitable for the model input.
[0060] Calculate the mean of the eigenvectors:
[0061] ;
[0062] in, It is the sample size. It is the first Feature vector of each sample
[0063] Calculate the standard deviation of the eigenvectors:
[0064] ;
[0065] Standardize the feature vector:
[0066] ;
[0067] Load the trained intent prediction model :
[0068] ;
[0069] wherein, loading a pre-trained machine learning model;
[0070] wherein parameters of the model;
[0071] Assign the pre-processed feature vector to the input variable :
[0072] ;
[0073] Calculate the forward propagation of the model:
[0074] ;
[0075]
[0076]
[0077]
[0078] wherein, and are weight matrices, and are bias vectors, is an activation function, is an activation function for multi-classification;
[0079] Use the prediction function of the model to predict the input feature vector X, and obtain the query intent of the target person :
[0080] ;
[0081] wherein, performing a prediction operation of the intent prediction model;
[0082] Extract the probability value of the target person's query intent predicted by the model, denoted as ;
[0083] Set a prediction decision function to determine whether to accept the prediction result of the model:
[0084] ;
[0085] wherein, is a classification threshold, which is a value between 0 and 1;
[0086] Obtaining a recommendation model ;
[0087] Obtaining a database of a data sharing platform;
[0088] Searching the database to extract a data set ;
[0089] Generating a recommendation result according to the predicted intention and the data set :
[0090] ;
[0091] wherein, is a prediction function of the recommendation model;
[0092] Filtering high-confidence recommendation results from to form a recommendation set :
[0093] ;
[0094] wherein, is a set confidence threshold, represents the confidence of the recommendation result.
[0095] As an optional solution of the data retrieval method based on smart city government data, the auxiliary retrieval analysis further includes semantic auxiliary retrieval, specifically:
[0096] Generating prompt information for the function box of the query interface;
[0097] Obtaining a query request of a target person;
[0098] Segmenting the query request of the target person into words or phrases:
[0099] ;
[0100] wherein, represents segmenting the text into word or sub-word units;
[0101] Removing common stop words in the query:
[0102] ;
[0103] wherein, removing stop words in the text;
[0104] restoring the words to their base form:
[0105] ;
[0106] wherein, restoring the words to their base form;
[0107] merging the preprocessed word sequence into a string as the input for subsequent processing:
[0108] ;
[0109] wherein, concatenating multiple strings or words into a complete string;
[0110] obtaining the database of the data sharing platform;
[0111] searching the database;
[0112] calculating the word frequency of the target person query and the text data in the database:
[0113] ;
[0114] wherein, the number of times the word appears in the document , the total number of words in the document ;
[0115] calculating the inverse document frequency of the target person query and the text data in the database:
[0116] ;
[0117] wherein, the total number of documents, the number of documents containing the word ;
[0118] converting the preprocessed text data into a document vector:
[0119] ;
[0120] converting the preprocessed query text into a query vector:
[0121] ;
[0122] wherein, the word In the query request The word frequency in the query request;
[0123] Calculate the cosine similarity between the query vector And the document vector :
[0124] ;
[0125] Where Is the dot product of the vector, And Respectively, the length of the vector module;
[0126] According to the numerical value of the similarity from large to small, the text data in the database is sorted to form a semantic set .
[0127] As an optional solution of the data retrieval method based on smart city government data, the auxiliary retrieval analysis further includes comprehensive retrieval analysis, specifically:
[0128] The recommended set And the semantic set Merged into a result set :
[0129] ;
[0130] For each result , Calculate a comprehensive score :
[0131] ;
[0132] In the comprehensive score , Is the weight parameter, usually between 0 and 1;
[0133] In the comprehensive score , It represents the confidence of the recommended result , Specifically:
[0134] ;
[0135] Where, Is the predicted score between the target person And the target data set , Specifically:
[0136] ;
[0137] Where, Is the target person Most similar The set of neighbor query personnel, the prediction score is actually the weighted average score of the neighbor query personnel to the data set , The score of the query personnel to the data set , The similarity between the query personnel, specifically:
[0138] ;
[0139] The comprehensive score , Indicates the cosine similarity between the query vector and the document vector , specifically:
[0140] ;
[0141] According to the value of the comprehensive score , the merged results are sorted from large to small to generate an ordered set, denoted as .
[0142] As an optional solution of the data retrieval method based on smart city government data, if the target personnel successfully determines the query condition in a short time, the query retrieval analysis is performed, specifically:
[0143] If , the database is directly retrieved;
[0144] If but , a prompt information is generated for the function box of the query interface;
[0145] Obtain the query request of the target personnel;
[0146] Split the query request of the target personnel into words or phrases:
[0147] ;
[0148] Among them, Text is divided into word or sub-word units;
[0149] Remove common stop words in the query:
[0150] ;
[0151] Among them, Remove stop words in the text;
[0152] Reduce the word to its base form:
[0153] ;
[0154] Where, is to reduce the word to its base form;
[0155] Merge the preprocessed word sequence into a string as the input for subsequent processing:
[0156] ;
[0157] Where, is to concatenate multiple strings or words into a complete string;
[0158] Search the database;
[0159] Calculate the word frequency of the target person query and the text data in the database:
[0160] ;
[0161] Where, is the number of times the word appears in the document , is the total number of words in the document ;
[0162] Calculate the inverse document frequency of the target person query and the text data in the database:
[0163] ;
[0164] Where, is the total number of documents, is the number of documents containing the word ;
[0165] Convert the preprocessed text data into a document vector:
[0166] ;
[0167] Convert the preprocessed query text into a query vector:
[0168] ;
[0169] Where, is the word frequency of the word in the query request ;
[0170] Calculate the cosine similarity between the query vector and the document vector :
[0171] ;
[0172] wherein is the dot product of vectors, and are the lengths of vectors respectively;
[0173] According to the numerical value of the similarity, the text data in the database is sorted from large to small to form a retrieval set .
[0174] As an optional solution of the data retrieval method based on smart city government data, wherein the database is retrieved, specifically:
[0175] Obtain the database of the data sharing platform;
[0176] Obtain all sub-databases in the database;
[0177] Calculate the relevance of each sub-database to the target personnel query :
[0178] ;
[0179] According to the numerical value of the relevance , all sub-databases are sorted from large to small to form an association set;
[0180] For the sub-databases in the association set with the same numerical value of relevance , obtain the data amount of each sub-database :
[0181] ;
[0182] In combination with the numerical value of the data amount , the sub-databases in the association set are sorted again from large to small to form a retrieval order set, denoted as :
[0183] The sub-databases in the retrieval order set are retrieved in turn:
[0184] ;
[0185] Integrate the retrieval order set and the retrieval results in each sub-database in the retrieval order set to form a data set .
[0186] As an optional solution of the data retrieval method based on smart city government data, wherein the content of the retrieval is determined, specifically:
[0187] Acquisition sequence set Or retrieval set , identified as retrieval analysis set, denoted as ;
[0188] Acquire retrieval analysis set The selection amount of each element:
[0189] ;
[0190] According to the numerical value of the selection amount, sort all elements in the retrieval analysis set , form a preliminary generation set ;
[0191] For the elements in the preliminary generation set The numerical value of the selection amount is the same, get the historical browsing amount of each element:
[0192] ;
[0193] Combine the numerical value of the historical browsing amount from large to small, re-sort the first sequence set to form a retrieval generation set ;
[0194] According to the order of the retrieval generation set , show the content of each element of the retrieval generation set to the target personnel one by one.
[0195] As an optional solution of the data retrieval method based on smart city government data, wherein: the database of the data sharing platform, specifically:
[0196] Get all the businesses of the data sharing platform;
[0197] Get the query amount of each business :
[0198] ;
[0199] Among them, Indicates the number of queries of a certain business, Indicates traversing all businesses ;
[0200] According to the platform resources and the number of businesses, determine the number of sub-databases :
[0201] ;
[0202] Among them, Indicates the number of sub-databases determined;
[0203] Distribute the services to the sub-databases initially evenly:
[0204] ;
[0205] wherein, assign a dictionary to the sub-databases, recording the sub-database to which each service is assigned, denotes a modulo operation, calculating the remainder of one number divided by another number, denotes traversing each service index in the service set , , denotes calculating the result of the index modulo the number of sub-databases ;
[0206] Sort the services in descending order according to the query volume:
[0207] ;
[0208] wherein, denotes sorting the service set in descending order according to the query volume , denotes the key according to which the sorting is specified, denotes the direction of the specified sorting;
[0209] Distribute the services to the sub-databases according to the query volume:
[0210] ;
[0211] wherein, and denotes distributing the sorted services to independent sub-databases or shared sub-databases ;
[0212] Identify and record services that exist in association:
[0213] ;
[0214] wherein, denotes traversing from the next service of the current service index to the last service, is a set threshold value.
[0215] The present application has the following advantages:
[0216] 1、The data retrieval method based on smart city government data, by partitioning the database of the data sharing platform, by statistical query and dynamic adjustment of business storage, the business with large query volume is allocated to an independent sub-database, and the business with small query volume is allocated to a common sub-database, realizing the reasonable allocation of resources, improving the storage and access efficiency of data, at the same time, the establishment of associated business link also helps to optimize the data structure, which is convenient for subsequent joint query, when retrieving the sub-database, the sub-database is sorted according to the relevance and data volume, and is queried in turn, this strategy can preferentially retrieve the sub-database most relevant to the query personnel's problem, reduce unnecessary query operation, so as to improve the retrieval speed, allocate independent sub-database for the business with large query volume, avoid the excessive occupation of shared database resources by the business with large query volume, ensure the stability of the system under high concurrency query condition, at the same time, improve the utilization rate of resources, so that the data sharing platform has higher efficiency and accuracy in data retrieval and management, compared with the traditional data retrieval method, it can better meet the needs of the query personnel, enhance the competitiveness and attractiveness of the platform, the efficient query and data management mechanism encourages the query personnel to use the data sharing platform more actively, promotes the sharing and circulation of data, improves the utilization rate of data, and provides strong support for the construction and development of smart city.
[0217] 2、The data retrieval method based on smart city government data, by acquiring the query condition and query question input by the target personnel, judging whether the target personnel can successfully determine the query condition in a short time, providing diversified query conditions and combined query function, the query personnel can flexibly select according to their own needs, quickly find the required data, avoid a large number of irrelevant results caused by unclear query conditions, when the query personnel cannot clearly determine the query condition, provide a language description function box, the query personnel can describe their query needs in natural language, the system provides relevant results combined with semantic search and recommendation algorithm, reducing the use cost of the query personnel.
[0218] 3、The data retrieval method based on smart city government data, if the target personnel cannot determine the query condition in a short time, auxiliary retrieval analysis is performed, if the target personnel successfully determines the query condition in a short time, query retrieval analysis is performed, the database is retrieved, the content of the retrieval is determined, and the content of the retrieval is output to the target personnel, data mining and machine learning algorithm auxiliary retrieval, through analyzing the historical query records and data usage of the query personnel, the query intention of the query personnel is predicted, various related data sets or query conditions are provided for the query personnel, the time of manual screening of the query personnel is reduced, the search efficiency is improved, semantic search can understand the semantics of the query of the query personnel, even if the query input by the query personnel is not accurate enough or has ambiguity, the system can accurately return the results consistent with the intention of the query personnel, improve the accuracy of the query, when the query personnel cannot clearly determine the query condition, a language description function box is provided and the query personnel is guided to describe the problem that needs to be queried, the query personnel can describe the query demand in natural language, the system provides related results in combination with semantic search and recommendation algorithm, reduces the use cost of the query personnel, through accurate query and intelligent assistance, the query personnel can quickly find the required data, reduces the search time, improves the work efficiency, and improves the satisfaction of the data sharing platform. BRIEF DESCRIPTION OF DRAWINGS
[0219] Figure 1 The data retrieval method based on smart city government data is a block diagram. DETAILED DESCRIPTION
[0220] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to 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 the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0221] Embodiment one, a data retrieval method based on smart city government data, referring to Figure 1 , comprising:
[0222] Obtain the condition input data of the target personnel:
[0223]
[0224] Among them, represents the input query condition of the target personnel, such as the name, type, time range, etc. of the data;
[0225] Display the function box on the query interface;
[0226] Obtain the description input data of the target personnel:
[0227] ;
[0228] wherein, represents the content of the input question description of the target person;
[0229] record the time when the target person starts inputting, which is the time when the target person inputs the first character when inputting the query condition or question description for the first time this time;
[0230] ;
[0231] wherein, is a function for obtaining the current time of the system;
[0232] set a condition judgment function to judge whether the data input by the target person is clear;
[0233] ;
[0234] record the time when the target person finishes inputting, denoted as , which is the time when the target person inputs the last character when inputting the query condition or question description for the first time this time;
[0235] calculate the time spent by the target person in determining the query condition:
[0236] ;
[0237] set a time judgment function to judge whether the data input by the target person is smooth;
[0238] ;
[0239] by integrating the judgment strategy, judge whether the target person determines his query condition smoothly in a short time:
[0240] ;
[0241] if , it is determined that the target person determines his query condition smoothly in a short time;
[0242] if , it is determined that the target person cannot determine his query condition in a short time.
[0243] The embodiment also provides that if the target person cannot determine his query condition in a short time, auxiliary retrieval analysis is performed, including historical auxiliary retrieval, specifically:
[0244] Obtain the query history record of the target person, including the target person's past query conditions, click behavior, browsing time, etc., denoted as ;
[0245] Extract the feature vector from the query history of the target person, including the frequency of query words, query time, click behavior and browsing time, etc.:
[0246] ;
[0247] wherein, represents extracting features from data, converting raw data into feature vectors suitable for model input, feature extraction is a key step in data preprocessing, which can convert data into a format that the model can recognize;
[0248] Calculate the mean of the feature vector:
[0249] ;
[0250] wherein, is the number of samples, is the feature vector of the th sample
[0251] Calculate the standard deviation of the feature vector:
[0252] ;
[0253] Standardize the feature vector:
[0254] ;
[0255] This step subtracts the mean of each feature value from the mean of the feature, and then divides by the standard deviation of the feature, so that each standardized feature value is distributed within the range of mean 0 and standard deviation 1;
[0256] Load the trained intent prediction model :
[0257] ;
[0258] wherein, represents loading a pre-trained machine learning model for prediction or further training, loading the model can avoid retraining, saving time and computing resources;
[0259] wherein represents the parameters of the model, and the intent prediction model is a trained neural network model;
[0260] Assign the preprocessed feature vector to the input variable :
[0261] ;
[0262] Forward propagation of the computational model:
[0263] ;
[0264]
[0265]
[0266]
[0267] where, and are weight matrices, and are bias vectors, is an activation function, such as ReLU, Sigmoid, etc., is an activation function for multi-classification;
[0268] Predict the input feature vector X using the prediction function of the model to obtain the query intention of the target person :
[0269] ;
[0270] where, denotes the prediction operation of the intention prediction model, which is a machine learning or deep learning model designed to predict the intention of the target person based on input data such as the target person's historical behavior, query conditions, etc. Through the prediction operation, the trained model can effectively analyze the behavior or query of the target person and predict the intention of the target person, thereby providing personalized recommendations or search results;
[0271] Extract the probability value of the target person's query intention predicted by the model, denoted as ;
[0272] Set a prediction decision function to determine whether to accept the prediction result of the model:
[0273] ;
[0274] where, The classification threshold is a value between 0 and 1, and the common default value is 0.5. If the prediction probability of the model is lower than the classification threshold, a default intent is returned, which is a general, low-priority intent or an intent prompting the target person to further clarify the demand. If the prediction probability of the model is higher than the classification threshold, the prediction result of the model is returned.
[0275] Obtaining a recommendation model ;
[0276] Obtaining a database of a data sharing platform
[0277] Searching the database to extract a data set ;
[0278] According to the predicted intent and the data set generate a recommendation result :
[0279] ;
[0280] wherein, is a prediction function of the recommendation model, used to generate a recommendation result, which finds the most relevant items from the data set according to the historical behavior, preference or query intent of the target person and returns them as recommendations;
[0281] Filtering high-confidence recommendation results from to form a recommendation set :
[0282] ;
[0283] wherein, is a set confidence threshold for filtering high-confidence recommendation results, represents the confidence of the recommendation result, reflecting the certainty of the recommendation system to the recommendation result. The higher the value, the more the system believes that the target person will be interested in the recommendation.
[0284] The auxiliary search analysis further includes semantic auxiliary search, specifically:
[0285] Generating prompt information for the function box of the query interface, so that the target person can input the question he needs to query by referring to the prompt information;
[0286] Obtaining the query request of the target person, i.e. the question he needs to query by referring to the prompt information;
[0287] Segmenting the query request of the target person into words or phrases:
[0288] ;
[0289] where, represents the segmentation of text into word or subword units, which is a fundamental step in natural language processing, facilitating subsequent text analysis and processing;
[0290] Remove common stop words in the query, such as "of", "and", "is", etc.:
[0291] ;
[0292] where, represents the removal of stop words in the text, which are words that appear frequently in the text but contribute little to the semantics, such as "of", "and", "is", etc. It can reduce data volume and improve processing efficiency;
[0293] Restore the word to its basic form, such as "running" to "run":
[0294] ;
[0295] where, is to restore the word to its basic form, i.e. root, which helps to unify different forms of words, reduce the diversity of vocabulary, and improve the efficiency of text processing;
[0296] Merge the preprocessed word sequence into a string as the input for subsequent processing:
[0297] ;
[0298] where, is to connect multiple strings or words into a complete string, which is often used to recombine the processed word list into readable text;
[0299] Obtain the database of the data sharing platform;
[0300] Search the database;
[0301] Calculate the word frequency of the target person query and the text data in the database:
[0302] ;
[0303] where, is the number of times a word appears in a document , is the total number of words in the document ;
[0304] Calculate the inverse document frequency of the target person query and the text data in the database:
[0305] ;
[0306] wherein, is the total number of documents, is the number of documents containing the word ;
[0307] Convert the preprocessed text data into document vectors:
[0308] ;
[0309] Convert the preprocessed query text into a query vector:
[0310] ;
[0311] wherein, is the term frequency of the word in the query request ;
[0312] Calculate the cosine similarity between the query vector and the document vector :
[0313] ;
[0314] wherein is the dot product of the vectors, and are the lengths of the vectors, respectively;
[0315] Sort the text data in the database according to the numerical value of the similarity from large to small to form a semantic set .
[0316] wherein, the auxiliary retrieval analysis further includes comprehensive retrieval analysis, specifically:
[0317] Merge the recommended set and the semantic set into a result set , and when merging, remove duplicates based on the unique identifier of the document, such as the document ID, or the content itself:
[0318] ;
[0319] For each result , calculate a comprehensive score :
[0320] ;
[0321] In the comprehensive score , is a weight parameter, usually between 0 and 1, used to balance the contribution of the recommendation result and the semantic search result;
[0322] The comprehensive score represents the confidence of the recommendation result , reflecting the credibility of the recommendation model for this result, which is a value between 0 and 1, the higher the value, the more reliable the recommendation result, specifically:
[0323] ;
[0324] wherein, is the predicted score between the target person and the target data set , specifically:
[0325] ;
[0326] wherein, is the set of the most similar neighbor query persons to the target person , and the predicted score is actually the weighted average score of the neighbor query persons to the data set , is the score of the query person to the data set , is the similarity between the query persons, specifically:
[0327] ;
[0328] The comprehensive score , represents the cosine similarity between the query vector and the document vector , reflecting the semantic relevance of the document to the query of the query person , which is a value between 0 and 1, the higher the value, the more relevant the document to the query, specifically:
[0329] ;
[0330] According to the numerical value of the comprehensive score , the merged results are sorted from large to small to generate an ordered set, denoted as .
[0331] The embodiment also provides that if the target person successfully determines the query condition in a short time, the query retrieval analysis is performed, specifically:
[0332] If If the database is directly searched;
[0333] If the database is directly searched; But If the database is directly searched;
[0334] Obtain the query request of the target person, i.e. the question input by the target person for reference to the prompt information;
[0335] Segment the query request of the target person into words or phrases:
[0336] ;
[0337] Wherein, The text is segmented into word or sub-word units, which is a basic step in natural language processing, facilitating subsequent text analysis and processing;
[0338] Remove common stop words in the query, such as "of", "and", "is", etc.:
[0339] ;
[0340] Wherein, Remove stop words in the text, which have high frequency but little contribution to the semantics, such as "of", "and", "is", etc. This can reduce data volume and improve processing efficiency;
[0341] Restore the word to its basic form, such as "running" to "run":
[0342] ;
[0343] Wherein, Restore the word to its basic form, i.e. root, which helps to unify different forms of words, reduce the diversity of vocabulary and improve text processing efficiency;
[0344] Merge the preprocessed word sequence into a string as the input for subsequent processing:
[0345] ;
[0346] Wherein, Connect multiple strings or words into a complete string, which is often used to recombine the processed word list into readable text;
[0347] Search the database;
[0348] Calculate the word frequency of the text data in the database and the query of the target person:
[0349] ;
[0350] wherein, is the number of occurrences of the word in the document ; is the total number of words in the document ;
[0351] Calculate the inverse document frequency of the target person query and the text data in the database:
[0352] ;
[0353] wherein, is the total number of documents, is the number of documents containing the word ;
[0354] Convert the preprocessed text data into a document vector:
[0355] ;
[0356] Convert the preprocessed query text into a query vector:
[0357] ;
[0358] wherein, is the word frequency of the word in the query request ;
[0359] Calculate the cosine similarity between the query vector and the document vector :
[0360] ;
[0361] wherein is the dot product of the vectors, and are the lengths of the vectors, respectively;
[0362] According to the numerical value of the similarity from large to small, sort the text data in the database to form a retrieval set .
[0363] The embodiment also provides that the content of the retrieval is determined, specifically:
[0364] Obtain the order set or the retrieval set , and identify it as a retrieval analysis set, denoted as ;
[0365] Acquiring a search analysis set The selected amount of each element in the search analysis set:
[0366] ;
[0367] Wherein, The selected amount of each element in the search analysis set is acquired from the time of entering the database to the current time;
[0368] All elements in the search analysis set are sorted according to the numerical value of the selected amount from large to small to form a preliminary generated set ; ;
[0369] The historical browsing amount of each element in the preliminary generated set with the same numerical value of the selected amount is acquired:
[0370] ;
[0371] Wherein, The browsing amount of each element in the preliminary generated set is acquired from the time of entering the database to the current time;
[0372] The first order set is re-sorted according to the numerical value of the historical browsing amount from large to small to form a search generated set ;
[0373] According to the order of the search generated set , the content of each element of the search generated set is displayed to the target person one by one.
[0374] By partitioning the database of the data sharing platform and obtaining the query conditions and questions input by the target user, the system determines whether the target user can quickly determine their query conditions. If the target user cannot quickly determine their query conditions, auxiliary retrieval analysis is performed. If the target user can quickly determine their query conditions, query retrieval analysis is performed, the database is searched, the search content is determined, and the search content is output to the target user. This avoids a large number of irrelevant results caused by unclear query conditions, predicts the target user's query intent, reduces the time spent on manual filtering, improves search efficiency, and enhances query accuracy. When the target user cannot clearly define their query conditions, the system combines semantic search and recommendation algorithms to provide relevant results, reducing the risk to the target user. This approach reduces staff usage costs, achieves rational resource allocation, improves data storage and access efficiency, helps optimize data structure, facilitates subsequent joint queries, reduces unnecessary query operations, thereby improving retrieval speed, avoids excessive occupation of shared database resources by high-volume business operations, ensures system stability under high-concurrency query conditions, and improves resource utilization. It enables target personnel to quickly find the data they need, reduces search time, improves work efficiency, and thus enhances satisfaction with the data sharing platform. It boasts higher efficiency and accuracy, better meeting the needs of target personnel compared to traditional data retrieval methods, enhancing the platform's competitiveness and attractiveness, promoting data sharing and circulation, improving data utilization, and providing strong support for the construction and development of smart cities.
[0375] Example 2 is an improvement upon Example 1. This data retrieval method based on smart city government data analyzes the conditional input data of target personnel.
[0376] Extract keywords from the target personnel's conditional input data, generate a keyword list, and denot it as... :
[0377] ;
[0378] in, This refers to extracting keywords from text. Keywords are usually the most important words in the text and are used to characterize the content of the text.
[0379] Initialize an empty dictionary Used to store explicit query conditions:
[0380] ;
[0381] in, Represent an empty set;
[0382] Traverse the keyword list :
[0383] ;
[0384] A set of condition patterns, denoted as , is formed by integrating all predefined query condition patterns, which is used to identify the keywords extracted in the target personnel query process and determine the corresponding query conditions, such as data name, type, time range, etc., so as to determine whether the query data output by the target personnel is clear.
[0385] Traverse the condition pattern set , which is used to match the query conditions corresponding to each keyword in the keyword list , such as data name, type, time range, etc., so as to determine whether the query data output by the target personnel is clear.
[0386] ;
[0387] For each keyword and each query condition pattern , determine whether they match:
[0388] ;
[0389] If , it is determined that the keyword matches the query condition pattern;
[0390] If , it is determined that the keyword does not match the query condition pattern;
[0391] Extract all query condition patterns that satisfy from the condition pattern set , form a matching pattern set, denoted as ;
[0392] Set a matching judgment function to determine whether there is a query condition pattern in the condition pattern set that matches the keyword :
[0393] ;
[0394] If , it is determined that there is a query condition pattern in the condition pattern set that matches the keyword ;
[0395] From the matching keyword extract the query condition pattern from the value of the pattern
[0396]
[0397] wherein, extracts the value from the text in a specific format, such as extracting "Zhang San" from the text like "the name is 'Zhang San'";
[0398] stores the extracted value in :
[0399]
[0400] wherein, is the key of the pattern, is the extracted value;
[0401] if , it is determined that the query condition pattern in the condition pattern set does not match the keyword ;
[0402] the keyword is retained to the new keyword list :
[0403]
[0404] the original keyword list is updated to the new keyword list :
[0405] .
[0406] Embodiment three, this embodiment is improved on the basis of embodiment two, in this embodiment, the database is retrieved, specifically:
[0407] obtain the database of the data sharing platform;
[0408] obtain all sub-databases in the database;
[0409] calculate the relevance of each sub-database to the target personnel query :
[0410]
[0411] According to the value of the relevance , sort all sub-databases from large to small, form a relevance set;
[0412] sort the relevance set according to the relevance The sub-databases with the same value of the number of data :
[0413] ;
[0414] The number of data , from large to small, the sub-databases in the association set are sorted again, forming a search order set, denoted as :
[0415] The sub-databases in the search order set are searched in turn:
[0416] ;
[0417] The search results of the search order set and each sub-database in the search order set are integrated to form a data set .
[0418] The embodiment also provides a database of the data sharing platform, specifically:
[0419] Obtaining all services of the data sharing platform;
[0420] Obtaining the query amount of each service :
[0421] ;
[0422] Wherein, represents the number of queries of a certain service, helping to understand the popularity or importance of each service, and providing a basis for subsequent resource allocation and priority sorting, represents traversing all services , used for performing subsequent operations on each service, such as calculating the query amount, adjusting the storage location, etc.
[0423] According to the platform resources and the number of services, the number of sub-databases is determined :
[0424] ;
[0425] Wherein, represents determining the number of sub-databases, reasonably allocating storage resources according to the platform resources and the number of services, and ensuring efficient operation of the system;
[0426] The services are preliminarily and uniformly distributed into the sub-databases:
[0427] ;
[0428] Wherein, Assign a dictionary to the sub-databases to record the sub-databases assigned to each business function. This represents the modulo operation, calculating the remainder when one number is divided by another. It's used to evenly distribute workloads across different sub-databases, ensuring load balancing. Indicates traversing the business set Each business index in This is used to perform allocation operations for each service. Indicates calculated index Number of sub-databases The result of the modulo operation determines the business. The sub-database IDs to be assigned should be used to ensure even distribution of business operations.
[0429] Sort business queries in descending order by query volume:
[0430] ;
[0431] in, Indicates based on query volume For business sets Sort in descending order to prioritize high-volume queries and ensure that demanding tasks receive sufficient resources. This indicates the key used for sorting. This indicates the query count for each element, used to tell the sorting function what rules or values to use to sort the elements. For example, if... Indicates business The query volume, then It sorts business transactions by query volume. Indicates the direction of sorting. This indicates sorting in descending order, i.e., from largest to smallest. This indicates ascending order, i.e., from smallest to largest. It is used to determine whether the sorting result is ascending or descending. When it is necessary to prioritize important or frequent items, descending order is usually used.
[0432] Business operations are allocated to sub-databases based on query volume; that is, business operations with high query volume are allocated to independent sub-databases, and business operations with low query volume are allocated to shared sub-databases.
[0433] ;
[0434] in, and This indicates the sorted business. Assigned to independent sub-database Or share a sub-database It is used to dynamically adjust its storage location based on the query volume of the business and optimize resource allocation;
[0435] Identify and record the existence of associated business:
[0436] ;
[0437] wherein, representing traversal from the current business index the next business until the last business, avoiding repeated comparison of business pairs, improving efficiency, is a set threshold value for determining whether two businesses are associated, representing if the association of the business pair exceeds the threshold value, then record their association, otherwise not record, for identifying and recording the association between businesses, in order to carry out more intelligent query processing and resource optimization.
[0438] In this embodiment, by partitioning the database of the data sharing platform, by obtaining the query conditions and query questions input by the target personnel, it is judged whether the target personnel can successfully determine the query conditions in a short time. If the target personnel cannot determine the query conditions in a short time, auxiliary retrieval analysis is performed. If the target personnel successfully determines the query conditions in a short time, query retrieval analysis is performed, the database is retrieved, the content of the retrieval is determined, and the content of the retrieval is output to the target personnel, avoiding a large number of irrelevant results caused by unclear query conditions, predicting the query intention of the target personnel, reducing the time of manual screening of the target personnel, improving the search efficiency, improving the accuracy of the query, when the target personnel cannot clearly determine the query conditions, the system provides relevant results combined with semantic search and recommendation algorithm, reduces the use cost of the target personnel, realizes the reasonable allocation of resources, improves the storage and access efficiency of data, helps to optimize the data structure, facilitates subsequent joint query, reduces unnecessary query operation, thereby improves the retrieval speed, avoids excessive occupation of shared database resources by business pairs with large query volume, ensures the stability of the system under high concurrency query, at the same time improves the utilization rate of resources, enables the target personnel to quickly find the required data, reduces the search time, improves the work efficiency, thereby improves the satisfaction of the data sharing platform, has higher efficiency and accuracy, compared with the traditional data retrieval method, can better meet the needs of the target personnel, enhances the competitiveness and attractiveness of the platform, promotes the sharing and circulation of data, improves the utilization rate of data, provides strong support for the construction and development of smart city.
Claims
1. A data retrieval method based on smart city government data, characterized in that: include: The query interface displays a function box to obtain the target person's condition input data and description input data. It determines whether the data entered by the target person is clear. If the description input data is not empty and the condition input data is not empty, the data is determined to be clear; otherwise, the data is determined to be unclear. Record the time when the target person starts inputting data and the time when they finish inputting data. Calculate the time the target person spends determining the query conditions. Determine whether the target person's data input is smooth. If the time the target person spends determining the query conditions is less than a preset time threshold, the data input is considered smooth. Otherwise, the data input is considered unsuccessful. Determine whether the target person can successfully determine their query conditions within a short time. If the data entered by the target person is clear and the data input is smooth, the target person can successfully determine their query conditions within a short time. Otherwise, the target person cannot determine their query conditions within a short time. If the target user's query criteria cannot be determined within a short period, auxiliary retrieval analysis is performed, including historical auxiliary retrieval. Specifically, this involves obtaining the target user's query history, extracting feature vectors from the query history, calculating the mean and standard deviation of the feature vectors, standardizing the feature vectors, loading a pre-trained intent prediction model, using the model's prediction function to predict the input standardized feature vectors to obtain the target user's query intent, extracting the probability value of the target user's predicted query intent, and determining whether to accept the model's prediction result. If the probability value of the target user's predicted query intent is greater than a preset threshold, the model's prediction result is accepted; otherwise, it is rejected. The database of the data sharing platform is then retrieved, the database is searched, the dataset is extracted, and recommendation results are generated based on the predicted intent and the dataset.
2. The data retrieval method based on smart city government data according to claim 1, characterized in that: The database is searched, specifically as follows: The process involves acquiring the database of the data sharing platform, retrieving all sub-databases within the database, calculating the relevance of each sub-database to the target user's query, sorting all sub-databases from largest to smallest based on the relevance values to form a relevance set, obtaining the data volume of each sub-database for the sub-databases with the same relevance values, and sorting the sub-databases within the relevance set again from largest to smallest based on the data volume values to form a retrieval order set, sequentially retrieving the sub-databases in the retrieval order set, and integrating the retrieval results from each sub-database in the retrieval order set.
3. The data retrieval method based on smart city government data according to claim 2, characterized in that: The database of the data sharing platform is specifically as follows: Acquire all services from the data sharing platform, obtain the query volume for each service, determine the number of sub-databases based on platform resources and the number of services, initially distribute services evenly among the sub-databases, sort services in descending order by query volume, allocate services to sub-databases based on query volume, and identify and record related services.
Citation Information
Patent Citations
Data query method and device, computer equipment and storage medium
CN118394896A
Archive information resource intelligent sharing method and system based on AI
CN119149704A