OpenNMTClient - C# REST API Clients (ASPX and console) for an OpenNMT REST API Server


(miguel canals) #1

Hi everybody!

After much more time than I expected, finally I have finished the main steps to call an OpenNMT server in a more “user friendly” way. The idea was to create a web page in order to paste some text and click “Translate” or use a command line program to translate a text file from a “normal” computer (aka Windows).

I have developed a VS C# Windows solution: OpenNMTClient with 2 clients (an aspx web page (OpenNMTWebClient) and console program (OpenNTMConsoleClient) that have a shared code in order to call an OpenNMT REST API server. The code uses Visual Studio out of the box features (only .NET is needed).

a) First I would recommend you to review some sort of general info in http://www.mknals.com/04_3_OpenNMTClient.html

b) I have setup a live demo in http://213.97.57.158/OpenNMTWebClient/ONMTSimpleRESTWebClient.aspx

This live demo uses Catalan -> Spanish model created with a corpus from the legal board of the catalan government. But if you have your own server you can use (you should provide a internet hostname/address in the web page). If you provide one, the server should be started with

th tools/rest_translation_server.lua -host  your.host.com -port nnn -case_feature true \
[-joiner_annotate true -joiner ■ -mode aggressive -replace_unk -segment_numbers] \
-model /your/model.t7 [-gpuid 1]

(The code expects a case feature mode in the target side. Tokenization, if any, on the server side).

You can play (with care :roll_eyes:) with the web page.

c) The source code is in git hub if you want to play more https://github.com/miguelknals/OpenNMTClient

Any comments will be appreciate it.

Hope helps!
have a nice day
miguel canals