It also doesn't guarantee that the library will work properly at all times if you want to use a stable API, you should use the official Google Translate API. However, this library is unofficial, as mentioned earlier the author noted that the maximum character length on a single text is 15K. This library is great for everyone who wants a quick way to translate text in an application. Here is a truncated output: Total supported languages: 107 Print("Total supported languages:", len(constants.LANGUAGES)) Let's print all of them: # print all available languages Supported LanguagesĪs you may know, Google Translate supports more than 100 languages. Read also: Conversational AI Chatbot with Transformers in Python. This will return the language code, to get the full language name, you can use the LANGUAGES dictionary provided by Googletrans: print("Language:", constants.LANGUAGES) This will print the code of the detected language along with the confidence rate ( 1.0 means 100% confidence): Language code: hi Google Translate API offers us language detection calls as well: # detect a languageĭetection = tect("नमस्ते दुनिया") Good bye! (en) -> Güle güle! (tr) Language Detection Output: Hello everyone (en) -> herkese merhaba (tr)ĭo you speak english ? (en) -> İngilizce biliyor musunuz ? (tr)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |