Open source neural machine translation

Argos Translate

  • Check Mark Open source
  • Check MarkPython library, API, Web app, Desktop application
  • 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 has an API and web-app for Argos Translate translations.

Argos Translate supports installing model files which are a zip archive with an ".argosmodel" extension that contains an OpenNMT CTranslate model, a SentencePiece tokenization model, a Stanza tokenizer model for sentence boundary detection, and metadata about the model. Pretrained models can be downloaded here. To install a model click "Manage packages" from the toolbar in the GUI and select your model file. Models can be automatically downloaded and installed with Python bindings.

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

Currently, there are models available to translate between:

  • Arabic
  • Chinese
  • English
  • French
  • German
  • Italian
  • Portuguese
  • Russian
  • Spanish


Examples

GUI

Screenshot Screenshot2

Python

>>> from argostranslate import package, translate
>>> package.install_from_path('en_es.argosmodel')
>>> installed_languages = translate.load_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-cli --from-lang en --to-lang es "Hello World"
Hola Mundo

$ echo "Text to translate" | argos-translate-cli --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!"
}