Skip to content

PeterNex14/bookbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

BookBot ๐Ÿค–

BookBot is a command-line interface (CLI) tool that analyzes text files (like books!) to gather interesting statistics. It reports the total number of words and the frequency of each character found in the document.

This project is part of the Boot.dev guided project curriculum, specifically the "Build a BookBot in Python" course.

๐Ÿš€ Features

  • Word Count Analysis: Calculates and displays the total number of words in a text file.
  • Character Frequency: Counts the occurrence of every character (case-insensitive) and sorts them by frequency.
  • Clean Reporting: Generates a structured report in the terminal.

๐Ÿ› ๏ธ Installation & Setup

To run this project, you need to have Python 3 installed on your machine.

  1. Clone the repository:

    git clone https://github.com/PeterNex14/bookbot.git
    cd bookbot

    (Note: Replace the URL with your actual repository URL if different)

  2. Verify files: Ensure you have main.py, stats.py, and a books/ directory (or any text file you wish to analyze).

๐Ÿ’ป Usage

Run the main.py script from your terminal, providing the path to the text file you want to analyze as an argument.

Command syntax:

python3 main.py <path_to_book_file>

Example: To analyze the text of Frankenstein (assuming it's located in books/frankenstein.txt):

python3 main.py books/frankenstein.txt

Sample Output

========== BOOKBOT ==========
Analyzing book found at books/frankenstein.txt...
========== Word Count ==========
Found 75767 total words
========== Character Count ==========
e: 44594
t: 29565
a: 26038
o: 24332
...
========== END ==========

๐Ÿง  What I Learned

In this project, I practiced:

  • Reading files in Python.
  • String manipulation (splitting, lowercasing).
  • Using dictionaries for frequency counting.
  • Sorting lists of dictionaries.
  • structuring a Python project with multiple modules (main.py importing from stats.py).
  • Handling command-line arguments with sys.argv.

Built with Python as part of the Boot.dev backend learning path.

About

Python Bookbot Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages