<commit_before>## Server ##

The server side is written in node.js

A 3rd part dictionary, CC-CEDICT, is used for the translate.

http://www.mdbg.net/chindict/chindict.php?page=cedict
http://en.wikipedia.org/wiki/CEDICT

The server API load the dictionary into a dictionary / map in memory at start,
and query the user request in the dictionary, then return the result in JSON format.

### API ###
There are two APIs, one hosted in AWS and the other hosted in my server

[Host] http://aws.aboutme.com.hk:3000

### translate ###

/translate?word=PARM1

PARM1: the word need to be translated, UTF-8 and URL encoded. 
Case insensitive, multiple words are support.

A JSON will be return for the tranlate result.

If no error, the message will be "OK", and the result can be found in "output".

{
  "output": <string: tranlate result>,
  "message": <string: system message>
}

#### examples ####

Translate one word, for example:

http://aws.aboutme.com.hk:3000/translate?word=one

{"output":"一","message":"OK"}

Multiple words are support, for example:

http://aws.aboutme.com.hk:3000/translate?word=one%20two%20three<commit_msg>add how to start the server in README<commit_after>## Server ##

The server side is written in node.js

### start ###

To install the dependencies, run `npm install`

$ npm install

To start the server, run `npm start`

$ npm start

Ensure you got node in your $PATH, for Ubuntu, it uses nodejs instead of node,
please create a symbolic link before start the server

$ sudo ln -s /usr/bin/nodejs /usr/bin/node

### dictionary ###

A 3rd part dictionary, CC-CEDICT, is used for the translate.

http://www.mdbg.net/chindict/chindict.php?page=cedict
http://en.wikipedia.org/wiki/CEDICT

The server API load the dictionary into a dictionary / map in memory at start,
and query the user request in the dictionary, then return the result in JSON format.

### API ###
There are two APIs, one hosted in AWS and the other hosted in my server

[Host] http://aws.aboutme.com.hk:3000

### translate ###

/translate?word=PARM1

PARM1: the word need to be translated, UTF-8 and URL encoded.
Case insensitive, multiple words are support.

A JSON will be return for the tranlate result.

If no error, the message will be "OK", and the result can be found in "output".

{
  "output": <string: tranlate result>,
  "message": <string: system message>
}

#### examples ####

Translate one word, for example:

http://aws.aboutme.com.hk:3000/translate?word=one

{"output":"一","message":"OK"}

Multiple words are support, for example:

http://aws.aboutme.com.hk:3000/translate?word=one%20two%20three
{'fraction_non_alphanumeric': 0.11529592621060722, 'fraction_numerical': 0.015372790161414296, 'mean_word_length': 4.269230769230769, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5637995', 'n_tokens_mistral': 850, 'n_tokens_neox': 807, 'n_words': 325}