-
Notifications
You must be signed in to change notification settings - Fork 1
Home
A Java library client for Yandex Translate service.
This library offers three services: text translation, text language detection and available languages for translation. You will need a free API key in order to use the Yandex API.
Maven:
<dependency>
<groupId>co.aurasphere</groupId>
<artifactId>jyandex</artifactId>
<version>1.0.0</version>
</dependency>
Gradle:
compile group: 'co.aurasphere', name: 'jyandex', version: '1.0.0'
SBT:
libraryDependencies += "co.aurasphere" % "jyandex" % "1.0.0"
Jyandex client = new Jyandex(apiKey);
(you can get a free API key here).
Translate a sentence to Italian:
client.translateText(textToTranslate, Language.ITALIAN);
If you know the original language, you can pass it as an argument for better results (otherwise the language will be guessed). In this case, we are translating an English sentence into Italian:
client.translateText(textToTranslate, Language.ENGLISH, Language.ITALIAN);
Detect the language of a sentence:
client.detectLanguage(textToDetect);
You can also pass a list of most-likely languages as hint:
List<String> hint = Arrays.asList(Language.JAPANESE, Language.ITALIAN, Language.AFRIKAANS);
client.detectLanguage(textToDetect, hint);
Get a list of supported languages from Yandex in English:
client.supportedLanguages();
If you want to display the list in another language (Italian in this case):
client.supportedLanguages(Language.ITALIAN);
If you want to contribute on this project, just fork this repo and submit a pull request with your changes. Improvements are always appreciated!
This project is considered completed and won't be developed further unless I get any specific requests.
You can contact me using my account e-mail or opening an issue on this repo. I'll try to reply back ASAP.
The project is released under the MIT license, which lets you reuse the code for any purpose you want (even commercial) with the only requirement being copying this project license on your project.
Copyright (c) 2016 Donato Rimenti