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.
Make sure you have the required libraries installed. You can install them using:
pip install -r requirements.txt
- Clone the repository:
git clone https://github.com/arpy8/ArpitSengar_TaskRound_GDSC_VITB.git
cd ArpitSengar_TaskRound_GDSC_VITB
- Run the Streamlit app:
streamlit run streamlit_app.py
- Adjust the number of lines using the provided input and click "Submit" to generate sonnets.
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.
ngram_model
: The script uses an n-gram model to generate sonnets. You can experiment with different values ofn
for varied results.
# Generate 5 sonnets with 10 lines each
create_sonnet(5)
- This project is inspired by the timeless works of William Shakespeare.
This project is licensed under the MIT License - see the LICENSE file for details.