lyrics-translator


Namelyrics-translator JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://mauroluzzatto.github.io/lyrics-translator
Summary🎵 LyricsTranslator - automated lyrics translation
upload_time2023-05-17 15:49:01
maintainer
docs_urlNone
authorMauro Luzzatto
requires_python>=3.8,<4.0
licenseMIT
keywords lyrics translation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<!-- <p align="center">
<img src="https://github.com/MauroLuzzatto/lyrics-translator/blob/main/docs/img/logo.jpg" width="200" height="200"/>
</p> -->

<h1 align="center">🎵 LyricsTranslator - automated lyrics translation</h1>



<p align="center">

<a href="https://pypi.python.org/pypi/lyrics-translator" target="_blank">
    <img src="https://img.shields.io/pypi/v/lyrics-translator.svg" alt="pypi version">
</a>

<a href="https://pypi.org/project/lyrics-translator" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/lyrics-translator.svg" alt="Supported versions">
</a>

<a href="https://github.com/ambv/black" target="_blank">
    <img src="https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square" alt="Code style: black">
</a>


<a href="https://pycqa.github.io/isort/" target="_blank">
    <img src="https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336" alt="Imports: isort">
</a>


<a href="https://github.com/MauroLuzzatto/lyrics-translator/actions?workflow=Tests" target="_blank">
    <img src="https://github.com/MauroLuzzatto/lyrics-translator/workflows/Tests/badge.svg" alt="Tests">
</a>

</p>


---

**Documentation**: <a href="https://mauroluzzatto.github.io/lyrics-translator" target="_blank">https://mauroluzzatto.github.io/lyrics-translator</a>

**Source Code**: <a href="https://github.com/MauroLuzzatto/lyrics-translator" target="_blank">https://github.com/MauroLuzzatto/lyrics-translator</a>

---


`LyricsTranslator` is a Python module that allows you to download lyrics from the popular music lyrics website [genius](https://genius.com/) and translate them into a target language of your choice. The module uses the powerful 🤗[hugging face](https://huggingface.co/) 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](https://github.com/Helsinki-NLP/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](https://huggingface.co/models?other=marian).


All languages that are supported by [OPUS-MT](https://github.com/Helsinki-NLP/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](https://docs.genius.com/#/getting-started-h1) from `genius` add the API token to the `.env` file:

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


## Usage
<!--
📚 A comprehensive example of the `explainy` API can be found in this ![Jupyter Notebook](https://github.com/MauroLuzzatto/explainy/blob/main/examples/01-explainy-intro.ipynb)

📖 Or in the [example section](https://explainy.readthedocs.io/en/latest/examples/01-explainy-intro.html) of the documentation -->


```python
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
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://mauroluzzatto.github.io/lyrics-translator",
    "name": "lyrics-translator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "lyrics,translation",
    "author": "Mauro Luzzatto",
    "author_email": "mauroluzzatto@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a6/d7/7f8a25bc4e0e049bd4fef1e2668b61c9b3aeda52fd3844775b577c3d32d1/lyrics_translator-0.4.0.tar.gz",
    "platform": null,
    "description": "\n<!-- <p align=\"center\">\n<img src=\"https://github.com/MauroLuzzatto/lyrics-translator/blob/main/docs/img/logo.jpg\" width=\"200\" height=\"200\"/>\n</p> -->\n\n<h1 align=\"center\">\ud83c\udfb5 LyricsTranslator - automated lyrics translation</h1>\n\n\n\n<p align=\"center\">\n\n<a href=\"https://pypi.python.org/pypi/lyrics-translator\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/v/lyrics-translator.svg\" alt=\"pypi version\">\n</a>\n\n<a href=\"https://pypi.org/project/lyrics-translator\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/pyversions/lyrics-translator.svg\" alt=\"Supported versions\">\n</a>\n\n<a href=\"https://github.com/ambv/black\" target=\"_blank\">\n    <img src=\"https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square\" alt=\"Code style: black\">\n</a>\n\n\n<a href=\"https://pycqa.github.io/isort/\" target=\"_blank\">\n    <img src=\"https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336\" alt=\"Imports: isort\">\n</a>\n\n\n<a href=\"https://github.com/MauroLuzzatto/lyrics-translator/actions?workflow=Tests\" target=\"_blank\">\n    <img src=\"https://github.com/MauroLuzzatto/lyrics-translator/workflows/Tests/badge.svg\" alt=\"Tests\">\n</a>\n\n</p>\n\n\n---\n\n**Documentation**: <a href=\"https://mauroluzzatto.github.io/lyrics-translator\" target=\"_blank\">https://mauroluzzatto.github.io/lyrics-translator</a>\n\n**Source Code**: <a href=\"https://github.com/MauroLuzzatto/lyrics-translator\" target=\"_blank\">https://github.com/MauroLuzzatto/lyrics-translator</a>\n\n---\n\n\n`LyricsTranslator` is a Python module that allows you to download lyrics from the popular music lyrics website [genius](https://genius.com/) and translate them into a target language of your choice. The module uses the powerful \ud83e\udd17[hugging face](https://huggingface.co/) library for translation, which provides state-of-the-art performance in natural language processing tasks.\n\nWith `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.\n\nThe module supports all languages that are available on the [OPUS-MT](https://github.com/Helsinki-NLP/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 \ud83e\udd17[hugging face](https://huggingface.co/models?other=marian).\n\n\nAll languages that are supported by [OPUS-MT](https://github.com/Helsinki-NLP/Opus-MT) are available for translation.\n\n- German: `de`\n- Swedish: `sv`\n- French: `fr`\n- Spanish: `es` \n- Chinese: `zh`\n- Japanese: `ja`\n- Portuguese: `pt`\n- Arabic: `ar`\n- Italian: `it`\n\nand many more ...\n\n\n\n\n\n## Install\n\n```\npip install lyrics-translator\n```\n\n## Setup\nTo use the `LyricsTranslator` you will have to [get an API token](https://docs.genius.com/#/getting-started-h1) from `genius` add the API token to the `.env` file:\n\n```txt\nGENIUS_ACCESS_TOKEN=<replace-me-with-your-genius-api-token>\n```\n\n\n## Usage\n<!--\n\ud83d\udcda A comprehensive example of the `explainy` API can be found in this ![Jupyter Notebook](https://github.com/MauroLuzzatto/explainy/blob/main/examples/01-explainy-intro.ipynb)\n\n\ud83d\udcd6 Or in the [example section](https://explainy.readthedocs.io/en/latest/examples/01-explainy-intro.html) of the documentation -->\n\n\n```python\nfrom lyrics_translator import LyricsTranslator\n\nsong = \"Surfin' U.S.A.\"\nartist = \"The Beach Boys\"\nlanguage = \"de\"\n\ntranslator = LyricsTranslator(language)\nlyrics = translator.get_song_translation(song, artist)\nprint(lyrics)\n```\nOutput:\n```\nSurfin\u2019 USA Lyrics[Verse 1]\nWenn jeder einen Ozean h\u00e4tte\n\u00dcberall in den USA\nDann w\u00fcrde jeder surfen\nWie Californi-a\nSie w\u00fcrden ihre Taschen tragen.\nAuch Huarache Sandalen\nEin stumpfes stumpfes blond Haar\nSurfin' U.S.A\n\n[Korus]\nSie w\u00fcrden sie surfen in Del Mar\n(Innen, Au\u00dfen, USA)\nVentura County Line\n(Innen, Au\u00dfen, USA)\nSanta Cruz und Trestles\n(Innen, Au\u00dfen, USA)\nAustraliens Narrabeen\n(Innen, Au\u00dfen, USA)\n\u00dcberall in Manhattan\n(Innen, Au\u00dfen, USA)\nUnd den Doheny Way hinunter\n(Innen, Au\u00dfen)\n[Anschlag]\nJeder ist surfin'\nSurfin' U.S.A\n\n[Zwischenruf 2]\nWir werden alle diese Route planen.\nWir werden wirklich bald\nWir wischen unsere Surfbretter ab\nWir k\u00f6nnen auf Juni nicht warten\nWir werden alle f\u00fcr den Sommer weg sein\nWir sind auf surfari zu bleiben\nSagen Sie dem Lehrer, wir surfen\nSurfin' U.S.A\n\n[Korus]\nHaggerties und Swamis\n(Innen, Au\u00dfen, USA)\nPalisaden im Pazifik\n(Innen, Au\u00dfen, USA)\nSan Onofre und der Sonnenuntergang\n(Innen, Au\u00dfen, USA)\nRedondo Beach LA\n(Innen, Au\u00dfen, USA)\nGanz La Jolla\n(Innen, Au\u00dfen, USA)\nIn der Bucht von Wa'imea\n(Innen, Au\u00dfen)\n[Anschlag]\nJeder ist surfin'\nSurfin' U.S.A\n\n[Instrumental Interlude]\n\n[Outro]\nJeder ist surfin'\nSurfin' U.S.A\n\nJeder ist surfin'\nSurfin' U.S.A\n\nJeder ist surfin'\nSurfin' U.S.A\n\nJeder ist surfin'\nSurfin' U.S.A\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\ud83c\udfb5 LyricsTranslator - automated lyrics translation",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://mauroluzzatto.github.io/lyrics-translator",
        "Repository": "https://github.com/MauroLuzzatto/lyrics-translator"
    },
    "split_keywords": [
        "lyrics",
        "translation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58d6f3694bd51da76da4dcfd098d2a7e996a0cd9a6401e73f49ae5f447ae737d",
                "md5": "d1ecee7b06e0cdd7a4ab4d429c1a3522",
                "sha256": "8a0a34a24ff9ee15435a1be7d4fd046ce2abbfbeb0ae2fb2d0868212f7da29fd"
            },
            "downloads": -1,
            "filename": "lyrics_translator-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d1ecee7b06e0cdd7a4ab4d429c1a3522",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 10148,
            "upload_time": "2023-05-17T15:48:59",
            "upload_time_iso_8601": "2023-05-17T15:48:59.278905Z",
            "url": "https://files.pythonhosted.org/packages/58/d6/f3694bd51da76da4dcfd098d2a7e996a0cd9a6401e73f49ae5f447ae737d/lyrics_translator-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a6d77f8a25bc4e0e049bd4fef1e2668b61c9b3aeda52fd3844775b577c3d32d1",
                "md5": "c52aa742347fbafb3ff178bbf37c5f0e",
                "sha256": "504025581826f467761675f4a51ec77d2becd7c4857547ca44d7376fb5384902"
            },
            "downloads": -1,
            "filename": "lyrics_translator-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c52aa742347fbafb3ff178bbf37c5f0e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 10079,
            "upload_time": "2023-05-17T15:49:01",
            "upload_time_iso_8601": "2023-05-17T15:49:01.651217Z",
            "url": "https://files.pythonhosted.org/packages/a6/d7/7f8a25bc4e0e049bd4fef1e2668b61c9b3aeda52fd3844775b577c3d32d1/lyrics_translator-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-17 15:49:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MauroLuzzatto",
    "github_project": "lyrics-translator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lyrics-translator"
}
        
Elapsed time: 0.06451s