diff options
author | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2017-08-19 14:22:35 +0300 |
---|---|---|
committer | Roman Grundkiewicz <rgrundki@exseed.ed.ac.uk> | 2017-08-19 14:24:59 +0300 |
commit | a6b5c27a75390f689620fa11ca4a664139d2250b (patch) | |
tree | 0f728acf50765128ee74f9199f9e3e8d2d229889 /scripts | |
parent | 036693b5316779812e72f447233eb9ba49705566 (diff) |
Update python example scripts
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/python/example.py | 17 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/python/mariannmt_server.py (renamed from scripts/server/server.py) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | scripts/server/client_example.py | 0 |
3 files changed, 17 insertions, 0 deletions
diff --git a/scripts/python/example.py b/scripts/python/example.py new file mode 100644 index 00000000..c0a70720 --- /dev/null +++ b/scripts/python/example.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +import os +import sys + +sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + "../../build")) +import libmariannmt as nmt + +print >>sys.stderr, "marian-nmt version: ", nmt.version() + +if len(sys.argv) == 1: + print >>sys.stderr, "Specify s2s arguments" + exit(1) + +nmt.init(' '.join(sys.argv)) +for line in sys.stdin: + print nmt.translate([line.rstrip()]) diff --git a/scripts/server/server.py b/scripts/python/mariannmt_server.py index 9f9d2a53..9f9d2a53 100755..100644 --- a/scripts/server/server.py +++ b/scripts/python/mariannmt_server.py diff --git a/scripts/server/client_example.py b/scripts/server/client_example.py index 595599bc..595599bc 100755..100644 --- a/scripts/server/client_example.py +++ b/scripts/server/client_example.py |