Source Code Classifier for Open Source Detection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current methods for analyzing source code files to detect open source code and identify compliance and security risks are prone to false positives, are computationally intensive, and struggle with accurately distinguishing between source and non-source code components, leading to decreased accuracy and increased processing time.

Innovation Solution

A deep neural network classifier is trained to identify patterns in source code files, distinguishing between source code and non-source code elements such as license information, copyright information, and dependent library information, thereby reducing false positives and improving detection accuracy while reducing analysis time.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If traditional scanning methods are used to analyze source code files, then comprehensive detection of open source code can be performed, but false positive detections increase and processing time increases

Engineering Contradiction:
Improvedetection accuracyVSAvoidprocessing time
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The source code file is divided into multiple text lines, and the classifier processes each text line independently to determine whether it corresponds to code construct type information. This segmentation allows parallel processing and reduces the overall processing time while maintaining detection accuracy.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The classifier extracts and identifies specific text lines that correspond to code construct type information (such as license information) from the source code file. By extracting only the relevant portions, the system reduces the amount of data that needs to be processed further, thereby decreasing processing time without compromising detection accuracy.

Inventive Principle:
Principle #2Taking out (Extraction)

2Reliability

If traditional scanning methods are used to analyze source code files, then open source code detection can be performed, but computational resources are excessively consumed

Engineering Contradiction:
Improvedetection accuracyVSAvoidcomputational resource consumption
Core Design Contradiction:
ReliabilityVSUse of energy by moving object

Solution Approach 1:

The classifier is pre-trained with sample source code files to learn the patterns and characteristics of code construct type information. This preliminary training enables the classifier to quickly and accurately identify relevant text lines during the actual analysis, reducing the computational resources required during the detection phase while maintaining high detection accuracy.

Inventive Principle:
Principle #10Preliminary action

3Measurement precision

If the classifier identifies code construct type information in all text lines, then detection accuracy improves, but the subset generation process becomes more complex

Engineering Contradiction:
Improveidentification accuracyVSAvoidprocessing complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The classifier automatically and independently evaluates each text line to determine whether it corresponds to code construct type information. This self-service approach allows the system to maintain high identification accuracy through intelligent classification while avoiding the need for complex manual processing or additional processing layers, thereby reducing overall processing complexity.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS11954485B1Classification of programming language code into basic constructs of source code and non-source code
Publication Date: 2024.04.09 BLACK DUCK SOFTWARE INC
  • US11954485B1 patent drawing
  • US11954485B1 patent drawing
  • US11954485B1 patent drawing

AI summary

A method for processing a source code file comprises scanning the source code file to identify text lines, and analyzing, via one or more processors, the text lines with a classifier to identify one or more of the text lines that correspond to code construct type information. The code construct type information includes license information. The classifier is trained with sample source code files. The method further comprises generating a subset of the text lines that excludes the one or more of the text lines identified as corresponding to the code construct type information. Further, the method comprises determining first text lines within the subset that correspond to open source code by comparing the subset to a database. The database includes a plurality of text lines associated with open source code.