# US 2021/0334095 A1 · Quality analysis of source code

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

- Number: US 2021/0334095 A1
- Document ID: US20210334095A1
- Status: Published application
- Kind: A1
- Application number: 16/856,461
- Filed: 2020-04-23
- Published: 2021-10-28
- Earliest claimed: 2020-04-23
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Hiroaki Nakamura; Toshiaki Yasue; Kohichi Ono; Alisa Ooka; Nobuhiro Hosokawa; Yukiko Hara
- Web page: https://patentgrep.com/patent/US20210334095A1

## CPC

- G06F 8/73: Program documentation
- G06F 8/75: Structural analysis for program understanding
- G06N 3/09: Supervised learning
- G06N 20/00: Machine learning
- G06N 3/045: Combinations of networks
- G06N 3/08: Learning methods
- G06N 20/10: using kernel methods, e.g. support vector machines [SVM]
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06N: COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS

## Abstract

Systems and methods for quality analysis of a source code are disclosed. The method includes obtaining plural comments included in the source code. Each of the plural comments includes at least one of plural predetermined words. Also the method extracts plural candidate comments which are comments obtained by excluding plural specific comments from the obtained plural comments. Each of the plural specific comments can be identified using a similarity between a source code fragment relating to any of the obtained plural comments and an adjacent source code fragment adjacent to the source code fragment. In addition, the method outputs an evaluation about incompletion of the source code. The evaluation is determined using the plural candidate comments.

## Claims

### Claim 1

A computer-implemented method for quality analysis of a source code, the method comprising:
obtaining a plurality of comments included in the source code, each of the plurality of comments including at least one of a plurality of predetermined words;
extracting, using machine learning, a plurality of candidate comments which are comments obtained by excluding a plurality of specific comments from the plurality of comments, each of the plurality of specific comments being identified using a similarity between a source code fragment relating to any of the plurality of comments and an adjacent source code fragment adjacent to the source code fragment; and
outputting an evaluation about incompletion of the source code, the evaluation being determined using the plurality of candidate comments.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, wherein the source code fragment is one of the plurality of comments.

### Claim 3 (depends on 1)

The computer-implemented method of claim 1, wherein the source code fragment is a program statement corresponding to one of the plurality of comments.

### Claim 4 (depends on 1)

The computer-implemented method of claim 1, wherein the plurality of candidate comments are comments obtained by further excluding a plurality of other specific comments from the plurality of comments, each of the plurality of other specific comments being identified using a type of a source code fragment including any of the plurality of comments.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein the evaluation is determined using a classifier trained to learn a relationship between an appearance tendency of words included in a comment and whether or not the comment indicates that a corresponding program statement is incomplete.

### Claim 6 (depends on 5)

The computer-implemented method of claim 5, further comprising:
training the classifier to learn the relationship using words included in the plurality of candidate comments and a plurality of labels given to the plurality of candidate comments, each of the plurality of labels indicating whether or not a corresponding candidate comment indicates that a corresponding program statement is incomplete.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, wherein outputting the evaluation includes arranging correspondences between each source code fragment and the respective candidate comment in descending order of incompletion-indicating evaluation values assigned to each source code fragment.

### Claim 8

An apparatus for quality analysis of a source code, the apparatus comprising:
a processor; and
a memory coupled to the processor, wherein
the memory tangibly stores program instructions executable by the processor to cause the processor to perform a method comprising:
obtaining a plurality of comments included in the source code, each of the plurality of comments including at least one of a plurality of predetermined words;
extracting, using machine learning, a plurality of candidate comments which are comments obtained by excluding a plurality of specific comments from the obtained plurality of comments, each of the plurality of specific comments being identified using a similarity between a source code fragment relating to any of the obtained plurality of comments and an adjacent source code fragment adjacent to the source code fragment; and
outputting an evaluation about incompletion of the source code, the evaluation being determined using the plurality of candidate comments.

### Claim 9 (depends on 8)

The apparatus of claim 8, wherein the source code fragment is one of the obtained plurality of comments.

### Claim 10 (depends on 8)

The apparatus of claim 8, wherein the source code fragment is a program statement corresponding to one of the obtained plurality of comments.

### Claim 11 (depends on 8)

The apparatus of claim 8, wherein the plurality of candidate comments are comments obtained by further excluding a plurality of other specific comments from the obtained plurality of comments, each of the plurality of other specific comments being identified using a type of a source code fragment including any of the obtained plurality of comments.

### Claim 12 (depends on 8)

The apparatus of claim 8, wherein the evaluation is determined using a classifier trained to learn a relationship between an appearance tendency of words included in a comment and whether or not the comment indicates that a corresponding program statement is incomplete.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein the method further comprises:
training the classifier to learn the relationship using words included in the plurality of candidate comments and a plurality of labels given to the plurality of candidate comments, each of the plurality of labels indicating whether or not a corresponding candidate comment indicates that a corresponding program statement is incomplete.

### Claim 14

A computer program product for quality analysis of a source code, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by a computer to cause the computer to perform a method comprising:
obtaining a plurality of comments included in the source code, each of the plurality of comments including at least one of a plurality of predetermined words;
extracting a plurality of candidate comments using machine learning, the comments being obtained by excluding a plurality of specific comments from the obtained plurality of comments, each of the plurality of specific comments being identified using a similarity between a source code fragment relating to any of the obtained plurality of comments and an adjacent source code fragment adjacent to the source code fragment; and
outputting an evaluation about incompletion of the source code, the evaluation being determined using the plurality of candidate comments.

### Claim 15 (depends on 14)

The computer program product of claim 14, wherein the source code fragment is one of the obtained plurality of comments.

### Claim 16 (depends on 14)

The computer program product of claim 14, wherein the source code fragment is a program statement corresponding to one of the obtained plurality of comments.

### Claim 17 (depends on 14)

The computer program product of claim 14, wherein the plurality of candidate comments are comments obtained by further excluding a plurality of other specific comments from the obtained plurality of comments, each of the plurality of other specific comments being identified using a type of a source code fragment including any of the obtained plurality of comments.

### Claim 18 (depends on 14)

The computer program product of claim 14, wherein the evaluation is determined using a classifier trained to learn a relationship between an appearance tendency of words included in a comment and whether or not the comment indicates that a corresponding program statement is incomplete.

### Claim 19 (depends on 18)

The computer program product of claim 18, wherein the method further comprises:
training the classifier to learn the relationship using words included in the plurality of candidate comments and a plurality of labels given to the plurality of candidate comments, each of the plurality of labels indicating whether or not a corresponding candidate comment indicates that a corresponding program statement is incomplete.

### Claim 20 (depends on 14)

The computer program product of claim 14, wherein outputting the evaluation includes arranging correspondences between each source code fragment and the respective candidate comment in descending order of incompletion-indicating evaluation values assigned to each source code fragment.
