=
commited on
Commit
·
0e35eb5
1
Parent(s):
834048f
updated readme
Browse files- README.rst +22 -11
README.rst
CHANGED
@@ -48,11 +48,10 @@ I needed to translate a text using python. It was hard to find a simple way to d
|
|
48 |
There are other libraries that can be used for this task, but somehow,most of them
|
49 |
are buggy, not supported anymore or complex.
|
50 |
|
51 |
-
Therefore, I decided to build this simple tool
|
52 |
-
support for all languages
|
53 |
-
More features are coming soon, mainly support for the PONS translator and others.
|
54 |
|
55 |
-
Basically, my goal
|
56 |
in this tool.
|
57 |
|
58 |
When you should use it
|
@@ -77,6 +76,7 @@ Features
|
|
77 |
* Support for google translate
|
78 |
* Support for Pons translator (pons.com)
|
79 |
* Support for the Linguee translator
|
|
|
80 |
* Translate directly from a text file
|
81 |
* Get multiple translation for a word
|
82 |
* Automate the translation of different paragraphs in different languages
|
@@ -100,21 +100,32 @@ Usage
|
|
100 |
|
101 |
from deep_translator import GoogleTranslator, PonsTranslator, LingueeTranslator, MyMemoryTranslator
|
102 |
|
103 |
-
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
106 |
|
107 |
# Alternatively, you can pass languages by their name:
|
108 |
translated = GoogleTranslator(source='english', target='german').translate(text=english_text)
|
109 |
|
110 |
-
|
|
|
|
|
|
|
111 |
translated = GoogleTranslator(source='auto', target='german').translate_file('path/to/file')
|
112 |
|
|
|
|
|
|
|
|
|
113 |
# or maybe you have many sentences in different languages and want to automate the translation process
|
114 |
translated = GoogleTranslator(source='auto', target='de').translate_sentences(your_list_of_sentences)
|
115 |
|
116 |
|
117 |
-
|
118 |
|
119 |
|
120 |
.. code-block:: python
|
@@ -126,7 +137,7 @@ or maybe you would like to use the Pons translator: Pons.com
|
|
126 |
translated_word = PonsTranslator(source='english', target='french').translate(word, return_all=True)
|
127 |
|
128 |
|
129 |
-
Alternatively deep_translator (version >= 1.0.0) supports the Linguee translator:
|
130 |
|
131 |
|
132 |
.. code-block:: python
|
@@ -137,7 +148,7 @@ Alternatively deep_translator (version >= 1.0.0) supports the Linguee translator
|
|
137 |
# set the argument return_all to True if you want to get all synonyms of the word to translate
|
138 |
translated_word = LingueeTranslator(source='english', target='french').translate(word, return_all=True)
|
139 |
|
140 |
-
The mymemory translator is also supported for version >= 1.0.2:
|
141 |
|
142 |
.. code-block:: python
|
143 |
|
@@ -230,4 +241,4 @@ Next Steps
|
|
230 |
==========
|
231 |
|
232 |
Take a look in the examples folder for more :)
|
233 |
-
Contributions are always welcome. Feel free to make a pull request and give me a feedback if you found the package useful
|
|
|
48 |
There are other libraries that can be used for this task, but somehow,most of them
|
49 |
are buggy, not supported anymore or complex.
|
50 |
|
51 |
+
Therefore, I decided to build this simple tool. It is clean and easy to use and provide
|
52 |
+
support for all languages.
|
|
|
53 |
|
54 |
+
Basically, my goal was to integrate support for multiple famous translators
|
55 |
in this tool.
|
56 |
|
57 |
When you should use it
|
|
|
76 |
* Support for google translate
|
77 |
* Support for Pons translator (pons.com)
|
78 |
* Support for the Linguee translator
|
79 |
+
* Support for the Mymemory translator
|
80 |
* Translate directly from a text file
|
81 |
* Get multiple translation for a word
|
82 |
* Automate the translation of different paragraphs in different languages
|
|
|
100 |
|
101 |
from deep_translator import GoogleTranslator, PonsTranslator, LingueeTranslator, MyMemoryTranslator
|
102 |
|
103 |
+
text = 'happy coding'
|
104 |
|
105 |
+
- Simple translation:
|
106 |
+
|
107 |
+
.. code-block:: python
|
108 |
+
|
109 |
+
translated = GoogleTranslator(source='auto', target='de').translate(text=english_text)
|
110 |
|
111 |
# Alternatively, you can pass languages by their name:
|
112 |
translated = GoogleTranslator(source='english', target='german').translate(text=english_text)
|
113 |
|
114 |
+
- Translate from a file:
|
115 |
+
|
116 |
+
.. code-block:: python
|
117 |
+
|
118 |
translated = GoogleTranslator(source='auto', target='german').translate_file('path/to/file')
|
119 |
|
120 |
+
- Automate translation by detecting the source language
|
121 |
+
|
122 |
+
.. code-block:: python
|
123 |
+
|
124 |
# or maybe you have many sentences in different languages and want to automate the translation process
|
125 |
translated = GoogleTranslator(source='auto', target='de').translate_sentences(your_list_of_sentences)
|
126 |
|
127 |
|
128 |
+
- Maybe you would like to use the Pons translator: Pons.com
|
129 |
|
130 |
|
131 |
.. code-block:: python
|
|
|
137 |
translated_word = PonsTranslator(source='english', target='french').translate(word, return_all=True)
|
138 |
|
139 |
|
140 |
+
- Alternatively deep_translator (version >= 1.0.0) supports the Linguee translator:
|
141 |
|
142 |
|
143 |
.. code-block:: python
|
|
|
148 |
# set the argument return_all to True if you want to get all synonyms of the word to translate
|
149 |
translated_word = LingueeTranslator(source='english', target='french').translate(word, return_all=True)
|
150 |
|
151 |
+
- The mymemory translator is also supported for version >= 1.0.2:
|
152 |
|
153 |
.. code-block:: python
|
154 |
|
|
|
241 |
==========
|
242 |
|
243 |
Take a look in the examples folder for more :)
|
244 |
+
Contributions are always welcome. Feel free to make a pull request and give me a feedback if you found the package useful or you are using it :)
|