<commit_before>
ytrans.js  [![Build Status](https://travis-ci.org/odeke-em/ytrans.js.svg)](https://travis-ci.org/odeke-em/ytrans.js)  [![Coverage Status](https://coveralls.io/repos/odeke-em/ytrans.js/badge.png)](https://coveralls.io/r/odeke-em/ytrans.js)
=========

+ Unofficial NodeJS API for Yandex translation services.

* A similar project that I'd recommend checking out for Python is:

   [yTrans](https://github.com/rkashapov/yandex-translator) by [<NAME>](https://github.com/rkashapov)<commit_msg>Started examples<commit_after>
ytrans.js  [![Build Status](https://travis-ci.org/odeke-em/ytrans.js.svg)](https://travis-ci.org/odeke-em/ytrans.js)  [![Coverage Status](https://coveralls.io/repos/odeke-em/ytrans.js/badge.png)](https://coveralls.io/r/odeke-em/ytrans.js)
=========

+ Unofficial NodeJS API for Yandex translation services.

* A similar project that I'd recommend checking out for Python is:

   [yTrans](https://github.com/rkashapov/yandex-translator) by [<NAME>](https://github.com/rkashapov)


Usage:
========

```
    var ytrans = require('ytrans.js');
    var yt = new ytrans();
    yt.set_key(API_KEY);

    yt.translate({
        text: ['good afternoon!', 'what is your name?'], lang: 'en-de'
    }, function(err, translation) {
        ...;
    });

```
    var ytk = new ytrans({api_key_path: API_KEY_PATH});
    ytk.get_allowed_translations("uk", function(err, secondaries {
        ...;
    });
```

```
    var ytk1 = new ytrans(API_KEY_PATH);
    ytk1.translate_file({
        path: TARGET_FILE, lang: 'cs-ru'
    }, function(err, content) {
        ...;
    });

    ytk1.is_allowed_transition("ru", "ch", function(err, validity) {
        ...;
    });
```

* [Detailed usage](https://github.com/odeke-em/ytrans.js/blob/master/test/ytrans-test.js)
{'fraction_non_alphanumeric': 0.19662921348314608, 'fraction_numerical': 0.0016853932584269663, 'mean_word_length': 3.566666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 13, 'lorem ipsum': 0, 'www.': 0, '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': '2664466', 'n_tokens_mistral': 678, 'n_tokens_neox': 647, 'n_words': 100}