- Notifications
You must be signed in to change notification settings - Fork2
paladini/py-simple-lyric-generator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A simple Markov chains lyric generator written in Python.
This small project generate new lyrics based on the lyrics of a given artist. For example, you can ask the script to generate Pink Floyd-like lyrics, so it will read all the lyrics from Pink Floyd and generate a new one with the same style.
I've made a small "database" too, so whenever you load all lyrics from a given artist it will be saved on your computer under thedb folder. This way we can avoid a lot of API calls (that are quite expensive).
- PyMarkovChain (install it using
pip3 install PyMarkovChain
) - requests (install it using
pip3 install requests
) - Wikya Lyrics API (you don't need to install/configure it)
- Python 3
The program expects the following arguments:
python3 py-simple-lyric-generator.py"<name of the artist>"<number_of_phrases_to_generate>
For example, if you want to generate 10 sentences based on Pink Floyd lyrics you should run:
python3 py-simple-lyric-generator.py"Pink Floyd" 10
Then you'll get somewhat like that:
I'd be goneCause I'm the man on the outside looking inPlaying to rulesLotuses lean on each other in yearningThe SchoolmasterAnd all that you seeAnd if you don't mindIt's awfully considerate of you to leave, LucyWheeling, soaring, gliding b Instrumental He made his way to the see-saw It's awfully considerate of you to think of me hereDon't accept that what's hap One sound, one single kiss
If you want to reset cached artists from the database, just run the following:
chmod +x clean_db.sh./clean_db.sh
This's my first experiment within lyrics generation with Markov chains, but I've read some texts and a lot of examples. In order to understand how can I generate lyrics, please check the following links:
- Lyricize: A Flask App to Create Lyrics Using Markov Chains [very useful]
- Text generation with Markov chains
- Generating pseudo random text with Markov chains using Python
And here you can check some projects on Github that helped me:
- Lyrics Can Be Easy
- taytay [Taylor-Swift-like lyric generator, I really want to read their code, they have awesome results]
- PyMarkovChain
Thepy-simple-lyric-generator
was created by Fernando Paladini on 01-17-2016, but it was heavily based on another open-source projects you can find at the web. If you have any issue, doubt, problem or suggestion, please feel free to create anew Issue or even contact me at fnpaladini at gmail dot com.
About
A simple Markov chains lyric generator written in Python.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.