translation · English→Arabic RTL MarianMT · q8 · WASM · 117.60 MB · Apache-2.0
Opus-MT English → Arabic
University of Helsinki's OPUS-MT EN→AR
(Helsinki-NLP/opus-mt-en-ar,
quantized to 117.60 MB first-visit q8 ONNX in
Xenova/opus-mt-en-ar)
is a 6+6 MarianMT encoder-decoder translating English prose into right-to-left Arabic script
(dir="rtl" lang="ar") using sentence-initial target control tokens (>>ara<< #4) —
running 100% locally in CPU WebAssembly.
1 · On-device model (117.60 MB q8 WASM · encoder 51.77 MB + decoder 59.08 MB + tokenizer 6.75 MB)
2 · Live English → Arabic RTL Neural Translator
Select an English preset, type or paste English (or mixed bidi text), or drop/upload a
.txt, .md, .srt, or .csv file anywhere below.
.txt, .md, .srt, or .csv file here, paste via
Ctrl/Cmd+V, or choose a local file:
Arabic RTL Translation (العربية)
Waiting for runPrepare Opus-MT EN→AR above to translate English text into RTL Arabic locally in CPU WebAssembly.
3 · See Inside: Sentence Alignment, Arabic Script Breakdown & MarianTokenizer Subwords
Inspect the prepended target control token (>>ara<< #4), English SentencePiece subwords
from the 62,802-token vocabulary, and generated Arabic script density (letters, hamza/ة, digits, and bidi Latin tokens).
| # | English segment | Arabic RTL translation | Tokens (in→out) | Latency |
|---|---|---|---|---|
| Run a translation above to inspect sentence-by-sentence alignment. | ||||
Real SentencePiece Source Subwords (MarianTokenizer · 62,802 vocab)
Run a translation to inspect real MarianTokenizer control tags and SentencePiece subwords.
Waiting for first on-device run.
4 · At a Glance, Why It Matters, Code & Use-Case Ladder
| Upstream model |
Helsinki-NLP/opus-mt-en-ar
(Tatoeba eng-ara: BLEU 14.0 · chr-F 0.437)
|
|---|---|
| Browser ONNX repo |
Xenova/opus-mt-en-ar
(encoder_model_quantized.onnx 51.77 MB + decoder_model_merged_quantized.onnx 59.08 MB +
tokenizer.json 6.75 MB + configs = 117.60 MB q8)
|
| Pipeline task & runtime | translation · @huggingface/transformers@3.7.5 (shared pin in lib/webai.js) · CPU WASM |
| Architecture | MarianMTModel (6 encoder + 6 decoder layers, d_model=512, 8 heads, ffn=2048, swish, max_length=512, vocab_size=62802) |
| Special & control tokens | pad=<pad> (62801, also decoder_start_token_id), eos=</s> (0), unk=<unk> (1), >>ara<< (4) |
| License | Apache-2.0 (University of Helsinki Language Technology Research Group) |
Why it matters: Teams shipping offline documentation portals, local i18n copy previews, or
privacy-sensitive customer communications into Arabic can localize English text, .srt captions,
and CSV tables entirely inside the visitor's browser with zero server round-trips.
Show the code — Real Transformers.js MarianMT EN→AR inference, >>ara<< prepending & NaN check
Show the code — Abbreviation-safe English sentence segmentation for 512-token safety
Compare Beam 1 vs Beam 2 vs Beam 4 in RTL Arabic and ablate bidi numbers/acronyms and >>ara<< control tokens.
Practical · CSV, .SRT & i18n JSON LocalizerBatch-localize product CSVs, .SRT subtitles, and i18n JSON bundles off-thread with Cancel & safe exports.
Wild · Idioms, Negation, Bidi & Truncation LabStress-test English idioms, nested negations, RTL URLs/units/dates, homographs, and token truncation.
Multi-Model · EN→AR→EN Round-Trip VerifierChain Opus-MT EN→AR (117.60 MB) + Opus-MT AR→EN (110.88 MB) to verify Arabic translation drift locally.