GithubHelp home page GithubHelp logo

lyrics-generator's Introduction

Lyrics Generator

This project, developed using Python for the San Diego State University Artificial Intelligence Club Hackathon, is designed to generate lyrics based on user-selected music genres using Markov chains.

alt text

Project Structure

  • main.py: Entry point of the program that presents the user with a menu to select a music genre and generates lyrics based on the chosen genre.
  • scrape.py: Module to retrieve lyrics from various songs of different genres using the Genius.com API and store them in text files categorized by genre.
  • clean.py: Module to preprocess the retrieved lyrics by removing unwanted patterns and metadata from the text files.
  • generate.py: Module to generate new lyrics using Markov chains based on the preprocessed lyrics stored in text files.

Dependencies

  • lyricsgenius: A Python client for the Genius.com API, used for fetching song lyrics.
  • pyfiglet: A Python library for creating ASCII text banners, used for the project banner.
  • markovify: A simple, extensible Markov chain generator, used for generating new lyrics.

How It Works

  1. Retrieving Lyrics: The scrape.py module retrieves lyrics from various songs of different genres using the Genius.com API and stores them in text files categorized by genre in the lyrics/ directory.

  2. Preprocessing Lyrics: The clean.py module preprocesses the retrieved lyrics by removing unwanted patterns, metadata, and formatting from the text files to prepare them for the Markov chain generation process.

  3. Generating Lyrics: The generate.py module uses Markov chains to generate new lyrics based on the preprocessed lyrics stored in text files. It creates new lyrics by analyzing the patterns and structures of the existing lyrics.

  4. User Interaction: The main.py script provides a user-friendly CLI interface where the user can select a music genre from a menu and view the generated lyrics based on their choice.

Challenges and Considerations

  • Web Scraping: One of the challenges faced was web scraping and cleaning the lyrics. The lyricsgenius library was used for scraping, but there were limitations and stability concerns due to infrequent updates.
  • Regex Patterns: Another challenge was using regex patterns for text cleaning. Researching and learning regex patterns were necessary to effectively clean the retrieved lyrics.
  • Text Uniqueness: A key consideration is that with a larger dataset of lyrics to work with, the generated text would be more unique and diverse.

Future Improvements

  • API Integration: Consider integrating with a dedicated API for fetching song lyrics to ensure stability and reliability in the lyrics retrieval process.
  • Enhanced Text Cleaning: Implement more advanced text cleaning techniques using regex to handle a wider range of patterns and improve the quality of generated lyrics.
  • Advanced Generation Techniques: Explore advanced generation techniques beyond Markov chains to enhance the quality and variability of generated lyrics.

Usage

  1. Clone the repository to your local machine.
  2. Install the required dependencies using pip install -r requirements.txt.
  3. Run the main.py script to start the Lyrics Generator.
  4. Follow the on-screen instructions to select a music genre and view the generated lyrics.

lyrics-generator's People

Contributors

vndlgd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.