[sip-comm-dev] Translation module v0.1.5


#1

Hi everyone,

This is the third release of the module. Major changes:

- Implemented limits (maxLines, maxChars and pause) required for long translation requests
- Configuration can be read from any URL (best way to keep up to date information about translation services)
- Multiple services per XML allowed

At this point the module is very stable and usable, except for some glitches on the text encoding. I expect one more release before I start modifying SIP to work with the module.

Execution sample (using a mock CLI client for the module):

-> start 51
Translation Service> Starting translation services...
Translation Service> Translation services up and running
-> start 53
Translation Client> Starting client...
Translation Client> Enter config file path (blank line for default URL [http://two.xthost.info/soc/All.xml]):

Translation Service> Reading config from http://two.xthost.info/soc/All.xml...
Translation Service> serviceName: Google Translate
Translation Service> Request method: POST
Translation Service> Request template: http://translate.google.com/translate_t?sl=<source/>&tl=<target/>&text=<text/>
Translation Service> serviceUrl: http://translate.google.com
Translation Service> Request encoding: UTF-8
Translation Service> Response encoding: UTF-8
Translation Service> Response start token: <div id=result_box dir="ltr">
Translation Service> Response end token: </div>
Translation Service> Limits: 0 Chars, 0 Lines, 0 pause.
Translation Service> Reading language pairs...
Translation Service> {ar=[it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], bg=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], cs=[ar, it, nl, el, hr, sv, es, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], da=[ar, it, nl, el, hr, sv, es, cs, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], de=[ar, it, nl, el, hr, sv, es, cs, da, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], el=[ar, it, nl, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], en=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, ko, zh-cn, zh-tw, ja], es=[ar, it, nl, el, hr, sv, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], fi=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], fr=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], hi=[ar, it, nl, el, hr, sv, es, cs, da, de, no, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], hr=[ar, it, nl, el, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], it=[ar, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], ja=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw], ko=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, zh-cn, zh-tw, ja], nl=[ar, it, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], no=[ar, it, nl, el, hr, sv, es, cs, da, de, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], pl=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], pt=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, ro, ru, en, ko, zh-cn, zh-tw, ja], ro=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ru, en, ko, zh-cn, zh-tw, ja], ru=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, en, ko, zh-cn, zh-tw, ja], sv=[ar, it, nl, el, hr, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, zh-tw, ja], zh-cn=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-tw, ja], zh-tw=[ar, it, nl, el, hr, sv, es, cs, da, de, no, hi, fi, fr, bg, pl, pt, ro, ru, en, ko, zh-cn, ja]}
Translation Service> ... 552 total pairs
Translation Service> serviceName: Systran
Translation Service> Request method: POST
Translation Service> Request template: http://w4.systranlinks.com/trans?id=sherlock&charset=utf-8&api=1&lp=<source/>_<target/>&text=<text/>
Translation Service> serviceUrl: http://www.systransoft.com/
Translation Service> Request encoding: UTF-8
Translation Service> Response encoding: UTF-8
Translation Service> Response start token: [CDATA[
Translation Service> Response end token: ]]
Translation Service> Limits: 0 Chars, 0 Lines, 0 pause.
Translation Service> Reading language pairs...
Translation Service> {de=[en, fr], el=[en, fr], en=[ar, sv, zh, zt, nl, fr, de, el, it, ja, ko, pt, ru, es], es=[en, fr], fr=[nl, en, de, el, it, pt, es], it=[en, fr], ja=[en], ko=[en], nl=[en, fr], pt=[en, fr], ru=[en], zh-cn=[en], zh-tw=[en]}
Translation Service> ... 38 total pairs
Translation Service> serviceName: Systran (Apple)
Translation Service> Request method: POST
Translation Service> Request template: http://wu.apple.com/trans?id=sherlock&charset=utf-8&api=1&lp=<source/>_<target/>&text=<text/>
Translation Service> serviceUrl: http://www.systransoft.com/
Translation Service> Request encoding: UTF-8
Translation Service> Response encoding: UTF-8
Translation Service> Response start token: [CDATA[
Translation Service> Response end token: ]]
Translation Service> Limits: 0 Chars, 0 Lines, 0 pause.
Translation Service> Reading language pairs...
Translation Service> {de=[en, fr], el=[en, fr], en=[ar, sv, zh, zt, nl, fr, de, el, it, ja, ko, pt, ru, es], es=[en, fr], fr=[nl, en, de, el, it, pt, es], it=[en, fr], ja=[en], ko=[en], nl=[en, fr], pt=[en, fr], ru=[en], zh-cn=[en], zh-tw=[en]}
Translation Service> ... 38 total pairs
Translation Client> [0]: Google Translate
Translation Client> [1]: Systran
Translation Client> [2]: Systran (Apple)
Translation Client> Choose translation service (0 default):

Translation Client> Source language (es default):

Translation Client> Target language (en default):

Translation Client> Enter a blank line to exit.
Translation Client> Enter text to translate (es>en): La onza, irbis o leopardo de las nieves (Uncia uncia) es un gran felino nativo de las montañas de Asia central. Hasta hace poco muchos taxonomistas incluían al leopardo de las nieves dentro del género Panthera junto a otros grandes felinos, en vez de dentro del género (Uncia).
Translation Service> Request: http://translate.google.com/translate_t?sl=es&tl=en&text=La+onza%2C+irbis+o+leopardo+de+las+nieves+(Uncia+uncia)+es+un+gran+felino+nativo+de+las+montañas+de+Asia+central.+Hasta+hace+poco+muchos+taxonomistas+incluían+al+leopardo+de+las+nieves+dentro+del+género+Panthera+junto+a+otros+grandes+felinos%2C+en+vez+de+dentro+del+género+(Uncia).
Translation Client> Translation: The ounce, _libra_ or snow leopard, (snow leopard) is a great feline native of the mountains of Central Asia. Until recently many taxonomists inclu�an a snow leopard, within the g� � nero Panthera alongside other big cats, rather than within the g� � nero (Uncia).
Translation Client> Enter text to translate (es>en):

Cheers,

Ernesto

translation.jar (326 KB)