2

**Problem: **

  • The result must be a working translator - offline.
    We need http API (self-hosted) similar to Google Translate.


I found a few options:

  • Install Microsoft Translator on Windows, download dictionaries, and somehow through http transfer requests for translation there
  • Apertium, this option is closer to reality, but it’s not clear how to set everything up ...
  • Apache Joshua
  • Promt, it is perfect but it is very expensive
  • Install Android on PC, and there is already Google Translate, but again there will be a question of sending http requests

**Todo: **

  • We need to translate whole sentences, not just individual words.
  • Maybe there is some kind of command line utility.
    Or maybe there is something for linux.


    Which of the above options is better to look for more information?

Atybzz
  • 327
  • 3
  • 14

1 Answers1

5

The five-minute solution is to do this on Debian or Ubuntu:

sudo apt install apertium-apy      # http server for apertium
sudo apt install apertium-eng-spa  # install some language data
sudo systemctl enable apertium-apy # start http server on next boot
sudo systemctl start apertium-apy  # start http server right now too

You now have translation between English and Spanish that responds to http requests and answers in JSON:

curl 'http://localhost:2737/translate?langpair=spa|eng&q=Eres+la+leche' 

You can see all the apt-installable Apertium language pairs with

apt-cache search apertium |grep 'pair$'

If you want more pairs in Apertium, you could try the adding the nightly apt repo with unreleased data (or consider Contributing your own language data).


However, you tagged this neural-network – if you want NN's, or more language pairs than Apertium has, you could train a translator with OpenNMT and data from e.g. http://opus.nlpl.eu/ , but that will definitely take more than five minutes :-)

unhammer
  • 4,306
  • 2
  • 39
  • 52