PythonFile I/OData Analysis

BookBot

A command-line tool for analyzing text files. Give it any document and it returns a word count plus a sorted character frequency table. My first Boot.dev project.

Features

  • Total word count
  • Character frequency analysis (case-insensitive)
  • Results sorted by frequency, highest to lowest
  • Works with any plain text file
  • No external dependencies — pure Python stdlib

Usage

python3 main.py books/frankenstein.txt

Output:

============ BOOKBOT ============
Analyzing book at: books/frankenstein.txt
=================================
Found 73115 total words
--------- Character Count -------
e: 46043
t: 30365
a: 26743
...
============= END ===============

How It Works

  1. Read the file into a string
  2. Split on whitespace to count words
  3. Iterate over every character, incrementing a frequency counter (lowercased)
  4. Sort the counter by value descending
  5. Print the formatted report

Tech Stack

  • Language: Python
  • Libraries: Python stdlib only (sys, os)