https://github.com/atelierarith/docstringtranslationollamabackend.jl

DocstringTranslation using Ollama

https://github.com/atelierarith/docstringtranslationollamabackend.jl

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.9%) to scientific vocabulary

Keywords

julia julialang ollama translation translator
Last synced: 9 months ago · JSON representation

Repository

DocstringTranslation using Ollama

Basic Info
  • Host: GitHub
  • Owner: AtelierArith
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Homepage:
  • Size: 28.3 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
julia julialang ollama translation translator
Created over 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

DocstringTranslationOllamaBackend.jl

Description

This Julia package inserts Large Language Model (LLM) hooks into the API in the Base.Docs module, giving non-English speaking users the opportunity to help smooth API comprehension.

Prerequisite

Install Julia

Install Julia using juliaup.

sh $ curl -fsSL https://install.julialang.org | sh -s -- --yes

Ollama

This package utilizes Ollama Navigate to https://ollama.com/download and follow the instruction. Once it has been installed, we can use ollama command. Let's run ollama --version

sh $ ollama --version ollama version is 0.4.2

By default, We use local LLM model as gemma2:9b. Therefore, please pull the model in advance. Namely:

sh $ ollama pull gemma2:9b

Usage

Start Julia REPL

``sh $ cd path/to/directory $ julia _ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _ | | | | || | | | (| | | Version 1.11.1 (2024-10-16) / |_'|||_'| | Official https://julialang.org/ release |_/ |

julia> using Pkg; Pkg.activate("."); Pkg.instantiate()

julia> using DocstringTranslationOllamaBackend [ Info: Launching ollama with "ollama ls" command [ Info: Done ```

Call @switchlang! macro with your preferred language.

Example: Japanese(日本語)

```julia julia> @switchlang! :Japanese

help?> sin search: sin sinc sind sinh sign asin in min sinpi using isinf

sin(x)

x (ラジアンで表された値) の正弦を計算します。

sind、sinpi、sincos、cis、asin も参照してください。

例 ≡≡

julia> round.(sin.(range(0, 2pi, length=9)'), digits=3) 1×9 Matrix{Float64}: 0.0 0.707 1.0 0.707 0.0 -0.707 -1.0 -0.707 -0.0

julia> sind(45) 0.7071067811865476

julia> sinpi(1/4) 0.7071067811865475

julia> round.(sincos(pi/6), digits=3) (0.5, 0.866)

julia> round(cis(pi/6), digits=3) 0.866 + 0.5im

julia> round(exp(im*pi/6), digits=3) 0.866 + 0.5im

─────────────────────────────────────────────────────────────

sin(A::AbstractMatrix)

正方行列 A のマトリックスサインを計算します。

A が対称行列またはエルミート行列であれば、固有値分解 (eigen) が使用して sine を計算します。それ以外の場合は、exp を呼び出すことで sine を決定します。

例 ≡≡

julia> sin(fill(1.0, (2,2))) 2×2 Matrix{Float64}: 0.454649 0.454649 0.454649 0.454649

julia> ```

Example: German(ドイツ語)

```julia help?> sin search: sin sinc sind sinh sign asin in min sinpi using isinf

sin(x)

Berechnung des Sinus von x, wobei x in Radians liegt.

Siehe auch sind, sinpi, sincos, cis, asin.

Beispiele ≡≡≡≡≡≡≡≡≡

julia> round.(sin.(range(0, 2pi, length=9)'), digits=3) 1×9 Matrix{Float64}: 0.0 0.707 1.0 0.707 0.0 -0.707 -1.0 -0.707 -0.0

julia> sind(45) 0.7071067811865476

julia> sinpi(1/4) 0.7071067811865475

julia> round.(sincos(pi/6), digits=3) (0.5, 0.866)

julia> round(cis(pi/6), digits=3) 0.866 + 0.5im

julia> round(exp(im*pi/6), digits=3) 0.866 + 0.5im

─────────────────────────────────────────────────────────────

sin(A::AbstractMatrix)

Berechnet die Matrix-Sinus von einer quadratischen Matrix A.

Wenn A symmetrisch oder hermitesch ist, wird ihre Eigenwertzerlegung (eigen) verwendet, um den Sinus zu berechnen. Andernfalls wird der Sinus durch einen Aufruf von exp bestimmt.

Beispiele ≡≡≡≡≡≡≡≡≡

julia> sin(fill(1.0, (2,2))) 2×2 Matrix{Float64}: 0.454649 0.454649 0.454649 0.454649

julia> ```

Back to English(英語)

You can revert the default @doc functionality anytime. Just call @revertlang! macro.

```julia julia> @revertlang!

help?> sin search: sin sinc sind sinh sign asin in min sinpi using isinf

sin(x)

Compute sine of x, where x is in radians.

See also sind, sinpi, sincos, cis, asin.

Examples ≡≡≡≡≡≡≡≡

julia> round.(sin.(range(0, 2pi, length=9)'), digits=3) 1×9 Matrix{Float64}: 0.0 0.707 1.0 0.707 0.0 -0.707 -1.0 -0.707 -0.0

julia> sind(45) 0.7071067811865476

julia> sinpi(1/4) 0.7071067811865475

julia> round.(sincos(pi/6), digits=3) (0.5, 0.866)

julia> round(cis(pi/6), digits=3) 0.866 + 0.5im

julia> round(exp(im*pi/6), digits=3) 0.866 + 0.5im

─────────────────────────────────────────────────────────────

sin(A::AbstractMatrix)

Compute the matrix sine of a square matrix A.

If A is symmetric or Hermitian, its eigendecomposition (eigen) is used to compute the sine. Otherwise, the sine is determined by calling exp.

Examples ≡≡≡≡≡≡≡≡

julia> sin(fill(1.0, (2,2))) 2×2 Matrix{Float64}: 0.454649 0.454649 0.454649 0.454649

julia> ```

Switching to another LLM.

On machines without a GPU accelerator, one may want to switch to another lightweight model, such as gemma2:2b. However, the translation accuracy will be reduced.

julia julia> using Pkg; Pkg.activate(".") julia> using DocstringTranslationOllamaBackend julia> switchmodel!("gemma2:2b")

To improve translation accuracy, we can use gemma2:27b.

julia julia> using Pkg; Pkg.activate(".") julia> using DocstringTranslationOllamaBackend julia> switchmodel!("gemma2:27b")

Other potential selections

Acknowledgement

Appendix

Normally @doc mod::Module reads the README.md of a given module mod. If the README.md contains many sentences, we have to wait a long time, even on GPU-enabled machines. Here, we use a stream=true option to make Julia show us real-time processing. As an example, try the following command:

julia julia> using LatticeQCD; using DocstringTranslationOllamaBackend; @switchlang! :Japanese; @doc LatticeQCD; @revertlang!; @doc LatticeQCD

Owner

  • Name: AtelierArith
  • Login: AtelierArith
  • Kind: organization
  • Email: contact@atelier-arith.jp
  • Location: Japan

Enhance "Math meets Art"

GitHub Events

Total
  • Watch event: 3
  • Public event: 1
  • Push event: 27
Last Year
  • Watch event: 3
  • Public event: 1
  • Push event: 27

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels