BookBot is one of the capstone Boot.dev projects!
Bookbot is a Python script that parses .txt files, counts the words, and hashes characters to their occurrences. At the end, it generates a report displaying the total number of words and the frequency of each character in the text. This project was built as a capstone for the backend development course on Boot.dev.
- 📖 Parses
.txtfiles from a book repository - 🔢 Counts the total number of words in a book
- 🔍 Calculates character occurrences in the text
- 📊 Generates a formatted report
- ⚡ Includes a Makefile to automate book downloads and cleanup
To set up the project locally:
git clone https://github.com/dancikmad/bookbot
cd bookbotEnsure you have Python installed (Python 3.x recommended).
The project includes a Makefile that automates the process of fetching books from Project Gutenberg.
Run the following command to download .txt files into the books/ directory:
make loadAfter downloading a .txt file, analyze a book by running:
python3 main.py books/frankenstein.txtThis will output:
- 📜 The total number of words in the book
- 🔢 A breakdown of character occurrences
Once finished, remove the downloaded .txt files by running:
make clean75767 words found in the document
Character occurrences:
- 'a': 25421
- 'b': 4605
- 'c': 8814
- 'd': 16158
- ...
bookbot/
├── 📂 books/ # Directory for storing downloaded .txt files
├── 📜 main.py # Bookbot script
├── ⚙️ Makefile # Automation script for fetching and cleaning books
├── 📄 README.md # Project documentation
└── 📊 stats.py # Helper functions for counting words and characters
- 🐍 Python 3.x
- 🌐
wget(for downloading books via Makefile)
This project is for educational purposes and follows open-source guidelines.
Created as part of the Boot.dev Backend Development Course.
- The
Makefilesimplifies the process of setting up the book repository. - The script can analyze any
.txtbook, not just Frankenstein. - Future improvements may include support for additional text processing features.