# US 2017/0286103 A1 · Identifying and correlating semantic bias for code evaluation

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

- Number: US 2017/0286103 A1
- Document ID: US20170286103A1
- Status: Published application
- Kind: A1
- Application number: 15/087,717
- Filed: 2016-03-31
- Published: 2017-10-05
- Earliest claimed: 2016-03-31
- Assignees: CA, Inc.
- Applicants: CA, Inc.
- Inventors: Eladio Beguico Caritos, II
- Web page: https://patentgrep.com/patent/US20170286103A1

## CPC

- G06F 8/73: Program documentation
- G06F 11/3604: Analysis of software for verifying properties of programs (testing of software G06F11/3668)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

System and techniques are disclosed for associating annotation semantic bias with program code. A pre-processor partitions an annotation from program statements contained within one or more source files. A lexical parser generates program statement tokens corresponding to the program statements, wherein each of the program statement tokens associates program statement text with a programming language lexeme category. The lexical parser generates one or more annotation tokens that each correspond to the annotation, wherein each of the annotation tokens associates annotation text with a natural language lexeme category. A syntactic analyzer compares the program statement tokens with the annotation tokens. A semantic analyzer determines a semantic correlation between the annotation and one or more of the program statements based, at least in part, on the results of the syntactic analyzer's comparing. A bias analyzer determines a semantic bias associated with at least one of the annotation tokens and a result processor associates at least one of the one or more program statements with the determined semantic bias based, at least in part, on the determined semantic correlation.

## Claims

### Claim 1

A method for associating annotation semantic bias with program code, said method comprising:
separating an annotation from program statements contained within one or more source files;
generating program statement tokens corresponding to the program statements, wherein each of the program statement tokens associates program statement text with a programming language lexeme category;
generating one or more annotation tokens that each correspond to the annotation, wherein each of the annotation tokens associates annotation text with a natural language lexeme category;
comparing the program statement tokens with the annotation tokens;
determining a semantic correlation between the annotation and one or more of the program statements based, at least in part, on a result of said comparing;
determining a semantic bias associated with at least one of the annotation tokens; and
associating at least one of the one or more program statements with the determined semantic bias based, at least in part, on the determined semantic correlation.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
identifying lexemes contained in the at least one of the annotation tokens; and
modifying the annotation based, at least in part, on the identified lexemes.

### Claim 3 (depends on 1)

The method of claim 1, wherein said comparing the program statement tokens with the annotation tokens comprises:
generating an annotation syntax tree from the annotation tokens;
generating a program statement syntax tree from the program statement tokens;
selecting a compare rule based on a programming language lexeme category specified by at least one of the program statement tokens; and
applying the selected compare rule to select an annotation lexeme from the annotation syntax tree.

### Claim 4 (depends on 3)

The method of claim 3, further comprising:
identifying a programming language syntax category of a program statement lexeme within the program statement syntax tree; and
selecting a program statement lexeme to be compared based, at least in part, on the identified programming language syntax category; and
wherein said applying the selected compare rule comprises selecting an annotation lexeme within the annotation syntax tree to be compared with the selected program statement lexeme based, at least in part, on the programming language lexeme category specified by the at least one of the program statement tokens.

### Claim 5 (depends on 1)

The method of claim 1, wherein said determining a semantic correlation between the annotation and at least one of the program statements comprises:
selecting a program statement lexeme based on a compare rule;
determining synonyms for the program statement lexeme;
selecting an annotation lexeme based on,
the compare rule; and
the selected program statement lexeme;
determining synonyms for the annotation lexeme; and
pattern matching the synonyms for the program statement lexeme with the synonyms for the annotation lexeme.

### Claim 6 (depends on 5)

The method of claim 5, further comprising generating a correlation report having an entry that associates an identifier of the annotation with identifiers of at least one of the program statements based on said pattern matching.

### Claim 7 (depends on 1)

The method of claim 1, wherein said determining a semantic bias comprises:
applying a sentiment analysis algorithm to the annotation to determine a subjectivity indicator; and
comparing at least one lexeme within the annotation to bias associated character strings to determine a bias polarity.

### Claim 8 (depends on 7)

The method of claim 7, further comprising generating an annotation bias report that associates an identifier of the annotation with the determined semantic bias.

### Claim 9

One or non-transitory more machine-readable storage media having program code for associating annotation semantic bias with program statements stored therein, the program code to:
partition an annotation from program statements contained within one or more source files;
generate program statement tokens corresponding to the program statements, wherein each of the program statement tokens associates program statement text with a programming language lexeme category;
generate one or more annotation tokens that each correspond to the annotation, wherein each of the annotation tokens associates annotation text with a natural language lexeme category;
compare the program statement tokens with the annotation tokens;
determine a semantic correlation between the annotation and one or more of the program statements based, at least in part, on a result of said comparing;
determine a semantic bias associated with at least one of the annotation tokens; and
associate at least one of the one or more program statements with the determined semantic bias based, at least in part, on the determined semantic correlation.

### Claim 10 (depends on 9)

The machine-readable storage media of claim 9, wherein the program code further includes program code to:
identify lexemes contained in the at least one of the annotation tokens; and
modify the annotation based, at least in part, on the identified lexemes.

### Claim 11 (depends on 9)

The machine-readable storage media of claim 9, wherein the program code to compare the program statement tokens with the annotation tokens comprises program code to:
generate an annotation syntax tree from the annotation tokens;
generate a program statement syntax tree from the program statement tokens;
select a compare rule based on a programming language lexeme category specified by at least one of the program statement tokens; and
apply the selected compare rule to select an annotation lexeme from the annotation syntax tree.

### Claim 12 (depends on 11)

The machine-readable storage media of claim 11, wherein the program code further includes program code to:
identify a programming language syntax category of a program statement lexeme within the program statement syntax tree; and
select a program statement lexeme to be compared based, at least in part, on the identified programming language syntax category; and
wherein the program code to apply the selected compare rule comprises program code to select an annotation lexeme within the annotation syntax tree to be compared with the selected program statement lexeme based, at least in part, on the programming language lexeme category specified by the at least one of the program statement tokens.

### Claim 13 (depends on 9)

The machine-readable storage media of claim 9, wherein the program code to determine a semantic correlation between the annotation and at least one of the program statements comprises program code to:
select a program statement lexeme based on a compare rule;
determine synonyms for the program statement lexeme;
select an annotation lexeme based on,
the compare rule; and
the selected program statement lexeme;
determine synonyms for the annotation lexeme; and
pattern match the synonyms for the program statement lexeme with the synonyms for the annotation lexeme.

### Claim 14 (depends on 13)

The machine-readable storage media of claim 13, wherein the program code further includes program code to generate a correlation report having an entry that associates an identifier of the annotation with identifiers of at least one of the program statements based on said pattern matching.

### Claim 15 (depends on 9)

The machine-readable storage media of claim 9, wherein the program code to determine a semantic bias comprises program code to:
apply a sentiment analysis algorithm to the annotation to determine a subjectivity indicator; and
compare at least one lexeme within the annotation to bias associated character strings to determine a bias polarity.

### Claim 16 (depends on 15)

The machine-readable storage media of claim 15, wherein the program code further includes program code to generate an annotation bias report that associates an identifier of the annotation with the determined semantic bias.

### Claim 17

An apparatus comprising:
a processor; and
a machine-readable medium having program code executable by the processor to cause the apparatus to,
partition an annotation from program statements contained within one or more source files;
generate program statement tokens corresponding to the program statements, wherein each of the program statement tokens associates program statement text with a programming language lexeme category;
generate one or more annotation tokens that each correspond to the annotation, wherein each of the annotation tokens associates annotation text with a natural language lexeme category;
compare the program statement tokens with the annotation tokens;
determine a semantic correlation between the annotation and one or more of the program statements based, at least in part, on a result of said comparing;
determine a semantic bias associated with at least one of the annotation tokens; and
associate at least one of the one or more program statements with the determined semantic bias based, at least in part, on the determined semantic correlation.

### Claim 18 (depends on 17)

The apparatus of claim 17, wherein the program code further includes program code executable by the processor to cause the apparatus to:
identify lexemes contained in the at least one of the annotation tokens; and
modify the annotation based, at least in part, on the identified lexemes.

### Claim 19 (depends on 17)

The apparatus of claim 17, wherein the program code further includes program code executable by the processor to cause the apparatus to:
generate an annotation syntax tree from the annotation tokens;
generate a program statement syntax tree from the program statement tokens;
select a compare rule based on a programming language lexeme category specified by at least one of the program statement tokens; and
apply the selected compare rule to select an annotation lexeme from the annotation syntax tree.

### Claim 20 (depends on 19)

The apparatus of claim 19, wherein the program code further includes program code executable by the processor to cause the apparatus to:
identify a programming language syntax category of a program statement lexeme within the program statement syntax tree; and
select a program statement lexeme to be compared based, at least in part, on the identified programming language syntax category; and
select an annotation lexeme within the annotation syntax tree to be compared with the selected program statement lexeme based, at least in part, on the programming language lexeme category specified by the at least one of the program statement tokens.
