Open source neural machine translation

Argos Translate

  • Check Mark Open source
  • Check MarkPython library, Desktop application, API, Web app
  • Check Mark State of the art neural machine translation
  • Check Mark Install custom translations with packages
Live Demo Install
Argos Translate icon


Code | Docs

Open-source offline translation library written in Python. Uses OpenNMT for translations, SentencePiece for tokenization, Stanza for sentence boundary detection, and PyQt for GUI. Designed to be used as either a Python library, command-line, or GUI application. LibreTranslate is an API and web-app built on top of Argos Translate.

Argos Translate supports installing model files which are a zip archive with an ".argosmodel" extension that contains an OpenNMT CTranslate2 model, a SentencePiece tokenization model, a Stanza tokenizer model for sentence boundary detection, and metadata about the model. Pretrained models can be downloaded here.

Argos Translate also manages automatically pivoting through intermediate languages to translate between languages that don't have a direct translation between them installed. For example, if you have a es ➔ en and en ➔ fr translation installed you are able to translate from es ➔ fr as if you had that translation installed. This allows for translating between a wide variety of languages at the cost of some loss of translation quality.

Models

GUI

Screenshot Screenshot2

Python

>>> from argostranslate import package, translate
>>> package.install_from_path('en_es.argosmodel')
>>> installed_languages = translate.get_installed_languages()
>>> [str(lang) for lang in installed_languages]
['English', 'Spanish']
>>> translation_en_es = installed_languages[0].get_translation(installed_languages[1])
>>> translation_en_es.translate("Hello World!")
'¡Hola Mundo!'

Command Line

$ argos-translate --from-lang en --to-lang es "Hello World"
Hola Mundo

$ echo "Text to translate" | argos-translate --from-lang en --to-lang es
Texto para traducir

LibreTranslate Web App (Demo)

Web App Screenshot

LibreTranslate API

const res = await fetch("https://libretranslate.com/translate", {
    method: "POST",
    body: JSON.stringify({
        q: "Hello!",
        source: "en",
        target: "es"
    }),
    headers: {
        "Content-Type": "application/json"}
    });

console.log(await res.json());

{
    "translatedText": "¡Hola!"
}