/reverso-api

🌍 Simple JavaScript Reverso API. Context, Spell Check, Synonyms and Translation are currently available.

Primary LanguageJavaScriptMIT LicenseMIT

Reverso API

version downloads telegram chat

logotype

First of all, this API is not official! The API allows you to manipulate with your text in different ways. Almost all the features from the website are supported by this API. Currently supported: context, translation, spell check, synonyms.

Navigation

Installing

$ npm install reverso-api

Usage

const Reverso = require('reverso-api');
const reverso = new Reverso();

Congrats! You can use all the available methods now.
Let's read through the README and find out how the things work.

Remember, you can pass either callback function...

reverso.getContext(...params, (response) => {
    ...
});

or use .then() function.

reverso.getContext(...params).then((response) => {
    ...
});

All the examples below will be given using callback function.

Examples

getContext

reverso.getContext('meet me half way', 'English', 'Russian', (response) => {
    console.log(response);
}).catch(err => {
    console.error(err);
});

Response:

{
    text: String,
    from: String,
    to: String,
    translation: [String, ...],
    examples: [
        {
            id: Number,
            from: String,
            to: String
        },
        ...
    ]
}

Error:

{ method: String, error: String }

Available languages for this method: English, Arabic, German, Spanish, French, Hebrew, Italian, Japanese, Dutch, Polish, Portuguese, Romanian, Russian, Turkish, Chinese.

getSpellCheck

reverso.getSpellCheck('helo', 'English', (response) => {
    console.log(response);
}).catch(err => {
    console.error(err);
});

Response:

[
    {
        id: Number,
        text: String,
        type: String,
        explanation: String,
        corrected: String,
        full_corrected: String
    }
]

Error:

{ method: String, error: String }

Available languages for this method: English and French.

getSynonyms

reverso.getSynonyms('dzień dobry', 'Polish', (response) => {
    console.log(response);
}).catch(err => {
    console.error(err);
});

Response:

{
    text: String,
    from: String,
    synonyms: [
        { id: Number, synonym: String },
        ...
    ]
}

Error:

{ method: String, error: String }

Available languages for this method: English, Russian, German, Spanish, French, Italian, Polish.

getTranslation

⚠️ WARNING: eventually, your server's IP address might get banned by Reverso moderators and you won't receive any data.

reverso.getTranslation('how is going?', 'English', 'Chinese', (response) => {
    console.log(response);
}).catch(err => {
    console.error(err);
});

Response:

{
    text: String,
    from: String,
    to: String,
    translation: [String, ...],
    context: {
        examples: [
            {
                from: String,
                to: String,
                phrase_from: String,
                phrase_to: String
            },
            ...
        ], 
        rude: Boolean
    }, // or null
    detected_language: String,
    voice: String // or null
}

Error:

{ method: String, error: String }

Available languages for this method: English, Arabic, German, Spanish, French, Hebrew, Italian, Japanese, Dutch, Polish, Portuguese, Romanian, Russian, Turkish, Chinese.

Credits