Cross-Language Source Code Search Engine Using ML Translation

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Developers often create redundant source code for tasks already performed by existing code, as they may be unaware of previously developed source code, leading to inefficiencies and resource wastage across multiple repositories using different programming languages.

Innovation Solution

A system utilizing machine learning models to translate and compare source code across languages, generate vectors for functionality, and provide recommendations for consolidation or microservices architecture based on similarity measures, reducing the need for duplicate development.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If developers create source code independently without awareness of existing code, then individual development flexibility is maintained, but redundant code and resource wastage increase

Engineering Contradiction:
Improvedevelopment flexibilityVSAvoidresource wastage
Core Design Contradiction:
Adaptability or versatilityVSLoss of energy

Solution Approach 1:

The system performs preliminary actions by proactively analyzing and indexing source code across multiple repositories before developers create new code. Machine learning models pre-process and understand existing code functionalities, enabling the system to present relevant existing code to developers before they start writing new code, thus preventing redundancy while maintaining development flexibility

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system implements feedback mechanisms where developers interact with the system by providing feedback on code recommendations. The machine learning models continuously learn from this feedback to improve recommendation accuracy. This feedback loop enables the system to adapt to developer preferences and coding styles while reducing resource wastage through increasingly accurate code matching and reuse suggestions

Inventive Principle:
Principle #23Feedback

2Weight of moving object

If source code is maintained separately in multiple repositories, then project independence and modular development are preserved, but code duplication and maintenance effort increase

Engineering Contradiction:
Improveproject independenceVSAvoidmaintenance effort
Core Design Contradiction:
Weight of moving objectVSLoss of time

Solution Approach 1:

The system creates a universal code representation that can identify equivalent functionalities across different programming languages and repository structures. By translating and comparing code semantics rather than syntax, the system enables cross-language code reuse while preserving project independence, reducing maintenance effort through identified consolidation opportunities without requiring actual code movement

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The system acts as an intermediary layer between multiple source code repositories. It analyzes, translates, and compares code from different languages and repositories, then provides recommendations for consolidation or reuse. This intermediary approach enables reduced maintenance effort through intelligent code management while preserving the independence of individual projects until consolidation is desired

Inventive Principle:
Principle #24Intermediary (Mediator)

3Extent of automation

If developers are unaware of previously developed source code, then independent innovation is encouraged, but redundant development and inefficiency increase

Engineering Contradiction:
Improveindependent innovationVSAvoiddevelopment efficiency
Core Design Contradiction:
Extent of automationVSProductivity

Solution Approach 1:

The system enables self-service by automatically analyzing, indexing, and making existing source code accessible to developers. The machine learning models autonomously understand code functionalities, translate between languages, and generate relevant recommendations without requiring manual code registration or classification. This self-service approach maintains independent innovation while significantly improving development efficiency through automated code discovery and reuse suggestions

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system performs preliminary analysis and indexing of existing source code across multiple repositories before developers need to search for it. Machine learning models pre-process code to understand functionalities, relationships, and equivalencies, enabling rapid retrieval and recommendation when developers need code. This preliminary action maintains independent innovation workflows while improving productivity through reduced code search and duplication time

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS11797281B2Multi-language source code search engine
Publication Date: 2023.10.24 SAP SE
  • US11797281B2 patent drawing
  • US11797281B2 patent drawing
  • US11797281B2 patent drawing

AI summary

A machine learning model is trained to translate source code from one or more programming languages into a common programming language. The machine learning model translates source code from the other languages into the common programming language. A language embedder generates a vector for each function in the source code, all of which is now in the common programming language. A user provides a text search query which is converted by a language embedder to a vector. Based on the vector of the text search query and the vectors for the source code, search results are generated and presented in a user interface. Additional machine learning models may be trained and used to measure function complexity, test coverage, documentation quantity and complexity, or any suitable combination thereof. These measures may be used to determine which search results to present, an order in which to present search results, or both.