Program Statement Similarity Through Heterogeneous Diagram Matching
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing technologies for determining similarity between program statements fail to utilize structural and hierarchical information, lacking the capability to capture internal execution logic and data calculation processes, leading to inaccurate and inefficient similarity calculations.
Innovation Solution
Convert program statements into heterogeneous diagrams to calculate similarity through heterogeneous diagram matching, considering syntactic and structural features, thereby capturing internal logic and data processing flows.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If program statement similarity is determined using existing technologies, then the process is simple, but the accuracy is low because structural and hierarchical information is not utilized
Solution Approach 1:
The patent segments program statements into heterogeneous diagrams by dividing them into statement tokens and their relationships. This segmentation allows the system to analyze structural and hierarchical information at a granular level, improving similarity calculation accuracy by comparing individual components and their connections rather than treating statements as monolithic units.
Solution Approach 2:
The patent transforms one-dimensional program statements into two-dimensional heterogeneous diagrams with nodes and edges representing statement tokens and their relationships. This dimensional transformation enables the capture of structural and hierarchical information that cannot be represented in linear text, thereby improving similarity measurement by considering both syntactic and semantic dimensions.
2Measurement precision
If program statements are converted into heterogeneous diagrams for similarity calculation, then the accuracy improves by capturing internal logic, but the computational efficiency decreases
Solution Approach 1:
The patent applies preliminary action by pre-processing program statements into heterogeneous diagrams with standardized node and edge representations before similarity calculation. This pre-structuring organizes the data in a way that facilitates efficient comparison operations, allowing the system to leverage the organized structure during the actual similarity computation rather than processing raw text from scratch.
Solution Approach 2:
The patent creates simplified copies of program statements in the form of heterogeneous diagrams that preserve essential structural and hierarchical information while discarding redundant details. These diagrammatic copies serve as efficient representations for comparison, capturing the core logical structure needed for similarity assessment without the full complexity of the original statements.
3Adaptability or versatility
If existing similarity determination methods are used, then the processing speed is fast, but the capability to understand user intention and handle diverse expressions is limited
Solution Approach 1:
The patent segments program statements into heterogeneous diagrams by dividing them into statement tokens and their relationships. This segmentation allows the system to analyze structural and hierarchical information at a granular level, improving similarity calculation accuracy by comparing individual components and their connections rather than treating statements as monolithic units.
Solution Approach 2:
The patent transforms one-dimensional program statements into two-dimensional heterogeneous diagrams with nodes and edges representing statement tokens and their relationships. This dimensional transformation enables the capture of structural and hierarchical information that cannot be represented in linear text, thereby improving similarity measurement by considering both syntactic and semantic dimensions.
Data Source
AI summary
Embodiments of the present disclosure relate to a method, an apparatus, an electronic device, and a computer program product for determining similarity. The method includes obtaining a first program statement and a second program statement. The method also includes generating a first heterogeneous diagram corresponding to the first program statement and a second heterogeneous diagram corresponding to the second program statement. In addition, the method also includes determining the similarity between the first program statement and the second program statement based on the first heterogeneous diagram and the second heterogeneous diagram. Therefore, with the solution proposed in the embodiments of the present disclosure, a program statement can be converted into a heterogeneous diagram to calculate similarity through heterogeneous diagram matching.


