If you send the chassis via the command line interface, for example
xzcat corpus.sme.xz | sed 's/$/ ./' | apertium -f html-noent sme-nob > translated.nob.mt
then you can try just
xzcat corpus.sme.xz | paste - translated.nob.mt
to get input near the exit. This suggests that you want to share things on the news. sedexists so that words do not move along newline characters (rules, as a rule, do not move along the boundaries of sentences).
It will be fast, but it is a bit hacky and there are many cases with edges.
, JSON API .
Debian/Ubuntu ( apertium repos), API
sudo apt install apertium-apy
sudo systemctl start apertium-apy
sudo systemctl enable apertium-apy
:
$ echo 'Jeg liker ikke ansjos' | curl --data-urlencode 'q@-' 'localhost:2737/translate?langpair=nob|nno'
{"responseDetails": null, "responseData": {"translatedText": "Eg likar ikkje ansjos"}, "responseStatus": 200}
( Javascript ajax, http://wiki.apertium.org/wiki/Apertium-apy/Debian http://wiki.apertium.org/wiki/Apertium-apy#Usage)
, apertium-apy , /usr/share/apertium/modes; ( systemctl), .
JSON, , jq (sudo apt install jq), .
$ orig="Jeg liker ikke ansjos"
$ echo "$orig" \
| curl -Ss --data-urlencode 'q@-' 'localhost:2737/translate?langpair=nob|nno' \
| jq "{phrase: {original:\"$orig\", translated:.responseData.translatedText }}"
{
"phrase": {
"original": "Jeg liker ikke ansjos",
"translated": "Eg likar ikkje ansjos"
}
}
:
xzcat corpus.nob.xz | while read -r orig; do
echo "$orig" \
| curl -Ss --data-urlencode 'q@-' 'localhost:2737/translate?langpair=nob|nno' \
| jq "{phrase: {original:\"$orig\", translated:.responseData.translatedText}}";
done
( 500 , 23,7 , paste - 5.5 .)