arpy8 / ArpitSengar_TaskRound_GDSC_VITB

Employs the NLTK library to craft Shakespearean Sonnets

Home Page:https://shakespeares-sonnets.streamlit.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shakespearean Sonnet Generator

banner

Overview

This project is a Shakespearean Sonnet generator based on n-gram modeling. It utilizes NLTK for text processing and Streamlit for creating a user interface. The generated sonnets mimic the style of William Shakespeare.

Getting Started

Prerequisites

Make sure you have the required libraries installed. You can install them using:

pip install -r requirements.txt

Usage

  1. Clone the repository:
git clone https://github.com/arpy8/ArpitSengar_TaskRound_GDSC_VITB.git
cd ArpitSengar_TaskRound_GDSC_VITB
  1. Run the Streamlit app:
streamlit run streamlit_app.py
  1. Adjust the number of lines using the provided input and click "Submit" to generate sonnets.

Code Structure

  • streamlit_app.py: Main application script that uses NLTK and Streamlit to generate and display Shakespearean sonnets.
  • data/Sonnets.txt: Text file containing Shakespeare's sonnets for training the n-gram model.
  • notebook/Shakespeare’s Sonnets.ipynb: Jupyter Notebook that I used during the development stage.
  • assets/banner.png: Contains the banner image for readme.

Configuration

  • ngram_model: The script uses an n-gram model to generate sonnets. You can experiment with different values of n for varied results.

Example

# Generate 5 sonnets with 10 lines each
create_sonnet(5)

Contributors

Acknowledgments

  • This project is inspired by the timeless works of William Shakespeare.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Employs the NLTK library to craft Shakespearean Sonnets

https://shakespeares-sonnets.streamlit.app/

License:MIT License


Languages

Language:Jupyter Notebook 97.7%Language:Python 2.3%