Skip to content

jhill426/bookbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BookBot

This is a command-line tool that analyzes text files and provides statistics about word count and character frequency.

Features

  • Word Count: Counts the total number of words in a text file
  • Character Frequency: Analyzes and displays the frequency of each letter (case-insensitive)
  • Sorted Results: Character counts are sorted from most to least frequent

Requirements

  • Python 3.x

Installation

No installation required! Just clone or download this repository:

git clone <your-repo-url>
cd bookbot

Usage

Run BookBot by providing the path to a text file you want to analyze:

python3 main.py <path_to_book>

Example

python3 main.py books/frankenstein.txt

Output

BookBot will display:

  1. The path to the file being analyzed
  2. Total word count
  3. Character frequency for each letter, sorted by frequency

Example output:

============ BOOKBOT ============
Analyzing book found at books/frankenstein.txt...
----------- Word Count ----------
Found 75767 total words
--------- Character Count -------
e: 44538
t: 29493
a: 25894
o: 24494
i: 23927
n: 23643
s: 20360
r: 20079
h: 19176
d: 16318
l: 12306
m: 10206
u: 10111
c: 9011
f: 8451
y: 7756
w: 7450
p: 5952
g: 5795
b: 4868
v: 3737
k: 1661
x: 691
j: 497
q: 325
z: 235
æ: 28
â: 8
ê: 7
ë: 2
ô: 1
============= END ===============

Project Structure

  • main.py - Main entry point for the application
  • stats.py - Core functions for text analysis
    • get_book_text() - Reads text from a file
    • get_word_count() - Counts words in the text
    • get_letter_counts() - Counts and sorts letter frequencies

License

Open source - feel free to use and modify as you like.

About

Book statistical analysis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages