{"id":25217257,"url":"https://github.com/taylor-eos/helped-manual-classifier","last_synced_at":"2025-10-10T18:35:42.278Z","repository":{"id":275859523,"uuid":"927379512","full_name":"Taylor-eOS/helped-manual-classifier","owner":"Taylor-eOS","description":"Manual text classification GUI with machine learning prediction","archived":false,"fork":false,"pushed_at":"2025-07-13T06:22:31.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-11T05:34:02.858Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Taylor-eOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-04T21:22:40.000Z","updated_at":"2025-07-13T06:22:34.000Z","dependencies_parsed_at":"2025-02-05T10:36:48.515Z","dependency_job_id":"d2a0474d-6e9b-42dc-ac1d-62e92391aa43","html_url":"https://github.com/Taylor-eOS/helped-manual-classifier","commit_stats":null,"previous_names":["taylor-eos/mlp-classifier","taylor-eos/helped-manual-classifier"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Taylor-eOS/helped-manual-classifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taylor-eOS%2Fhelped-manual-classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taylor-eOS%2Fhelped-manual-classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taylor-eOS%2Fhelped-manual-classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taylor-eOS%2Fhelped-manual-classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Taylor-eOS","download_url":"https://codeload.github.com/Taylor-eOS/helped-manual-classifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taylor-eOS%2Fhelped-manual-classifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279004909,"owners_count":26083803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-10T20:13:22.429Z","updated_at":"2025-10-10T18:35:42.250Z","avatar_url":"https://github.com/Taylor-eOS.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### **PDF Block Classifier with Machine Learning Assistance**\n\nThis project is a GUI-based tool for classifying text blocks in PDF documents into predefined categories such as headers, body text (`\u003cp\u003e`), footers, quotes, and excluded content. The user manually selects classifications and the model trains on each page to improve the prediction of subsequent pages. Classification works smoothly now, I ran through a 600 page book in a few minutes.\u003cbr\u003e\nThe tool is designed to assist users in organizing and extracting the text from PDF documents, for instance for conversion into a reflowable format.\u003cbr\u003e\nThis was a learning project that gradually extended on itself, and the code is very messy.\u003cbr\u003e\n\n#### **Key Features**\n1. **Interactive GUI**: A Tkinter interface allows users to visually inspect and classify text blocks on PDF pages.\n2. **Manual Annotation**: Users can click on text blocks to assign labels (e.g., header, body, footer) manually.\n3. **Machine Learning Assistance**: A neural network model (MLP with residual blocks) assists in predicting block labels based on geometric and textual features, reducing the need for manual annotation.\n4. **Feature Extraction**: The tool extracts a variety of features from text blocks, including geometric properties (position, size), textual properties (font size, word count), and linguistic features (capitalization, punctuation).\n5. **Incremental Training**: The model is trained incrementally on each page as users annotate blocks, improving its predictions over time.\n6. **Multi-Page Support**: The tool processes PDF documents page by page, allowing classification of entire files.\n7. **Export Results**: Classified text blocks are exported to structured output files for further integration into other workflows (like https://github.com/Taylor-eOS/calibre-epub).\n\n#### **How It Works**\n1. **PDF Processing**: The tool uses `PyMuPDF` (Fitz) to extract text blocks and their geometric properties from PDF pages.\n2. **Feature Extraction**: For each block, features such as position, font size, word count, and linguistic properties are computed.\n3. **Manual Classification**: Users classify blocks by clicking on them and selecting a label from the GUI.\n4. **Model Training**: The annotated blocks are used to train a neural network model, which then predicts labels for the next page.\n5. **Prediction and Feedback**: The model's predictions are displayed in the GUI, and users can correct misclassifications, which further improves the model.\n\n#### **Technical Details**\n- **Backend**: The machine learning model is implemented using PyTorch, with a custom neural network architecture that includes residual blocks for quick learning while still getting better long-term.\n- **Feature Engineering**: The tool computes a wide range of features for each text block, including geometric, textual, and linguistic properties.\n- **Incremental Learning**: The model is trained incrementally as users annotate blocks, allowing it to adapt to the specific characteristics of the document being processed.\n\n#### **Usage**\n1. Clone the repository or download the `py` files.\n2. Create an environment and install the dependencies via the `requirements.txt` file.\n3. Place your input PDF file in the same folder.\n4. Run `main_script.py` and provide the basename the PDF file.\n\n#### **Testing**\nThe script `testing.py` is used to run all data in the file `ground_truth.json` and compute an accuracy value, for quick model evaluation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaylor-eos%2Fhelped-manual-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaylor-eos%2Fhelped-manual-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaylor-eos%2Fhelped-manual-classifier/lists"}