Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ebook Sorter

A Python CLI tool designed to organize your ebook collection (PDF, EPUB, MOBI) by Topic and Difficulty.

Features

  • Topic Classification: Automatically sorts books into categories like Python, Go, DevOps, Data_AI, Database, etc., based on filenames and content analysis.
  • Difficulty Scoring: Uses the Flesch-Kincaid Grade Level to classify books as Easy, Medium, or Hard.
  • Language Detection: Identifies non-English books and sorts them separately (e.g., Topic/Language_ZH).
  • Safe Operation: Default mode COPIES files to prevent data loss. Experimental --move flag available.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/ebook-sorter.git
    cd ebook-sorter
  2. Create a virtual environment:

    python3 -m venv venv
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt

Usage

Basic usage (Copies files):

python main.py /path/to/source_directory /path/to/output_directory

Move files (Delete from source):

python main.py /path/to/source_directory /path/to/output_directory --move

How It Works

  1. Scanning: Recursively finds all .pdf, .epub, and .mobi files in the source directory.
  2. Text Extraction: Extracts text from the first few pages of each book.
  3. Topic Detection: Checks for keywords in the filename first, then scans the extracted text for topic-specific terminology.
  4. Difficulty Analysis: Calculates the readability score of the text.
  5. Organization: Moves or copies the file to Output_Dir/<Topic>/<Difficulty>/<Filename>.

Dependencies

  • PyMuPDF (fitz): PDF text extraction
  • EbookLib & BeautifulSoup4: EPUB parsing
  • textstat: Readability scoring
  • langdetect: Language identification
  • tqdm: Progress bars

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages