otis22/reverso

Library for working with reverso context api

0.0.6 2024-07-23 14:06 UTC

This package is auto-updated.

Last update: 2024-10-23 15:47:19 UTC


README

EO badge

Library for working with context.reverso.net api

GitHub CI Coverage Status

How to use

composer require otis22/reverso

Be careful library can translate only one a single word

Available language list: en, fr, es, de, it, pt, ru, ro, cz, zh

use Otis22\Reverso\Context;

$context = Context::fromLanguagesAndWord("ru", "en", "пример");

$context->original(); # return "пример"

$context->firstInDictionary(); # return "example" word, because it is the most popular variant in the reverso.net

$context->dictionary(); #return synonyms array ['example', 'sample', 'case', ...]

$context->examples(); #return examples sentences
/** 
    [
        [
            'source' => 'Красивый <em>пример</em> - прошлогодняя эпидемия свиного гриппа.',
            'target' => 'So a nice <em>example</em> of this came from last year and swine flu.'
        ],
        ...
    ]
*/

Why it looks so?(In Russian)

Contributing

For run all tests

make all

or connect to terminal

make exec

Dafault php version is 7.4. Use PHP_VERSION= for using custom version.

make all PHP_VERSION=8.0
# run both 
make all PHP_VERSION=7.4 && make all PHP_VERSION=8.0

all commands

# composer install
make install
# composer install with --no-dev
make install-no-dev
# check code style
make style
# fix code style
make style-fix
# run static analyze tools
make static-analyze
# run unit tests
make unit
#  check coverage
make coverage