TransRepo ๐
February 14, 2025 ยท View on GitHub
TransRepo is a repository-level code translation benchmark focused on Java-to-C# translation, providing skeleton code and test cases for evaluation.
Overview ๐
TransRepo presents a novel approach to repository-level code translation evaluation:
- ๐ฏ Generates C# skeleton code from Java repositories
- ๐งช Translates Java test files to C# test files
- ๐ Provides evaluation metrics for translated implementations
- ๐ Focuses on preserving project structure and maintainability
Dataset ๐ฆ
The benchmark dataset is available at "/data", containing:
- Original Java source files
- Translated C# skeleton code
- Translated C# test files
- Project configuration files (*.csproj)
Usage ๐ป
Language Versions
- Java 21 or later
- C# 12.0 (.NET 8.0) or later
Python Dependencies
- Python 3.x
- tree-sitter >= 0.20.1
- tqdm >= 4.65.0
Evaluation Command
python transrepo/verify/translated_code_validator.py \
--skeleton-path /path/to/skeleton \
--translated-path /path/to/translated \
--json-path /path/to/json \
--output-path /path/to/output \
--progress-bar-length 50
Baseline Translation and Evaluation
python transrepo/baseline/optimize_translation_without_skeleton.py \
--input-path /path/to/java/source \
--skeleton-path /path/to/csharp/skeleton \
--output-path /path/to/output \
--test-config /path/to/test/config