Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.4 instead.

yaku

English | 日本語

Fully offline translator for command output. Only the prose gets translated; everything else is left verbatim.

Identifiers, flags, paths and quoted strings survive unchanged, because they are moved out of the way before the model sees the text and put back afterwards. No network access, no API keys, no data leaving the machine.

Install

pip install yaku
yaku setup --lang ja

yaku setup downloads FuguMT at a pinned revision and converts it to a 62 MB int8 model. The model is not bundled because it is CC BY-SA 4.0. The converter needs torch, which yaku does not depend on, so the conversion runs in a throwaway environment created with uv.

yaku setup requires uv. Install it and put it on PATH before running the command.

Use

terraform plan 2>&1 | yaku
man tar | col -bx | yaku
kubectl describe pod web | yaku
pbpaste | yaku

Useful options:

Option Effect
--lang ja target language, which also selects the model and thresholds
--fallback both|original|mark what to emit for a line that fails the quality check
--show-reason append why a line failed
--stats write a summary to stderr
--dry-run show classification and masking without loading a model
--join / --no-join override the automatic wrapped-line detection
--width N wrap the translated text
--mask-off NAME,... disable mask rules

How it works

stdin
  ↓ strip ANSI escapes
  ↓ analysis pass        decides whether lines are wrapped prose
  ↓ classify             pass through / command example / translatable
  ↓ join                 reassemble wrapped sentences
  ↓ mask                 identifiers become T1, T2, ...
  ↓ split                back into sentences
  ↓ cache                keyed on the normalised masked text
  ↓ translate            CTranslate2 + SentencePiece
  ↓ check                lost placeholders, length ratio, repetition
  ↓ unmask               identifiers restored
stdout

Two parts carry most of the value.

Masking is not about withholding text. A sequence model that has never seen aws_instance.web_server_01 in training will hallucinate around it; T1 will be created is ordinary English and translates cleanly. Masking also cuts the request by 5 to 10 percent in tokens, and a placeholder that fails to come back is the only reliable sign that a clause was dropped.

The quality check exists because dropped clauses cannot be prevented. Each line is verified afterwards, and anything suspect is shown with its original text rather than silently replaced.

Limits

  • Translation quality is bounded by a 60M parameter model. It will not match a large language model.
  • Dropped clauses cannot be eliminated, only detected. Roughly 5 to 9 percent of translated lines in manual pages are flagged, of which some are real drops and some are Japanese simply being more compact than the ratio check allows.
  • Whether lines are joined is decided once for the whole input. Inside record-per-line output, a paragraph is still rejoined when its lines are filled to the wrap column, but a wrap that lands just before a capitalised word is left split.
  • Japanese output sometimes loses a space around a restored identifier.

Adding a language

--lang switches the model and the measured constants together, so a new language needs a profile, not just a model.

  1. Pick a CTranslate2-compatible model (Marian and OPUS-MT convert cleanly).
  2. uv run tools/check_placeholders.py to choose a placeholder format.
  3. uv run tools/eval_translate.py to measure the length ratio bounds.
  4. Write src/yaku/rules/target/<lang>.toml.

Development

uv sync
export YAKU_MODELS_DIR=models     # use the checkout's model, not the installed one
uv run pytest
uv run ruff check src tests tools && uv run ruff format src tests tools
uv run tools/measure_wrap.py captured-output.txt
uv run tools/eval_translate.py captured-output.txt

Rules live in src/yaku/rules/ as TOML. Users can add their own in ~/.config/yaku/rules/ or point --rules-dir at a directory; shipped rules are never edited in place.

Licence

MIT. The default model, FuguMT, is CC BY-SA 4.0 and is downloaded separately.

Metadata

Release files for yaku 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yaku 0.1.0
File Size Uploaded Provenance Actions
yaku-0.1.0.tar.gz 47.3 kB Without provenance Details for yaku-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yaku 0.1.0
File Interpreter ABI Platform Actions
yaku-0.1.0-py3-none-any.whl Python 3 none any Details for yaku-0.1.0-py3-none-any.whl

Total release size: 83.7 kB

Release files / yaku-0.1.0.tar.gz

Download URL yaku-0.1.0.tar.gz
Size 47.3 kB
Tags Source
SHA-256 checksum
How to use checksums
09e38a6899eee50fc8faf629f26e93ab7abf3f497ebdbc8110213a862d22efe4
BLAKE2b-256 checksum
How to use checksums
d9c5fd096065053ae52bd77c917f434247eb10de9dae54ad20962a5bac7bc463
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / yaku-0.1.0-py3-none-any.whl

Download URL yaku-0.1.0-py3-none-any.whl
Size 36.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ff2fbbe868c14c91f4720645b472ff02f350a016130d1d1fdcdd978277cf5164
BLAKE2b-256 checksum
How to use checksums
fa3ec363a0694beec61598161fb120b77571a93ab88b1b8d1f33355661e45413
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for yaku 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page