Functional programming intelligent recommendation method and system based on semantic knowledge graph

By extracting semantic features and clustering multi-source functional programming corpora, constructing a semantic knowledge graph, and dynamically adjusting the recommendation strategy, the problems of low efficiency and semantic drift in function recommendation are solved, and efficient and accurate function recommendation is achieved.

CN121050696AActive Publication Date: 2025-12-02GANSU COMM IND SERVICE CO LTD POST & TELECOMM PLANNING CONSULTING & DESIGN BRANCH

Patent Information

Application Number
CN202511595784.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-04
Publication Date
2025-12-02
Estimated Expiration
2045-11-04

AI Technical Summary

Technical Problem

In current software development, function recommendation efficiency is insufficient, and semantic path noise and inference offset exist in the graph reasoning stage. Semantic embedding models are prone to semantic position distortion when the graph scale expands and knowledge is updated, which increases the time cost for developers in the process of function selection, combination and debugging.

Method used

By extracting semantic feature vectors from multi-source functional programming corpora, a semantic embedding space is constructed. A semantic aggregation pre-screening mechanism is used for preliminary clustering, candidate entity clusters are dynamically processed, a semantic knowledge graph is constructed, the semantic relationship paths of functions are traversed, a recommendation strategy is generated, and dynamic adjustments are made in combination with user operation history.

Benefits of technology

It significantly improves the accuracy and context relevance of function recommendations, reduces semantic drift and path noise, improves developer efficiency, and ensures that the recommendation results meet actual needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121050696A_ABST
    Figure CN121050696A_ABST
Patent Text Reader

Abstract

The invention discloses a functional programming intelligent recommendation method and system based on a semantic knowledge graph, relates to the technical field of data processing, and constructs a high-dimensional semantic embedding space by performing semantic feature vector extraction on a multi-source functional programming corpus. The method comprises the following steps: firstly, embedding a plurality of candidate entity clusters into a semantic embedding space, preliminarily clustering the embedded vectors by utilizing a semantic aggregation pre-screening mechanism to obtain each candidate entity cluster and performing dynamic processing, then constructing a semantic relationship among the candidate entity clusters according to neighborhood distribution of the semantic embedding space, performing self-adaptive correction on inter-cluster distribution, and constructing a semantic knowledge graph generation recommendation method. A closed loop is formed from the corpus to the knowledge graph to the recommendation strategy, so that the intelligent recommendation system can accurately recognize the function semantic relationship, reduce noise interference and improve the recommendation hit rate and the personalized matching effect, and the accuracy, stability and user satisfaction of functional programming intelligent recommendation based on the semantic knowledge graph are remarkably enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a functional programming intelligent recommendation method and system based on semantic knowledge graphs. Background Technology

[0002] Functional programming is a programming paradigm that emphasizes using functions to describe computation, rather than variables and data structures. The core idea of ​​this approach is to view computation as a functional application of data, rather than altering the state of the data. In the field of artificial intelligence, the characteristics of functional programming bring numerous conveniences to model building and algorithm implementation. In machine learning algorithms, the pure function nature of functional programming makes the model training process more predictable and debuggable. Interaction through functional interfaces reduces dependencies and coupling between services. Furthermore, with the development of emerging technologies such as quantum computing, functional programming, due to its strong support for parallel computing and function composition, is expected to play a significant role in these fields, providing new ideas and methods for solving more complex computational problems.

[0003] For example, the publicly disclosed intelligent recognition and recommendation system, with announcement number CN117725313B, belongs to the field of information processing technology. The system includes three interconnected modules: an event decision-making module, a customer group selection module, and an analysis module. The event decision-making module acquires current user behavior data, makes decisions through a strategy tree, and obtains information recommendation clues. In the customer group selection module, a real-time analysis database acquires and stores current user behavior data, and a customer group screening canvas is used to obtain a list of recommended users based on the data in the real-time analysis database. The analysis module determines the information recommendation content corresponding to each user tag in the recommended user list based on the information recommendation clues. The intelligent recognition and recommendation system, by obtaining information recommendation clues and a list of recommended users, and through the analysis module, generates information recommendation content corresponding to each user based on the information recommendation clues and user tags, and pushes information recommendation content to users in a timely and accurate manner.

[0004] For example, the publicly disclosed intelligent personalized recommendation system with publication number CN118013107A includes a data collection module, a data preprocessing and cleaning module, a feature engineering module, a machine learning module, a recommendation generation module, a user feedback and update module, a user interface module, a big data analysis and storage module, a security and privacy module, and a performance monitoring and optimization module.

[0005] The above-mentioned technology has at least the following technical problems: Current software development methods suffer from shortcomings in function recommendation and efficiency improvement, and semantic path noise and inference bias may occur during the graph inference stage. The relationships between different function entities in a knowledge graph are not always strongly logically related; some marginal relationships may only be effective in specific scenarios. Furthermore, semantic drift may occur during semantic embedding and feature extraction. As the graph expands and knowledge is updated more frequently, the semantic representation space of the embedding model may gradually deviate from its original distribution, causing semantic distortion of some functions, especially when handling new libraries or functions. This increases the time cost for developers in function selection, combination, and debugging, and may also cause them to miss high-value functions that better meet actual needs. Summary of the Invention

[0006] To address the technical problems existing in the prior art, embodiments of the present invention provide a functional programming intelligent recommendation method based on semantic knowledge graphs. The technical solution is as follows, including: Semantic feature vectors are extracted from multi-source functional programming corpora and a semantic embedding space is constructed. The semantic embedding vectors are pre-clustered through a semantic aggregation pre-screening mechanism to obtain candidate entity clusters. Fusion judgment is performed on each candidate entity cluster to obtain the fusion judgment result of each candidate entity cluster. Dynamic processing is performed on each candidate entity cluster based on the fusion judgment result.

[0007] The semantic relations of each candidate entity cluster are constructed based on the neighborhood distribution of the semantic embedding space, and the neighborhood distribution of each candidate entity cluster in the semantic embedding space is adaptively corrected to reconstruct each candidate entity cluster.

[0008] A semantic knowledge graph is constructed based on the reconstructed candidate entity clusters. The functional semantic relationship paths of the semantic knowledge graph are traversed to obtain the confidence factors of each functional semantic relationship path. A recommendation strategy is generated based on the confidence factors of each functional semantic relationship path.

[0009] A second aspect of the present invention also provides a functional programming intelligent recommendation system based on semantic knowledge graphs, comprising: a semantic embedding and candidate cluster generation module, used to extract semantic feature vectors from multi-source functional programming corpora and construct a semantic embedding space, perform preliminary clustering of semantic embedding vectors through a semantic aggregation pre-screening mechanism to obtain candidate entity clusters, perform fusion judgment on each candidate entity cluster to obtain the fusion judgment result of each candidate entity cluster, and perform dynamic processing on each candidate entity cluster based on the fusion judgment result.

[0010] The candidate cluster adaptive reconstruction module is used to construct the semantic relationship of each candidate entity cluster based on the neighborhood distribution of the semantic embedding space, and to adaptively correct the neighborhood distribution of each candidate entity cluster in the semantic embedding space to reconstruct each candidate entity cluster.

[0011] The Functional Semantic Relationship Path Reasoning and Intelligent Recommendation Module is used to construct a semantic knowledge graph based on the reconstructed candidate entity clusters, traverse the functional semantic relationship paths of the semantic knowledge graph, obtain the confidence factor of each functional semantic relationship path, and generate a recommendation strategy based on the confidence factor of each functional semantic relationship path.

[0012] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following: (1) This invention proposes an intelligent recommendation method for functional programming based on semantic knowledge graphs. First, semantic feature vectors are extracted from multi-source functional programming corpora to construct a high-dimensional semantic embedding space. Then, a semantic aggregation pre-screening mechanism is used to perform preliminary clustering of the embedding vectors to obtain candidate entity clusters and dynamically optimize them. Next, semantic relationships between entity clusters are constructed based on the neighborhood distribution of the semantic embedding space. The distribution between clusters is adaptively corrected to form a semantic knowledge graph. Finally, recommendation strategies are generated based on the function semantic relationship paths of this graph, realizing a closed loop from corpus to knowledge modeling to intelligent recommendation. In actual development environments, it can be combined with IDEs, code completion systems, or function library management platforms, enabling the recommendation engine to dynamically adjust the function recommendation results by combining contextual call features and historical usage preferences. This effectively reduces semantic drift and path noise in existing technologies, significantly improving the accuracy, context relevance, and user operation efficiency of function recommendations.

[0013] (2) This invention calculates the fusion requirement factor of each candidate entity cluster, performs refined classification and dynamic processing of the candidate clusters, and enables the system to distinguish between sets of functions with high semantic consistency and good type matching and sets with potential conflicts or semantic deviations. In actual functional programming scenarios, developers often need to select or combine multiple functions with similar functions but different implementations in complex semantic contexts. If there is no semantic consistency judgment mechanism, it will often lead to incompatibility between functions, conflicting call logic, or deviations in execution results. Compared with the traditional static aggregation method based on function signature or call frequency, this invention introduces multi-dimensional fusion indicators such as mean cosine similarity, type matching rate, and call path overlap rate to evaluate the rationality and compatibility of function combination from a semantic level, thereby effectively reducing the occurrence of semantic drift, type conflict, and redundant recommendations. This not only improves the structural stability of candidate entity clusters in the semantic knowledge graph, but also provides high-quality input for subsequent adaptive cluster reconstruction, knowledge graph semantic reasoning, and function call path optimization, making the recommendation results more in line with the real programming needs of developers, and significantly improving the accuracy, reliability, and code reuse efficiency of function recommendations.

[0014] (3) This invention introduces an overall stability score for priority candidate regions to evaluate the clustering robustness of candidate entity clusters in real time. It also dynamically adjusts the update step size of the model by statistically analyzing the number of erroneous clusters in each detection cycle. This allows the system to automatically accelerate iterations to achieve rapid correction when semantic distribution shifts, while maintaining a smaller step size in the stable phase to ensure model convergence accuracy. Function recommendation systems typically employ fixed clustering step sizes and static model update strategies, which are difficult to adapt to dynamic changes in the semantic space in a timely manner. However, this invention uses a control mechanism to ensure that the embedding space can maintain the rationality and continuity of the clustering structure when faced with new functions or changes in semantic relationships. This enables priority management and stability monitoring of function entity clusters, providing a more reliable structural foundation for subsequent semantic knowledge graph construction and function recommendation strategy generation, effectively improving the accuracy of semantic aggregation and the overall recommendation performance of the system.

[0015] (4) This invention quantifies and ranks the confidence factors of the semantic relationship paths of each function in the semantic knowledge graph, and prioritizes the inclusion of high-confidence paths into the main recommendation channel, enabling the recommendation system to prioritize the output of highly reliable function combinations that have been verified by semantics and call history. In the current functional programming development environment, function recommendation systems mostly rely on static rules or single similarity calculations, lacking the ability to dynamically respond to the reliability of function semantic paths and user behavior feedback, resulting in unstable recommendation results or deviations from actual needs. This invention also collects the user's actual operation records in real time during system operation, such as function selection, call success rate, and usage frequency, and dynamically integrates these behavioral feedbacks into the confidence factor update mechanism to achieve continuous optimization and adaptive correction of the recommendation strategy, effectively suppressing the influence of semantic noise and weakly related paths, enabling the recommendation system to maintain high accuracy and high adaptability in changing development scenarios. This not only significantly improves the accuracy and context fit of recommendations, but also enhances the system's self-adjustment ability to new function libraries, semantic drift, and changes in user preferences, ultimately improving overall development efficiency and intelligence level. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a schematic diagram of the method provided in an embodiment of the present invention; Figure 2 This is a flowchart of the functional programming intelligent recommendation method based on semantic knowledge graph provided in this embodiment of the invention; Figure 3This is a flowchart of the function metadata generation process provided in an embodiment of the present invention; Figure 4 This is an example diagram of a semantic knowledge graph provided in an embodiment of the present invention; Figure 5 This is a flowchart of the intelligent recommendation algorithm provided in an embodiment of the present invention; Figure 6 A schematic diagram of system modules provided in an embodiment of the present invention. Detailed Implementation

[0018] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0019] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.

[0020] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, they convey the same meaning.

[0021] In this embodiment of the invention, sometimes a subscript such as W1 may be written in a non-subscript form such as W1. When the difference is not emphasized, the meaning they express is the same.

[0022] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0023] like Figure 1 As shown in the figure, this embodiment of the invention provides a schematic diagram of a functional programming intelligent recommendation method based on semantic knowledge graph. The method includes: extracting semantic feature vectors from multi-source functional programming corpora and constructing a semantic embedding space; performing preliminary clustering of semantic embedding vectors through a semantic aggregation pre-screening mechanism to obtain candidate entity clusters; performing fusion judgment on each candidate entity cluster to obtain the fusion judgment result of each candidate entity cluster; and performing dynamic processing on each candidate entity cluster based on the fusion judgment result.

[0024] The semantic relations of each candidate entity cluster are constructed based on the neighborhood distribution of the semantic embedding space, and the neighborhood distribution of each candidate entity cluster in the semantic embedding space is adaptively corrected to reconstruct each candidate entity cluster.

[0025] A semantic knowledge graph is constructed based on the reconstructed candidate entity clusters. The functional semantic relationship paths of the semantic knowledge graph are traversed to obtain the confidence factors of each functional semantic relationship path. A recommendation strategy is generated based on the confidence factors of each functional semantic relationship path.

[0026] It should be noted that by extracting semantic feature vectors and constructing an embedding space, the system can accurately represent the semantic information between functions, enabling recommendations to be based on actual semantics rather than simple text matching, thereby improving accuracy. Through aggregation pre-screening, fusion judgment, and dynamic processing, the semantic consistency and rationality of calls within candidate entity clusters are guaranteed, reducing erroneous recommendations caused by noise and incorrect clustering, and improving context relevance. Adaptive correction and reconstruction of inter-cluster relationships ensure reasonable distribution of semantic neighborhoods and stable path logic, providing high-quality input for subsequent knowledge graphs and making the combination relationships between functions more consistent with actual calling scenarios. Finally, by using the confidence factor of function semantic relationship paths to generate recommendation strategies, the system can prioritize function combinations with high confidence and high semantic fit, while dynamically adjusting based on user operation history, thereby shortening development decision time, reducing repetitive operations, and improving user operation efficiency. The synergistic effect of these links constitutes the specific basis for improving the performance of the recommendation system.

[0027] It's important to note that the recommendation strategy is generated based on the confidence factors of each function's semantic relationship path. This process occurs after the recommendation strategy is generated but before the actual suggestions are delivered to the user. It dynamically updates the path confidence factors based on the user's function selection, call success rate, and usage frequency. Specifically, after the recommendation strategy is generated, the system monitors each function call in the user's actual programming environment, including the user's selected function, whether the function call was successful, and the frequency of the function's usage in a specific context, recording this information as a user behavior log. Then, this behavioral data is mapped back to the corresponding function semantic relationship path, and the recommendation weights are dynamically adjusted based on the user's actual operation records. After the recommendation weights are updated, the system reorders all paths and generates a new recommendation strategy so that the next recommendation is more aligned with the user's actual preferences and contextual needs. This process forms a closed-loop feedback mechanism, allowing the recommendation strategy to continuously adapt and optimize with user behavior, thereby suppressing the interference of low-relevance paths on recommendations and improving recommendation accuracy and operational efficiency. This real-time adjustment and adaptive optimization of the recommendation strategy ensures that the generated recommendations better match the user's current usage habits and contextual environment.

[0028] It should be noted that in the semantic modeling phase of the system, semantic feature vectors are first extracted from the multi-source functional programming corpus (including function definitions, call contexts, parameter types, return value descriptions, and code comments). The input corpus is encoded by a pre-trained language model (such as CodeBERT, GraphCodeBERT, or T5-Code), outputting high-dimensional semantic embedding vectors to represent the position of each function in the semantic space. Subsequently, the system performs semantic clustering based on these embedding vectors using density clustering algorithms (such as DBSCAN) or hierarchical clustering, forming preliminary candidate entity clusters based on the cosine similarity and call dependencies between functions. In this process, the model input is the function semantic embedding matrix and call graph information, and the output is the member allocation results of several candidate clusters. Next, a fusion decision mechanism is used to calculate the average semantic similarity, type matching rate, and call path overlap rate of each cluster, generating a fusion requirement factor to determine whether to merge, delay, or split the clusters. For the formed stable candidate clusters, the system further constructs a semantic relationship network between functions based on the neighborhood distribution of the semantic embedding space. Specifically, a semantic relationship graph is constructed using a graph embedding model (such as GraphSAGE or TransE) with each candidate cluster as a node and function call frequency, semantic dependency strength, and context co-occurrence probability as edge weights. The model takes candidate cluster features and a neighborhood connectivity matrix as input and outputs semantic relationship weights and spatial location vectors between clusters. An adaptive correction mechanism updates the neighborhood distribution in the embedding space, optimizing the spatial locations of anomalous clusters and edge functions, achieving semantic consistency and stable reconstruction of the cluster structure. This provides a high-quality semantic foundation for subsequent knowledge graph construction and function recommendation.

[0029] It should be noted that after filtering the inference path, the system semantically locates the input based on the user's current programming environment (including code context, function call stack, variable types, dependency libraries, and programming language version), and projects this input into the embedding space of the knowledge graph. Through path expansion and semantic neighborhood retrieval, the system selects the set of function entities most relevant to the current task, and performs weighted scoring and ranking based on multi-dimensional features such as semantic similarity, type compatibility, context co-occurrence strength, and version stability to generate a preliminary recommendation list. This list can be output as code completion suggestions, function call templates, or alternative implementation schemes to support the user's development activities. If the user calls the same type of function multiple times in the same context, the system will automatically identify this as a usage preference and generate semantic memory nodes, making subsequent recommendations more in line with individualized programming habits.

[0030] It should be noted that the reasoning path selection is a process of targeted selection and constraint screening of possible combinations of functional entities in the knowledge graph, based on the previously constructed semantic knowledge graph and the reconstruction results of candidate entity clusters. Its purpose is to extract the most semantically reliable and practically usable function combination paths from the vast functional relationship network, providing a foundation for subsequent recommendation strategy generation. Specifically, firstly, using candidate entity clusters, the semantic feature vector of each entity cluster is mapped to the embedding space of the knowledge graph, giving each entity a clear position and neighborhood relationship in the high-dimensional space. Based on this, the functional semantic relationship paths of the knowledge graph are traversed. For each path, the semantic consistency, type compatibility, and continuity of calling logic among its internal functional entity clusters are examined, i.e., whether there are stable calling dependencies, data type matching, and the frequency of co-occurrence in historical corpora between adjacent entities on the path. Furthermore, the path selection process also considers historical usage and co-occurrence patterns over time. For example, when the same function call sequence appears repeatedly in multiple contexts with a consistent call order, the system marks the function combination as a "continuously occurring" high-frequency call path. For function combination paths that appear consecutively with a stable logical order and a frequency that reaches a preset threshold, the system will prioritize their retention. Paths that do not reach the preset threshold in terms of the number of calls or have obvious logical jumps in the function call chain will be marked as low-confidence paths or directly excluded. Ultimately, only highly reliable and highly relevant function combination paths will be retained. This lays a solid foundation for subsequent semantic localization and selection of task-related function sets in the user's current programming environment, thereby ensuring that the generated recommendation strategy not only conforms to the actual usage logic of the functions but also minimizes the impact of semantic drift and type conflicts.

[0031] It should be noted that dynamic processing includes direct merging, delayed observation, or semantic splitting.

[0032] like Figure 2 As shown, Figure 2The flowchart of the functional programming intelligent recommendation method based on semantic knowledge graph provided in this embodiment of the invention is as follows: First, semantic feature vectors are extracted from multi-source functional programming corpora and an embedding space is constructed. The embedding vectors are semantically aggregated and pre-screened to obtain candidate entity clusters. Then, based on the fusion requirement factor of the candidate clusters, the clusters are judged and processed into merging, delayed observation, or splitting. The clusters are assigned to different priority candidate regions according to the difference in fusion requirement. Furthermore, the intra-cluster variance, inter-cluster distance, and neighborhood overlap rate are calculated through a preset detection period to determine whether to trigger adaptive reconstruction of the clusters. After reconstruction, a semantic knowledge graph is constructed. The functional semantic relationship paths in the knowledge graph are traversed, and the historical hit rate, context matching degree, and semantic consistency of the paths are calculated and weighted to obtain the path confidence factor. Finally, a recommendation strategy is generated based on the path confidence factor ranking, and the recommendation weight is dynamically adjusted in combination with the user's actual operation record to optimize the semantic reliability and user adaptability of function recommendation. The specific process of determining the fusion requirement factor based on the candidate cluster is as follows: the evidence strength of each candidate entity cluster obtained by semantic aggregation pre-screening is evaluated, the average cosine similarity, type matching rate and call path overlap rate of each candidate entity cluster are obtained, and the average cosine similarity, type matching rate and call path overlap rate of each candidate entity cluster are weighted and fused to obtain the fusion requirement factor of each candidate entity cluster. The fusion requirement factor of each candidate entity cluster is used to quantitatively evaluate the semantic consistency, type compatibility and consistency of actual call logic of the function entities within each candidate entity cluster.

[0033] It's important to note that dynamically adjusting recommendation weights based on users' actual operation records involves the system collecting the user's current programming operation records after generating a knowledge graph-based function recommendation strategy. This includes the functions actually called in the code editing area, the call order, the types of input parameters, the dependent libraries used, the number of times the function was called repeatedly, and the matching of the calls with the code context. The system maps these operation records to function entities or semantic paths in the knowledge graph, calculating the "user call frequency" and "context matching degree" for each path. Specifically, if a user calls a function on a certain path multiple times in their most recent or three most recent editing operations, the "user call frequency" score for that path will increase; if the function on the path is highly consistent with the current code context (such as variable types and dependent libraries), the "context matching degree" score will also increase. Next, the system combines the path confidence factor with these two scores, calculating the final weight of each path through direct summation or linear normalization. Paths with higher weights are ranked higher in the recommendation list, while paths with lower weights are ranked lower. Whenever a user makes a new function call, the system immediately updates the user's call frequency and context matching score, and recalculates the final weights to adjust the ranking of the recommendation list. This mechanism ensures that paths with high confidence and that match the user's recent actions and current context are prioritized, while irrelevant or unused paths are automatically downgraded, achieving accurate and dynamic personalized recommendations.

[0034] like Figure 3 As shown, Figure 3 This is a flowchart of the function metadata generation process provided in this embodiment of the invention. Function metadata generation is the input end of the entire system, used to extract structured information (such as function name, parameters, return type, call relationship, context description, etc.) from multi-source functional programming corpora and form metadata that can be used for semantic modeling. In this embodiment, function metadata generation starts with two data input methods: automatic data scraping (obtained from open-source code repositories, hosting platforms, etc.) and manual input (user-filled function information). After preliminary processing, the data from the two paths converge into a unified data cleaning and format standardization stage. Subsequently, through parsing and key attribute extraction, standardized function metadata is finally generated. This diagram clearly shows a complete data processing pipeline from multi-source data acquisition to standardized output.

[0035] Specifically, the fusion determination results of each candidate entity cluster are obtained. The specific process is as follows: extract the fusion requirement factor of each candidate entity cluster and compare it with the fusion requirement factor threshold range stored in the database. If the fusion requirement factor of a candidate entity cluster is higher than the upper limit of the fusion requirement factor threshold range, the fusion determination result of the candidate entity cluster is recorded as merged.

[0036] If the fusion demand factor of a candidate entity cluster is within the threshold range of the fusion demand factor, then the fusion determination result of the candidate entity cluster is recorded as a delayed observation.

[0037] If the fusion demand factor of a candidate entity cluster is lower than the lower limit of the fusion demand factor threshold range, the fusion determination result of the candidate entity cluster is recorded as split.

[0038] It should be noted that the process of extracting semantic feature vectors and constructing a semantic embedding space from multi-source functional programming corpora begins with the system acquiring function-related data from different sources, including function definitions, parameter signatures, call examples, library dependency information, and user code context, while also taking into account the differences between multi-language versions and documentation from different frameworks. The system first preprocesses the original source code and documentation text, including syntax parsing, identifier normalization, comment extraction, and function call path analysis, to form a unified semantic representation foundation. Subsequently, natural language processing techniques are used to encode word vectors into function comments, documentation descriptions, and natural language information embedded in the code. Simultaneously, static code analysis methods are combined to extract structured features from function signatures, input / output types, return value structures, and call patterns, thereby obtaining multimodal feature representations. The system maps the aforementioned multimodal features into a high-dimensional vector space through a deep embedding model. Each function entity corresponds to a vector representation in the embedding space. This vector comprehensively reflects the function's semantics, structure, contextual dependencies, and version information, forming a high-dimensional, continuous, and measurable semantic embedding space. Each vector not only reflects the semantic features of the function itself but also contains its association information in different contexts, versions, and libraries. This provides a solid data foundation and spatial support for subsequent candidate entity cluster generation, semantic clustering, graph construction, and intelligent recommendation, realizing the unified representation and operable management of multi-source function semantics in the embedding space.

[0039] It should be noted that the mean cosine similarity is calculated by taking the cosine similarity of all vectors within a cluster and then averaging them. A higher value indicates that the semantics expressed by the functions within the cluster are more similar, and the cluster is more compact.

[0040] It should be noted that the type matching rate and call path overlap rate are primarily obtained through structured feature analysis of entity nodes and their associated functions in the semantic knowledge graph. The system first encodes the parameter types, return value types, and their positional relationships in the function signatures of each function in the candidate entity cluster. It then calculates the similarity of type vectors between different functions using a semantic embedding model. Finally, it normalizes the similarity by incorporating inheritance and inclusion relationships in the type hierarchy ontology, thus obtaining the type matching rate, which measures the consistency of different functions in their input-output semantic structures. The call path overlap rate is obtained based on the topological structure of the function call dependency graph. The system extracts the call chains of each function from function metadata and static code analysis results, forming a path set. The degree of overlap in call relationships is characterized by calculating the ratio of the intersection to the union of the path sets among candidate entity clusters. This metric comprehensively reflects the co-occurrence strength and functional proximity of functions in the logical execution chain, effectively revealing potential semantic relevance and substitutability, providing high-confidence structural support for subsequent entity fusion and recommendation decisions.

[0041] It should be noted that the weighted fusion of the average cosine similarity, type matching rate, and call path overlap rate of each candidate entity cluster involves directional standardization of each parameter to ensure that the numerical directions of all indicators are consistent, thus enabling unified comparison. Specifically, after unifying the directions, the parameters are mapped to a unified dimensional range to eliminate the impact of dimensional differences between different indicators on the fusion results. Subsequently, the system performs a linear weighted summation of the three standardized and normalized indicators based on strategic weights. This results in a fusion requirement factor that simultaneously reflects the consistency of semantic consistency, type compatibility, and the consistency of actual call logic, providing a decision-making basis for subsequent fusion determination. This allows the system to dynamically select direct merging, delayed observation, or splitting processing strategies, achieving intelligent management and optimization of candidate entity clusters.

[0042] It's important to note that when the system performs fusion judgment on candidate entity clusters, it first needs to ensure that the numerical directions of the three indicators are consistent. A higher mean cosine similarity indicates greater semantic consistency, a higher type matching rate indicates better type compatibility, and a higher call path overlap rate indicates stronger consistency in actual call logic. All indicators are normalized, mapping them to a range of 0 to 1. For example, minimum-maximum normalization can be used: subtract the minimum value from the current value and then divide by the difference between the maximum and minimum values. This allows indicators with different dimensions and ranges to be directly compared. Mapping the values ​​of all indicators to the range of 0 to 1 ensures that larger values ​​better meet the expected fusion conditions. To ensure consistent comparison, the system performs directional standardization on these indicators. In this embodiment, higher values ​​for mean cosine similarity, type matching rate, and call path overlap rate indicate greater semantic consistency. These indicators are inherently positive for calculating the fusion requirement factor and do not require reversal. However, if some indicators have negative original values, they need to be reversed, for example, by subtracting the current value from the maximum value or taking a negative value, to align their direction with the positive indicators. After unifying the directions, the system weights the three indicators according to strategic weights. This weighting is determined based on the system's assessment of the importance of different indicators in the candidate cluster fusion decision. The system can preset the weights during the design phase or dynamically adjust them based on historical fusion success rates, ensuring the total weights equal to 1 to guarantee that the fusion requirement factor has a clear dimension. The specific method for weighted fusion is as follows: multiply the three standardized indicators by their corresponding weights (e.g., multiply the standardized mean cosine similarity by the weight corresponding to the mean cosine similarity), and then fuse the results of multiplying the three standardized indicators by their corresponding weights, thus accumulating them to obtain a single fusion requirement factor. Preset weights can be set based on expert experience or business needs. For example, in functional programming recommendations, if semantic consistency is more important than type matching, the mean cosine similarity can be given a higher weight, while the call path overlap rate may be secondary, and the type matching rate even lower. Initial weights can be directly expressed as proportions, such as 0.5, 0.3, and 0.2, with the sum of the three being 1. Secondly, historical data-driven optimization methods can be used. By collecting the fusion results of candidate entity clusters in a large number of real-world development scenarios and the subsequent recommendation accuracy, the contribution of each indicator to the correct fusion decision can be calculated. For example, in historically successful fusion clusters, which type of indicator is more likely to predict correct fusion can be statistically analyzed, and the weight can be derived through normalization. Thirdly, machine learning can be combined to optimize the weights. Indicators are used as features, and fusion results (such as whether the fusion was successful or whether it improved recommendation accuracy) are used as labels. A linear regression or logistic regression model is trained, and the regression coefficients trained by the model can be used as indicator weights, which can be directly used after normalization.

[0043] Specifically, dynamic processing is performed on each candidate entity cluster based on the fusion determination result. The specific process is as follows: the candidate entity clusters whose fusion determination result is to be merged are triggered to perform a merging operation.

[0044] The candidate entity clusters whose fusion determination result is delayed observation are cached and enter the entity fusion waiting area. The candidate entity clusters in the entity fusion waiting area are managed hierarchically.

[0045] If the fusion determination result of each candidate entity cluster is split, then the splitting strategy is triggered.

[0046] It should be noted that the system triggers a cluster-level merging operation. The specific process is as follows: First, the system identifies candidate entity clusters to be merged based on the set of clusters whose fusion requirement factors exceed the upper limit of the threshold range. Then, according to the calculated average cosine similarity, type matching rate, and call path overlap rate within each cluster, weighted fusion is performed on similar attributes: attributes with high similarity are averaged to obtain a unified value; fields with matching types are directly merged; overlapping paths are mapped to maintain logical connections; and conflicting or missing attributes are selected or supplemented based on the time consistency criterion. Finally, the system generates unified entity records based on the merged multi-source attributes and updates their identifiers and feature vectors in the database, achieving a structurally consistent and semantically coherent fusion result.

[0047] It should be noted that the splitting strategy first recalculates the relevance between entities within a cluster based on the similarity matrix, and then uses density-based quadratic clustering or graph partitioning algorithms to split the original cluster into several sub-clusters. Subsequently, each sub-cluster is independently subjected to identity consistency determination and attribute completion to ensure the integrity and uniqueness of the entities after splitting.

[0048] Specifically, hierarchical management is implemented for each candidate entity cluster in the entity fusion waiting area. The specific process is as follows: each candidate entity cluster in the entity fusion waiting area is designated as a second candidate entity cluster. The fusion requirement factor of each second candidate entity cluster is extracted and the difference is processed with the set threshold of the fusion requirement factor of the candidate entity cluster to obtain the fusion requirement difference factor of each second candidate entity cluster. The fusion requirement difference factor of each second candidate entity cluster is matched with the priority candidate area corresponding to each interval of the fusion requirement difference factor of the candidate entity cluster stored in the database to obtain the priority candidate area of ​​each second candidate entity cluster. The priority candidate area of ​​the second candidate entity cluster includes the first priority candidate area, the second priority candidate area, and the third priority candidate area.

[0049] It should be noted that extracting the fusion requirement factor of each second candidate entity cluster and performing difference processing with the set fusion requirement factor threshold of the candidate entity cluster involves obtaining the fusion requirement factor of each second candidate entity cluster, comparing it with the fusion requirement factor threshold stored in the database or configuration, and obtaining the difference through subtraction operation, that is, the fusion requirement factor of the candidate cluster minus the threshold. The difference is used to quantify how close or far the candidate cluster is to the threshold, thereby helping to analyze whether the candidate cluster should be assigned to the first, second or third priority candidate area.

[0050] It should be noted that during the dynamic scheduling of the first, second, and third priority candidate regions, the system quantitatively determines the magnitude of changes in key parameters based on historical monitoring data and an adaptive threshold model to ensure the stability and real-time performance of the semantic fusion process. Specifically, for the first priority candidate region, a stable decrease in the semantic drift rate means that the decrease in this indicator within a continuous detection period is no less than 15% of the previous average, and the fluctuation variance is less than 20% of the global variance; this can be considered as semantic drift stabilization. A continuous increase in the co-occurrence ratio means that the average increase over three consecutive detection windows is greater than 10% of the initial baseline value, and its growth trend maintains a positive slope in the fitted curve for a period exceeding a preset threshold. If both the stable decrease in the semantic drift rate and the continuous increase in the co-occurrence ratio are met simultaneously, the system can determine that the semantics within the candidate entity cluster are convergent, triggering a rapid fusion verification process. For the second priority buffer, the system uses a relatively lenient dynamic judgment threshold. When the comprehensive index indicates a significant increase in semantic convergence, it refers to the simultaneous satisfaction of the increase in document description similarity and the change rate of dependency consistency (which measures the change in semantic similarity within or between candidate entity clusters. Document description similarity is generally obtained by calculating the cosine similarity of text embedding vectors of function comments, function signatures, call examples, or related documents. Dependency consistency refers to the degree of consistency between functions or entity clusters in terms of call relationships, parameter types, and functional dependencies. For example, when two functions are frequently called in the same context or share the same dependency library, their dependency consistency is high). This is considered a clear semantic aggregation trend. At this time, the system will mark the cluster as a "potential fusion cluster" and increase its sampling frequency in subsequent detection cycles, entering the high-frequency fusion evaluation stage. If the semantic convergence index of the cluster continues to rise for two consecutive detection cycles, it will be automatically promoted to the first priority candidate area and enter the fast fusion channel. Semantic convergence is a comprehensive quantification of the semantic consistency of members within a candidate entity cluster and the overall vector aggregation. It is usually combined with multiple dimensions such as the mean cosine similarity, type compatibility, and call path overlap rate, and a single index is obtained through weighted fusion. An increase in the metric indicates that functions within a cluster are becoming increasingly consistent in semantics, type, and calling logic, while a decrease indicates semantic drift or increased calling differences. Conversely, if the semantic convergence metric is detected to decrease by more than 20% within three periods or the dependency consistency change rate falls below the threshold, the semantic association is considered to have decayed, and the cluster is downgraded to the third priority observation zone. For the third priority observation zone, low-frequency evaluation is maintained through long-term monitoring, mainly observing the spatial convergence of semantic distribution (spatial convergence refers to the positional relationship of candidate entity clusters relative to the target high-confidence cluster in the semantic embedding space. By calculating the cosine similarity or Euclidean distance of the cluster center vectors, it is evaluated whether the cluster is gradually approaching the high-confidence entity cluster in the multidimensional embedding space).The criterion for determining whether a semantic distribution gradually approaches a high-confidence entity cluster is that, in the last five detection periods, the average cosine similarity between the embedding vector center of the candidate entity cluster and the embedding center of the target high-confidence entity cluster increases by more than 8%, and the semantic variance decreases by more than 25% of the global average. In this case, the semantic aggregation trend can be considered significant. The system will then reactivate the dynamic evaluation process of the candidate entity cluster, causing it to re-enter the buffer for fusion trend re-evaluation. Through multi-level threshold constraints and dynamic adjustment mechanisms, the system can adaptively monitor the evolution of different candidate entity clusters in the semantic embedding space. For clusters with changes within the critical range, the system automatically adjusts the threshold based on the distribution characteristics of historical samples, ensuring robustness and stability of the fusion determination under different corpus sizes and semantic fluctuation intensities. This effectively avoids invalid fusion due to excessively wide thresholds and prevents delays in fusion due to overly stringent conditions, thus achieving a high-confidence, low-redundancy entity fusion process in a dynamically evolving semantic space.

[0051] Specifically, adaptive correction is performed on the neighborhood distribution of each candidate entity cluster in the semantic embedding space. The specific process is as follows: each detection period is preset, and in each detection period, the intra-cluster variance, inter-cluster distance, and neighborhood overlap rate of each second candidate entity cluster in the priority candidate region are obtained. The intra-cluster variance is normalized with the average intra-cluster variance of all candidate entity clusters, the inter-cluster distance is normalized with the average inter-cluster distance, and the neighborhood overlap rate is normalized with the average neighborhood overlap rate to obtain the overall stability score of the candidate entity cluster in the priority candidate region. The overall stability score of the candidate entity cluster in the priority candidate region is used to evaluate the robustness of the overall distribution of the candidate cluster in the embedding space.

[0052] The number of candidate entity clusters in the priority candidate region that have an overall stability score lower than or equal to the set overall stability score threshold in each detection period is recorded as the number of erroneous clusters. If the number of erroneous clusters is higher than or equal to the erroneous cluster count threshold stored in the database, the update step size is increased; otherwise, the update step size is not increased.

[0053] It should be noted that increasing the update step size first requires calculating the difference between the current overall stability score and the threshold, and then mapping this difference to the size of a scaling factor. The mapping employs a configurable scaling strategy (e.g., linear mapping or weak exponential mapping). In actual execution, the current local update step size is directly multiplied by this scaling factor to accelerate convergence, and key indicators (such as the rate of decrease in intra-cluster variance, the improvement in inter-cluster distance, and whether new oscillations appear) are monitored in subsequent training / update iterations. If instability or deterioration of indicators is detected after the update, the system will proportionally revert the step size to the previous safe value within a preset cooling period and record this event as a parameter tuning sample.

[0054] It should be noted that the overall stability score of candidate entity clusters within the priority candidate region is analyzed under the following conditions: ; In the formula, S represents the overall stability score of the candidate entity cluster within the priority candidate region, and A j 2 D represents the intra-cluster variance within the priority candidate region of the j-th second candidate entity cluster. j R represents the inter-cluster distance within the priority candidate region of the j-th second candidate entity cluster. j Let A1 represent the neighborhood overlap rate within the priority candidate region of the j-th second candidate entity cluster, A1 represent the average intra-cluster variance of all candidate entity clusters, D1 represent the average inter-cluster distance, R1 represent the average neighborhood overlap rate, and j represent the number of each second candidate entity cluster, j=1,2,3,...,n, where n represents the total number of second candidate entity clusters.

[0055] It should be noted that intra-cluster variance is primarily obtained by calculating the average distance from all functional entity vectors within the cluster to the cluster center vector. This distance is typically measured using Euclidean or cosine distance, reflecting the semantic concentration of cluster members. A smaller variance indicates greater semantic consistency among entities within the cluster. Inter-cluster distance is obtained by calculating the average distance between the current cluster center vector and the center vectors of other clusters in the same priority candidate region. It measures the relative separation between candidate clusters and other clusters in the embedding space. A larger distance indicates clearer semantic boundaries and less mutual interference between clusters. Neighborhood overlap rate is obtained by statistically analyzing the proportion of overlap between each entity vector within a cluster and other cluster entities in its nearest neighbor vector set. This is calculated by setting a threshold for the number of nearest neighbors. This metric reflects the mutual coverage of candidate clusters with other clusters in space. A lower overlap rate indicates stronger independence of the cluster in the semantic space.

[0056] It should be noted that the intra-cluster variance, inter-cluster distance, and neighborhood overlap rate of each second candidate entity cluster are interrelated and mutually influential in evaluating the overall robustness of the candidate clusters. When the intra-cluster variance increases, it indicates that the vector distribution within the cluster becomes more dispersed, which directly leads to blurred boundaries with neighboring clusters, thus causing the inter-cluster distance to decrease and the neighborhood overlap rate to increase. Conversely, if the intra-cluster variance decreases, the clusters are more compact, which usually increases the inter-cluster isolation and reduces the overlap rate. At the same time, the reduction in the inter-cluster distance itself may be caused by the internal diffusion of a cluster or by the gradual convergence of two semantically very similar clusters (e.g., version convergence or increased semantic overlap).

[0057] Specifically, each candidate entity cluster is reconstructed. The specific process is as follows: obtain the semantic drift rate of each second candidate entity cluster in the entity fusion waiting area after adaptive correction and the co-occurrence ratio of each second candidate entity cluster in the entity fusion waiting area before and after adaptive correction. If the semantic drift rate of a certain second candidate entity cluster after adaptive correction is lower than the set semantic drift rate threshold and the difference in co-occurrence ratio of each second candidate entity cluster before and after adaptive correction is higher than the co-occurrence ratio threshold, then the second candidate entity cluster is marked as a mergeable candidate entity cluster, thereby obtaining each mergeable candidate entity cluster, and then merging each mergeable candidate entity cluster.

[0058] It should be noted that obtaining the semantic drift rate of each second candidate entity cluster in the entity fusion waiting area after adaptive correction requires calculation based on the semantic embedding vector of each entity cluster. That is, by comparing the degree of change of the center vector or member vector of the entity cluster before and after adaptive correction, the semantic drift rate is usually represented by a metric such as cosine distance or Euclidean distance, which reflects the semantic stability of the entity cluster after correction. As for the co-occurrence ratio of each second candidate entity cluster in the entity fusion waiting area before and after adaptive correction, it is obtained by analyzing the co-occurrence frequency of entities within the cluster in the text corpus. The co-occurrence ratio is defined as the ratio of the number of times entity pairs in the cluster co-occur within the same context window to the total number of all possible entity pairs in the cluster. This ratio is calculated before and after correction and is used as the co-occurrence ratio of each second candidate entity cluster in the entity fusion waiting area before and after adaptive correction.

[0059] It should be noted that for these mergeable candidate entity clusters, the system first assigns them to the corresponding priority candidate regions for dynamic monitoring and fusion determination. In the first priority candidate region, when the semantic drift rate of a candidate cluster decreases by less than 5% for three consecutive detection periods, and the co-occurrence ratio increases by more than 10% for three consecutive detection periods, the system determines that the semantic convergence of the candidate cluster has significantly increased, thereby triggering reconstruction or merging operations. In the second priority candidate region, the system allows for some fluctuation in single-period indicators, but as long as the trend score (quantified by one of the various indicators of the candidate entity cluster in consecutive detection periods, such as semantic drift rate, co-occurrence ratio, document description similarity, dependency consistency, etc.) shows a gradual increase over three to five detection periods, and the document description similarity and dependency consistency indicators continue to rise, the candidate cluster is considered to have fusion potential and reconstruction is triggered. Because the semantic state changes slowly in the third priority observation area, the system accumulates trends over five to ten detection cycles. Combining the overall increase in trend scores with the stability of the embedded vectors (the stability of the candidate entity cluster's position in the semantic embedding space, typically quantified by an indicator such as the variance of vectors within the cluster, the magnitude of the cluster center vector's movement, or the cosine similarity to historical vector distributions), the system determines whether the triggering conditions are met, thus avoiding frequent triggering of invalid fusion. Through this mechanism, all merging candidate entity clusters undergo dynamic monitoring, trend quantification, and reconstruction triggering under a unified logic, ensuring robust and efficient semantic aggregation.

[0060] like Figure 4 As shown, Figure 4This is an example of a semantic knowledge graph provided in this embodiment of the invention. The semantic knowledge graph example is mainly used to demonstrate the association structure at the knowledge level after the reconstruction of candidate entity clusters. It includes nodes and edges such as functions, parameters, call chains, context relationships, and functional categories, reflecting the semantic and logical connections between functions and serving as the core knowledge carrier of recommendation algorithms. First, it clarifies the key differences between this function in Python 2.x and 3.x versions (returning a list and an iterator respectively), explaining that as a built-in higher-order function of the builtins module, it can be used without importing. It also clarifies that the core function of `map` is to "apply a specified function to each element of an iterable object to generate a new object," and further elaborates on its name, type, common application scenarios (such as structure transformation), and related best practices for performance optimization. The process involves constructing a semantic knowledge graph based on the reconstructed candidate entity clusters, traversing the functional semantic relationship paths within the semantic knowledge graph, and obtaining the confidence factor for each functional semantic relationship path. Specifically, the process involves constructing a semantic knowledge graph based on the reconstructed candidate entity clusters, traversing each functional semantic relationship path within the semantic knowledge graph, obtaining the historical hit rate, context matching degree, and semantic consistency of each functional semantic relationship path, and performing weighted fusion to obtain the confidence factor for each functional semantic relationship path. The confidence factor of each functional semantic relationship path is used to quantify the reliability of each path in the knowledge graph, reflecting the semantic fit, logical consistency, and user preference matching degree of the function combination associated with the path in the actual use scenario.

[0061] It should be noted that, in terms of semantic knowledge graph construction, the ontology design uses the Protégé tool, modeling according to the concepts and relationships in the functional development domain. Entity extraction utilizes tools such as Stanford CoreNLP (Stanford Natural Language Processing Toolkit) for named entity recognition, combined with regular expression matching, to extract entities from function metadata and code documentation. Relationship mapping determines the relationships between entities by analyzing the association information in code logic and metadata, and uses a Python driver (such as neo4-driver) for Neo4j (a graph database management system) to store the entities and relationships in the graph database.

[0062] It should be noted that in the implementation of the function-based intelligent recommendation algorithm, the semantic similarity-based algorithm uses the Gensim library to train a word vector model and calculate the semantic similarity between functions; the development context-based algorithm obtains contextual information by analyzing the abstract syntax tree (AST) of the code and uses the query function of the knowledge graph to recommend relevant functions; the user behavior-based algorithm uses the Pandas library to preprocess user behavior data and uses the Surprise library to implement a collaborative filtering algorithm for personalized recommendations. Algorithm optimization utilizes optimization algorithms (such as random search and grid search) from the Scikit-learn library to fine-tune the parameters of the recommendation algorithm. In the semantic similarity-based algorithm, the word vector model trained by the Gensim library can effectively capture the semantic features of functions.

[0063] It's important to note that historical hit rate is typically calculated by statistically analyzing the proportion of times the functions involved in the path were actually selected by users during past recommendation processes out of the total number of recommendations. Its value generally ranges from 0 to 1; a higher value indicates that the function combination corresponding to the path better matches the user's actual needs. Context matching is obtained by analyzing the semantic similarity between the user's current query or function call context and the function nodes in the path. It can be mapped to a matching score of 0 to 1 using cosine similarity or Euclidean distance of embedding vectors; a higher value indicates a stronger fit between the current semantic context and the path content. Semantic consistency measures the internal coherence of semantic relationships between function nodes in the path. It can be obtained by calculating the average cosine similarity between node vectors within the path or the consistency score of dependencies. Its value is also usually normalized to the range of 0 to 1; a high value indicates a more stable path semantics and more coherent logic.

[0064] like Figure 5 As shown, Figure 5 This is a flowchart of the intelligent recommendation algorithm provided in this embodiment of the invention. It mainly includes three parallel recommendation algorithm engines: one based on semantic similarity (using models such as Word2Vec / BERT), one based on real-time encoding context (analyzing the code editing area and filtering in the knowledge graph), and one based on user behavior analysis (mining call records and search preferences). The recommendation results generated by these engines are fused together, and finally a recommendation list with metadata is output. The recommendation effect is evaluated and improved through continuous A / B testing and algorithm optimization to form a complete closed-loop intelligent recommendation system. The recommendation strategy is generated based on the confidence factor of the semantic relationship path of each function. Specifically, the confidence factors of the semantic relationship path of each function are sorted from largest to smallest. The recommendation strategy is generated based on the sorting of the confidence factors of the semantic relationship path of each function. At the same time, the user's actual operation record data is obtained, and the recommendation strategy is dynamically adjusted based on the user's actual operation record data.

[0065] It should be noted that in the process of generating recommendation strategies, the system first sorts the semantic relationship paths of each function in the knowledge graph from highest to lowest confidence factor. The sorted paths reflect the semantic credibility and historical usage effect of different function combinations. High-confidence paths indicate that these function combinations perform well in terms of semantic aggregation, call consistency, and historical recommendation hit rate, and therefore should be given priority for generating recommendations. The system will select the function sequence that best matches the current user's needs from the sorted paths based on the current user's context, call requirements, and semantic relationships between path nodes to construct an initial recommendation. It will also consider metrics such as path length, function call dependencies, and document description similarity to ensure the recommendation is both reasonable and executable. For example, if the user is currently writing file reading logic in a Python environment, and the code context includes the variable type `file_path: str` and the dependencies include the `os` and `pandas` modules, the system will retrieve function path combinations highly relevant to these contextual features from the knowledge graph, such as: `os.path.exists→open→pandas.read_csv`, `pathlib.Path.exists→pandas.read_excel`. The system will analyze the user's historical operation records. For example, in the last 10 related tasks, the user selected `pandas.read_csv` 7 times, with a 100% success rate and an average call time of 0.3 seconds; in another 3 times, the user selected `pandas.read_excel` but then replaced it with `read_csv`, indicating that the former is semantically relevant but has a lower actual need matching degree; the user has imported `os` in 80% of similar contexts. The module calls `os.path.exists` to check file existence; historical logs show that the user prefers to verify the path before loading the file (the call order is stable). Based on the above operational data, the system determines that the path `os.path.exists→open→pandas.read_csv` has the highest confidence factor and context matching degree, and prioritizes retaining this path for generating recommendation schemes. After the recommendation strategy is generated, the system collects the user's actual operation data on the recommendation function in real time, including whether the user directly accepts the recommendation, replaces certain functions, or completely rejects the recommendation. This operation data is used as a dynamic feedback signal to adjust the weight of the path in subsequent recommendations.Specifically, for paths repeatedly accepted by users, their confidence factors gradually increase, thus gaining higher priority in future recommendations. For example, if a path is accepted by users over multiple periods, the system calculates an amplification factor based on the number of acceptances and the acceptance rate. This amplification factor is positively correlated with the path's historical hit rate. The amplification can be linear or non-linear. In a linear case, each user acceptance increases the current confidence factor by a set proportion; in a non-linear case, the increase gradually decreases as the number of acceptances accumulates to avoid over-inflation. This principle utilizes historical feedback to strengthen highly reliable paths while maintaining stability and preventing over-adjustment caused by a single abnormal operation. Conversely, for paths repeatedly not accepted, their confidence factors decrease accordingly, and their exposure in the main recommendation channel is reduced by a set proportion.

[0066] like Figure 6 As shown, the second aspect of the present invention also provides a schematic diagram of a functional programming intelligent recommendation system based on a semantic knowledge graph. The system includes: a semantic embedding and candidate cluster generation module, used to extract semantic feature vectors from multi-source functional programming corpora and construct a semantic embedding space; to perform preliminary clustering of the semantic embedding vectors through a semantic aggregation pre-screening mechanism to obtain candidate entity clusters; to perform fusion judgment on each candidate entity cluster to obtain the fusion judgment result of each candidate entity cluster; and to perform dynamic processing on each candidate entity cluster based on the fusion judgment result. A candidate cluster adaptive reconstruction module is used to construct the semantic relationships of each candidate entity cluster according to the neighborhood distribution of the semantic embedding space, and to adaptively correct the neighborhood distribution of each candidate entity cluster in the semantic embedding space, thereby reconstructing each candidate entity cluster.

[0067] The Functional Semantic Relationship Path Reasoning and Intelligent Recommendation Module is used to construct a semantic knowledge graph based on the reconstructed candidate entity clusters, traverse the functional semantic relationship paths of the semantic knowledge graph, obtain the confidence factor of each functional semantic relationship path, and generate a recommendation strategy based on the confidence factor of each functional semantic relationship path.

[0068] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0069] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the devices, apparatuses, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0070] In the embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0071] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0072] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0073] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0074] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A functional programming-based intelligent recommendation method based on semantic knowledge graphs, characterized in that, The method includes: Semantic feature vectors are extracted from multi-source functional programming corpora and a semantic embedding space is constructed. The semantic embedding vectors are pre-clustered through a semantic aggregation pre-screening mechanism to obtain candidate entity clusters. Fusion judgment is performed on each candidate entity cluster to obtain the fusion judgment result of each candidate entity cluster. Dynamic processing is performed on each candidate entity cluster based on the fusion judgment result. The semantic relations of each candidate entity cluster are constructed based on the neighborhood distribution of the semantic embedding space, and the neighborhood distribution of each candidate entity cluster in the semantic embedding space is adaptively corrected and reconstructed. A semantic knowledge graph is constructed based on the reconstructed candidate entity clusters. The functional semantic relationship paths of the semantic knowledge graph are traversed to obtain the confidence factors of each functional semantic relationship path. A recommendation strategy is generated based on the confidence factors of each functional semantic relationship path.

2. The functional programming intelligent recommendation method based on semantic knowledge graphs according to claim 1, characterized in that, The specific process of performing fusion determination on each candidate entity cluster is as follows: Evidence strength assessment is performed on each candidate entity cluster obtained from semantic aggregation pre-screening. The average cosine similarity, type matching rate, and call path overlap rate of each candidate entity cluster are obtained. The average cosine similarity, type matching rate, and call path overlap rate of each candidate entity cluster are weighted and fused to obtain the fusion requirement factor of each candidate entity cluster. The fusion requirement factor of each candidate entity cluster is used to quantitatively evaluate the semantic consistency, type compatibility, and consistency of actual call logic of function entities within each candidate entity cluster.

3. The functional programming intelligent recommendation method based on semantic knowledge graphs according to claim 1, characterized in that, The specific process for obtaining the fusion determination results of each candidate entity cluster is as follows: Extract the fusion requirement factor of each candidate entity cluster and compare it with the fusion requirement factor threshold range stored in the database. If the fusion requirement factor of a candidate entity cluster is higher than the upper limit of the fusion requirement factor threshold range, the fusion determination result of the candidate entity cluster is recorded as merged. If the fusion demand factor of a candidate entity cluster is within the threshold range of the fusion demand factor, then the fusion determination result of the candidate entity cluster is recorded as a delayed observation. If the fusion demand factor of a candidate entity cluster is lower than the lower limit of the fusion demand factor threshold range, the fusion determination result of the candidate entity cluster is recorded as split.

4. The functional programming intelligent recommendation method based on semantic knowledge graphs according to claim 1, characterized in that, The dynamic processing of each candidate entity cluster based on the fusion determination result is as follows: The merging operation is triggered for each candidate entity cluster whose fusion determination result is to be merged. The candidate entity clusters whose fusion determination result is delayed observation are cached and enter the entity fusion waiting area. The candidate entity clusters in the entity fusion waiting area are managed hierarchically. If the fusion determination result of each candidate entity cluster is split, then the splitting strategy is triggered.

5. The functional programming intelligent recommendation method based on semantic knowledge graphs according to claim 4, characterized in that, The specific process for hierarchical management of candidate entity clusters in the entity fusion waiting area is as follows: Each candidate entity cluster in the entity fusion waiting area is designated as a second candidate entity cluster. The fusion requirement factor of each second candidate entity cluster is extracted and the difference is processed with the set threshold of the fusion requirement factor of the candidate entity cluster to obtain the fusion requirement difference factor of each second candidate entity cluster. The fusion requirement difference factor of each second candidate entity cluster is matched with the priority candidate area corresponding to each interval of the fusion requirement difference factor of the candidate entity cluster stored in the database to obtain the priority candidate area of ​​each second candidate entity cluster. The priority candidate area of ​​each second candidate entity cluster includes a first priority candidate area, a second priority candidate area, and a third priority candidate area.

6. The functional programming intelligent recommendation method based on semantic knowledge graphs according to claim 1, characterized in that, The adaptive correction of the neighborhood distribution of each candidate entity cluster in the semantic embedding space is performed as follows: Each detection period is preset, and in each detection period, the intra-cluster variance, inter-cluster distance, and neighborhood overlap rate of each second candidate entity cluster within the priority candidate region are obtained. The intra-cluster variance is normalized to the average intra-cluster variance of all candidate entity clusters, the inter-cluster distance is normalized to the average inter-cluster distance, and the neighborhood overlap rate is normalized to the average neighborhood overlap rate to obtain the overall stability score of the candidate entity cluster within the priority candidate region. The overall stability score of the candidate entity cluster within the priority candidate region is used to evaluate the robustness of the overall distribution of the candidate cluster in the embedding space. The number of candidate entity clusters in the priority candidate region that have an overall stability score lower than or equal to the set overall stability score threshold in each detection period is recorded as the number of erroneous clusters. If the number of erroneous clusters is higher than or equal to the erroneous cluster count threshold stored in the database, the update step size is increased; otherwise, the update step size is not increased.

7. The functional programming intelligent recommendation method based on semantic knowledge graphs according to claim 1, characterized in that, The candidate entity clusters are reconstructed, and the specific process is as follows: The semantic drift rate of each second candidate entity cluster in the entity fusion waiting area after adaptive correction and the co-occurrence ratio of each second candidate entity cluster in the entity fusion waiting area before and after adaptive correction are obtained. If the semantic drift rate of a second candidate entity cluster after adaptive correction is lower than the set semantic drift rate threshold and the difference in co-occurrence ratio of each second candidate entity cluster before and after adaptive correction is higher than the co-occurrence ratio threshold, then the second candidate entity cluster is marked as a mergeable candidate entity cluster. Thus, each mergeable candidate entity cluster is obtained, and each mergeable candidate entity cluster is then merged again.

8. The functional programming intelligent recommendation method based on semantic knowledge graphs according to claim 1, characterized in that, The process of constructing a semantic knowledge graph based on the reconstructed candidate entity clusters, traversing the functional semantic relation paths of the semantic knowledge graph, and obtaining the confidence factor of each functional semantic relation path is as follows: A semantic knowledge graph is constructed based on the reconstructed candidate entity clusters. Each semantic relationship path of a function is traversed in the semantic knowledge graph to obtain the historical hit rate, context matching degree, and semantic consistency of each semantic relationship path. The confidence factor of each semantic relationship path is obtained by weighted fusion. The confidence factor of each semantic relationship path is used to quantify the reliability of each path in the knowledge graph and reflect the semantic fit, logical consistency, and user preference matching degree of the function combination associated with the path in the actual use scenario.

9. The functional programming intelligent recommendation method based on semantic knowledge graphs according to claim 1, characterized in that, The specific process for generating the recommendation strategy based on the confidence factor of each function's semantic relationship path is as follows: The confidence factors of each function's semantic relationship path are sorted from largest to smallest. A recommendation strategy is generated based on the sorting of the confidence factors of each function's semantic relationship path. At the same time, the user's actual operation record data is obtained, and the recommendation strategy is dynamically adjusted based on the user's actual operation record data.

10. A system applying the functional programming intelligent recommendation method based on semantic knowledge graphs as described in any one of claims 1-9, characterized in that, include: The semantic embedding and candidate cluster generation module is used to extract semantic feature vectors from multi-source functional programming corpora and construct a semantic embedding space. It performs preliminary clustering of semantic embedding vectors through a semantic aggregation pre-screening mechanism to obtain candidate entity clusters. It performs fusion judgment on each candidate entity cluster to obtain the fusion judgment result of each candidate entity cluster. Based on the fusion judgment result, it performs dynamic processing on each candidate entity cluster. The candidate cluster adaptive reconstruction module is used to construct the semantic relationship of each candidate entity cluster based on the neighborhood distribution of the semantic embedding space, and to adaptively correct the neighborhood distribution of each candidate entity cluster in the semantic embedding space and reconstruct each candidate entity cluster. The Functional Semantic Relationship Path Reasoning and Intelligent Recommendation Module is used to construct a semantic knowledge graph based on the reconstructed candidate entity clusters, traverse the functional semantic relationship paths of the semantic knowledge graph, obtain the confidence factor of each functional semantic relationship path, and generate a recommendation strategy based on the confidence factor of each functional semantic relationship path.

Citation Information

Patent Citations

  • Intelligent recognition and recommendation system

    CN117725313B

  • Intelligent personalized recommendation system

    CN118013107A

  • Automatic construction method of end-to-end agent based on graph structure semantic fusion

    CN120235181A

  • Intelligent programming auxiliary method and system based on multi-mode AI language model

    CN120315685A

  • Chronic wound nursing scheme recommendation method and system based on clustering and mapping knowledge domain

    CN120473073A

Cited By

  • Large model-oriented split privacy protection training method

    CN121561979A

  • Power grid professional knowledge graph construction method for green supply chain platform

    CN121766416A