https://github.com/leroyanders/google-translate-unlimited
Google Translate module no length limit. Support all 7,151 languages.
https://github.com/leroyanders/google-translate-unlimited
google-translate nltk python python3 tkinter translation
Last synced: 8 months ago
JSON representation
Google Translate module no length limit. Support all 7,151 languages.
- Host: GitHub
- URL: https://github.com/leroyanders/google-translate-unlimited
- Owner: leroyanders
- License: mit
- Created: 2022-08-04T10:15:36.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-16T19:12:50.000Z (over 3 years ago)
- Last Synced: 2025-02-27T04:25:57.861Z (over 1 year ago)
- Topics: google-translate, nltk, python, python3, tkinter, translation
- Language: Python
- Homepage: https://rapidapi.com/leroywagner/api/unlimited-google-translate/
- Size: 28.3 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# About
This python script translates text using an open-source GPT model with a custom prompt.
+ No limits.
+ Fully free.
+ Supports all 7,151 languages.
# Install dependencies
```bash
pip3 install -r requirements.txt
```
The model requires the PyTorch backend. If it is not present in your environment,
install it following the instructions on .
On Apple Silicon machines (e.g., M1/M2 Macs), install the PyTorch build with
[MPS](https://pytorch.org/docs/stable/notes/mps.html) support to offload
computation to the GPU. The translators in this project automatically use MPS
when it is available, reducing CPU usage.
# Languages list
Full NameLanguage Code
AfaraaAbkhazianabAvestanaeAfrikaansafAkanakAmharicamAragoneseanArabicarAssameseasAvaricavAymaraayAzerbaijaniazBashkirbaBelarusianbeBulgarianbgBihari languagesbhBislamabiBambarabmBengalibnTibetanboBretonbrBosnianbsCatalan; ValenciancaChechenceChamorrochCorsicancoCreecrCzechcsChurch Slavic; Slavonic;
Old BulgariancuChuvashcvWelshcyDanishdaGermandeDivehi; Dhivehi; MaldiviandvDzongkhadzEweeeGreek, Modern (1453-)elEnglishenEsperantoeoSpanish; CastilianesEstonianetBasqueeuPersianfaFulahffFinnishfiFijianfjFaroesefoFrenchfrWestern FrisianfyIrishgaGaelic; Scottish GaelicgdGalicianglGuaranignGujaratiguManxgvHausahaHebrewheHindihiHiri MotuhoCroatianhrHaitian; Haitian CreolehtHungarianhuArmenianhyHererohzInterlinguaiaIndonesianidInterlingue; OccidentalieIgboigSichuan Yi; NuosuiiInupiaqikIdoioIcelandicisItalianitInuktitutiuJapanesejaJavanesejvGeorgiankaKongokgKikuyu; GikuyukiKuanyama; KwanyamakjKazakhkkKalaallisut; GreenlandicklCentral KhmerkmKannadaknKoreankoKanurikrKashmiriksKurdishkuKomikvCornishkwKirghiz; KyrgyzkyLatinlaLuxembourgish; LetzeburgeschlbGandalgLimburgan; Limburger; LimburgishliLingalalnLaoloLithuanianltLuba-KatangaluLatvianlvMalagasymgMarshallesemhMaorimiMacedonianmkMalayalammlMongolianmnMarathimrMalaymsMaltesemtBurmesemyNaurunaNorwegian BokmålnbNdebele, North; North NdebelendNepalineNdongangDutch; FlemishnlNorwegian NynorsknnNorwegiannoNdebele, South; South NdebelenrNavajo; NavahonvChichewa; Chewa; NyanjanyOccitan (post 1500)ocOjibwaojOromoomOriyaorOssetian; OsseticosPanjabi; PunjabipaPalipiPolishplPushto; PashtopsPortugueseptQuechuaquRomanshrmRundirnRomanian; Moldavian; MoldovanroRussianruKinyarwandarwSanskritsaSardinianscSindhisdNorthern SamiseSangosgSinhala; SinhalesesiSlovakskSlovenianslSamoansmShonasnSomalisoAlbaniansqSerbiansrSwatissSotho, SouthernstSundanesesuSwedishsvSwahiliswTamiltaTeluguteTajiktgThaithTigrinyatiTurkmentkTagalogtlTswanatnTonga (Tonga Islands)toTurkishtrTsongatsTatarttTwitwTahitiantyUighur; UyghurugUkrainianukUrduurUzbekuzVendaveVietnameseviVolapükvoWalloonwaWolofwoXhosaxhYiddishyiYorubayoZhuang; ChuangzaChinesezhZuluzu
# Install punkt
```console
python <<< 'import nltk' && python <<< 'nltk.download("punkt")'
```
# Using
```python
import module
tr = module.PromptTranslator(text='Hello, World!', dest='fr')
translated_text = tr.translated_text
if __name__ == '__main__':
print(f'Result: {translated_text}');
```
The result will be:
``` Result: Bonjour le monde! ```
You can run the provided `example.py` script from the command line:
```bash
python example.py "Hello, world!" --dest fr
```
# Prompt-based translator
You can also use an open chat model that accepts custom prompts:
```python
from module import PromptTranslator
tr = PromptTranslator(text="Hello, World!", dest="fr")
print(tr.translated_text)
```
Loading the default chat model (`openai-community/openai-gpt`) is lightweight
and can run on modest hardware. The model has a 512-token context window, so
large prompts are automatically truncated.