Semantic knowledge graph-based functional programming intelligent recommendation method and system

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 distortion in function recommendation are solved, achieving efficient and accurate function recommendation and adaptive optimization.

CN121050696BActive Publication Date: 2026-02-17GANSU COMM IND SERVICE CO LTD POST & TELECOMM PLANNING CONSULTING & DESIGN BRANCH
View PDF 4 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In current software development, function recommendation efficiency is insufficient, semantic path noise and inference bias exist in the graph reasoning stage, and semantic embedding models are prone to distortion when the graph scale expands and knowledge is updated, which increases the time cost of function selection and combination process and may cause high-value functions to be missed.

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 and fusion judgment. Candidate entity clusters are dynamically processed to construct a semantic knowledge graph. The semantic relationship paths of functions are traversed to generate recommendation strategies, which are then dynamically adjusted based on 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, ensures that recommendation results meet actual needs, and enhances the system's adaptability and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121050696B_ABST
    Figure CN121050696B_ABST
Patent Text Reader

Abstract

The application discloses a function programming intelligent recommendation method and system based on a semantic knowledge graph, relates to the technical field of data processing, extracts semantic feature vectors from multi-source function programming corpus, constructs a high-dimensional semantic embedding space, and uses a semantic aggregation pre-screening mechanism to preliminarily cluster embedding vectors to obtain each candidate entity cluster and perform dynamic processing. Then, according to the neighborhood distribution of the semantic embedding space, the semantic relationship between each candidate entity cluster is constructed, the inter-cluster distribution is adaptively corrected, and a semantic knowledge graph is generated to form a recommendation method. From corpus to knowledge graph to recommendation strategy, a closed loop is formed, so that the intelligent recommendation system can accurately identify function semantic relationships, reduce noise interference, improve recommendation hit rate and personalized matching effect, thereby significantly enhancing the accuracy, stability and user satisfaction of the function programming intelligent recommendation based on the semantic knowledge graph.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a function programming intelligent recommendation method and system based on a semantic knowledge graph. BACKGROUND

[0002] Functional programming is a programming paradigm that emphasizes the use of functions to describe computations rather than using variables and data structures. The core idea of this programming approach is to view computation as a functional application to data rather than changing the state of data. In the field of artificial intelligence, the characteristics of functional programming bring many conveniences to model building and algorithm implementation. In machine learning algorithms, the pure function feature of functional programming makes the model training process more predictable and debuggable. Through the interface of functional programming, the interaction between services is reduced, and the dependence and coupling between services are reduced. At the same time, with the development of emerging technologies such as quantum computing, functional programming is expected to play an important role in these fields due to its good support for parallel computing and function composition, and provide new ideas and methods for solving more complex computing problems.

[0003] For example, the patent number CN117725313B discloses an intelligent identification and recommendation system, which belongs to the technical field of information processing. The system includes an event decision module, a customer group selection module, and an analysis module connected to each other. The event decision module is used to obtain user current behavior data, make decisions through a strategy tree, and obtain information recommendation clues. In the customer group selection module, a real-time analysis database is used to obtain and store user current behavior data, and a customer group selection canvas is used to obtain a recommendation user list based on the data of the real-time analysis database. The analysis module is used to determine the information recommendation content corresponding to each user tag in the recommendation user list based on the information recommendation clues. The intelligent identification and recommendation system obtains information recommendation clues and a recommendation user list, and generates information recommendation content corresponding to each user through the analysis module based on the information recommendation clues and user tags, and timely and accurately pushes information recommendation content to users.

[0004] For example, the patent number CN118013107A discloses an intelligent personalized recommendation system, which 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 at least has the following technical problems:

[0006] The existing function recommendation and efficiency improvement in software development are insufficient, and semantic path noise and reasoning deviation problems may occur in the graph reasoning stage. The relationships between different function entities in the knowledge graph do not all have strong logical correlation, and some edge relationships may only be valid in a specific scenario. In addition, semantic drift problems may also occur in the semantic embedding and feature extraction stage. As the size of the graph expands and the knowledge updates frequently, the semantic representation space of the embedding model may gradually deviate from the original distribution, causing the semantic position of some functions to be distorted, especially when dealing with new libraries or functions. This increases the time cost of developers in the function selection, combination, and debugging process, and may also miss higher value functions that better meet actual needs. SUMMARY

[0007] To solve the technical problems existing in the prior art, the embodiments of the present application provide a function programming intelligent recommendation method based on a semantic knowledge graph. The technical solution is as follows, comprising:

[0008] The semantic feature vectors of the multi-source function programming corpus are extracted and a semantic embedding space is constructed. The semantic embedding vectors are preliminarily clustered by a semantic aggregation pre-screening mechanism to obtain each candidate entity cluster. 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 according to the fusion judgment result.

[0009] The semantic relationships of each candidate entity cluster are constructed according to 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 each candidate entity cluster is reconstructed.

[0010] A semantic knowledge graph is constructed according to each reconstructed candidate entity cluster. The function semantic relationship paths of the semantic knowledge graph are traversed to obtain the confidence factors of each function semantic relationship path. A recommendation strategy is generated according to the confidence factors of each function semantic relationship path.

[0011] The second aspect of the present application also provides a function programming intelligent recommendation system based on a semantic knowledge graph, comprising: a semantic embedding and candidate cluster generation module for extracting semantic feature vectors from a multi-source function programming corpus and constructing a semantic embedding space. The semantic embedding vectors are preliminarily clustered by a semantic aggregation pre-screening mechanism to obtain each candidate entity cluster. 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 according to the fusion judgment result.

[0012] 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, and to reconstruct each candidate entity cluster.

[0013] The function semantic relationship path reasoning and intelligent recommendation module is configured to construct a semantic knowledge graph according to the reconstructed candidate entity clusters, traverse function semantic relationship paths of the semantic knowledge graph, obtain a confidence factor of each function semantic relationship path, and generate a recommendation strategy according to the confidence factor of each function semantic relationship path.

[0014] The technical scheme provided by the embodiment of the application has at least the following beneficial effects:

[0015] (1) The application provides an intelligent recommendation method for functional programming based on a semantic knowledge graph. First, semantic feature vectors are extracted from multi-source functional programming corpus to construct a high-dimensional semantic embedding space, and a semantic aggregation pre-screening mechanism is used to preliminarily cluster the embedding vectors to obtain candidate entity clusters and dynamically optimize them. Then, the semantic relationship between the entity clusters is constructed according to the neighborhood distribution of the semantic embedding space, the distribution between the clusters is adaptively corrected, and a semantic knowledge graph is formed. Finally, a recommendation strategy is generated based on the function semantic relationship paths of the graph, realizing a closed loop from corpus to knowledge modeling to intelligent recommendation. In actual development environment, it can be combined with IDE, code completion system or function library management platform for application, so that the recommendation engine can dynamically adjust the function recommendation results by combining the context calling features and historical use preferences, effectively reducing the semantic drift and path noise in the prior art, and significantly improving the accuracy, context relevance and user operation efficiency of function recommendation.

[0016] (2) The application classifies and dynamically processes the candidate clusters by calculating the fusion demand factor of each candidate entity cluster, so that the system can distinguish between function sets with high semantic consistency and good type matching and sets with potential conflicts or semantic deviation. In the actual functional programming scenario, developers often need to select or combine multiple functions with similar functions but different implementation methods in a complex semantic context. If there is no semantic consistency judgment mechanism, it will often lead to type incompatibility between functions, calling logic conflicts or execution result deviation. Compared with the traditional static aggregation method based on function signature or calling frequency, the application introduces multi-dimensional fusion indicators such as average cosine similarity, type matching rate and calling path overlap rate to evaluate the rationality and compatibility of function combination from the semantic level, thereby effectively reducing the occurrence of semantic drift, type conflict and redundant recommendation, not only improving the structural stability of the candidate entity clusters in the semantic knowledge graph, but also providing high-quality input for subsequent adaptive cluster reconstruction, knowledge graph semantic reasoning and function calling 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 recommendation.

[0017] (3) The application evaluates the clustering robustness of the candidate entity cluster in real time by introducing the overall stability score of the priority candidate area, and dynamically adjusts the update step of the model by counting the number of false clusters in each detection period, so that the system can automatically speed up iteration to realize rapid correction when the semantic distribution deviates, and maintain a small step to ensure the convergence accuracy of the model in the stable stage. The function recommendation system usually uses fixed clustering step and static model updating strategy, which is difficult to adapt to the dynamic changes of semantic space in time. The embedding space of the application can still maintain the rationality and continuity of the clustering structure when facing new functions or changes in semantic relationship, thereby realizing the prioritization management and stability monitoring of the function entity cluster, providing a more reliable structural basis for subsequent semantic knowledge graph construction and function recommendation strategy generation, and effectively improving the accuracy of semantic aggregation and the overall recommendation performance of the system.

[0018] (4) The application quantitatively evaluates and sorts the confidence factors of each function semantic relationship path in the semantic knowledge graph, and preferentially includes high-confidence paths into the recommended main channel, so that the recommendation system can preferentially output high-reliability function combinations that have been verified by semantic verification and calling history. In the current functional programming development environment, the function recommendation system relies on static rules or single similarity calculation, lacks dynamic response capability to function semantic path reliability and user behavior feedback, and the recommended results often deviate from the actual needs. The application also collects user's actual operation records such as function selection, calling success rate and usage frequency in real time during system operation, and dynamically integrates these behavior feedback into the update mechanism of the confidence factor to realize continuous optimization and self-adaptive correction of the recommendation strategy, effectively suppress the influence of semantic noise and weakly related paths, and make the recommendation system maintain high precision and high adaptability in the changing development scene. Not only significantly improves the accuracy and context fit of the recommendation, but also enhances the self-adjustment ability of the system to new function library, semantic drift and user preference changes, ultimately improves the overall development efficiency and intelligent level. BRIEF DESCRIPTION OF DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor.

[0020] Figure 1 is a method schematic diagram provided by the embodiment of the application;

[0021] Figure 2 is a flow chart of the intelligent function programming recommendation method based on semantic knowledge graph provided by the embodiment of the application;

[0022] Figure 3 is a function metadata generation flowchart provided by the embodiment of the application;

[0023] Figure 4 is an example semantic knowledge graph provided by the embodiment of the application;

[0024] Figure 5 is an intelligent recommendation algorithm flowchart provided by the embodiment of the application;

[0025] Figure 6 The system module schematic diagram provided by the embodiment of the application. DETAILED DESCRIPTION

[0026] The technical solutions in the application will be described below with reference to the drawings.

[0027] In the embodiments of the application, the words such as “example”, “for example” and the like are used to represent as an example, illustration or description. Any embodiment or design scheme described as “example” in the application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the word “example” is intended to present the concept in a specific manner. In addition, in the embodiments of the application, the meaning expressed by “and / or” can be both, or can be one of the two.

[0028] In the embodiments of the application, “image” and “picture” can be used interchangeably at times, and it should be pointed out that the meanings expressed are consistent when the distinction is not emphasized. “Of”, “corresponding” and “corresponding” can be used interchangeably at times, and it should be pointed out that the meanings expressed are consistent when the distinction is not emphasized.

[0029] In the embodiments of the application, sometimes the subscript such as W1 can be written in the form of non-subscript such as W1, and the meanings expressed are consistent when the distinction is not emphasized.

[0030] In order to make the technical problems, technical solutions and advantages to be solved by the application more clear, specific embodiments will be described in detail below with reference to the drawings.

[0031] As shown in Figure 1 The embodiment of the application provides a function programming intelligent recommendation method based on a semantic knowledge graph, and the method comprises the following steps: performing semantic feature vector extraction on multi-source function programming corpus and constructing a semantic embedding space; performing preliminary clustering on the semantic embedding vector through a semantic aggregation pre-screening mechanism to obtain each candidate entity cluster; performing fusion determination on each candidate entity cluster to obtain a fusion determination result of each candidate entity cluster; and performing dynamic processing on each candidate entity cluster according to the fusion determination result.

[0032] According to the neighborhood distribution of the semantic embedding space, the semantic relationship of each candidate entity cluster is constructed, and the neighborhood distribution of each candidate entity cluster in the semantic embedding space is adaptively corrected, and each candidate entity cluster is reconstructed.

[0033] According to the reconstructed each candidate entity cluster, a semantic knowledge graph is constructed, a function semantic relationship path of the semantic knowledge graph is traversed, a confidence factor of each function semantic relationship path is obtained, and a recommendation strategy is generated according to the confidence factor of each function semantic relationship path.

[0034] It should be noted that through semantic feature vector extraction and embedding space construction, the system can accurately represent the semantic information between functions, so that the recommendation can be based on actual semantics rather than simple text matching, thereby improving accuracy; through aggregation pre-screening, fusion judgment and dynamic processing, the internal semantic consistency and reasonable calling of the candidate entity cluster are guaranteed, noise and error clustering are reduced, and context relevance is improved; adaptive correction and reconstruction of inter-cluster relationships ensure reasonable semantic neighborhood distribution and stable path logic, providing high-quality input for subsequent knowledge graph, and making function combination more in line with actual calling scenarios; finally, using the function semantic relationship path confidence factor to generate a recommendation strategy can prioritize high-confidence and high-semantic-compatibility function combinations, while dynamically adjusting based on user operation history, thereby shortening development decision-making time, reducing repetitive operations, and improving user operation efficiency. The synergistic effect of these links collectively constitutes the specific basis for improving the performance of the recommendation system.

[0035] It should be noted that according to the confidence factor of each function semantic relationship path, a recommendation strategy is generated, which occurs after the generation of the recommendation strategy and before the actual output of the suggestion to the user, and is used to dynamically update the path confidence factor based on user function selection, calling success rate and usage frequency, etc. operation records, that is, after the generation of the recommendation strategy, the system will monitor each function call in the actual programming environment of the user, including the function selected by the user, whether the function call is successful, the usage frequency of the function in a specific context, etc., and record these information as user behavior logs. Then, map these behavior data back to the corresponding function semantic relationship path, and dynamically adjust the recommendation weight based on the actual operation of the user. After the recommendation weight is updated, the system reorders all the paths and generates a new recommendation strategy, so that the next recommendation can better meet the actual preferences and context needs of the user. This process forms a closed-loop feedback mechanism, which continuously optimizes the recommendation strategy based on user behavior, thereby suppressing the interference of low-relevance paths on the recommendation, while improving the recommendation accuracy and operation efficiency. Thus, the recommendation strategy is adjusted and optimized in real time, so that the generated recommendation is more in line with the actual usage habits and context environment of the current user.

[0036] It should be noted that in the semantic modeling phase of the system, first, the semantic feature vector extraction is performed on the multi-source functional programming corpus (including function definition, calling context, parameter type, return value specification and code annotation, etc.). The input corpus is encoded by a pre-trained language model (such as CodeBERT, GraphCodeBERT or T5-Code), and a high-dimensional semantic embedding vector is output to represent the position of each function in the semantic space. Subsequently, the system uses density clustering algorithm (such as DBSCAN) or hierarchical clustering (Hierarchical Clustering) based on these embedding vectors to perform semantic clustering, and forms a preliminary candidate entity cluster according to the cosine similarity between functions and the calling dependency relationship. In this process, the model input is the function semantic embedding matrix and the calling graph information, and the output is the member assignment result of several candidate clusters. Then, the average semantic similarity, type matching rate and calling path overlap rate of each cluster are calculated by fusing the judgment mechanism to generate a fusion demand factor for judging the merging, delay or splitting of the cluster. For the stable candidate cluster formed, the system further constructs the semantic relationship network between functions according to the neighborhood distribution of the semantic embedding space. Specifically, taking each candidate cluster as a node, taking the calling frequency, semantic dependency strength and context co-occurrence probability between functions as edge weight, and using a graph embedding model (such as GraphSAGE or TransE) to construct a semantic relationship graph. The model input is the candidate cluster features and neighborhood connection matrix, and the output is the semantic relationship weight and spatial position vector between clusters. Through an adaptive correction mechanism, the neighborhood distribution of the embedding space is updated to optimize the spatial position of abnormal clustering points and edge functions, realize the stable reconstruction of semantic consistency and clustering structure, and provide a high-quality semantic basis for subsequent knowledge graph construction and function recommendation.

[0037] It should be noted that after completing the reasoning path screening, the system performs semantic positioning on the input content according to the current programming environment of the user (including code context, function call stack, variable type, dependent library and development language version), and projects the input into the embedding space of the knowledge graph. Through path expansion and semantic neighborhood retrieval, the system selects the function entity set most relevant to the current task, and performs weighted scoring and sorting according to the multi-dimensional features such as semantic similarity, type compatibility, context co-occurrence strength and version stability, to generate a preliminary recommendation list. The list can be output as a code completion suggestion, a function call template or an alternative implementation scheme to support the user's development activities. If the user repeatedly calls similar functions in the same context, the system will automatically identify it as a usage preference and generate a semantic memory node, so that subsequent recommendations are more in line with individual programming habits.

[0038] It should be noted that the reasoning path screening is a process of targeted selection and constraint screening of possible combination relationships between function entities in the knowledge graph based on the previously constructed semantic knowledge graph and the candidate entity cluster reconstruction result. The purpose is to extract the function combination path with the most semantic reliability and actual availability from the huge function relationship network, and provide a basic guarantee for the subsequent recommendation strategy generation. Specifically, first, the candidate entity cluster is used to map the semantic feature vector of each entity cluster to the embedding space of the knowledge graph, so that each entity has a clear position and neighborhood relationship in the high-dimensional space. On this basis, the function semantic relationship path of the knowledge graph is traversed. For each path, first, the semantic consistency, type compatibility and calling logic continuity between the function entity clusters in the path are investigated, that is, whether there is a stable calling dependency, data type matching and common occurrence frequency between adjacent entities on the path. Further, the path screening process also considers the historical usage and co-occurrence patterns in time series, for example, when the same function calling sequence repeatedly appears in multiple contexts and the calling order remains the same, the system will mark this function combination as a high-frequency calling path with "continuous occurrence". For such function combination paths that continuously appear, the logic order is stable, and the number of occurrences reaches the preset number threshold, the system will preferentially retain them; while those paths whose number of calls does not reach the preset number threshold, or there are obvious logical jumps in the function calling chain, are marked as low-confidence paths or directly excluded, and finally only the function combination paths with high reliability and high relevance are retained, laying a solid foundation for subsequent semantic positioning and task-related function set selection in the user's current programming environment, thereby ensuring that the generated recommendation strategy not only conforms to the actual use logic of the function, but also maximizes the reduction of the influence of semantic drift and type conflict.

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

[0040] As shown in Figure 2 Figure 2 ​The function programming intelligent recommendation method flowchart provided by the embodiment of the present application based on the semantic knowledge graph first extracts semantic feature vectors from a plurality of source function programming corpora and constructs an embedding space, performs semantic aggregation pre-screening on the embedding vectors to obtain candidate entity clusters, then judges based on a fusion demand factor of the candidate clusters, processes the clusters into merging, delayed observation or splitting respectively, and allocates them to different priority candidate areas according to the fusion demand difference, further calculates the intra-cluster variance, inter-cluster distance and neighborhood overlap rate through a preset detection period to determine whether to trigger adaptive reconstruction of the cluster, constructs a semantic knowledge graph after reconstruction, traverses the function semantic relationship path in the knowledge graph, calculates the historical hit rate, context matching degree and semantic consistency of the path and weightedly fuses them to obtain a path confidence factor, finally sorts the path confidence factor to generate a recommendation strategy, and dynamically adjusts the recommendation weight in combination with the actual operation record of the user, so as to realize the optimization of semantic reliability and user adaptability of function recommendation. The specific process of judging based on the fusion demand factor of the candidate clusters is: performing evidence strength evaluation on each candidate entity cluster obtained by semantic aggregation pre-screening, obtaining the average cosine similarity, type matching rate and call path overlap rate of each candidate entity cluster, weightedly fusing the average cosine similarity, type matching rate and call path overlap rate of each candidate entity cluster to obtain the fusion demand factor of each candidate entity cluster, and the fusion demand factor of each candidate entity cluster is used to quantitatively evaluate the semantic consistency, type compatibility and actual call logic consistency of the function entities in each candidate entity cluster.

[0041] It should be noted that the dynamic adjustment of the recommendation weight in combination with the actual operation record of the user is specifically that after the system generates the function recommendation strategy based on the knowledge graph, the current programming operation record of the user is collected, including the function actually called in the code editing area, the calling sequence, the type of the input parameter, the used dependent library, the number of repeated calls of the function and the matching condition of the call and the code context. The system maps these operation records to the function entity or semantic path of the knowledge graph, calculates the "user call frequency" and "context matching degree" of each path. Specifically, if the user calls the function on a certain path multiple times in the last operation or the last three editing operations, the "user call frequency" score of the path will increase; if the function on the path is highly consistent with the current code context (such as variable type and dependent library), the "context matching degree" score will also increase. Then, the system combines the path confidence factor with the two scores, calculates the final weight of each path by directly adding or linearly normalizing, that is, directly adding the path confidence factor and the two scores to obtain the final weight of the path. The path with high weight is ranked in the front in the recommendation list, and the path with low weight is ranked in the back. Whenever the user performs a new function call, the system immediately updates the user call frequency and the context matching degree, and recalculates the final weight, so as to adjust the ranking of the recommendation list. This mechanism ensures that the path with high confidence and consistent with the user's recent operation and current context is preferentially recommended, and the irrelevant or unused path is automatically reduced in priority, realizing accurate and dynamic personalized recommendation.

[0042] As shown in Figure 3 Figure 3 is a function metadata generation flowchart provided by the embodiment of the application. The function metadata generation is the input end of the whole system, which is used to extract structured information (such as function name, parameter, return type, calling relationship, context description, etc.) from multi-source functional programming corpus and form metadata that can be used for semantic modeling. In this embodiment, the function metadata generation starts from two data input modes: automatic grabbing (which can be obtained from open source code library, hosting platform and other sources) and manual input (function information filled by the user). After the data of the two paths is preliminarily processed, it will be converged to a unified data cleaning and format normalization stage, and then through parsing and key attribute extraction, the standardized function metadata is finally integrated and generated. This diagram clearly shows a complete data processing pipeline from multi-source data collection to standardized output.

[0043] Specifically, the fusion determination result of each candidate entity cluster is obtained, and the specific process is as follows: the fusion demand factor of each candidate entity cluster is extracted and compared with the fusion demand factor threshold interval stored in the database. If the fusion demand factor of a certain candidate entity cluster is higher than the upper limit of the fusion demand factor threshold interval, the fusion determination result of the candidate entity cluster is recorded as merging.

[0044] ​If the fusion demand factor of a certain candidate entity cluster is within the fusion demand factor threshold interval, the fusion determination result of the candidate entity cluster is recorded as delayed observation.

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

[0046] It should be noted that the process of extracting semantic feature vectors from multi-source functional programming corpus and constructing semantic embedding space starts from the system obtaining function-related data from different sources, including function definition, parameter signature, calling example, library dependency information and user code context, while taking into account the differences between multi-language versions and different framework documents. The system first preprocesses the original source code and document text, including syntax analysis, identifier normalization, comment extraction and function call path analysis, in order to form a unified semantic representation basis. Subsequently, the natural language processing technology is used to encode the word vectors of function annotations, document descriptions and natural language information embedded in the code, and the static code analysis method is used to extract structured features of function signature, input and output type, return value structure and calling mode, so as to obtain multi-modal feature representation. The system maps the above multi-modal features to a high-dimensional vector space through a deep embedding model, and each function entity corresponds to a vector representation in the embedding space. The vector comprehensively reflects the semantics, structure, context dependence and version information of the function, forming a high-dimensional, continuous and measurable semantic embedding space, in which each vector not only embodies the semantic features of the function itself, but also contains its associated information in different contexts, versions and libraries. It provides a solid data foundation and spatial support for subsequent candidate entity cluster generation, semantic clustering, graph construction and intelligent recommendation, realizes the unified representation and operable management of multi-source function semantics in the embedding space.

[0047] It should be noted that the average cosine similarity is the average value of the cosine similarity between all vectors in the cluster. The higher the value, the closer the semantic representation of the functions in the cluster, and the tighter the cluster.

[0048] It should be noted that the type matching rate and the call path overlap rate are mainly dependent on the structured feature analysis of the 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 signature of each function in the candidate entity cluster, calculates the similarity of type vectors between different functions through a semantic embedding model, and then normalizes the similarity by combining the inheritance and inclusion relationships in the type hierarchy ontology, to obtain the type matching rate, which is used to measure the consistency of different functions in input and output semantic structure. The call path overlap rate is obtained based on the topological structure of the function call dependency graph. The system extracts the call links of each function from the function metadata and the results of static code analysis to form a path set, and represents the overlap degree of the call relationship by calculating the ratio of the intersection size to the union size of the path set between the candidate entity clusters. This index comprehensively reflects the co-occurrence strength and functional proximity of functions in the logical execution chain, and can effectively reveal the potential semantic correlation and replaceability, providing high-confidence structural support for subsequent entity fusion and recommendation determination.

[0049] 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 is specifically a directional normalization process for each parameter, so that the numerical direction of all indicators is consistent, and thus can be compared uniformly. Specifically, after completing the directional unification, it is mapped to a unified dimension interval to eliminate the influence of the dimension difference of different indicators on the fusion result. Subsequently, the system linearly weights and sums the three standardized and normalized indicators according to the strategic weight, so that the final fusion demand factor reflects the consistency of semantic consistency, type compatibility and actual call logic, providing a decision basis for subsequent fusion determination, so that the system can dynamically select direct merging, delayed observation or splitting processing strategy, and realize intelligent management and optimization of candidate entity clusters.

[0050] It should be noted that when the system determines the fusion of the candidate entity cluster, it is necessary to ensure that the numerical values of the three indicators are consistent. The higher the average cosine similarity indicates the more consistent semantics, the higher the type matching rate indicates the better type compatibility, and the higher the call path overlap rate indicates the stronger actual call logic consistency. All indicators are normalized to map them to the 0 to 1 interval, for example, using min-max normalization: the current value is subtracted from the minimum value and then divided by the difference between the maximum value and the minimum value, so that indicators of different dimensions and different ranges can be directly compared, and the values of all indicators are mapped to the 0 to 1 interval, ensuring that the larger the value indicates the more consistent with the expected fusion condition. In order to unify the comparison, the system will perform directional standardization on these indicators. In the present embodiment, the larger the values of the average cosine similarity, the type matching rate and the call path overlap rate indicate the more consistent semantics. These indicators are positively directed for calculating the fusion demand factor itself, and do not need to be reversed. However, if the original value of some indicators is negative, it needs to be mapped in the opposite direction first, for example, subtracting the current value from the maximum value or taking the negative value, so that its direction is consistent with that of the positive indicators. After completing the direction unification, the system will weight the three indicators according to the strategic weight, that is, according to the system's evaluation of the importance of different indicators in the candidate cluster fusion decision. The system can preset the weight in the design stage, or dynamically adjust the weight based on the historical fusion success rate, so that the sum of the weights is 1, to ensure that the value of the fusion demand factor has a clear dimension. The specific method of weighted fusion is: multiply the three standardized indicators by the corresponding weight (for example, multiply the standardized average cosine similarity by the weight corresponding to the average cosine similarity), and then fuse the results of multiplying the three standardized indicators by the corresponding weight, that is, add up to obtain a single fusion demand factor. The preset weight can be set to an initial weight based on expert experience or business requirements, for example, in functional programming recommendation, if semantic consistency is more important than type matching, the average cosine similarity weight can be higher, while the call path overlap rate can be less important, and the type matching rate can be less important. The initial weight can be directly represented by a proportion, such as 0.5, 0.3, and 0.2, and the sum of the three is 1. Secondly, a historical data driven optimization method can be used. By collecting a large number of candidate entity cluster fusion results and subsequent recommendation accuracy in actual development scenarios, the contribution of each indicator to the correct fusion decision can be calculated. For example, by normalizing, the weight of the indicator that can predict correct fusion in the historical successful fusion cluster is obtained. Thirdly, the weight can be optimized combined with machine learning. The indicators are used as features, and the fusion results (such as whether to successfully merge or whether to improve the recommendation accuracy) are used as labels. A linear regression or logistic regression model is trained, and the regression coefficient trained by the model can be used as the weight of the indicator, which is directly used after normalization.

[0051] Specifically, the dynamic processing is performed on each candidate entity cluster according to the fusion determination result, and the specific process is that each candidate entity cluster whose fusion determination result is merging is triggered to perform a merging operation.

[0052] Each candidate entity cluster whose fusion determination result is delayed observation is cached to enter an entity fusion waiting area, and each candidate entity cluster in the entity fusion waiting area is managed in a hierarchical manner.

[0053] Each candidate entity cluster whose fusion determination result is splitting is triggered to perform a splitting strategy.

[0054] It should be noted that the system triggers a cluster-level merging operation, and the specific process is that, in the merging process, first, the system locks the candidate entity clusters to be merged according to the cluster set whose fusion demand factor is higher than the upper limit of the threshold interval, and then performs weighted fusion on the same attribute according to the average cosine similarity, type matching rate and call path overlap rate calculated in each cluster: the attributes with high similarity are averaged to obtain a unified value, the fields with type matching are directly merged, the path overlap part is established to reference mapping to maintain logical association, and for the attributes with conflicts or missing, the time consistency double criteria are used for selection or completion. Finally, the system generates a unified entity record according to the fused multi-source attributes, and updates the identification and feature vector of the unified entity record in the database, to realize a consistent structure and coherent semantic fusion result.

[0055] It should be noted that the splitting strategy first recalculates the correlation between entities in each cluster according to the similarity matrix, and uses a density-based secondary clustering or graph partitioning algorithm to split the original cluster into several sub-clusters; then, identity consistency determination and attribute completion are independently performed on each sub-cluster to ensure the integrity and uniqueness of the split entities.

[0056] Specifically, each candidate entity cluster in the entity fusion waiting area is managed in a hierarchical manner, and the specific process is that each candidate entity cluster in the entity fusion waiting area is recorded as each second candidate entity cluster, the fusion demand factor of each second candidate entity cluster is extracted, and difference processing is performed on the fusion demand factor of each second candidate entity cluster and the set candidate entity cluster fusion demand factor threshold, to obtain the fusion demand difference factor of each second candidate entity cluster. The fusion demand difference factor of each second candidate entity cluster is matched with the priority candidate area corresponding to each interval of the candidate entity cluster fusion demand difference factor 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 a first priority candidate area, a second priority candidate area and a third priority candidate area.

[0057] It should be noted that the difference between the fusion requirement factor of each second candidate entity cluster and the set candidate entity cluster fusion requirement factor threshold is obtained by subtracting the fusion requirement factor of each second candidate entity cluster from the fusion requirement factor threshold stored in the database or configuration, and then comparing the fusion requirement factor of the candidate cluster with the threshold value. The difference, i.e. the fusion requirement factor of the candidate cluster minus the threshold value, is obtained by subtraction, which is used to quantify the proximity or exceedance of the candidate cluster relative to the threshold value, thereby helping to analyze whether the candidate cluster should be allocated to the first, second or third priority candidate area.

[0058] It should be noted that in the process of dynamically scheduling the first, second and third priority candidate regions by the system, in order to ensure the stability and real-time performance of the semantic fusion process, the system quantitatively judges the change amplitude of the key parameters based on the historical monitoring data and the adaptive threshold model. Among them, for the first priority candidate region, the stable decline of the semantic drift rate means that the decline amplitude of the index in the continuous detection period is not less than 15% of the previous average value and the fluctuation variance is less than 20% of the global variance, at this time it can be considered that the semantic drift tends to be stable. The continuous rise of co-occurrence ratio means that the average rise amplitude of the continuous three detection windows is greater than 10% of the initial reference value, and its growth trend maintains a positive slope in the fitting curve for more than a preset threshold period. If both the stable decline of the semantic drift rate and the continuous rise of the co-occurrence ratio are met, the system can determine that the semantics inside the candidate entity cluster converge, triggering the fast fusion verification process. For the second priority buffer area, the system adopts a relatively loose dynamic judgment threshold. When the comprehensive index shows that the semantic convergence degree is significantly enhanced, it means that the document description similarity improvement amplitude and the dependence consistency change rate (which measures the similarity change between the candidate entity clusters or the clusters in the semantic layer. The document description similarity is generally obtained by calculating the cosine similarity of the text embedding vectors of function annotations, function signatures, call examples or related documents. The dependence consistency refers to the consistency degree of the calling relationship, parameter type and functional dependence between functions or entity clusters. For example, two functions are frequently called in the same context or share the same dependent library, and their dependence consistency is high.) are met at the same time, it is considered that the semantic aggregation trend is obvious. At this time, the system will mark this cluster as a "potential fusion cluster" and increase its sampling frequency in the subsequent detection period, entering the high-frequency fusion evaluation stage; if the semantic convergence degree index of the cluster remains rising trend in the continuous two detection periods, it is automatically promoted to the first priority candidate area and enters the fast fusion channel. The semantic convergence degree is a comprehensive quantitative of the semantic consistency of the internal members of the candidate entity cluster and the overall vector aggregation. It usually combines cosine similarity average, type compatibility, call path overlap rate and other multi-dimensional parameters to obtain a single index through weighted fusion. The index rising means that the functions inside the cluster are more and more consistent in semantics, type and calling logic, and the decline means that the semantic drift or calling difference increases. Conversely, if the semantic convergence degree index is detected to decrease by more than 20% in three periods or the dependence consistency change rate decreases below the threshold, it is determined that the semantic correlation decays, and the cluster is downgraded to the third priority observation area. For the third priority observation area, it is maintained in a low-frequency evaluation mode by long-term monitoring, mainly observing the spatial approximation degree of the semantic distribution (the spatial approximation degree refers to the positional relationship of the candidate entity cluster 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 multi-dimensional embedding space.The determination criterion for the semantic distribution gradually approaching a high-confidence entity cluster is that, in the last five detection cycles, 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 is improved by more than 8%, and the semantic variance is reduced by more than 25% of the global average. At this time, it can be determined that the semantic aggregation trend is significant. In this case, the system will reactivate the dynamic evaluation process of the candidate entity cluster, making it re-enter the buffer zone for fusion trend reevaluation. Through the multi-level threshold constraint and dynamic adjustment mechanism, the system can realize adaptive evolution monitoring of different candidate entity clusters in the semantic embedding space. For clusters with a change rate in the critical interval, the system will automatically correct the threshold according to the distribution characteristics of historical samples, so that the fusion determination can maintain robustness and stability under different corpus sizes and semantic fluctuation intensities. This effectively avoids ineffective fusion caused by excessively wide thresholds and prevents delays in fusion opportunities caused by excessively strict conditions, thereby realizing a high-confidence and low-redundancy entity fusion process in a dynamically evolving semantic space.

[0059] Specifically, the neighborhood distribution of each candidate entity cluster in the semantic embedding space is adaptively corrected. The specific process is as follows: preset each detection cycle, obtain the intra-cluster variance, inter-cluster distance, and neighborhood overlap rate in the priority candidate area of each second candidate entity cluster in each detection cycle, normalize the intra-cluster variance, inter-cluster distance, and neighborhood overlap rate to obtain the overall stability score of the candidate entity cluster in the priority candidate area, and the overall stability score of the candidate entity cluster in the priority candidate area is used to evaluate the robustness of the overall distribution of the candidate cluster in the embedding space.

[0060] The number of candidate entity clusters in the priority candidate area whose overall stability score is less than or equal to the set overall stability score threshold is counted and recorded as the number of false clusters. If the number of false clusters is higher than or equal to the threshold value of the number of false clusters stored in the database, the update step is increased, otherwise the update step does not need to be increased.

[0061] It should be noted that when the update step is increased, the difference between the current overall stability score and the threshold value is first calculated, and then the difference is mapped to the size of an amplification factor; mapping uses a configurable scaling strategy (such as linear mapping or weak exponential mapping). In actual execution, the current local update step is directly multiplied by the amplification factor to speed up convergence, and key indicators such as the speed of intra-cluster variance reduction, inter-cluster distance improvement, and whether new oscillation signs appear are monitored in the subsequent several training / update iterations; if the update introduces instability or the indicators worsen, the system will proportionally back off the step to the last safe value within a preset cooling period and record the event as a tuning sample.

[0062] It should be noted that the overall stability score of the candidate entity cluster in the priority candidate region is specifically analyzed under the condition that:

[0063] ;

[0064] In the formula, S represents the overall stability score of the candidate entity cluster in the priority candidate region, A j 2 represents the intra-cluster variance of the jth second candidate entity cluster in the priority candidate region, D j represents the inter-cluster distance of the jth second candidate entity cluster in the priority candidate region, R j represents the neighborhood overlap rate of the jth second candidate entity cluster in the priority candidate region, A1 represents the average intra-cluster variance of all candidate entity clusters, D1 represents the average inter-cluster distance, R1 represents the average neighborhood overlap rate, j represents the number of each second candidate entity cluster, j = 1, 2, 3,..., n, and n represents the total number of second candidate entity clusters.

[0065] It should be noted that the intra-cluster variance is mainly obtained by calculating the average distance of all function entity vectors in the cluster to the cluster center vector, and this distance is usually measured by Euclidean distance or cosine distance, reflecting the semantic concentration degree of the cluster members. The smaller the variance, the more consistent the semantics of the entities in the cluster. The 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, which is used to measure the relative separation degree of the candidate cluster and other clusters in the embedding space. The larger the distance, the clearer the semantic boundary between clusters and the smaller the mutual interference. The neighborhood overlap rate is obtained by counting the overlap proportion of each entity vector in the cluster in its nearest neighbor vector set with other cluster entities, which is calculated by setting a nearest neighbor number threshold. This index reflects the mutual coverage of the candidate cluster and other clusters in the space. The lower the overlap rate, the stronger the independence of the cluster in the semantic space.

[0066] It should be noted that the intra-cluster variance, inter-cluster distance, and neighborhood overlap rate of each second candidate entity cluster have mutual correlation and mutual influence when evaluating the overall stability of the candidate cluster. When the intra-cluster variance increases, the internal vector distribution of the cluster becomes dispersed, which directly leads to a blurred boundary with adjacent clusters, thus reducing the inter-cluster distance and increasing the neighborhood overlap rate. Conversely, if the intra-cluster variance decreases, the cluster is more compact, which usually increases the inter-cluster isolation and reduces the overlap rate. At the same time, the reduction of the inter-cluster distance may be caused by the internal dispersion of a cluster, or by the gradual convergence of two clusters with very close semantics (such as version convergence or increased semantic overlap).

[0067] Specifically, each candidate entity cluster is restructured, and the specific process is as follows: the semantic drift rate of each second candidate entity cluster in the adaptive correction post-entity fusion waiting area and the co-occurrence ratio of each second candidate entity cluster in the adaptive correction pre-and post-entity fusion waiting area 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 co-occurrence ratio difference 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 mergable candidate entity cluster, thereby obtaining each mergable candidate entity cluster, and each mergable candidate entity cluster is re-merged.

[0068] It should be noted that the semantic drift rate of each second candidate entity cluster in the adaptive correction post-entity fusion waiting area needs to be calculated based on the semantic embedding vector of each entity cluster, that is, by comparing the change degree of the center vector or member vector of the entity cluster before and after adaptive correction, the semantic drift rate is usually represented by using cosine distance or Euclidean distance and other metrics to reflect the semantic stability of the corrected entity cluster; and the co-occurrence ratio of each second candidate entity cluster in the adaptive correction pre-and post-entity fusion waiting area is obtained by analyzing the co-occurrence frequency of the entities in the cluster in the text corpus, and the co-occurrence ratio is defined as the ratio of the number of entity pairs in the cluster that co-occur in the same context window to the total number of all possible entity pairs in the cluster, and the ratio is calculated before and after correction as the co-occurrence ratio of each second candidate entity cluster in the adaptive correction pre-and post-entity fusion waiting area.

[0069] It should be noted that for these mergable candidate entity clusters, the system first assigns them to the corresponding priority candidate area for dynamic monitoring and fusion determination. In the first priority candidate area, when the semantic drift rate of the 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 degree of the candidate cluster is significantly enhanced, thereby triggering the reconstruction or merging operation. In the second priority candidate area, the system allows single-period indicators to have certain fluctuations, but as long as the trend score across three to five detection periods shows gradual enhancement, and the document description similarity and dependency consistency indicators continue to rise, the candidate cluster is considered to have fusion potential and triggers reconstruction. In the third priority observation area, due to the slow change of semantic state, the system accumulates the trend across five to ten detection periods, combines the overall upward trend of the trend score and the stability of the embedded vector (the stability of the position of the candidate entity cluster in the semantic embedding space, usually quantified by some indicators such as the variance of the vector within the cluster, the moving amplitude of the cluster center vector, or the cosine similarity with the historical vector distribution), to determine whether the trigger condition is met, thereby avoiding frequent triggering of invalid fusion. Through this mechanism, all mergable candidate entity clusters complete dynamic monitoring, trend quantification, and reconstruction triggering under a unified logic, ensuring robust and efficient semantic aggregation.

[0070] As Figure 4 shown, Figure 4is an example of a semantic knowledge graph provided by the embodiments of the present application. The semantic knowledge graph example is mainly used to show the association structure of the candidate entity cluster after reconstruction in the knowledge level, contains function, parameter, call chain, context relationship, function category and other nodes and edges, can reflect the semantic and logical relationship between functions, is the core knowledge carrier of the recommendation algorithm. First, the key differences of this function in Python 2.x and 3.x versions (returning list and iterator respectively) are pointed out, and it is explained that as a built-in high-level function of the builtins module, it can be used without importing, and it is clear that the core function of map is "apply the specified function to each element of the iterable object to generate a new object", and further elaborates its name, type, common application scenarios (such as structure conversion) and related performance optimization best practices. Among them, according to the reconstructed each candidate entity cluster, the function semantic relationship path of the semantic knowledge graph is traversed, and the confidence factor of each function semantic relationship path is obtained. The specific process is: according to the reconstructed each candidate entity cluster, the function semantic relationship path of the semantic knowledge graph is traversed, the historical hit rate, context matching degree and semantic consistency of each function semantic relationship path are obtained, weighted fusion is performed to obtain the confidence factor of each function semantic relationship path, and the confidence factor of each function semantic relationship path is used to quantify the reliability of each path in the knowledge graph, reflecting the semantic fit degree, logical consistency and user preference matching degree of the function combination associated with the path in the actual use scenario.

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

[0072] 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.

[0073] 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.

[0074] 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.

[0075] It should be noted that in the process of generating the recommended strategy, the system will first sort the confidence factors of each function semantic relationship path in the knowledge graph from high to low. The sorted paths reflect the semantic credibility and historical use 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, so they should be prioritized for generating recommendations. The system will select the function sequence that best meets the current demand from the sorted paths based on the user's context information, call requirements, and semantic relationships between path nodes to construct a preliminary recommendation scheme. It will also consider path length, function call dependencies, and document description similarity to ensure that the recommended results are reasonable and executable. For example, when the user is currently writing file reading logic in a Python environment, the code context contains the variable type file_path: str and the dependent library has imported the os and pandas modules, the system will retrieve highly relevant function path combinations in 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 record data, such as: in the last 10 related tasks, the user has chosen pandas.read_csv 7 times, with a 100% success rate and an average call time of 0.3 seconds; another 3 times the user chose pandas.read_excel, but after calling, it was replaced with read_csv, indicating that the former has semantic relevance but the actual demand matching degree is low; the user has imported the os module in 80% of similar contexts and called os.path.exists to judge the existence of the file; historical logs show that the user prefers to verify the path before loading the file (the call sequence is stable). Based on the above operation data, the system will determine that the path os.path.exists→open→pandas.read_csv has the highest confidence factor and context matching degree, and will prioritize this path for generating the recommended strategy. After the recommended strategy is generated, the system will collect real-time user operation data on the recommended functions, including whether the user accepts the recommendation directly, replaces some functions, or completely rejects the recommendation. These operation data are used as dynamic feedback signals to adjust the weight of the path in subsequent recommendations.Specifically, for the path accepted by the user multiple times, the confidence factor is gradually increased, so as to obtain a higher priority in future recommendations. For example, if a path is accepted by the user in multiple periods, the system calculates an amplification factor according to the number of acceptances and the acceptance rate. The amplification factor is positively correlated with the historical hit rate of the path. The amplification rate can be linear or nonlinear. In the linear case, the current confidence factor can be increased by a certain percentage each time the user accepts. In the nonlinear case, as the number of acceptances accumulates, the increase gradually decreases to avoid excessive expansion. This principle uses historical feedback to strengthen high-confidence paths while maintaining stability to prevent excessive adjustment caused by single abnormal operations. For paths that are not adopted multiple times, the confidence factor is correspondingly reduced. Similarly, the current confidence factor can be reduced by a certain percentage to reduce its exposure rate in the main recommendation channel.

[0076] As shown in Figure 6 The second aspect of the present application also provides a module 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, which is used for extracting semantic feature vectors from a multi-source functional programming corpus and constructing a semantic embedding space. The semantic embedding vectors are preliminarily clustered by a semantic aggregation pre-screening mechanism to obtain each candidate entity cluster. Fusion judgment is performed on each candidate entity cluster to obtain a fusion judgment result of each candidate entity cluster. Dynamic processing is performed on each candidate entity cluster according to the fusion judgment result. A candidate cluster adaptive reconstruction module is used for constructing the semantic relationship of each candidate entity cluster according to the neighborhood distribution of the semantic embedding space, and adaptively correcting the neighborhood distribution of each candidate entity cluster in the semantic embedding space, and reconstructing each candidate entity cluster.

[0077] A function semantic relationship path reasoning and intelligent recommendation module is used for constructing a semantic knowledge graph according to each reconstructed candidate entity cluster, traversing the function semantic relationship path of the semantic knowledge graph, obtaining a confidence factor of each function semantic relationship path, and generating a recommendation strategy according to the confidence factor of each function semantic relationship path.

[0078] Those skilled in the art can appreciate that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0079] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described devices, apparatuses and units can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.

[0080] In several embodiments provided by the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the above-described apparatus embodiments are merely schematic, and the division of units is merely a logical function division. In actual implementation, another division manner can be adopted, for example, a plurality of units or components can be combined or integrated into another device, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.

[0081] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, can be located in one place or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0082] In addition, the functional units in each embodiment of the present application can be integrated into a processing unit, or each unit can be physically present separately, or two or more units can be integrated into one unit.

[0083] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0084] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A semantic knowledge graph-based intelligent recommendation method for functional programming, 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. Based on the fusion determination results, dynamic processing is performed on each candidate entity cluster. The specific process 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. Each candidate entity cluster in the entity fusion waiting area is denoted as a second candidate entity cluster; 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 merged again. 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. 2.The semantic knowledge graph based intelligent recommendation method of functional programming 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 semantic knowledge graph based intelligent recommendation method of functional programming according to claim 1, wherein, The specific process for obtaining the fusion determination results of each candidate entity cluster is as follows: The fusion demand factor of each candidate entity cluster is extracted, and is compared with the fusion demand factor threshold interval stored in the database. If the fusion demand factor of a certain candidate entity cluster is higher than the upper limit of the fusion demand factor threshold interval, the fusion determination result of the candidate entity cluster is recorded as merging. If the fusion demand factor of a certain candidate entity cluster is within the fusion demand factor threshold interval, the fusion determination result of the candidate entity cluster is recorded as delayed observation. If the fusion demand factor of a certain candidate entity cluster is lower than the lower limit of the fusion demand factor threshold interval, the fusion determination result of the candidate entity cluster is recorded as splitting. 4.The semantic knowledge graph based intelligent recommendation method of functional programming according to claim 1, wherein, The specific process of the hierarchical management of each candidate entity cluster in the entity fusion waiting area is as follows: The fusion demand factor of each second candidate entity cluster is extracted, and is subjected to difference processing with the fusion demand factor threshold of the candidate entity cluster to obtain the fusion demand difference factor of each second candidate entity cluster. The fusion demand difference factor of each second candidate entity cluster is matched with the priority candidate area corresponding to each interval of the fusion demand 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. 5.The semantic knowledge graph based intelligent recommendation method of functional programming according to claim 1, wherein, The specific process of the adaptive correction of the neighborhood distribution of each candidate entity cluster in the semantic embedding space is as follows: A preset detection cycle is set. In each detection cycle, the intra-cluster variance, inter-cluster distance, and neighborhood overlap rate in the priority candidate area of each second candidate entity cluster 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 area. The overall stability score of the candidate entity cluster in the priority candidate area is used to evaluate the robustness of the overall distribution of the candidate cluster in the embedding space. The number of overall stability scores of the candidate entity cluster in the priority candidate area that are lower than or equal to the set overall stability score threshold in each detection cycle is counted and recorded as the number of error clusters. If the number of error clusters is higher than or equal to the error cluster number threshold stored in the database, the update step is increased. Otherwise, the update step does not need to be increased. 6.The semantic knowledge graph based intelligent recommendation method of functional programming according to claim 1, wherein, The specific process of constructing the semantic knowledge graph according to the reconstructed candidate entity clusters, traversing the functional semantic relationship path of the semantic knowledge graph, and obtaining the confidence factor of each functional semantic relationship path is as follows: The semantic knowledge graph is constructed according to the reconstructed candidate entity clusters. The historical hit rate, context matching degree, and semantic consistency of each functional semantic relationship path in the semantic knowledge graph are obtained by traversing each functional semantic relationship path. The confidence factor of each functional semantic relationship path is obtained by weighted fusion. The confidence factor of each functional semantic relationship path is used to quantify the reliability of each path in the knowledge graph, and reflects the semantic fit degree, logical consistency, and user preference matching degree of the function combination associated with the path in the actual use scenario.

7. The system for applying the semantic knowledge graph-based functional programming intelligent recommendation method according to any one of claims 1-6, characterized in that, The method comprises the following steps: The semantic embedding and candidate cluster generation module is configured to extract semantic feature vectors from the multi-source functional programming corpus and construct a semantic embedding space, preliminarily cluster the semantic embedding vectors through a semantic aggregation pre-screening mechanism to obtain candidate entity clusters, perform fusion determination on the candidate entity clusters to obtain fusion determination results of the candidate entity clusters, and perform dynamic processing on the candidate entity clusters according to the fusion determination results. The candidate cluster adaptive reconstruction module is configured to construct semantic relationships of the candidate entity clusters according to a neighborhood distribution of the semantic embedding space, adaptively correct the neighborhood distribution of the candidate entity clusters in the semantic embedding space, and reconstruct the candidate entity clusters. The function semantic relationship path reasoning and intelligent recommendation module is configured to construct a semantic knowledge graph according to the reconstructed candidate entity clusters, traverse function semantic relationship paths of the semantic knowledge graph, obtain confidence factors of the function semantic relationship paths, and generate a recommendation strategy according to the confidence factors of the function semantic relationship paths.

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