A small command-line tool that reads a plain-text book and prints a report: total word count plus a per-character frequency table (letters only, sorted most-to-least frequent, case-insensitive).
Built as a Boot.dev learning project.
- Python 3.13 or newer
- uv (recommended) — or plain
python3
uv run main.py books/frankenstein.txtWithout uv:
python3 main.py books/frankenstein.txtExactly one argument is required: the path to a UTF-8 text file. With no argument the script prints usage and exits with status 1.
============ BOOKBOT ============
Analyzing book found at books/frankenstein.txt...
----------- Word Count ----------
Found 75767 total words
--------- Character Count -------
e: 44538
t: 29493
...
============= END ===============
books/ contains frankenstein.txt, mobydick.txt,
prideandprejudice.txt. Any plain-text file works.
| File | Purpose |
|---|---|
main.py |
CLI entry point: reads the file, prints the report |
stats.py |
Counting helpers (get_word_count, get_char_counts, chars_dict_to_sorted_list) |
books/ |
Sample input texts |
pyproject.toml |
Project metadata and dev dependency group |
uv sync # install dev tools (mypy, ruff, pytest)
uv run ruff check .
uv run mypy .
uv run pytest # no test files exist yet