# US 2009/0254884 A1 · Identification of topics in source code

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2009/0254884 A1
- Document ID: US20090254884A1
- Status: Published application
- Kind: A1
- Application number: 12/212,534
- Filed: 2008-09-17
- Published: 2009-10-08
- Earliest claimed: 2008-04-08
- Assignees: Infosys Technologies Limited
- Inventors: Girish Maskeri Rama; Kenneth Heafield; Santonu Sarkar
- Web page: https://patentgrep.com/patent/US20090254884A1

## CPC

- G06F 8/75: Structural analysis for program understanding
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Topics in source code can be identified using Latent Dirichlet Allocation (LDA) by receiving source code, identifying domain specific keywords from the source code, generating a keyword matrix, processing the keyword matrix and the source code using LDA, and outputting a list of topics. The list of topics is output as collections of domain specific keywords. Probabilities of domain specific keywords belonging to their respective topics can also be output. The keyword matrix comprises weighted sums of occurrences of domain specific keywords in the source code.

## Claims

### Claim 1

A method, implemented at least in part by a computing device, for identifying topics in source code using Latent Dirichlet Allocation (LDA), the method comprising:
receiving software source code;
identifying domain specific keywords from the software source code;
generating a keyword matrix, wherein the keyword matrix comprises weighted sums of occurrences of the domain specific keywords in the software source code;
processing, using LDA, the keyword matrix and the software source code; and
outputting, from the processing, collections of domain specific keywords and probabilities, wherein the collections corresponds to respective topics identified by LDA in the software source code.

### Claim 2 (depends on 1)

The method of claim 1 wherein each collection comprises one or more of the domain specific keywords, and wherein the one or more domain specific keywords of each collection are assigned respective probabilities of being associated with the collection.

### Claim 3 (depends on 1)

The method of claim 1 wherein the identifying the domain specific keywords comprises splitting source code identifiers in the software source code.

### Claim 4 (depends on 1)

The method of claim 1 wherein the identifying the domain specific keywords comprises:
extracting source code identifiers from the software source code;
splitting the source code identifiers to produce a set of potential domain specific keywords; and
filtering the set of potential domain specific keywords by removing potential domain specific keywords unlikely to indicate topics, wherein the domain specific keywords are those potential domain specific keywords remaining after the filtering.

### Claim 5 (depends on 4)

The method of claim 4 wherein the identifying the domain specific keywords further comprises:
stemming the set of potential domain specific keywords.

### Claim 6 (depends on 1)

The method of claim 1 wherein each of the domain specific keywords of the keyword matrix is weighted based upon a location type of the domain specific keyword.

### Claim 7 (depends on 1)

The method of claim 1 wherein the software source code is in one or more software source code files, and wherein the keyword matrix is a file-keyword matrix comprising weighted sums of occurrences of the domain specific keywords in the one or more software source code files.

### Claim 8 (depends on 7)

The method of claim 7, further comprising:
outputting, from the processing, an indication of which of the collections are present in specific files of the one or more software source code files.

### Claim 9 (depends on 1)

The method of claim 1 wherein the weighted sums in the keyword matrix take into account only cohesion data in the software source code.

### Claim 10 (depends on 1)

The method of claim 1 wherein the collections of domain specific keywords and probabilities are output in the form of a topic-keyword matrix whose entries correspond to probabilistic associations between the topics and the domain specific keywords.

### Claim 11 (depends on 1)

The method of claim 1 wherein the processing using LDA uses Gibbs sampling.

### Claim 12

One or more computer-readable media comprising computer-executable instructions for causing a computing device to perform a method for identifying topics in source code using Latent Dirichlet Allocation (LDA), the method comprising:
receiving one or more software source code files;
identifying domain specific keywords from the one or more software source code files;
generating a file-keyword matrix, wherein the file-keyword matrix comprises weighted sums of occurrences of the domain specific keywords in the one or more software source code files;
processing, using LDA, the file-keyword matrix and the one or more software source code files; and
outputting, from the processing, collections of domain specific keywords and probabilities, wherein the collections corresponds to respective topics identified by LDA in the one or more software source code files.

### Claim 13 (depends on 12)

The one or more computer-readable media of claim 12 wherein each collection comprises one or more of the domain specific keywords, and wherein the one or more domain specific keywords of each collection are assigned respective probabilities of being associated with the collection.

### Claim 14 (depends on 12)

The one or more computer-readable media of claim 12 wherein the identifying the domain specific keywords comprises:
extracting source code identifiers from the one or more software source code files;
splitting the source code identifiers to produce a set of potential domain specific keywords;
stemming the set of potential domain specific keywords; and
filtering the set of potential domain specific keywords by removing those potential domain specific keywords unlikely to indicate topics, wherein the domain specific keywords are those potential domain specific keywords remaining after the filtering.

### Claim 15 (depends on 12)

The one or more computer-readable media of claim 12 wherein each of the domain specific keywords of the file-keyword matrix is weighted based upon a location type of the domain specific keyword.

### Claim 16 (depends on 12)

The one or more computer-readable media of claim 12, further comprising:
outputting, from the processing, an indication of which of the collections are present in specific files of the one or more software source code files.

### Claim 17 (depends on 12)

The one or more computer-readable media of claim 12 wherein the domain specific keywords come only from cohesion data in the one or more software source code files.

### Claim 18

A method, implemented at least in part by a computing device, for identifying topics in source code using Latent Dirichlet Allocation (LDA), the method comprising:
receiving a software source code file;
identifying a domain specific keyword from the software source code file, wherein the identifying the domain specific keywords comprises splitting a source code identifier from the software source code file;
generating a file-keyword matrix, wherein the file-keyword matrix comprises a weighted sum of occurrence of the identified domain specific keyword in the software source code file, and wherein the file-keyword matrix is weighted based upon a location type of the identified domain specific keyword;
receiving, as input to LDA, a plurality of user-defined parameters, wherein the plurality of user-defined parameters comprise a number of topics T, a document Dirichlet parameter α, and a topic Dirichlet parameter β;
processing, using LDA, the file-keyword matrix and the software source code file; and
outputting, from the processing, a collection of domain specific keywords, wherein the collection comprises the identified domain specific keyword and a probability of the domain specific keyword being associated with the collection, and wherein the collection corresponds to a topic identified by LDA in the software source code file.

### Claim 19 (depends on 18)

The method of claim 18 wherein the identifying the domain specific keyword comprises:
extracting source code identifiers from the software source code file;
splitting the source code identifiers to produce a set of potential domain specific keywords; and
filtering the set of potential domain specific keywords by removing those potential domain specific keywords unlikely to indicate topics, wherein the identified domain specific keyword is one of the domain specific keywords remaining after the filtering.

### Claim 20 (depends on 18)

The method of claim 18, further comprising:
receiving a configuration file comprising a plurality of user-defined parameters used as input to the processing, wherein the plurality of user-defined parameters comprise a desired number of topics.
