saminul
commited on
Updated README to add Libre Translator
Browse files- docs/README.rst +41 -0
docs/README.rst
CHANGED
@@ -109,6 +109,7 @@ Features
|
|
109 |
* Support for the `QCRI translator <https://mt.qcri.org/api/>`_ (version >= 1.2.4)
|
110 |
* Support for the `DeepL translator <https://www.deepl.com/en/translator/>`_ (version >= 1.2.5)
|
111 |
* Support for the `Papago translator <https://papago.naver.com/>`_ (version >= 1.4.4)
|
|
|
112 |
* Support for proxy usage
|
113 |
* Automatic single language detection
|
114 |
* Batch language detection
|
@@ -527,6 +528,46 @@ Papago Translator
|
|
527 |
translated = PapagoTranslator(client_id='your_client_id', secret_key='your_secret_key', source='en', target='ko').translate(text=text) # output: 행복한 부호화
|
528 |
|
529 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
Proxy usage
|
531 |
-------------
|
532 |
|
|
|
109 |
* Support for the `QCRI translator <https://mt.qcri.org/api/>`_ (version >= 1.2.4)
|
110 |
* Support for the `DeepL translator <https://www.deepl.com/en/translator/>`_ (version >= 1.2.5)
|
111 |
* Support for the `Papago translator <https://papago.naver.com/>`_ (version >= 1.4.4)
|
112 |
+
* Support for the `Libre translator <https://libretranslate.com/>`_
|
113 |
* Support for proxy usage
|
114 |
* Automatic single language detection
|
115 |
* Batch language detection
|
|
|
528 |
translated = PapagoTranslator(client_id='your_client_id', secret_key='your_secret_key', source='en', target='ko').translate(text=text) # output: 행복한 부호화
|
529 |
|
530 |
|
531 |
+
Libre Translator
|
532 |
+
---------------------
|
533 |
+
|
534 |
+
.. note::
|
535 |
+
|
536 |
+
Libre translate has multiple `mirrors <https://github.com/LibreTranslate/LibreTranslate#mirrors/>`_ which can be used for the API endpoint.
|
537 |
+
Some require an API key to be used. By default the base url is set to `libretranslate.de <https://libretranslate.de/>`_ .
|
538 |
+
This can be set using the "base_url" input parameter.
|
539 |
+
|
540 |
+
.. code-block:: python
|
541 |
+
|
542 |
+
text = 'laufen'
|
543 |
+
translated = LibreTranslator(source='auto', target='en', base_url = 'https://libretranslate.com/', api_key = 'your_api_key').translate(text=text) # output: run
|
544 |
+
|
545 |
+
|
546 |
+
- You can pass languages by name or by abbreviation:
|
547 |
+
|
548 |
+
.. code-block:: python
|
549 |
+
|
550 |
+
translated = LibreTranslator(source='german', target='english').translate(text=text)
|
551 |
+
|
552 |
+
# Alternatively, you can pass languages by their abbreviation:
|
553 |
+
translated = LibreTranslator(source='de', target='en').translate(text=text)
|
554 |
+
|
555 |
+
|
556 |
+
- Translate batch of texts
|
557 |
+
|
558 |
+
.. code-block:: python
|
559 |
+
|
560 |
+
texts = ["hallo welt", "guten morgen"]
|
561 |
+
translated = LibreTranslator(source='auto', target='en').translate_batch(texts)
|
562 |
+
|
563 |
+
- Translate from a file:
|
564 |
+
|
565 |
+
.. code-block:: python
|
566 |
+
|
567 |
+
translated = LibreTranslator(source='auto', target='en').translate_file('path/to/file')
|
568 |
+
|
569 |
+
|
570 |
+
|
571 |
Proxy usage
|
572 |
-------------
|
573 |
|