BookBot is my first Boot.dev project!
🔽 ChatGPT ReadME 🔽
BookBot is a simple Python command-line tool that analyzes the text of a book.
It counts the total words and provides a character frequency report (A–Z).
- Reads a text file (book) from a given file path.
- Counts the total number of words in the text.
- Counts character frequencies (alphabetic characters only).
- Displays a neat, formatted report in the terminal.
├── main.py # Entry point for the program
├── stats.py # Contains helper functions (e.g., word/char counting, sorting)
└── README.md # Documentationgit clone <your-repo-url>
cd <your-repo-folder>python3 main.py <path_to_book>Example
python3 main.py books/frankenstein.txt============ BOOKBOT ============
Analyzing book found at books/frankenstein.txt...
----------- Word Count -----------
Found 78345 total words
--------- Character Count ---------
a: 5421
b: 1293
c: 3212
...
============= END ===============- Python 3.7+
- A valid text file (.txt) to analyze.
No external dependencies are required.
- get_book_text(filepath)
- Reads the entire text from the file.
- Word Count
- get_num_words(book_text) counts how many words are in the book.
- Character Frequency
- get_num_chars(book_text) counts the occurrences of each character.
- get_sorted_list(num_chars_dict) sorts them (likely in descending order).
- Report Generation
- Word count summary.
- Alphabet-only character frequency report.
- Nicely formatted output with borders.
BookBot is great for: • Analyzing public domain eBooks (like those from Project Gutenberg). • Quick text statistics for reports, analysis, or fun insights.
- Only alphabetic characters (A–Z) are included in the character report.
- Punctuation, spaces, and numbers are ignored.