harry commited on
Commit
46d68d5
·
1 Parent(s): fc2a750

update readme for TencentTranslator

Browse files
Files changed (1) hide show
  1. docs/README.rst +29 -0
docs/README.rst CHANGED
@@ -664,6 +664,35 @@ Libre Translator
664
 
665
  translated = LibreTranslator(source='auto', target='en').translate_file('path/to/file')
666
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
 
668
 
669
  Proxy usage
 
664
 
665
  translated = LibreTranslator(source='auto', target='en').translate_file('path/to/file')
666
 
667
+ TencentTranslator
668
+ -----------------
669
+
670
+ .. note::
671
+
672
+ In order to use the TencentTranslator translator, you need to generate a secret_id and a secret_key.
673
+ deep-translator supports both Pro and free APIs. Just check the examples below.
674
+ Visit https://cloud.tencent.com/document/api/551/15619 for more information on how to generate your Tencent secret_id
675
+ and secret_key.
676
+
677
+ - Simple translation
678
+
679
+ .. code-block:: python
680
+
681
+ text = 'Hello world'
682
+ translated = TencentTranslator(secret_id="your-secret_id", secret_key="your-secret_key" source="en", target="zh").translate(text)
683
+
684
+ - Translate batch of texts
685
+
686
+ .. code-block:: python
687
+
688
+ texts = ["Hello world", "How are you?"]
689
+ translated = TencentTranslator(secret_id="your-secret_id", secret_key="your-secret_key" source="en", target="zh").translate_batch(texts)
690
+
691
+ - Translate from a file:
692
+
693
+ .. code-block:: python
694
+
695
+ translated = TencentTranslator(secret_id="your-secret_id", secret_key="your-secret_key" source="en", target="zh").translate_file('path/to/file')
696
 
697
 
698
  Proxy usage