BookBot is a Python text analysis tool that reads books and provides detailed statistics including word count and character frequency analysis. This is my first Boot.dev project!
- Word Count Analysis: Counts the total number of words in a text file
- Character Frequency Analysis: Analyzes the frequency of each alphabetic character
- Formatted Output: Displays results in a clean, organized format
- Command Line Interface: Easy-to-use CLI for analyzing any text file
BookBot/
├── main.py # Main application entry point
├── stats.py # Text analysis functions
├── pyproject.toml # Project configuration
├── README.md # Project documentation
└── books/ # Sample books directory
├── frankenstein.txt
├── mobydick.txt
└── prideandprejudice.txt
- Clone the repository:
git clone https://github.com/BDGeraghty/BookBot.git
cd BookBot- Ensure you have Python 3.6+ installed:
python3 --versionRun BookBot from the command line by providing the path to a text file:
python3 main.py <path_to_book>python3 main.py books/frankenstein.txtBook Title: books/frankenstein.txt
77986 words found in the document
============ BOOKBOT ============
Analyzing book found at books/frankenstein.txt...
----------- Word Count ----------
Found 77986 total words
--------- Character Count -------
e: 46043
t: 30365
a: 26743
o: 25225
i: 24613
n: 24367
s: 21155
h: 19725
r: 18557
d: 16863
...
============= END ===============
main(): Main function that orchestrates the text analysis processget_book_text(path): Reads and returns the content of a text file
get_num_words(text): Counts the total number of words in the textget_chars_dict(text): Creates a dictionary with character frequencies
- Python 3.6+
- No external dependencies required
The project includes three classic literature texts for testing:
- Frankenstein by Mary Shelley
- Moby Dick by Herman Melville
- Pride and Prejudice by Jane Austen
This is a learning project from Boot.dev. Feel free to fork and experiment!
This project is open source and available under the MIT License.
Created as part of the Boot.dev Python course to learn:
- File I/O operations
- String manipulation
- Dictionary operations
- Command line argument parsing
- Code organization and modularity