Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uinput/deeplator
A Python library and application enabling translation via the DeepL translator available at deepl.com.
https://github.com/uinput/deeplator
application deepl language library python translation
Last synced: 3 months ago
JSON representation
A Python library and application enabling translation via the DeepL translator available at deepl.com.
- Host: GitHub
- URL: https://github.com/uinput/deeplator
- Owner: uinput
- License: mit
- Created: 2017-08-30T10:00:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-15T14:51:16.000Z (over 5 years ago)
- Last Synced: 2024-07-08T22:18:35.581Z (4 months ago)
- Topics: application, deepl, language, library, python, translation
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 61
- Watchers: 9
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-robotic-tooling - DeepL - An online translator that outperforms Google, Microsoft and Facebook. (Communication and Coordination)
- awesome-robotic-tooling - DeepL - DeepL, an online translator that outperforms Google, Microsoft and Facebook (Coordination and Communication)
- awesome-robotic-tooling - DeepL - An online translator that outperforms Google, Microsoft and Facebook. (Communication and Coordination)
README
# Deeplator
## About
Deeplator is a Python library and application enabling translation via the DeepL translator available at [deepl.com](https://www.deepl.com/translator).In August 2017, DeepL released the DeepL translator.
With unprecedented translation quality, the DeepL translator sets a new standard in neural machine translation.
Check out [deepl.com](https://www.deepl.com/press.html) to get more information.Currently, the supported languages include English, German, French, Spanish, Italian, Dutch and Polish.
If you're coding in PHP instead, [DeepLy](https://github.com/chriskonnertz/DeepLy) might be the right choice.
## Application Usage
Using the application is straight forward.
Basically, you just need to launch `deeplator.py`.The `-l LANG` argument specifies the source and output languages.
If omitted, the application will ask for the languages interactively.
`LANG` is the translation code in the format `AA-BB` where `AA` ist the source language code and `BB` is the output language code.
See the table below for all language codes.
For example, if you were to translate from English to German, the argument should be `-l EN-DE`.
You can also tell DeepL to automatically detect the language of the source text by supplying `AUTO` as the source language (e.g. `-l AUTO-DE`).|Language |Code|
|:----------|:--:|
|German |DE |
|English |EN |
|Spanish |ES |
|French |FR |
|Italian |IT |
|Dutch |NL |
|Polish |PL |
|Portuguese |PT |
|Russian |RU |You can tell Deeplator to read input from a file using the `-f PATH` argument.
When ommitted, Deeplator will read input from `stdin` instead.
Remember to exit the multiline input with `Ctrl+D`.## Library Usage
The Deeplator library was written for Python 3.### Single Sentence
```python
from deeplator import Translatort = Translator("EN", "DE")
sentence = "Hello world."
translation = t.translate_sentence(sentence)
print(translation)
```### Multiple Sentences
In case it is unknown if the input string consists of multiple sentences, use the `translate_sentences` method.
It will split the passed argument into sentences first and translate each sentence by its own.
```python
from deeplator import Translatort = Translator("EN", "DE")
paragraph = "Hello world. DeepL is awesome."
translations = t.translate_sentences(paragraph)
print(translations)
```