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.
yaku supports Python 3.12 to 3.14. sentencepiece has no prebuilt wheel for Python 3.15 yet, so if your default Python is 3.15, pick an older interpreter explicitly, for example pipx install yaku --python python3.14.
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.
- Pick a CTranslate2-compatible model (Marian and OPUS-MT convert cleanly).
uv run tools/check_placeholders.pyto choose a placeholder format.uv run tools/eval_translate.pyto measure the length ratio bounds.- 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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yaku-0.1.2.tar.gz | 47.8 kB | Without provenance | Details for yaku-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yaku-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for yaku-0.1.2-py3-none-any.whl |
Total release size: 84.3 kB
Release files / yaku-0.1.2.tar.gz
| Download URL | yaku-0.1.2.tar.gz |
|---|---|
| Size | 47.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d8e1448f898eaa75e485b35593449c6c9726997d0977879732070b1c0aedb67
|
|
BLAKE2b-256 checksum How to use checksums |
464622a76bc45a6b7fb8a24427628a19951d28a9d47e4c6e76b98e5341eeb488
|
| 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.2-py3-none-any.whl
| Download URL | yaku-0.1.2-py3-none-any.whl |
|---|---|
| Size | 36.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db2c23ea80dc2aa82ed2ca9285a95861a35f1a85cffda1dce42e73d6583542dc
|
|
BLAKE2b-256 checksum How to use checksums |
7b130973885b57990faf912e962e9ab5cc9a4d117e78244c5b373eb5b580511c
|
| 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.2
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.