Difference between revisions of "Apertium-apy/Debian"

From Apertium
Jump to navigation Jump to search
Line 13: Line 13:
sudo apt-get install apertium-eng-kaz apertium-sme-nob apertium-hbs-mkd apertium-eo-en apertium-tat-rus # etc.
sudo apt-get install apertium-eng-kaz apertium-sme-nob apertium-hbs-mkd apertium-eo-en apertium-tat-rus # etc.
</pre>
</pre>



Now check out and run APY:
Now check out and run APY:
Line 24: Line 25:


[[Image:apy-startup.png]]
[[Image:apy-startup.png]]



Open a new terminal to check that it's OK:
Open a new terminal to check that it's OK:
Line 36: Line 38:
That should give something like <code>{"responseData": {"translatedText": "jeg er ikke der borte"}, "responseDetails": null, "responseStatus": 200}
That should give something like <code>{"responseData": {"translatedText": "jeg er ikke der borte"}, "responseDetails": null, "responseStatus": 200}
</code>.
</code>.



If everything worked, congrats, you have your own Apertium API server running! Now open port 2737 and point your [[apertium-html-tools|website]] or [[Android|app]] at it :-)
If everything worked, congrats, you have your own Apertium API server running! Now open port 2737 and point your [[apertium-html-tools|website]] or [[Android|app]] at it :-)
Line 41: Line 44:
If you ran into trouble, please ask for help on [[IRC]] or the [[Contact|mailing list]].
If you ran into trouble, please ask for help on [[IRC]] or the [[Contact|mailing list]].


==Run on init==
There are example init scripts in <code>apertium-apy/tools/{systemd,upstart,sysvinit}</code>; if you're running a fairly recent Ubuntu (15.04 or newer), then you should follow the instructions from <code>apertium-apy/tools/systemd/README</code>


==More info==
See [[Apertium-apy]] for other things you can do with Apy and more documentation.


[[Category:Tools]]
[[Category:Tools]]

Revision as of 09:04, 7 January 2016

This is a quickstart guide to setting up your very own Apertium API server on Debian-based systems (including Ubuntu):

Install prerequisites:

wget http://apertium.projectjj.com/apt/install-nightly.sh
sudo bash install-nightly.sh
sudo apt-get -f install apertium-all-dev build-essential subversion python3-dev python3-pip zlib1g-dev
sudo pip3 install --upgrade tornado

And install the language pairs you want:

sudo apt-get install apertium-eng-kaz apertium-sme-nob apertium-hbs-mkd apertium-eo-en apertium-tat-rus # etc.


Now check out and run APY:

svn co https://svn.code.sf.net/p/apertium/svn/trunk/apertium-tools/apertium-apy
cd apertium-apy
### This will start the APY server:
./servlet.py /usr/share/apertium   # This is the path to package-installed Apertium language pairs

It should look like

Apy-startup.png


Open a new terminal to check that it's OK:

curl http://localhost:2737/listPairs

It should contain a list of pairs. Say it contains {"sourceLanguage": "sme", "targetLanguage": "nob"}, then we can try translating the sentence "in leat doppe" from sme to nob:

curl 'http://localhost:2737/translate?langpair=sme|nob&q=in+leat+doppe'

That should give something like {"responseData": {"translatedText": "jeg er ikke der borte"}, "responseDetails": null, "responseStatus": 200} .


If everything worked, congrats, you have your own Apertium API server running! Now open port 2737 and point your website or app at it :-)

If you ran into trouble, please ask for help on IRC or the mailing list.

Run on init

There are example init scripts in apertium-apy/tools/{systemd,upstart,sysvinit}; if you're running a fairly recent Ubuntu (15.04 or newer), then you should follow the instructions from apertium-apy/tools/systemd/README

More info

See Apertium-apy for other things you can do with Apy and more documentation.