Government resource recommendation method and system based on pre-aggregation and optimization
By adopting pre-summary and optimization methods in the government resource recommendation system, the problem that traditional systems cannot distinguish between high-quality and low-quality resources is solved, and accurate screening and optimization of government resources is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202411347103.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-09-26
AI Technical Summary
The existing government resource recommendation system cannot effectively distinguish high-quality and low-quality resources, resulting in the recommendation information obtained by users may contain a large number of irrelevant or outdated resources, affecting the user experience.
The government resource recommendation method based on pre-summary and optimization is adopted. By obtaining and filtering government resources, a government resource library is built, the latest user behavior records are obtained, the matching degree of resources is calculated, and the matching degree and preset sorting rules are sorted and recommended.
It realizes accurate screening and optimization of government resources, ensures that the recommended information obtained by users is the latest and most relevant, and improves user experience and satisfaction.
Smart Images

Figure CN118861436B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method and system for recommending government resources based on pre-aggregation and optimization. Background Art
[0002] At present, the recommendation system of government service resources mainly relies on keyword matching and rule-based recommendation algorithms. Traditional recommendation systems usually use static data screening and sorting methods to perform simple matching based on resource release time, relevance, etc.
[0003] However, the main problem faced by existing technologies in the resource recommendation process is how to accurately screen and optimize a large number of government resources. Traditional recommendation systems often cannot effectively distinguish between high-quality and low-quality resources, resulting in the recommendation information obtained by users may contain a large number of irrelevant or outdated resources, which can easily affect the user experience. Therefore, how to optimize and accurately recommend government resources in real time to better meet the personalized needs of users and improve the user experience is a key problem that current technologies urgently need to solve. Summary of the invention
[0004] This application provides a method and system for recommending government resources based on pre-aggregation and optimization, which can better meet the personalized needs of users and improve user experience. This application provides the following technical solutions:
[0005] In a first aspect, the present application provides a method for recommending government resources based on pre-aggregation and optimization, the method comprising:
[0006] Obtain and screen government resources;
[0007] Build a government resource library, and store the selected government resources in the library according to their types;
[0008] Obtain the user's latest behavior record, and confirm the type of government resources the user is interested in based on the latest behavior record;
[0009] Obtain the release time and deadline of the government resources of the type that the user is interested in, and calculate the matching degree of the government resources based on the release time and deadline;
[0010] Based on the matching degree and preset sorting rules, the government resources of the types that users are interested in are sorted and recommended to users.
[0011] In a specific implementation scheme, obtaining government resources and screening government resources includes:
[0012] Collect government-related tags and build a collection of government tag collections;
[0013] Use natural language processing technology to extract labels for government resources;
[0014] Calculate the correlation index between the extracted government resource tags and the government tag collection. The calculation formula is as follows:
[0015] in, is the label frequency, indicating the label frequency in government resources Number of occurrences; is the label coverage, indicating that the label Tags in the government tag collection Number of occurrences; is a constant; is the label density, indicating the label The number of times it appears in the text of government resources divided by the total number of words in government resources; It represents the total number of tags extracted from the government resource text;
[0016] The calculated relevance index of each government resource is compared with the preset threshold. If the relevance index is greater than or equal to the preset threshold, it is considered to be a government resource related to government affairs. If the relevance index is less than the preset threshold, it is considered to be a government resource unrelated to government affairs and is filtered out.
[0017] In a specific implementation scheme, storing the screened government resources in a government resource library according to the types of government resources includes:
[0018] Build a corresponding keyword library for each type of government resource;
[0019] Use the following formula to calculate the relevance of each government resource to a certain type of keyword library: :
[0020] in, Indicates keywords in government resources The ratio of the number of occurrences to the total number of keyword occurrences. Indicates the total number of keywords in all types of keyword libraries. Indicates the total length of the resource text. It is the number of keywords in a keyword library of a certain type. The text uniqueness index of government resources is calculated as follows:
[0021] The government resources are stored in the type that is most relevant to the government resources in the government resource library.
[0022] In a specific possible implementation scheme, obtaining the latest behavior record of the user and confirming the type of government resources that the user is interested in based on the latest behavior record includes:
[0023] Get the user's most recent search history as the latest behavior record;
[0024] Extracting a search term set from the user's search history;
[0025] Calculate the similarity between the search word set and the keyword library corresponding to all types of government resources; Calculate the similarity between the search word set and the keyword library corresponding to a certain type of government resources The calculation formula is as follows:
[0026] in, is the total number of search terms in the search term set, For a certain type of keyword library, Keyword Library The total number of keywords, Represents search term set and keyword library The number of intersection words;
[0027] According to the calculation results, the type of government resource with the highest similarity is confirmed to be the type of interest to the user.
[0028] In a specific possible implementation scheme, obtaining the release time and deadline of the government resources of the type that the user is interested in, and calculating the matching degree of the government resources based on the release time and deadline includes:
[0029] The release time and deadline of all government resources of the type that the user is interested in are obtained by searching in the government resource library; if the government resource has no deadline, a default relatively distant future date is used as the deadline.
[0030] In a specific possible implementation scheme, obtaining the release time and deadline of the government resources of the type that the user is interested in, and calculating the matching degree of the government resources based on the release time and deadline includes:
[0031] Use the following formula to calculate the matching degree of each government resource under this type:
[0032] in, The similarity between the search term set and each government resource calculated using the existing cosine similarity calculation method is: is the maximum value of cosine similarity, is the time decay rate, is the maximum value of time decay among all government resources. The calculation formula is as follows:
[0033] in, For the release time, For the deadline, is the current time, as well as The difference is in days.
[0034] In a specific possible implementation scheme, the sorting of government resources of the type of interest to the user based on the matching degree and the preset sorting rules and recommending to the user includes:
[0035] The preset sorting rules are as follows:
[0036] Prioritize the display of government resources published within 24 hours. Sort the government resources published within 24 hours in descending order of matching degree. If the matching degree is the same, the one with the later publishing time will be displayed first.
[0037] Then, the government resources that have not expired are displayed and sorted in descending order according to the matching degree. If the matching degrees are the same, the one with the later release time is placed first;
[0038] Finally, expired government resources are displayed, sorted directly in reverse order of release time.
[0039] In the second aspect, the present application provides a government resource recommendation system based on pre-aggregation and optimization, which adopts the following technical solutions:
[0040] A government resource recommendation system based on pre-aggregation and optimization, comprising:
[0041] A resource screening module is used to obtain and screen government resources;
[0042] The resource classification module is used to build a government resource library and classify and store the screened government resources in the government resource library according to the types of government resources;
[0043] The user matching module is used to obtain the user's latest behavior record and confirm the type of government resources that the user is interested in based on the latest behavior record;
[0044] A matching degree calculation module, used to obtain the release time and deadline of the government resources of the type that the user is interested in, and calculate the matching degree of the government resources based on the release time and deadline;
[0045] The resource recommendation module is used to sort the government resources of the type that the user is interested in based on the matching degree and preset sorting rules and recommend them to the user.
[0046] In a third aspect, the present application provides an electronic device comprising a processor and a memory; the memory stores a program, and the program is loaded and executed by the processor to implement a government resource recommendation method based on pre-aggregation and optimization as described in the first aspect.
[0047] In a fourth aspect, the present application provides a computer-readable storage medium, in which a program is stored. When the program is executed by a processor, it is used to implement a government resource recommendation method based on pre-aggregation and optimization as described in the first aspect.
[0048] In summary, the beneficial effects of this application include at least:
[0049] (1) Through the comprehensive calculation of time decay and cosine similarity, this application effectively incorporates the time validity and content relevance of resources into the recommendation system. This mechanism not only ensures that the latest released resources are displayed first, but also accurately matches the actual needs of users and avoids interference from outdated or irrelevant resources. It overcomes the limitation of traditional recommendation systems that they cannot dynamically adapt to changes in resource time and user interests, and achieves high efficiency and accuracy in resource recommendation.
[0050] (2) By analyzing the user's latest behavior data, the system can intelligently identify the user's interest type and provide personalized resource recommendations based on this. Combining existing natural language processing technology and keyword matching, the personalization and accuracy of recommendations are enhanced. This solves the problem that traditional recommendation systems cannot adjust recommendation results in real time due to changes in user interests, allowing users to receive government resource recommendations that are more in line with their personal needs, thereby improving user satisfaction and usage experience.
[0051] (3) By classifying and storing government resources and combining keyword libraries with text features for dynamic classification and screening, this application improves the efficiency of resource management and the accuracy of classification. In particular, when performing relevance calculations and resource filtering, it can effectively exclude low-quality or irrelevant resources. It optimizes the resource management and classification process, avoids the problems of resource redundancy and inefficient processing, and ensures the accurate recommendation and effective use of high-quality resources. This dynamic classification and screening mechanism improves the resource management capabilities and recommendation accuracy of the overall system.
[0052] By acquiring and screening government resources, they are classified and stored in the government resource library. Next, the user's latest behavior records (such as search records) are used to determine the type of government resources that the user is interested in, and the matching degree of each government resource under this type is calculated. The matching degree comprehensively considers the time decay and content similarity of the resource. Finally, the resources are sorted and recommended according to the matching degree and preset sorting rules. Through this method, the present application can effectively screen and optimize a large number of government resources, solve the problem that traditional recommendation systems cannot accurately distinguish between high-quality and low-quality resources, and improve the accuracy of resource recommendations and user experience.
[0053] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application and implement it according to the contents of the specification, the following is a detailed description of the preferred embodiments of the present application in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a flowchart of a method for recommending government resources based on pre-aggregation and optimization in an embodiment of the present application.
[0055] Figure 2 It is a flowchart of screening government resources in an embodiment of the present application.
[0056] Figure 3 It is a flowchart of classifying and storing government resources in a government resource library according to the types of government resources in an embodiment of the present application.
[0057] Figure 4 It is a flowchart of step S103 in the embodiment of the present application.
[0058] Figure 5 It is a schematic diagram of the overall process of the government resource recommendation method based on pre-aggregation and optimization in an embodiment of the present application.
[0059] Figure 6 It is a structural block diagram of the government resource recommendation system based on pre-aggregation and optimization in an embodiment of the present application.
[0060] Figure 7 It is a block diagram of an electronic device based on pre-aggregated and optimized government resource recommendations in an embodiment of the present application. DETAILED DESCRIPTION
[0061] The specific implementation methods of the present application are further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present application but are not intended to limit the scope of the present application.
[0062] Optionally, the present application uses the government resource recommendation method based on pre-aggregation and optimization provided in each embodiment as an example for use in an electronic device, where the electronic device is a terminal or a server. The terminal may be a computer, a tablet computer, etc. This embodiment does not limit the type of electronic device.
[0063] Reference Figure 1 , is a flowchart of a method for recommending government resources based on pre-aggregation and optimization provided by an embodiment of the present application, the method comprising at least the following steps:
[0064] Step S101: Acquire government resources and screen them.
[0065] Step S102: construct a government resource library, and classify and store the screened government resources in the government resource library according to the types of government resources.
[0066] Step S103: Obtain the latest behavior record of the user, and confirm the type of government resources that the user is interested in based on the latest behavior record.
[0067] Step S104: Obtain the release time and deadline of the government resources of the type that the user is interested in, and calculate the matching degree of the government resources based on the release time and deadline.
[0068] Step S105: sort the government resources of the type that the user is interested in based on the matching degree and preset sorting rules and recommend them to the user.
[0069] In step S101, Python and related libraries are used to periodically crawl resources from public resources to obtain government resources. Optionally, the public resources include but are not limited to public accounts, official websites and other government resource public release platforms.
[0070] Reference Figure 2 , is a flow chart of screening government resources in an embodiment of the present application, and the method includes at least the following steps:
[0071] Step S1011: Collect government affairs-related tags and build a government affairs tag collection.
[0072] In step S1011, various types of tags related to government affairs are manually collected and a collection of government affairs tags is constructed, for example, tags such as technological innovation, tax exemptions, real estate resources, and banking services.
[0073] Step S1012: Use natural language processing technology to extract labels of government resources.
[0074] In implementation, existing natural language processing technology is used to extract labels of government resources, wherein the number of labels extracted for each government resource may be one or more.
[0075] Specifically, firstly, labels are extracted based on word frequency technology, and the frequency of each word in the text of government resources is analyzed to determine the words with higher frequency as potential labels. For example, in government resources related to "scientific and technological innovation", words such as "innovation", "technology", and "research and development" may appear frequently, so they are extracted as labels. Then, the existing keyword recognition algorithm is used to extract labels, and common algorithms such as TF-IDF (word frequency-inverse document frequency) or TextRank can be used. In this application, TF-IDF is taken as an example. TF-IDF extracts important keywords by calculating the frequency of occurrence of words in documents and their rarity in the entire corpus. For example, in government resources related to "tax exemptions", words such as "taxation", "exemption", and "preferential policies" may be identified as labels. After extracting the labels of government resources through the above two methods, duplicate labels and inappropriate labels are screened out through manual review, and the remaining labels are used as labels for the government resources. If the labels of government resources cannot be extracted by the above two methods, a certain word is manually identified as the label of the government resource.
[0076] Step S1013: Calculate the correlation index between the extracted government resource tags and the government tag collection.
[0077] In implementation, the correlation index The calculation formula is as follows:
[0078] in, The tag frequency, which indicates the tag in the government resource text. The number of times a tag appears. Tag frequency reflects the importance and frequency of a tag in the text. is the label coverage, indicating that the label Coverage in the government label collection, that is, labels in the government label collection Number of occurrences. is a very small constant, usually 0.01, used to ensure When it is 0, it can still participate in the calculation to avoid calculation errors caused by zero values. This adjustment will not significantly change the result of the formula, but it can effectively avoid the problems caused by zero values. is the label density, indicating the label The distribution density in the government resource text, i.e., the label The number of times a word appears in the government resource text divided by the total number of words in the government resource text. It represents the total number of tags extracted from the government resource text. The above formula comprehensively considers the frequency of tags in the government resource text, the coverage in the government tag collection, and the density in the resource, and balances the influence of these factors by multiplying them. This design ensures that tags that are important and closely related to government tags contribute more to the relevance index.
[0079] When designing the formula, the tag frequency is a measure of the number of times a tag appears in the text of government resources. The higher the frequency, the greater the importance of the tag in the text. Therefore, the tag frequency is placed in the numerator to ensure that the tags with higher frequencies contribute more to the final relevance index in the relevance calculation, reflecting the importance of the actual frequency of occurrence of the tag in evaluating relevance. Tag coverage indicates the prevalence of tags in the collection of government tags. If a tag has a high coverage rate in the collection of government tags, it means that it is more representative in government-related content. Placing it in the numerator ensures that tags with high coverage contribute more to the relevance index, strengthening the correlation between tags and government content. Tag density reflects the distribution of tags in the text. Using it as the denominator can reduce the impact of some tags that appear frequently but may not be important in the government context on the relevance index. In other words, tags with higher density will be relatively "diluted", thereby avoiding the situation where they appear frequently in the text but have low relevance to government content.
[0080] Step S1014: compare the calculated correlation index of each government resource with the preset threshold. If the correlation index is greater than or equal to the preset threshold, it is considered to be a government resource related to government affairs. If the correlation index is less than the preset threshold, it is considered to be a government resource unrelated to government affairs and is filtered out.
[0081] In summary, by comprehensively considering label frequency, label coverage and label density, the designed relevance index can more accurately evaluate the relevance of a resource to government affairs. This can effectively filter out resources that are not related to government affairs and improve the accuracy and efficiency of screening.
[0082] It should be noted that the above formula is designed to preliminarily screen government resources and does not necessarily reflect the comprehensive importance of all tags. Since the formula takes into account the frequency, coverage, and density of tags, it may result in a higher relevance index for resources with more tags. It should be noted that the purpose of this design is to effectively filter out resources that are not related to government affairs, such as holiday greetings posted by government public accounts. In this way, it can be ensured that the resources finally screened out are more in line with the requirements of government affairs relevance and reduce the interference of irrelevant information.
[0083] In step S102, the screened government resources are stored in the database to complete the construction of the government resource library. Subsequently, the government resources need to be classified and stored according to their types. For example, government resources include financial, real estate, activity, policy, etc. Each type of government resources is stored independently to facilitate subsequent maintenance and management.
[0084] Reference Figure 3 , is a flow chart of classifying and storing government resources in a government resource library according to the types of government resources in an embodiment of the present application. The method includes at least the following steps:
[0085] Step S1021: construct a corresponding keyword library for each type of government resource.
[0086] Specifically, for each type of government resource, a keyword library corresponding to the type is artificially constructed. For example, the keyword library of finance contains keywords such as bank, loan, investment, etc., and the keyword library of activities contains keywords such as meeting, training, announcement, etc.
[0087] Step S1022: Calculate the correlation between each government resource and all types of keyword libraries.
[0088] Specifically, the following formula is used to calculate the correlation between each government resource and a certain type of keyword library: :
[0089] in, Indicates keywords in government resources The ratio of the number of occurrences to the total number of keyword occurrences. Indicates the total number of keywords in all types of keyword libraries. Indicates the total length of the resource text (i.e. the total number of words), It is the number of keywords in a keyword library of a certain type. The text uniqueness index of government resources is calculated as follows:
[0090] For example, suppose there is a government resource text with a total vocabulary of 2000, including 10 keywords. If the 10 keywords appear 20 times in total, then the total number of non-keyword words is 1980.
[0091] When designing the above formula, first of all, the keyword hit rate is used to measure the frequency of keywords in the resource text, so as to reflect the degree of match between the resource and the keyword library. A high hit rate indicates that the resource text is strongly associated with the keyword library, so the correlation will also be high. This part of the design ensures to a certain extent that texts in the resource that contain more relevant keywords can obtain higher correlations and thus be correctly classified. Secondly, the text uniqueness index is used to measure the diversity of resource texts, that is, the proportion of non-keywords in the resource text. Through this index, it can be avoided that resources with simple repeated keywords obtain unreasonably high correlations during calculations. This index prevents the high correlation caused by repeated keyword stacking or excessive simplicity of resource text, and ensures that the content quality of the resource is reasonably evaluated. Finally, the formula It is to smooth the total length of resource text. Text length usually affects the distribution of keywords. Longer text may contain more keywords, so the impact of text length needs to be adjusted. Using a logarithmic function can reduce the excessive impact of long text on relevance, so that resources of different lengths can be compared on a relatively fair basis. In addition, dividing the calculation result by the total number of keywords in the keyword library is to standardize the impact of keyword libraries of different sizes. This process ensures that the relevance can be measured uniformly for keyword libraries of different sizes, thereby avoiding unfair relevance judgments due to the larger size of certain types of keyword libraries. In summary, the formula not only considers the matching degree of keywords, but also integrates the uniqueness and length of the text to ensure that high-quality resources can obtain reasonable scores. By introducing the text uniqueness index, the formula reduces the scoring bias caused by repeated keyword stacking and avoids low-quality resources from obtaining unfair high scores. Standardization allows the formula to maintain consistency in resource libraries of different types and sizes and adapt to various complex situations. Ultimately, different types of government resources can be classified and stored more accurately and fairly.
[0092] Step S1023: Store the government resources in the type that is most relevant to the government resources in the government resource library.
[0093] In addition, as a preferred embodiment, an original library, a directory library and an index library of the government resource library can also be created, wherein the original library is used to store the unprocessed original data of government resources obtained from various channels. The original library is a mirror library of the source data structure. It stores the original data of government resources collected from different channels, and establishes corresponding structured data tables according to the data types and structures of different channels to keep consistent with the source data. This ensures the integrity and traceability of the original data. The directory library summarizes and stores the main fields of different types of government resources. The library uniformly manages the entry of resources. By extracting and sorting the key fields in the resources, the directory library realizes the centralized management of different types of resource information, which is helpful for subsequent query and analysis. The directory library extracts and summarizes the main fields of government resources to provide basic data support for subsequent resource management and classification. The data in the directory library can help the system manage and retrieve resources more efficiently. The index library annotates and structures the entire amount of government resources to form summary fields. The role of the index library is to provide efficient resource retrieval support to the outside world. By generating concise and standardized index information for each resource, the speed and accuracy of resource query and matching are improved. By annotating and structuring government resources, concise resource summaries are generated, and efficient retrieval and matching support is provided to the outside world. The data in the index library can significantly speed up the speed of resource matching and recommendation.
[0094] In step S103, refer to Figure 4 , is a flow chart of step S103 in this application, and the method includes at least the following steps:
[0095] Step S1031: Obtain the user's most recent search record as the latest behavior record.
[0096] Optionally, in the embodiment of the present application, search records are used as behavior records, and the user's most recent browsing records, click records, etc. can also be selected as the latest behavior records. The present application does not limit the specific type of behavior records.
[0097] Step S1032: extract a search word set from the user's search history.
[0098] In step S1032, common words that are meaningless to the analysis are removed, and words with higher frequency of occurrence are selected as search words to form a search word set. If there are no words with higher frequency, they are manually selected.
[0099] Step S1033: Calculate the similarity between the search term set and the keyword library corresponding to all types of government resources.
[0100] Specifically, the similarity between the search term set and the keyword library corresponding to a certain type of government resources The calculation formula is as follows:
[0101] in, is the total number of search terms in the search term set, It is a certain type of keyword library, that is, the keyword library constructed in step S102 of the present application. Keyword Library The total number of keywords, Represents search term set and keyword library The number of intersection words.
[0102] The above formula was designed taking into account the size of the keyword library and the vocabulary of the search records, and normalized by the square root of the product. This can eliminate the bias caused by differences in the size of the keyword library, making the evaluation more fair. In practice, when a keyword library is very large, the number of intersections may be small, even if the actual relevance is high. By setting the denominator to the square root of the keyword library size, the problem of inaccurate scoring due to the huge size of the keyword library can be avoided.
[0103] Step S1034: confirm, based on the calculation result, that the type of government resource with the highest similarity is the type of interest to the user.
[0104] In step S1034, after calculating the similarity between the search word set and the keyword library corresponding to all types, the type corresponding to the keyword library with the highest similarity is selected as the type of interest of the user. By obtaining the user's latest search history, the user's current interests and needs can be accurately grasped. This ensures that the recommended government resource types are highly relevant to the user's actual needs.
[0105] It should be noted that in implementation, if the user has no historical behavior record, the user is guided to actively select the type of government resource that he or she is most interested in, or a type is randomly selected. If the user's most recent behavior record has no practical meaning, such as punctuation marks, the behavior record is filtered and the most recent behavior record is retrieved.
[0106] In step S104, first, the release time and deadline of all government resources of the type that the user is interested in are obtained by keyword retrieval in the government resource library. It should be noted that while obtaining each government resource in step S101, the release time and deadline of each policy resource are manually confirmed. If the government resource has no deadline, a default relatively far future date is used as the deadline, such as ten years later. The release time helps to determine the timeliness of the resource, while the deadline helps the user understand the validity period or expiration time of the resource. It should be noted that the present application scheme is mainly used for resource recommendations in a specific area, so the number of government resources processed is relatively small, and it is feasible to manually confirm the release time and deadline of each resource. In addition, this method ensures the accuracy and timeliness of the resources and can provide users with more accurate policy recommendation services. Considering the limitation of the amount of resources, manual processing can ensure the quality of the data and avoid the errors that may be caused by automated processing.
[0107] The matching degree of each government resource of this type is then calculated using the following formula:
[0108] in, To calculate the similarity between the search word set in step S103 and each government resource using the existing cosine similarity calculation method, specifically, the search word set and the text of each government resource are converted into vectors, and the cosine similarity formula is used to calculate the similarity between the search word set vector and each government resource text vector. is the maximum value of cosine similarity, usually 1. is the time decay rate, It is the maximum value of time decay among all government resources and is used for standardization. The calculation formula is as follows:
[0109] in, For the release time, For the deadline, is the current time. as well as For example, suppose there is a government resource, its release time is September 1, 2024, its deadline is December 1, 2024, and the current time is October 1, 2024. Now use this formula to calculate the time decay degree. For 30 days, is 91 days, and the .
[0110] In the above formula, the time decay and similarity are standardized to unify their value ranges. The standardization of time decay and similarity can ensure that the matching degree is between 0 and 1, making the calculation results more comparable. Time decay reflects the time validity of resources, ensuring that the latest resources have a high matching degree. As the time of resource release increases, its timeliness gradually weakens, and the system may reduce its recommendation priority. Cosine similarity reflects the content relevance of resources, ensuring that resources that users are interested in are recommended first. The matching formula can comprehensively consider the time validity and content relevance of resources, thereby improving the accuracy of the recommendation system and user experience. Users can more easily find the latest and relevant government resources.
[0111] Optionally, in another feasible embodiment, the following method can also be used to calculate the matching degree between the user and each government resource. First, the resource matching degree is calculated using the following formula: :
[0112] in, is a collection of user tags. is a collection of resource tags. Indicates a system preset constant used to adjust the proportion or weight of the calculation result. Represents the number of tags. It is the total number of tags in the resource tag set. It is the number of tags in the intersection of the user tag set and the resource tag set. In implementation, the user tag set is composed of tags that are actively defined or selected by users in the system. These tags usually reflect the user's interests, needs, policy areas of concern, or other preferences. Users can enter or select specific tags in the system to represent the types of government resources they are concerned about. For example, users may choose tags such as "environmental protection policy", "support for small and medium-sized enterprises", and "technological innovation". These tags constitute the user tag set. The resource tag set is the collection of government tags in the above steps. The number of tag intersections is obtained by taking the intersection of the user tag set and the resource tag set, and then the ratio of the number of corresponding resource tag sets is calculated. According to the constant Compute the matching degree of resources.
[0113] The time matching is then calculated using the following formula :
[0114] in, The release time of government resources. is the current time, is a time distance constant, which is used to indicate the maximum time range that the system considers the resource to be valid. First, calculate the current time minus the time constant to get a reference time point. This reference time point is the upper limit of the time that the system considers the resource to be "fresh". If the resource is released later than this reference time point, it means that the resource is newer and has a higher degree of match; if it is earlier than this reference time point, it means that the resource is older and has a lower degree of match. Then calculate the difference between the resource release time and the reference time point. This difference indicates the relative freshness of the resource relative to the current time and the time constant. If the difference is positive, it means that the resource is within the effective time range defined by the system; if it is negative, it means that the resource is outside the defined effective time range. Finally, divide the above difference by the time constant, normalize the result to the interval of 0 to 1, and calculate the result to indicate the degree of match of the resource in time. If the calculation result is positive, it means that the resource is within the "fresh" time range and has a higher degree of match; if it is negative, it means that the resource is beyond the effective time range and has a lower degree of match.
[0115] Finally, according to the resource matching Matching with time Calculate the final matching degree:
[0116] in, is the resource measurement weight constant, which is used to adjust the weight of label matching. r is the time measurement weight constant, which is used to adjust the weight of time matching. is the basic score of the system resources, that is, the basic score set by the system for each resource, which is used to adjust the final matching degree. In this embodiment of the application, 100 is usually selected as The value of .
[0117] In summary, the tag set actively selected or defined by the user can accurately reflect the user's interests and needs, ensuring that the recommendation of resources is closer to the user's actual needs. The intersection of the user tag set and the resource tag set can measure the user's potential interest in a resource. The time matching calculation is introduced, so that the matching is not only based on the tag relevance, but also takes into account the timeliness of the resource, ensuring that the recommended government resources are not only relevant in content, but also meet the user's needs in time. In this way, users can obtain the latest or most current resources. By adjusting the resource measurement weight constant and the time measurement weight constant, the system can flexibly attach different degrees of importance to the tag matching and time matching according to the specific application scenario and user's preference, thereby optimizing the final matching result. The introduction of the system resource basic score sets a basic score for each resource, so that the matching calculation does not only rely on tags and time, but can also be adjusted according to the overall quality of the resource or the importance preset by the system, thereby improving the accuracy and rationality of the matching.
[0118] In step S105, the government resources of the type that the user is interested in are sorted and recommended to the user based on the matching degree and the preset sorting rules. The preset sorting rules are as follows:
[0119] 1) Prioritize displaying government resources published within 24 hours, and sort them in descending order of matching degree. If the matching degrees are the same, the one with the later publishing time will be displayed first.
[0120] 2) Then display the government resources that have not expired, and sort them in order from large to small according to the matching degree. If the matching degrees are the same, the one with the later release time is placed first.
[0121] 3) Finally, the expired government resources are displayed and sorted in reverse order of release time.
[0122] In summary, combined with Figure 5 , by acquiring and screening government resources, classifying and storing them in the government resource library. Next, the user's latest behavior records (such as search records) are used to determine the type of government resources that the user is interested in, and the matching degree of each government resource under this type is calculated. The matching degree comprehensively considers the time decay and content similarity of the resource. Finally, the resources are sorted and recommended according to the matching degree and preset sorting rules. Through this method, the present application can effectively screen and optimize a large number of government resources, solve the problem that traditional recommendation systems cannot accurately distinguish between high-quality and low-quality resources, and improve the accuracy of resource recommendations and user experience.
[0123] Figure 6 This is a structural block diagram of a government resource recommendation system based on pre-aggregation and optimization provided by an embodiment of the present application. The device includes at least the following modules:
[0124] A resource screening module is used to obtain and screen government resources;
[0125] The resource classification module is used to build a government resource library and classify and store the screened government resources in the government resource library according to the types of government resources;
[0126] The user matching module is used to obtain the user's latest behavior record and confirm the type of government resources that the user is interested in based on the latest behavior record;
[0127] A matching degree calculation module, used to obtain the release time and deadline of the government resources of the type that the user is interested in, and calculate the matching degree of the government resources based on the release time and deadline;
[0128] The resource recommendation module is used to sort the government resources of the type that the user is interested in based on the matching degree and preset sorting rules and recommend them to the user.
[0129] For relevant details, refer to the above method embodiment.
[0130] Figure 7 4 is a block diagram of an electronic device provided by an embodiment of the present application. The device at least includes a processor 401 and a memory 402.
[0131] The processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 401 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0132] The memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, which is used to be executed by the processor 401 to implement the government resource recommendation method based on pre-aggregation and optimization provided in the method embodiment of the present application.
[0133] In some embodiments, the electronic device may further optionally include: a peripheral device interface and at least one peripheral device. The processor 401, the memory 402 and the peripheral device interface may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface via a bus, a signal line or a circuit board. Schematically, the peripheral devices include but are not limited to: a radio frequency circuit, a touch display screen, an audio circuit, and a power supply.
[0134] Of course, the electronic device may also include fewer or more components, which is not limited in this embodiment.
[0135] Optionally, the present application also provides a computer-readable storage medium, in which a program is stored, and the program is loaded and executed by a processor to implement the government resource recommendation method based on pre-aggregation and optimization of the above method embodiment.
[0136] Optionally, the present application also provides a computer product, which includes a computer-readable storage medium, in which a program is stored, and the program is loaded and executed by a processor to implement the government resource recommendation method based on pre-aggregation and optimization of the above-mentioned method embodiment.
[0137] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0138] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for recommending government resources based on pre-aggregation and optimization, characterized in that: The method comprises: Obtain government resources and screen them, including: collecting government-related tags and building a collection of government tags; using natural language processing technology to extract tags of government resources; calculating the correlation index between the extracted tags of government resources and the collection of government tags, and the correlation index The calculation formula is as follows: 其中, is the label frequency, indicating the label frequency in government resources Number of occurrences; is the label coverage, indicating that the label Tags in the government tag collection Number of occurrences; is a constant ; is the label density, indicating the label The number of times it appears in the text of government resources divided by the total number of words in government resources; It represents the total number of tags extracted from the government resource text; the correlation index calculated for each government resource is compared with the preset threshold. If the correlation index is greater than or equal to the preset threshold, it is considered to be a government resource related to government affairs. If the correlation index is less than the preset threshold, it is considered to be a government resource unrelated to government affairs and is filtered out. Build a government resource library, and store the filtered government resources in the library according to their types, including: Build a corresponding keyword library for each type of government resource; use the following formula to calculate the relevance of each government resource to a certain type of keyword library : in, Indicates keywords in government resources The ratio of the number of occurrences to the total number of keyword occurrences. Indicates the total number of keywords in all types of keyword libraries. Indicates the total length of the resource text. It is the number of keywords in a keyword library of a certain type. The text uniqueness index of government resources is calculated as follows: storing the government resource in the type that is most relevant to the government resource in the government resource library; Obtain the user's latest behavior record and confirm the type of government resources that the user is interested in based on the latest behavior record, including: obtaining the user's most recent search record as the latest behavior record; extracting a search term set from the user's search record; calculating the similarity between the search term set and the keyword library corresponding to all types of government resources; calculating the similarity between the search term set and the keyword library corresponding to a certain type of government resource The calculation formula is as follows: in, is the total number of search terms in the search term set, For a certain type of keyword library, Keyword Library The total number of keywords, Represents search term set and keyword library According to the calculation results, the type of government resources with the highest similarity is confirmed to be the type that the user is interested in; Obtain the release time and deadline of the government resources of the type that the user is interested in, and calculate the matching degree of the government resources based on the release time and deadline, including: using the following formula to calculate the matching degree of each government resource under this type: in, The similarity between the search term set and each government resource calculated using the existing cosine similarity calculation method is: is the maximum value of cosine similarity , is the time decay rate, is the maximum value of time decay among all government resources. The calculation formula is as follows: in, For the release time, For the deadline, is the current time, as well as All are time differences in days; Based on the matching degree and preset sorting rules, the government resources of the types that users are interested in are sorted and recommended to users.
2. The government resource recommendation method based on pre-aggregation and optimization according to claim 1 is characterized in that: The obtaining of the release time and deadline of the government resources of the type that the user is interested in, and calculating the matching degree of the government resources based on the release time and deadline includes: The release time and deadline of all government resources of the type that the user is interested in are obtained by keyword searching in the government resource library; if the government resource has no deadline, a default relatively distant future date is used as the deadline.
3. The government resource recommendation method based on pre-aggregation and optimization according to claim 1 is characterized in that: The sorting of the government resources of the type that the user is interested in based on the matching degree and the preset sorting rules and recommending them to the user includes: The preset sorting rules are as follows: Prioritize the display of government resources published within 24 hours. Sort the government resources published within 24 hours in descending order of matching degree. If the matching degree is the same, the one with the later publishing time will be displayed first. Then, the government resources that have not expired are displayed and sorted in descending order according to the matching degree. If the matching degrees are the same, the one with the later release time is placed first; Finally, expired government resources are displayed, sorted directly in reverse order of release time.
4. A government resource recommendation system based on pre-aggregation and optimization, characterized in that: include: The resource screening module is used to obtain and screen government resources, including: collecting government-related tags and building a collection of government tag sets; using natural language processing technology to extract government resource tags; calculating the correlation index between the extracted government resource tags and the collection of government tag sets, and the correlation index The calculation formula is as follows: in, is the label frequency, indicating the label frequency in government resources Number of occurrences; is the label coverage, indicating that the label Tags in the government tag collection Number of occurrences; is a constant ; is the label density, indicating the label The number of times it appears in the text of government resources divided by the total number of words in government resources; It represents the total number of tags extracted from the government resource text; the correlation index calculated for each government resource is compared with the preset threshold. If the correlation index is greater than or equal to the preset threshold, it is considered to be a government resource related to government affairs. If the correlation index is less than the preset threshold, it is considered to be a government resource unrelated to government affairs and is filtered out. The resource classification module is used to build a government resource library and store the filtered government resources in the government resource library according to the type of government resources, including: building a corresponding keyword library for each type of government resource; using the following formula to calculate the relevance of each government resource to a certain type of keyword library : in, Indicates keywords in government resources The ratio of the number of occurrences to the total number of keyword occurrences. N represents the total number of keywords in all types of keyword libraries. Indicates the total length of the resource text. It is the number of keywords in a keyword library of a certain type. The text uniqueness index of government resources is calculated as follows: The government resource is stored in the type that is most relevant to the government resource in the government resource library; The user matching module is used to obtain the user's latest behavior record and confirm the type of government resources that the user is interested in based on the latest behavior record, including: obtaining the user's most recent search record as the latest behavior record; extracting a search term set from the user's search record; calculating the similarity between the search term set and the keyword library corresponding to all types of government resources; calculating the similarity between the search term set and the keyword library corresponding to a certain type of government resource; The calculation formula is as follows: in, is the total number of search terms in the search term set, For a certain type of keyword library, Keyword Library The total number of keywords, Represents search term set and keyword library According to the calculation results, the type of government resources with the highest similarity is confirmed to be the type that the user is interested in; The matching degree calculation module is used to obtain the release time and deadline of the government resources of the type that the user is interested in, and calculate the matching degree of the government resources based on the release time and deadline, including: using the following formula to calculate the matching degree of each government resource under this type: in, The similarity between the search term set and each government resource calculated using the existing cosine similarity calculation method is: is the maximum value of cosine similarity , is the time decay rate, is the maximum value of time decay among all government resources. The calculation formula is as follows: in, For the release time, For the deadline, is the current time, as well as All are time differences in days; The resource recommendation module is used to sort the government resources of the type that the user is interested in based on the matching degree and preset sorting rules and recommend them to the user.
5. An electronic device, characterized in that: The device includes a processor and a memory; a program is stored in the memory, and the program is loaded and executed by the processor to implement a government resource recommendation method based on pre-aggregation and optimization as described in any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: The storage medium stores a program, which, when executed by a processor, is used to implement a government resource recommendation method based on pre-aggregation and optimization as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Application group recommendation method and device
CN105069106A
Information pushing method and device, computer equipment and storage medium
CN110837590A