GistTree.Com
Entertainment at it's peak. The news is by your side.

Show HN: Argos Translate open source neural machine translation in Python

0

Medical doctors | Net pages

Launch source offline translation app written in Python. Makes exercise of OpenNMT for translations, SentencePiece for tokenization, Stanza for sentence boundary detection, and PyQt for GUI. Designed to be old either as a GUI utility, or as a Python library.

Argos Translate helps installing mannequin recordsdata which would perchance perchance be a zip archive with an “.argosmodel” extension that comprise an OpenNMT CTranslate mannequin, a SentencePiece tokenization mannequin, a Stanza tokenizer mannequin for sentence boundary detection, and metadata relating to the mannequin. Pretrained devices might perchance be downloaded right here. To set up a mannequin click “Arrange programs” from the toolbar in the GUI and lift your mannequin file. By default devices are saved in ~/.argos-translate, this also shall be modified in settings.py or by surroundings the associated price of the $ARGOS_TRANSLATE_PACKAGES_DIR atmosphere variable. When running from a snap package devices might perchance be pre-packaged with the snap package or build in after set up to $SNAP_USER_DATA.

Argos Translate also manages mechanically pivoting thru intermediate languages to translate between languages that form not salvage an rapid translation between them build in. As an illustration, in case you might perchance also honest salvage gotten a es -> en and en -> fr translation build in you are in a position to translate from es -> fr as in case you had that translation build in. This lets in for translating between a huge form of languages on the associated price of some lack of translation quality.

Gadgets

Gadgets accessible for downlad right here, and are being professional the usage of this practising script.

Currently there are devices accessible to translate between:

  • Arabic
  • Chinese
  • English
  • French
  • 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("Howdy World!")
'¡Hola Mundo!'

Set up

Install from PyPI

Argos Translate is accessible from PyPi and is likely to be build in with pip.

python3 -m pip set up --upgrade pip
python3 -m pip set up argostranslate

Install from Snap Retailer

Argos Translate is accessible prepackaged with a Engilish French translation from the Snap Retailer.

With snapd build in:

sudo snap set up argos-translate

Get it from the Snap Store

Python source set up

Dependencies

Requires Python3, pip (which ought to near with Python3), and optionally virtualenv to withhold Argos Translate’s dependencies separate from lots of Python programs you might perchance also honest salvage gotten build in.

Python Set up Instructions

On Ubuntu:

sudo correct-earn update
sudo correct-earn set up -y python3

Install

  1. Download a reproduction of this repo (this requires either installing git or downloading a zip from GitHub):
git clone https://github.com/argosopentech/argos-translate.git
cd argos-translate
  1. Assign a digital atmosphere to set up into (elective):
python3 -m pip set up --upgrade virtualenv # If virtualenv not already build in
virtualenv env
source env/bin/set off
  1. Install this package with pip:
python3 -m pip set up --upgrade pip
python3 -m pip set up .

Fabricate and set up snap package

  1. Install snapd if it is not always already build in.
  2. Utilizing snapd set up snapcraft and its dependency multipass:
sudo snap set up multipass
sudo snap set up snapcraft
  1. Clone this repo:
git clone https://github.com/argosopentech/argos-translate.git
cd argos-translate
  1. From the root itemizing of this project make the snap package:
snapcraft gorgeous && SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY=4G snapcraft

Any unzipped package recordsdata in package/ will be mechanically incorporated in the snap archive (and might presumably honest not earn a design to be deleted by customers of the snap).

Display, the make might perchance also honest not bustle with Snapcraft’s default make memory of 2GB so it is main to residing the SNAPCRAFT_BUILD_ENVIRONMENT atmosphere variable. More on Snapcraft forum.

  1. Install the snap package:
sudo snap set up --devmode argos-translate_.snap

Bustle Argos Translate!

argos-translate

When installing with snap a .desktop file ought to also be build wherein is able to carry out Argos Translate accessible from the desktop menu.

Contributing

Contributions are welcome!

License

Twin licensed below either the MIT License or CC0.

Read More

Leave A Reply

Your email address will not be published.