=
commited on
Commit
·
bce6760
1
Parent(s):
e335716
fixed autodetect bug in mymemory
Browse files- README.rst +9 -3
- deep_translator/mymemory.py +1 -2
- docs/usage.rst +11 -3
README.rst
CHANGED
@@ -79,7 +79,7 @@ or maybe you would like to use the Pons translator: Pons.com
|
|
79 |
translated_word = PonsTranslator(source='english', target='french').translate(word, return_all=True)
|
80 |
|
81 |
|
82 |
-
Alternatively deep_translator
|
83 |
|
84 |
|
85 |
.. code-block:: python
|
@@ -88,8 +88,14 @@ Alternatively deep_translator now supports the Linguee translator:
|
|
88 |
translated_word = LingueeTranslator(source='english', target='french').translate(word)
|
89 |
|
90 |
# set the argument return_all to True if you want to get all synonyms of the word to translate
|
91 |
-
translated_word =
|
92 |
|
93 |
-
|
|
|
|
|
94 |
|
|
|
|
|
|
|
|
|
95 |
Please contribute and give me a feedback if you found the package useful/helpful or you are using it :)
|
|
|
79 |
translated_word = PonsTranslator(source='english', target='french').translate(word, return_all=True)
|
80 |
|
81 |
|
82 |
+
Alternatively deep_translator (version >= 1.0.0) supports the Linguee translator:
|
83 |
|
84 |
|
85 |
.. code-block:: python
|
|
|
88 |
translated_word = LingueeTranslator(source='english', target='french').translate(word)
|
89 |
|
90 |
# set the argument return_all to True if you want to get all synonyms of the word to translate
|
91 |
+
translated_word = LingueeTranslator(source='english', target='french').translate(word, return_all=True)
|
92 |
|
93 |
+
The mymemory translator is also supported for version >= 1.0.2:
|
94 |
+
|
95 |
+
.. code-block:: python
|
96 |
|
97 |
+
word = 'good'
|
98 |
+
translated_word = MyMemoryTranslator(source='english', target='french').translate(word)
|
99 |
+
|
100 |
+
Take a look in the examples folder for more :)
|
101 |
Please contribute and give me a feedback if you found the package useful/helpful or you are using it :)
|
deep_translator/mymemory.py
CHANGED
@@ -17,7 +17,7 @@ class MyMemoryTranslator(BaseTranslator):
|
|
17 |
@param target: target language to translate to
|
18 |
"""
|
19 |
self.__base_url = BASE_URLS.get("MYMEMORY")
|
20 |
-
self._source = source
|
21 |
self._target = target
|
22 |
|
23 |
self.email = kwargs.get('email', None)
|
@@ -79,4 +79,3 @@ class MyMemoryTranslator(BaseTranslator):
|
|
79 |
|
80 |
except Exception as e:
|
81 |
raise e
|
82 |
-
|
|
|
17 |
@param target: target language to translate to
|
18 |
"""
|
19 |
self.__base_url = BASE_URLS.get("MYMEMORY")
|
20 |
+
self._source = source if source != 'auto' else 'Autodetect'
|
21 |
self._target = target
|
22 |
|
23 |
self.email = kwargs.get('email', None)
|
|
|
79 |
|
80 |
except Exception as e:
|
81 |
raise e
|
|
docs/usage.rst
CHANGED
@@ -4,7 +4,7 @@ Usage
|
|
4 |
|
5 |
.. code-block:: python
|
6 |
|
7 |
-
from deep_translator import GoogleTranslator, PonsTranslator, LingueeTranslator
|
8 |
|
9 |
english_text = 'happy coding'
|
10 |
|
@@ -32,7 +32,7 @@ or maybe you would like to use the Pons translator: Pons.com
|
|
32 |
translated_word = PonsTranslator(source='english', target='french').translate(word, return_all=True)
|
33 |
|
34 |
|
35 |
-
Alternatively deep_translator
|
36 |
|
37 |
|
38 |
.. code-block:: python
|
@@ -41,4 +41,12 @@ Alternatively deep_translator now supports the Linguee translator:
|
|
41 |
translated_word = LingueeTranslator(source='english', target='french').translate(word)
|
42 |
|
43 |
# set the argument return_all to True if you want to get all synonyms of the word to translate
|
44 |
-
translated_word =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
.. code-block:: python
|
6 |
|
7 |
+
from deep_translator import GoogleTranslator, PonsTranslator, LingueeTranslator, MyMemoryTranslator
|
8 |
|
9 |
english_text = 'happy coding'
|
10 |
|
|
|
32 |
translated_word = PonsTranslator(source='english', target='french').translate(word, return_all=True)
|
33 |
|
34 |
|
35 |
+
Alternatively deep_translator (version >= 1.0.0) supports the Linguee translator:
|
36 |
|
37 |
|
38 |
.. code-block:: python
|
|
|
41 |
translated_word = LingueeTranslator(source='english', target='french').translate(word)
|
42 |
|
43 |
# set the argument return_all to True if you want to get all synonyms of the word to translate
|
44 |
+
translated_word = LingueeTranslator(source='english', target='french').translate(word, return_all=True)
|
45 |
+
|
46 |
+
|
47 |
+
The mymemory translator is also supported for version >= 1.0.2:
|
48 |
+
|
49 |
+
.. code-block:: python
|
50 |
+
|
51 |
+
word = 'good'
|
52 |
+
translated_word = MyMemoryTranslator(source='english', target='french').translate(word)
|