Saravanan666/pypi-org huggingface dataset:
Package: translategram
TranslategramTranslategram is a Python package that provides translation capabilities for Telegram bots. It uses and supports multiple translation services.InstallationYou can install Translategram using pip:pip install translategramUsageFirst you need to add a parameter to your handler called whatever you want(in this example we called itmessage)and its type should be thestring.@translator.handler_translator(message="Welcome to our community!")asyncdeflogin(update:Update,context:ContextTypes.DEFAULT_TYPE,message:str)->None:awaitcontext.bot.send_message(chat_id=update.effective_chat.idifupdate.effective_chatelse0,text=message)And then just register your handler in handler class.login_handler=CommandHandler('login',login)As well as you should create translator instance based on the framework you are using(in this case python-telegram-bot).fromtranslategramimportPythonTelegramBotTranslator,MtranslateTranslatorServicetranslator=PythonTelegramBotTranslator(MtranslateTranslatorService)And finally your file should looks like this:importloggingfromtelegram.extimportApplicationBuilder,ContextTypes,CommandHandlerfromtelegramimportUpdatefromtranslategramimportPythonTelegramBotTranslator,MtranslateTranslatorServicetranslator=PythonTelegramBotTranslator(MtranslateTranslatorService)TOKEN='YOUR_TOKEN'logging.basicConfig(format='%(asctime)s-%(name)s-%(levelname)s-%(message)s',level=logging.INFO)logger=logging.getLogger(__name__)@translator.handler_translator(message="Welcome to our community!")asyncdeflogin(update:Update,context:ContextTypes.DEFAULT_TYPE,message:str)->None:awaitcontext.bot.send_message(chat_id=update.effective_chat.idifupdate.effective_chatelse0,text=message)@translator.handler_translator(message="This bot is very simple. You can just login with the /login command and that is it!")asyncdefstart(update:Update,context:ContextTypes.DEFAULT_TYPE,message:str)->None:awaitcontext.bot.send_message(chat_id=update.effective_chat.idifupdate.effective_chatelse0,text=message)if__name__=='__main__':application=ApplicationBuilder().token(TOKEN).build()login_handler=CommandHandler('login',login)start_handler=CommandHandler('start',start)application.add_handler(login_handler)application.add_handler(start_handler)application.run_polling()TODOImplement cache systemCache System with Memcache.Cache System with Redis.Add aiogram framework adapter.Add pyTelegramBotApi framework adapter.Add support for more translation services.LicenseThis project is licensed under the terms of the MIT license.
Package: translate-json
Translate JSONAbout The ProjectThis is a command line tool to translate all string values in a JSON file to multiple languages using the Google Cloud Translate API.Getting StartedPrerequisitesTo run this program you need to have python 3.9 installed on your machine.InstallationTo use this you need to have agoogle translate API keyInstall the packagepipinstalltranslate-jsonUsageYou can use this program as a command line tool.usage: translate-json [-h] -f FILE -s SOURCE_LANGUAGE [-o OUT] -l LANGS [LANGS ...] -k KEY

Translate all string values in a JSON file to multiple languages using the google translate API.

optional arguments:
  -h, --help            show this help message and exit
  -f FILE, --file FILE  The input file path
  -s SOURCE_LANGUAGE, --source-language SOURCE_LANGUAGE
                        The source language code
  -o OUT, --out OUT     The output directory path, will contain the created translation files
  -l LANGS [LANGS ...], --langs LANGS [LANGS ...]
                        List of target languages you want to translate the file to
  -k KEY, --key KEY     Google translate API key, don't set this if you already have a key set as the environement
                        variable "GOOGLE_TRANSLATE_TOKEN"CLI ExampleA file calledsource.jsoncontains the following values{"title":"Hello World","tags":{"lara":["Video games","swimming","Interrupt routines"],"david":[{"value":"Baseball","count":5},"Climbing trees"]},"example":{"title":"This will be translated","ok":true}}To translate this file to dutch and french, you can run this commandtranslate-json-fsource.json-sen-o./translations/-lnlfr-kYOUR_API_KEYAfter running the command, thetranslationsfolder will contain two files:source.nl.jsonandsource.fr.json.{"title":"Bonjour le monde","tags":{"lara":["Jeux vidéo","la natation","Routines d'interruption"],"david":[{"value":"Base-ball","count":5},"Grimper aux arbres"]},"example":{"title":"Cela sera traduit","ok":true}}{"title":"Hallo Wereld","tags":{"lara":["Computerspellen","zwemmen","Routines onderbreken"],"david":[{"value":"Basketbal","count":5},"Bomen klimmen"]},"example":{"title":"Dit wordt vertaald","ok":true}}ExampleYou can also import this library and use it in your codefromtranslate_json.translateimporttranslate_allif__name__=="__main__":# you must set the google cloud translate API key as an environment variable before running this programtranslate_all('source.json','en',['nl','de','fr'],'./dist/')ContributingAny contributions you make aregreatly appreciatedLicenseDistributed under the MIT License. SeeLICENSEfor more information.
Package: translate_md
translate-mdPython client tospanglish,and a bit more. Translate your markdown files from english 🇬🇧 to spanish 🇪🇸.CI/CDDocsPackageMetaThis project was developed for my personal use: translating markdown files from my blog posts. It may be useful for somebody (I would be honored to listen to that), but please don't expect everything correct to the detail.Anyway, the API is not expected to change much unless some extra feature is required. Contributions are welcome!To see the features along some examples, please visit the docs.🔧 Installationpip install translate-mdThis client depends on a service which is currently expected tu run locally. You would need to get it to work:Additional dependenciesYou will needspanglishrunning in order to start working. The easiest way is to clone the repo and use docker for it. Get the service up you should be ready to go.CLI versionIt may be convenient for some cases, so the library comes with a CLI with a subset of the functionality:pip install translate-md[cli]Or maybe better with pipxpipx install translate-md[cli]Visit the docs for further information.📝 DocumentationThedocumentationis made withMaterial for MkDocsand is hosted byGitHub Pages.
Package: translate-pdf-word
translate_pdf_word packageThis is a package for translating pdf or word files into Chinese versions.Install the packagepip install translate-pdf-wordUsagefromtranslate_pdf_wordimportWord2word# substitute "your path/to/word.docx" with your word file name or path to itword=Word2word.Word2word("your path/to/word.docx")word.translate_all_in_one_shot()word.save2docx()
Package: translate-po
translate-poSimple quick script for automatically translating .po files using Google. It speeds up internationalization by giving translators machine translated base version to correct.UsageInstallationpip install translate-poUsagefromtranslate_po.mainimportrunrun(fro="en"to="et"src="./untranslated"dest="./translated")Changelog1.0.13Fixed typo in the readme1.0.11Fixed distributable not including parts of codeBuild script improvementsFixed dependencies not automatically installingAdded .po file recognitionChanged default constants for simpler use1.0.4Swapped out my own implementation of .po file parser for polib one.Fixed metadata writing into new files.
Package: translater
[![Build Status](https://travis-ci.com/louisleroy5/translater.svg?token=qpRnYhTVUeLJ5WM1w9Wx&branch=master)](https://travis-ci.com/louisleroy5/translater)
[![Coverage Status](https://coveralls.io/repos/github/louisleroy5/translater/badge.svg?branch=develop&t=PLPFwA)](https://coveralls.io/github/louisleroy5/translater?branch=develop)
[![Documentation Status](https://readthedocs.org/projects/translater/badge/?version=latest)](https://translater.readthedocs.io/en/latest/?badge=latest)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)# Translaterpython for converting building simulation archetypesConvert IDF file (EnergyPlus) to BUI file (TRNBuild)## Overview** Translater** is a Python package that helps converting building archetypes. The public feature released in this
version is the  conversion of [EnergyPlus](https://energyplus.net) IDF models to Trnsys [TrnBuild](http://www.trnsys.com/features/suite-of-tools.php.html) Models (compatible with the multizone building model). For a list of features
currently in development see the [In development](#in-development) section.## AuthorsThis work is developed by a small team of building energy simulation enthusiastsLouis Leroy, Master Student at Polytechnique Montréal (Corresponding Author)Samuel Letellier-Duchesne, PhD Candidate at Polytechnique Montréal
Package: translate-term
Translate-term======Command-line translator relying on [WordReference](http://wordreference.com)for translation and coded in Python.After several years of being disappointed with google translate, I discoveredthe website [WordReference](http://wordreference.com), which offers far bettertranslations for about any word. What I particularly enjoy is the fact that ittries to translate all the variations in meaning, as words don't necessarilymatch perfectly. And it also works fairly well with expressions.So, since I'm a sucker for everything related to terminals, I came up with thislittle tool. Nothing fancy, just good translation at the fingertipInstall------You can install directly this package with pip:```pip install translate-term```Usage------You simply need to call it from a terminal with the `translate [dict] [word]`syntax.- The `dict` argument is a 4 letter string, the first two letters beingthe key corresponding to the initial language and the last 2 the key to thelanguage to translate to- The `word` argument is the word or expression to be translated. If the caseof an expression, remember to put quotes around it.For example, if you want to translate 'speak' from English to French, you needto type:```translate enfr speak```And if you want to translate an expression:```translate enfr "speak out"```If you want the list of available dictionaries, just pass the `-l` or `--list`argument:```translate -ltranslate --list```Any doute, just call for `--help`!:```translate -htranslate --help```Note------This utility doesn't rely on any API, so there is practically no limit in thenumber of translations that you can perform.There are a few strange characters that appear here and there. They come fromthe html, and I'm too lazy to handle them.Also you might notice that the returned table doesn't include all the resultsthat you would find on the website. That is completely intentional. Theobjective of this utility is to present a large enough variations of a a word,without displaying the whole dictionary either. It also helps limiting thewidth of the table, which becomes a mess if it is too wide.
Package: translatetool
translatetoolA Papago Translate module.Downloadpip install translatetoolExampleimporttranslatetoolimportasyncioasyncdefrunit():add=translatetool.translate("Papago Client ID","Papago Client Secret")# https://developers.naver.com/ 에서 발급add1=awaitadd.translate("ko","en","안녕하세요, 테스트 입니다.")# 언어: ko, en, ja, zh-CN, zh-TW, vi, id, th, de, ru, es, it, frprint(add1)asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())asyncio.run(runit())Language List
Package: translate-util
translate utils support google,baidu,iciba,youdao[introduction]support version: python 3.0+down installpip install:pipinstalltranslate-utilDEMOfromtranslate_util.translate_toolimporttranslate_other2cn,translate_other2en# translate other language to chinese (default use google)print(translate_other2cn('china'))# translate other language to english (default use google)print(translate_other2en('中国'))# other plat translate democontent='china'forplatin['google','baidu','youdao']:print(f'{plat}:{translate_other2cn(content,plat)}')content='中国'forplatin['google','baidu','youdao']:print(f'{plat}:{translate_other2en(content,plat)}')# if your request is limit by google,please use proxies iptran_rs=translate_other2cn(content='chinese',platform='google',proxies='5.34.178.48:8080')print(tran_rs)OTHER SUPPORTany customization demand,contact me with email
Package: translatify
translatifytranslatifyis a fun command line tool for translating text through
different languages using Google Translate, usually for some amusing results.Installationtranslatifycan be installed from PyPI usingpip:$pipinstalltranslatifyUsageAutodetect the language of the original text and run it through all languages
on Google Translate:$translatify"Google Translate is not always accurate"[English->Afrikaans]GoogleTranslateisniealtydakkuraatnie[Afrikaans->Albanian]GoogleTranslatenukështëgjithmonëisaktë[....][Yiddish->Yoruba]Funapẹẹrẹ,nigbatiisedale.[Yoruba->Zulu]Ngokwesibonelo,laphobiology.Alternatively, you can specify the source and target languages yourself:$translatify-sen-tda,zh-cn,de,en"Google Translate is not always accurate"[English->Danish]GoogleTranslateerikkealtidkorrekt[Danish->Chinese(Simplified)]谷歌翻译并不总是正确的[Chinese(Simplified)->German]Google-Übersetzungistnichtimmerrichtig[German->English]GoogletranslationisnotalwayscorrectYou can specifyallas a target language to include all the languages in
alphabetical order:$translatify-tde,all,de,en"Google Translate is not always accurate"[English->German]GoogleTranslateistnichtimmerrichtig[German->Afrikaans]GoogleTranslateisniealtydregnie[....][Zulu->German]Google[German->English]GoogleLanguages can be listed using the--listflag:$translatify--listCodeNameafAfrikaanssqAlbanianamAmharicarArabichyArmenianazAzerbaijanieuBasquebeBelarusianbnBengalibsBosnianbgBulgariancaCatalan[....]
Package: translation
Chinese Versiontranslation is a python translation package based on website service.It provids google, youdao, baidu, iciba translation service.InstallationpipinstalltranslationUsagefromtranslationimportbaidu,google,youdao,icibaprint(google('hello world!',dst='zh-CN'))print(google('hello world!',dst='ru'))print(baidu('hello world!',dst='zh'))print(baidu('hello world!',dst='ru'))print(youdao('hello world!',dst='zh-CN'))print(iciba('hello world!',dst='zh'))print(bing('hello world!',dst='zh-CHS'))DocumentsYou may find documenthereAdvanced usageProxiesYou may not use some of the function without proxies.Proxies can be set as following.fromtranslationimportgoogle,ConnectError# 127.0.0.1:1080 is a vaild proxiestry:print(google('hello world!',dst='zh-CN',proxies={'http':'127.0.0.1:1080'}))exceptConnectError:print('Invaild proxy')DefaultYou may change default setting such as:default source language (auto if not set)default destination language (zh-CN if not set)default translation (youdao if not set)default proxies (no proxy if not set)fromtranslationimport(set_default_translation,set_default_language,set_default_proxies,get,ConnectError)set_default_translation('google')set_default_language('auto','zh-CN')set_default_proxies({'http':'127.0.0.1:1080'})try:print(get('hello world!'))exceptConnectError:print('Invaild proxy')MoreMore functions are introduced in thedocument.LanguageLanguage list of all the translation are provided indocument.Somehow, iciba and youdao can only provide English translation.Googleel:Greek,eo:Esperanto,en:English,af:Afrikaans,sw:Swahili,ca:Catalan,it:Italian,iw:Hebrew,sv:Swedish,cs:Czech,cy:Welsh,ar:Arabic,ur:Urdu,ga:Irish,eu:Basque,et:Estonian,az:Azerbaijani,id:Indonesian,es:Spanish,ru:Russian,gl:Galician,nl:Dutch,pt:Portuguese,la:Latin,tr:Turkish,tl:Filipino,lv:Latvian,lt:Lithuanian,th:Thai,vi:Vietnamese,gu:Gujarati,ro:Romanian,is:Icelandic,pl:Polish,ta:Tamil,yi:Yiddish,be:Belarusian,fr:French,bg:Bulgarian,uk:Ukrainian,hr:Croatian,bn:Bengali,sl:Slovenian,ht:HaitianCreole,da:Danish,fa:Persian,hi:Hindi,fi:Finnish,hu:Hungarian,ja:Japanese,ka:Georgian,te:Telugu,zh-TW:ChineseTraditional,sq:Albanian,no:Norwegian,ko:Korean,kn:Kannada,mk:Macedonian,zh-CN:ChineseSimplified,sk:Slovak,mt:Maltese,de:German,ms:Malay,sr:SerbianCommentsIf you have any problem or suggestion, you may contact me in thisissue.
Package: translation-comparator
Translation ComparatorIt is a statically typed library that РЅelps to compare translated code.CythonWill remove most of the useless difference between files so you can focus on the important difference.Example of use with cythonLibrary InstallationAvailable on PyPI:python -m pip install translation_comparatorInstalling optional dependenciesFor example, this is how you can install a package with the required dependencies to work with cython.python -m pip install translation_comparator[cython]Upgradingpython -m pip install -U translation_comparator
Package: translation-finder
Weblate is libre software web-based continuous localization system,
used by over 2500 libre projects and companies in more than 165 countries.A translation file finder forWeblate, translation tool with tight version
control integration.This library is used byWeblateto discover translation files in a cloned
repository. It can operate on both file listings and actual filesystem.
Filesystem access is needed for more accurate detection in some cases
(detecting encoding or actual syntax of similar files).UsageIn can be used from Python:>>>fromtranslation_finderimportdiscover>>>frompprintimportpprint>>>results=discover("translation_finder/test_data/")>>>len(results)30>>>pprint(results[0].match){'file_format': 'aresource',
 'filemask': 'app/src/res/main/values-*/strings.xml',
 'name': 'android',
 'template': 'app/src/res/main/values/strings.xml'}>>>pprint(results[16].match){'file_format': 'po',
 'filemask': 'locales/*.po',
 'new_base': 'locales/messages.pot'}Additional information about discovery can be obtained from meta attribute:>>>pprint(results[0].meta){'discovery': 'TransifexDiscovery', 'origin': 'Transifex', 'priority': 500}>>>pprint(results[16].meta){'discovery': 'GettextDiscovery', 'origin': None, 'priority': 1000}Or command line:$weblate-discoverytranslation_finder/test_data/== Match 1 (Transifex) ==
file_format    : aresource
filemask       : app/src/res/main/values-*/strings.xml
name           : android
template       : app/src/res/main/values/strings.xml
...

== Match 7 ==
file_format    : po
filemask       : locales/*.po
new_base       : locales/messages.pot
Package: translation-gummy
Translation-GummyTranslation Gummyis amagical gadgetwhich enables user to be able to speak and understand other languages.※ Supported journals are listedhere.InstallationInstallTranslation-Gummy(There are two ways to install):Install from PyPI (recommended):$sudopipinstallTranslation-GummyAlternatively: installTranslation-Gummyfrom the GitHub source:$gitclonehttps://github.com/iwasakishuto/Translation-Gummy.git# If you want to use the latest version (under development)$gitclone-bdevelophttps://github.com/iwasakishuto/Translation-Gummy.git
$cdTranslation-Gummy
$sudopythonsetup.pyinstallInstallwkhtmltopdfDebian/Ubuntu:$sudoapt-getinstallwkhtmltopdfmacOS:$brewinstallhomebrew/cask/wkhtmltopdfInstalldriverforselenium:Seleniumrequires a driver to interface with the chosen browser, so please visit thedocumentationto install it.# Example: Chrome# visit "chrome://settings/help" to check your chrome version.# visit "https://chromedriver.chromium.org/downloads" to check <Suitable.Driver.Version> for your chrome.$wgethttps://chromedriver.storage.googleapis.com/<Suitable.Driver.Version>/chromedriver_mac64.zip
$unzipchromedriver_mac64.zip
$mvchromedriver/usr/local/bin/chromedriver
$chmod+x/usr/local/bin/chromedriver※ Seeorfor more specific example.Pyenv + PoetryPyenvis a python installation manager.Poetryis a packaging and dependency manager.I recommend you to use these tools toavoid the chaosof the python environment. See other sites for how to install these tools.$pyenvinstall3.8.9
$pyenvlocal3.8.9
$python-V
Python3.8.9# For Windows$poetryinstall-Ewindows# For the other platform$poetryinstall
$poetryrungummy-translate"This is a pen."--from-langen--to-langja
$poetryrungummy-journal"https://www.nature.com/articles/ncb0800_500"Quick exampleexample notebooksTranslation:Python Module:>>>fromgummyimportTranslationGummy>>>model=TranslationGummy(translator="deepl",from_lang="en",to_lang="ja")[success]localdrivercanbebuilt.[failure]remotedrivercan't be built.DRIVER_TYPE:local>>>model.en2ja("This is a pen.")DeepLTranslator(query1)02/30[#-------------------]  6.67% - 2.144[s]   translated: これはペン'これはペンです。'Command line:$gummy-translate"This is a pen."--from-langen--to-langja[success]localdrivercanbebuilt.[failure]remotedrivercan'tbebuilt.
DRIVER_TYPE:localDeepLTranslator(query1)02/30[#-------------------]  6.67% - 2.185[s]   translated: これはペンこれはペンです。OutputCreate PDF (with translation)Python Module:>>>fromgummyimportTranslationGummy>>>model=TranslationGummy(gateway="utokyo",translator="deepl")>>>pdfpath=model.toPDF(url="https://www.nature.com/articles/ncb0800_500",delete_html=True)Command line:$gummy-journal"https://www.nature.com/articles/ncb0800_500"Output
Package: translation-quality-estimator
Translation Quality EstimatorTranslation Quality Estimator is a simple but powerful way of estimating the quality of translations in over a hundred languages. It takes two lists of strings as input and returns the cosine similarity scores between their embeddings.Table of ContentsAbout the ProjectGetting Started2.1.Installation2.2.Basic Usage1. About the ProjectThe approach focuses on generating language agnostic state-of-the-art 🤗 transformer embeddings for the list of string pairs (provided as an input) and measures performance by calculating the cosine similarity between the embeddings. The similarity scores range between [0, 1] with higher referring to better quality of translations.The aim of this project is to create a quick and easy method for estimating the quality of translation of strings.2. Getting Started2.1. InstallationPyTorch 1.2.0or higher is recommended. If the install below gives an error, please install pytorch firsthere.Installation can be done usingpypipip install translation-quality-estimator2.2. UsageThe most minimal example can be seen below for translation quality estimation between two lists of strings:fromtqeimportTQElang_1=["what are you doing","what is your name"]lang_2=["तुम क्या कर रहे हो","तुम्हारा नाम क्या है"]model=TQE('LaBSE')cos_sim_values=model.fit(lang_1,lang_2)print(cos_sim_values)NOTE: For a full overview of all possible multi-lingual transformer models seesentence-transformer.
I would advise using'LaBSE'but you can also test out any'XLM-R'or'Multilingual-BERT'based models.LicenseMIT