![]() ![]() detected_source_lang ) # "JA" the language code for Japanese print ( result. translate_text (, target_lang = "EN-GB" ) print ( result. text ) # "Bonjour, le monde !" # Translate multiple texts into British English result = translator. translate_text ( "Hello, world!", target_lang = "FR" ) print ( result. # Translate text into a target language, in this case, French: result = translator. The translated text, and detected_source_lang is the detected source languageĬode. Translate_text() returns a TextResult, or a list of TextResultsĬorresponding to your input text(s). There are additional optional arguments to control translation, see Variant according to ISO 3166-1, for example 'EN-US', or 'PT-BR'. Some target languages also include the regional ![]() ![]() Language codes are case-insensitive strings according to ISO 639-1, forĮxample 'DE', 'FR', 'JA''. The source_lang is optional, if it is unspecified the source Source_lang and target_lang specify the source and target language codes The first argument is a stringĬontaining the text you want to translate, or a list of strings if you want to To translate text, call translate_text(). Translator accepts additional options, see Configuration In production code, theĪuthentication key should not be hard-coded, but instead fetched from aĬonfiguration file or environment variable. This example is for demonstration purposes only. Translator ( auth_key ) result = translator. import deepl auth_key = "f63c02c5-f056-." # Replace with your key translator = deepl. The first argument is a stringĬontaining your API authentication key as found in yourīe careful not to expose your key, for example when sharing source code. Import the package and construct a Translator. The requests module is used to perform HTTP requests the minimum is version The library is tested with Python versions 3.6 to 3.11. Use the workaround sudo apt install python3-cachecontrol asĮxplained in this bug report. On Ubuntu 22.04 an error might occur: ModuleNotFoundError: No module named 'cachecontrol'. If you need to modify this source code, install the dependencies using poetry: poetry install The library can be installed from PyPI using pip: pip install -upgrade deepl With a DeepL API FreeĪccount you can translate up to 500,000 characters/month for free. To use the DeepL Python Library, you'll need an API authentication key. With the library, though support for new features may be added to the libraryĪfter they’re added to the API. The DeepL Python library offers a convenient way for applications written in This opens a whole universe of opportunities forĭevelopers: any translation product you can imagine can now be built on top ofĭeepL's best-in-class translation technology. As with other translators, it is subject to errors, but even so, DeepL remains one of the most accurate online translation tools that exits today.The DeepL API is a language translation API that allows otherĬomputer programs to send texts and documents to DeepL's servers and receive The main limitation when using DeepL is that it only supports eight languages: Spanish, English, German, Portuguese, Italian, Dutch, Polish and Russian.ĭeepL is an incredibly useful tool for quick translations that provides excellent results for any content. Instead, the instant you hit Ctrl+C, the program opens up all by itself, even if it's closed. This way, you don't have to waste time opening the program and copying and pasting the text yourself. Then, the box located just below will show you the translation in the language entered.ĭeepL is designed so that all you have to do is select the text you want to translate and hit Ctrl+C twice on the keyboard for the text to automatically be copied and pasted in the program. To translate any text all you have to do is enter the text you want to translate in the first box, along with the language you want to translate it to. Even though it's still under development, it offers excellent results. The main reason for its accuracy is that it uses this technology together with its own dictionary, analyzing the context of the text itself to translate it accurately. DeepL is an online translator that's capable of analyzing text using neural networks. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |