Skip to content

Repository files navigation

[Project Name] - pdf_extraction_and_refinement_data

License: MIT ## Description

This project is a Python-based pipeline designed for processing book data, particularly large files in JSONL format. It includes scripts for chunking files, extracting content while detecting specific "gaps" or missing information, and applying a multi-stage post-processing routine guided by configurable heuristic rules.

Features

  • JSONL File Chunking: Split large JSONL files into smaller, manageable chunks.
  • Content Extraction & Gap Detection: Extract relevant information from book data and identify predefined gaps.
  • Multi-Stage Post-Processing: Apply a sequence of processing steps to refine the extracted data.
  • Heuristic Configuration: Customize post-processing rules and comparisons via a YAML configuration file.
  • Modular script design for pipeline steps.

Installation

  1. Clone the Repository:

    git clone [Your Repository URL]
    cd [your-repository-name]
  2. Create a Virtual Environment (Recommended):

    python -m venv venv
    # On Windows:
    # venv\Scripts\activate
    # On macOS/Linux:
    source venv/bin/activate
  3. Install Dependencies: This project requires several Python libraries. It's recommended to create a requirements.txt file containing the names of all necessary libraries (e.g., jsonlines, PyYAML, pandas, etc.).

    Create a file named requirements.txt in the root directory with needed libraries listed line by line. For example:

    PyMuPDF
    tqdm
    PyYAML
    ijson
    panda
    jsonlines

    Then, install them using pip:

    pip install -r requirements.txt

    ([FILL IN]: You will need to identify all the libraries your scripts actually use and list them in requirements.txt)

Usage

This project is designed as a processing pipeline. The typical workflow involves running the scripts in sequence:

  1. Chunking the Input File (Optional, for large files): Use jsonl_file_chunker_script.py to split your main JSONL file.

    python jsonl_file_chunker_script.py [input_jsonl_file] [output_directory] [chunk_size]

    ([FILL IN]: Specify command-line arguments or modify script to read paths)

  2. Running the Main Extraction and Gap Detection: Process the original file or the generated chunks using gap_detection_python_extract_books_final.py.

    python gap_detection_python_extract_books_final.py [input_file(s)] [output_location] [other_arguments]

    ([FILL IN]: Specify command-line arguments, input/output formats, and whether it processes single files or directories of chunks)

  3. Applying Post-Processing Step 1: Run the first phase of post-processing on the output from the previous step.

    python pos_processing_step.py [input_data] [output_location] [configuration_path - potentially heuristic config?]

    ([FILL IN]: Specify command-line arguments, expected input/output formats, and how it uses configuration)

  4. Applying Post-Processing Step 2: Run the second phase of post-processing.

    python phase_2_post_processing_step.py [input_data] [output_location] [configuration_path - potentially heuristic config?]

    ([FILL IN]: Specify command-line arguments, expected input/output formats, and how it uses configuration)

([FILL IN]: Explain the expected input data format for the initial step (likely JSONL) and the expected output formats/locations for each step.) ([FILL IN]: If the scripts need specific arguments or environmental variables, detail them here.)

Configuration

The behavior of the post-processing and potentially other steps is controlled by the heuristic comparation config.yaml file.

  • heuristic comparation config.yaml: This YAML file contains settings for heuristic comparisons and rules used in the post-processing steps. Review and modify this file to adjust the processing logic according to your needs. ([FILL IN]: Briefly describe the structure or key sections of the config file if possible, e.g., "It has sections for rules, thresholds, and output_settings.")

Project Structure

About

Book Data Processing Pipeline: Scripts for chunking JSONL, extracting content, gap detection, and post-processing.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages