A search method based on programming scene environment context

By obtaining the contextual information of the programming site environment, using K-means and hierarchical clustering to analyze semantic relationships, and combining it with ElasticSearch for data retrieval, it solves the problem of inability to efficiently search for suitable programming codes in the existing technology and achieves higher search accuracy. and user experience.

CN112667286BActive Publication Date: 2024-09-03NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011551429.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-24
Publication Date
2024-09-03
Estimated Expiration
2040-12-24

AI Technical Summary

Technical Problem

Existing search methods cannot efficiently search for appropriate programming code based on user habits and project needs, resulting in poor user experience and waste of time.

Method used

By obtaining contextual information of the programming site environment, the K-means algorithm and hierarchical clustering method are used to analyze semantic relationships, and combined with ElasticSearch for data retrieval, it provides accurate code recommendations.

Benefits of technology

It improves the search accuracy, can better recommend codes that conform to the user's programming habits and abilities, and improves the user experience. Compared with the RNN search method, the accuracy is increased by 40%.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112667286B
    Figure CN112667286B
Patent Text Reader

Abstract

The present invention proposes a search method based on the context of a programming site environment. The method comprises the following steps: obtaining the context information of the programming site environment, including the context information of the programmer, the context information of the programming project and task, and the context information of the programming time and environment; performing different preprocessing and storage on the original programming site environment context information obtained for the text language and the formal language; performing cluster analysis on the preprocessed programming site environment context information using the K-means algorithm to obtain the semantic relationship between the context information; performing hierarchical analysis on the preprocessed programming site environment context information using the hierarchical clustering method to obtain the explicit association and implicit association relationship between the context information; and using ElasticSearch as the underlying data retrieval model to complete the search for the required programming requirements. The present invention can achieve accurate recommendation of codes by deeply mining the extensive and diverse semantic relationships between context information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the computer field, and relates to data acquisition technology and reasoning engine technology in software development technology, and is specifically a search method based on the context of a field programming environment. Background Art

[0002] With the development of the Internet and the popularity of open source software, software and code reuse have become increasingly important in improving software development efficiency. Code search technology has received more and more research and attention. However, the current search method cannot search for the required programming code according to user requirements, which brings inconvenience and wastes time to the user's work; therefore, how to analyze the required and well-adapted code according to the habits of different users and the projects they have completed has become a key issue. Summary of the invention

[0003] Purpose of the invention: In view of the deficiencies in the prior art, the present invention proposes a search method based on the context of the programming site environment, which provides users with the codes they need with high precision, bringing a better user experience.

[0004] Technical solution: A search method based on programming site environment context, comprising the following steps:

[0005] Obtaining context information of the programming site environment, including context information of programmers, context information of programming projects and tasks, and context information of programming time and environment;

[0006] Preprocessing and storing the acquired original programming scene environment context information in terms of text language;

[0007] The K-means algorithm is used to perform cluster analysis on the preprocessed programming site environment context information to obtain the semantic relationship between the context information;

[0008] The hierarchical clustering method is used to perform hierarchical analysis on the preprocessed programming scene environment context information to obtain the explicit and implicit associations between the context information.

[0009] Use ElasticSearch as the underlying data retrieval model to complete the search for the required programming requirements.

[0010] Beneficial effects: The present invention extracts and analyzes information based on a questionnaire survey of users, their usual programming information, and the projects being executed. By deeply mining the extensive and diverse semantic relationships between contextual information, the present invention can then recommend to users the codes they need and that are in line with their programming habits and programming capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Picture 1 It is a flow chart of a search method based on programming scene context provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0012] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.

[0013] Reference Picture 1 , the search method based on the programming scene context proposed in the present invention first obtains the required user information by explicit acquisition, implicit acquisition and inference acquisition, and adopts different natural language processing and preprocessing for the text language according to the user's query conditions and the collected original context information and other data. Then, the K-means algorithm is used to deeply mine the extensive and diverse semantic relationships between context information, and the context information knowledge is integrated in a complete, unified and semantically connected manner by combining the text latent semantic analysis technology and the entity link analysis technology. After that, the hierarchical clustering technology is used to mine the association relationship between context information to discover the explicit and implicit association relationships between data, the laws and characteristics of the dynamic changes of context information, and the snowball effect in the iterative reuse process of software knowledge is used to form a benign growth and evolution cycle, so as to realize the collection, cleaning, organization and management of heterogeneous big data. Finally, the modeling uses ElasticSearch as the underlying data retrieval engine to search for the required programming requirements. The specific steps are as follows:

[0014] Step 1: Obtain the required information using explicit, implicit, and inferential methods.

[0015] First, determine the required information. Starting from the three dimensions of people, projects, and environment, the context information of the programming site environment includes the context information of programmers, the context information of programming projects and tasks, and the context information of programming time and environment. More specifically, the context information of programmers includes: familiarity with the current integrated development environment (IDE), familiarity with the current project, programmers' experience, programmers' programming habits, and programmers' social networks; the context information of programming projects and tasks includes: currently used command information, currently running modules, method descriptions, method calls, project structures, task types, programming error suggestions, project descriptions, project types, and historical recommendation information; the context information of programming time and programming environment includes: time information, project version number, programming location, interface elements used by developers, and interface elements that developers pay attention to.

[0016] The methods for obtaining various types of information are:

[0017] 1) Explicit acquisition: Use questionnaires to obtain familiarity with the current integrated development environment (IDE) and the current project. Project types, project descriptions, programming error suggestions, and historical recommendation information are mainly obtained by searching software records, development documents, and log reports. Time information and project version numbers can be obtained through user communication and / or document query.

[0018] 2) Implicit acquisition: By analyzing the user's previous code documents and bug reports, the programmer's programming habits can be determined; for the current running module, the current command used, the method description, the programming location, the interface elements used by the developer and the interface elements that the developer pays attention to, the information can be collected through implicit methods such as screen monitoring and mouse operation monitoring;

[0019] 3) Inferring: Programmer experience is obtained by crawling users’ records in programming forums through crawlers, and using social network analysis and inference to obtain users’ social networks; for task types, project structures, and method call information, the project requirements, design documents, and code structures are analyzed to infer the relationships between parameters and methods.

[0020] Preprocess the data based on the user's query conditions and the collected original context information. For text language, use word segmentation and keyword acquisition technology for preprocessing. Word segmentation can obtain syntactic and semantic information about words, sentences, etc. Keywords are a collection of words that express the subject content of the text and are a more concise summary of the text. Keywords obtained through keyword acquisition technology can quickly and roughly obtain the content of the document.

[0021] For the preprocessed information, the code uses the bag-of-words model to vectorize the code and represents it using one-shot representation. The value of the word that appears in the word sequence is 1, and the value of the word that does not appear in the word sequence is 0. For example, for the document:

[0022] 1 Chinese Nanjing Chinese 2 Tokyo Japan Chinese

[0023] The bag of words is constructed as follows:

[0024] Chinese Nanjing Tokyo Japan

[0025] For each code text, the value of each word in the word bag is calculated according to the one-shot representation method to obtain the vector representation of the code text.

[0026] The word vector of Chinese Nanjing Chinese is:

[0027] Chinese Nanjing Tokyo Japan 1 1 0 0

[0028] The word vector of Tokyo Japan Chinese is:

[0029] Chinese Nanjing Tokyo Japan 1 0 1 1

[0030] For text other than code, the n-gram model is used to represent and store it. For a sentence containing n words, the language model expression is: P(W1,W2,…,Wn)=P(W1)P(W2︱W1)P(W3︱W1,W2)…P(Wn︱W1,W2,…Wn-1), where p refers to the probability that the sentence is true. The greater the probability, the greater the possibility that the sentence is true. The model is based on the Markov hypothesis, assuming that whether the target word in the sentence appears only depends on the n words that appear before the word. In order to reduce the computational complexity, n is generally 2 or n is 3.

[0031] Step 2: Use the K-means algorithm to perform cluster analysis on the preprocessed data to obtain the semantic relationship between context information.

[0032] K-means clustering algorithm is an iterative clustering analysis algorithm. Its steps are to randomly select K objects as the initial cluster centers, then calculate the distance between each object and each seed cluster center, and assign each object to the cluster center closest to it. The cluster centers and the objects assigned to them represent a cluster.

[0033] The present invention uses the K-means algorithm to deeply mine the extensive and diverse semantic relationships between context information, clusters the above preprocessed information, and mines the context text information with great subject relevance in the context through clustering. Specifically, firstly, K context information related to the subject are selected as the initial cluster centers, then the distance between each context information and each center is calculated, and then each context information is assigned to the cluster center closest to it, thereby obtaining K clusters, and finally the context information far away from each cluster center (such as exceeding a preset distance threshold) is removed, thereby extracting the context information with great subject relevance in the context.

[0034] Step 3: Use a hierarchical clustering algorithm to perform hierarchical analysis on the preprocessed programming site environment context information to obtain explicit and implicit associations between the context information.

[0035] Hierarchical clustering divides a data set into layers of clusters, where the clusters generated in the next layer are based on the results of the previous layer. Hierarchical clustering algorithms are generally divided into two categories: (1) Divisive hierarchical clustering: also known as top-down hierarchical clustering, in which all objects initially belong to one cluster, and each time a cluster is divided into multiple clusters according to certain criteria, and so on and so forth until each object is a cluster; (2) Agglomerative hierarchical clustering: also known as bottom-up hierarchical clustering, in which each object initially belongs to a cluster, and each time the two closest clusters are merged to generate a new cluster according to certain criteria, and so on and so forth until all objects finally belong to one cluster.

[0036] In the present invention, hierarchical clustering technology is used to mine the association relationship between context information to discover the explicit association and implicit association relationship between data. Explicit association refers to the direct association relationship, and implicit association refers to the hidden association between the two information obtained through mining. For example, if Zhang San is male, then there is an explicit association between Zhang San and male gender. According to Zhang San’s usual activities, it is known through mining that he can be linked to a game, so Zhang San and the game are implicitly associated. The previous K-means is difficult to extract implicit contextual topic information. We use hierarchical clustering to process the pre-processed context information using Agglomerative hierarchical clustering, taking all text information as a class, and combining the two closest classes into one class, and proceeding in sequence until only K classes are left.

[0037] Step 4: Use the ElasticSearch search engine to search for the required programming requirements.

[0038] ElasticSearch is a search server based on Lucene. It provides a distributed multi-user full-text search engine that can easily enable the search, analysis and exploration of large amounts of data. It is based on the RESTful web interface, is developed in Java, and is released as open source under the terms of the Apache license. It is an enterprise-level search engine.

[0039] The present invention uses ElasticSearch as the underlying data retrieval engine, and ElasticSearch is an open source project. We use ElasticSearch to perform information retrieval using the contextual subject information and / or keyword information data obtained through preprocessing and data mining above.

[0040] In summary, the present invention has innovatively proposed a method for searching based on the context of the programming scene environment, which can effectively recommend the required and appropriate codes to users compared with other search methods. Through multiple users searching for codes based on their needs, and then calculating the search accuracy based on the standard of finding satisfactory codes, it is proved that the present invention can provide users with the codes they need with higher accuracy. Compared with the search method constructed by RNN, our search accuracy is relatively improved by about 40%, bringing a better user experience.

Claims

1. A search method based on programming site environment context, characterized in that: The following steps are involved: Obtaining context information of the programming site environment, including context information of programmers, context information of programming projects and tasks, and context information of programming time and environment; Preprocessing and storing the acquired original programming scene environment context information in terms of text language; The K-means algorithm is used to perform cluster analysis on the preprocessed programming site environment context information to obtain the semantic relationship between the context information; The hierarchical clustering method is used to perform hierarchical analysis on the preprocessed programming scene environment context information to obtain the explicit and implicit associations between the context information. Use ElasticSearch as the underlying data retrieval model to complete the search for the required programming requirements; The context information of the programmer includes: familiarity with the current integrated development environment, familiarity with the current project, experience of the programmer, programming habits of the programmer, and social network of the programmer; the context information of the programming project and task includes: currently used command information, currently running module, method description, method call, project structure, task type, programming error suggestion, project description, project type, and historical recommendation information; the context information of programming time and programming environment includes: time information, version number of the project, programming location, interface elements used by the developer, and interface elements that the developer pays attention to; The obtaining of programming scene environment context information includes: Use questionnaires to obtain familiarity with the current integrated development environment and current projects; Obtain project types, project descriptions, programming error suggestions, and historical recommendation information by searching software record documents, development documents, and log reports; Obtain time information and project version numbers through user communication and / or document query; Determine programmers' programming habits by analyzing historical code documents and bug report documents; Collect the currently running module, currently used commands, method descriptions, programming locations, interface elements used by developers, and interface elements that developers focus on through screen monitoring and mouse operation monitoring; Use crawlers to crawl users' records in programming forums as programmers' experience information; and use social network relationship analysis and reasoning to obtain users' social networks; By analyzing the project's requirements, design documents, and code structure, we can obtain information about task types, project structure, and method calls.

2. The search method based on programming scene environment context according to claim 1, characterized in that: The preprocessing and storage of text language includes: preprocessing the text language using word segmentation and keyword acquisition technology; representing and storing the preprocessed code information using a bag-of-words model and a one-shot representation method; representing and storing the text information using an n-gram model, where the text information refers to context information other than the code information.

3. The search method based on programming scene environment context according to claim 2, characterized in that: The method of using the K-means algorithm to perform cluster analysis on the preprocessed programming site environment context information to obtain the semantic relationship between the context information includes: selecting K context information related to the topic as initial cluster centers, calculating the distance between each context information and each center, assigning each context information to the cluster center closest to it, thereby obtaining K clusters, and removing the context information that is more than a preset threshold away from each cluster center, thereby extracting the context information with topic relevance in the context.

4. The search method based on programming scene environment context according to claim 2, characterized in that: The method of using the hierarchical clustering method to perform hierarchical analysis on the preprocessed programming site environment context information to obtain explicit associations and implicit associations between the context information includes: using hierarchical clustering to process the preprocessed context information using agglomerative hierarchical clustering, treating all text information as a class, combining the two closest classes into one class, and performing the process in sequence until the clustering division is completed.