Skip to main content

🎵 LyricsTranslator - automated lyrics translation

Project description

🎵 LyricsTranslator - automated lyrics translation

pypi version Supported versions Code style: black Imports: isort Tests


Documentation: https://mauroluzzatto.github.io/lyrics-translator

Source Code: https://github.com/MauroLuzzatto/lyrics-translator


LyricsTranslator is a Python module that allows you to download lyrics from the popular music lyrics website genius and translate them into a target language of your choice. The module uses the powerful 🤗hugging face library for translation, which provides state-of-the-art performance in natural language processing tasks.

With LyricsTranslator, you can easily translate the lyrics of your favorite songs into different languages, allowing you to appreciate the beauty and meaning of the lyrics in a language that you're comfortable with. This can be particularly helpful if you're learning a new language or if you want to explore the cultural nuances of a different language.

The module supports all languages that are available on the OPUS-MT platform, which includes languages from all around the world. Whether you're interested in German, Spanish, Chinese, Japanese, or any other language, LyricsTranslator has got you covered. The full list of list of languages can be found on 🤗hugging face.

All languages that are supported by OPUS-MT are available for translation.

  • German: de
  • Swedish: sv
  • French: fr
  • Spanish: es
  • Chinese: zh
  • Japanese: ja
  • Portuguese: pt
  • Arabic: ar
  • Italian: it

and many more ...

Install

pip install lyrics-translator

Setup

To use the LyricsTranslator you will have to get an API token from genius add the API token to the .env file:

GENIUS_ACCESS_TOKEN=<replace-me-with-your-genius-api-token>

Usage

from lyrics_translator import LyricsTranslator

song = "Surfin' U.S.A."
artist = "The Beach Boys"
language = "de"

translator = LyricsTranslator(language)
lyrics = translator.get_song_translation(song, artist)
print(lyrics)

Output:

Surfin’ USA Lyrics[Verse 1]
Wenn jeder einen Ozean hätte
Überall in den USA
Dann würde jeder surfen
Wie Californi-a
Sie würden ihre Taschen tragen.
Auch Huarache Sandalen
Ein stumpfes stumpfes blond Haar
Surfin' U.S.A

[Korus]
Sie würden sie surfen in Del Mar
(Innen, Außen, USA)
Ventura County Line
(Innen, Außen, USA)
Santa Cruz und Trestles
(Innen, Außen, USA)
Australiens Narrabeen
(Innen, Außen, USA)
Überall in Manhattan
(Innen, Außen, USA)
Und den Doheny Way hinunter
(Innen, Außen)
[Anschlag]
Jeder ist surfin'
Surfin' U.S.A

[Zwischenruf 2]
Wir werden alle diese Route planen.
Wir werden wirklich bald
Wir wischen unsere Surfbretter ab
Wir können auf Juni nicht warten
Wir werden alle für den Sommer weg sein
Wir sind auf surfari zu bleiben
Sagen Sie dem Lehrer, wir surfen
Surfin' U.S.A

[Korus]
Haggerties und Swamis
(Innen, Außen, USA)
Palisaden im Pazifik
(Innen, Außen, USA)
San Onofre und der Sonnenuntergang
(Innen, Außen, USA)
Redondo Beach LA
(Innen, Außen, USA)
Ganz La Jolla
(Innen, Außen, USA)
In der Bucht von Wa'imea
(Innen, Außen)
[Anschlag]
Jeder ist surfin'
Surfin' U.S.A

[Instrumental Interlude]

[Outro]
Jeder ist surfin'
Surfin' U.S.A

Jeder ist surfin'
Surfin' U.S.A

Jeder ist surfin'
Surfin' U.S.A

Jeder ist surfin'
Surfin' U.S.A

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lyrics_translator-0.4.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

lyrics_translator-0.4.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file lyrics_translator-0.4.0.tar.gz.

File metadata

  • Download URL: lyrics_translator-0.4.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.5 Linux/5.4.72-microsoft-standard-WSL2

File hashes

Hashes for lyrics_translator-0.4.0.tar.gz
Algorithm Hash digest
SHA256 504025581826f467761675f4a51ec77d2becd7c4857547ca44d7376fb5384902
MD5 c52aa742347fbafb3ff178bbf37c5f0e
BLAKE2b-256 a6d77f8a25bc4e0e049bd4fef1e2668b61c9b3aeda52fd3844775b577c3d32d1

See more details on using hashes here.

File details

Details for the file lyrics_translator-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: lyrics_translator-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.5 Linux/5.4.72-microsoft-standard-WSL2

File hashes

Hashes for lyrics_translator-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a0a34a24ff9ee15435a1be7d4fd046ce2abbfbeb0ae2fb2d0868212f7da29fd
MD5 d1ecee7b06e0cdd7a4ab4d429c1a3522
BLAKE2b-256 58d6f3694bd51da76da4dcfd098d2a7e996a0cd9a6401e73f49ae5f447ae737d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page