Skip to content

tstokes22/bookbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BookBot: Automated Text Analysis Tool

Python-Based Statistical Parser

Project Overview

BookBot is a Python command-line utility designed to perform comprehensive text analysis on literary works. Developed as an initial project for Boot.dev, it serves as a practical application of core programming concepts including file I/O, string manipulation, and data structure organization. The tool allows users to input any text file and receive a structured report detailing its word count and character frequency statistics.

Key Features

Total Word Counting: Programmatically splits text into individual strings to accurately determine the total word count of a given book.

Case-Insensitive Character Analysis: Iterates through the entire text to track the frequency of every character, ensuring "A" and "a" are treated as the same entry for statistical consistency.

Filtered Frequency Reporting: Automatically filters out non-alphabetic characters (such as punctuation or numbers) to focus purely on language-based data.

Sorted Statistical Output: Organizes character data into a sorted list, displaying the most frequently occurring letters at the top of the generated report.

Technical Implementation

The application demonstrates mastery of fundamental Python backend logic:

Command-Line Interface: Utilizes sys.argv to securely handle file path inputs directly from the terminal.

File Stream Management: Implements the with open() context manager to efficiently read large text files without memory leaks.

Statistical Logic:

The get_num_words function uses string splitting to generate word-level counts.

The get_num_char function employs a dictionary-based counter to map character occurrences.

The sort_dict function converts dictionaries into a list of dictionaries, utilizing custom sorting keys to rank data by frequency.

Installation & Usage

Clone the Repository:

git clone https://github.com/tstokes22/bookbot.git

Run the Analysis: Execute the tool by providing a path to any .txt file:

python3 main.py <path_to_book>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages