Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Experimental translator source code

License

NotificationsYou must be signed in to change notification settings

aleph-lang/aleph_ollama

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An experimental library for translating source code to different programming languages using Ollama.

Description

This library enables translation of source code files from one programming language to another using Ollama AI models capabilities. It's an experimental tool that can be helpful for quick code conversion between different languages.

Prerequisites

  • Rust installed on your system
  • Ollama installed and running locally
  • A compatible model (default: qwen2.5-coder)

Installation

cargo add aleph_ollama

Usage

The library can be used via command line through the provided example:

cargo run --example basic<source_file_path><target_language>

Example

cargo r --example basic test/dataset/syracuse.ml java

Which produces the following output:

importjava.util.ArrayList;importjava.util.List;publicclassSyracuse {publicstaticvoidmain(String[]args) {intn =7;List<Integer>suite =syracuse(n);System.out.print("Syracuse for " +n +" : ");for (intx :suite) {System.out.print(x +" ");        }System.out.println();    }publicstaticList<Integer>syracuse(intn) {if (n <=0) {thrownewIllegalArgumentException("Le nombre doit être strictement positif");        }elseif (n ==1) {List<Integer>list =newArrayList<>();list.add(1);returnlist;        }elseif (n %2 ==0) {List<Integer>list =syracuse(n /2);list.add(0,n);returnlist;        }else {List<Integer>list =syracuse(3 *n +1);list.add(0,n);returnlist;        }    }}

Configuration

The library can be configured through environment variables:

Limitations

  • Translation quality depends on the model used
  • Some language-specific concepts may not have direct equivalents in the target language
  • The tool is experimental and may require manual adjustments of generated code

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

About

Experimental translator source code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp