Metadata-Version: 2.2
Name: paper_academic_summarizer
Version: 0.1.6
Summary: A library for summarizing and explaining academic papers
Home-page: https://github.com/harshchi19/Paper-Summarizer-Library.git
Author: Harsh Chitaliya
Author-email: haarshchitaliya193@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: PyPDF2>=3.0.0
Requires-Dist: graphviz>=0.20.1
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Paper Summarizer & Explainer

**Paper Summarizer & Explainer** is a Python library designed to help students and researchers quickly digest complex academic papers. The library extracts text from PDFs or accepts raw text and uses Azure AI Inference (leveraging GitHub models) to generate concise summaries that highlight key concepts and define technical terms. Additionally, it provides an optional feature to generate simple diagrams or flowcharts from the summary.

## Features

- **PDF Text Extraction:** Easily extract text from academic papers in PDF format using [PyPDF2](https://pypi.org/project/PyPDF2/).
- **Automated Summarization:** Leverage Azure AI Inference and pre-trained NLP models to create clear, concise summaries of academic papers.
- **Diagram Generation:** Generate simple diagrams or flowcharts from summary points using [Graphviz](https://pypi.org/project/graphviz/).
- **Modular Design:** Start with core summarization and gradually expand functionality to include additional explanations or visual aids.

## Installation

### Prerequisites

- Python 3.8 or higher

### Install Dependencies

```bash
pip install azure-ai-inference PyPDF2 graphviz


### Example Usage
import os
from paper_summarizer import summarize_paper, generate_diagram

def shorten_summary(summary: str, max_words: int = 30) -> str:
    """
    Truncates the summary to a specified number of words.
    Appends '...' if the original summary exceeds max_words.
    """
    words = summary.split()
    if len(words) <= max_words:
        return summary
    return " ".join(words[:max_words]) + " ..."

def main():
    sample_text = """
    In this study, we present a comprehensive evaluation of several state-of-the-art deep learning architectures 
    for image classification and object detection. Our focus includes ResNet50, which uses residual connections 
    to mitigate the vanishing gradient problem, Inception-v3 for multi-scale processing, and EfficientNet-B7 
    leveraging compound scaling. We also analyze transformer-based models such as the Vision Transformer (ViT) 
    and DeiT, discussing their performance trade-offs in terms of accuracy, computational cost, and scalability. 
    Overall, these findings provide guidance for selecting and optimizing deep learning architectures in 
    real-world applications, where balancing efficiency and accuracy is crucial.
    """

    # 1) Generate a summary using your library
    full_summary = summarize_paper(sample_text, is_pdf=False)
    print("Full Summary from the Library:\n")
    print(full_summary)

    # 2) Shorten the summary to ensure it's very concise
    short_summary = shorten_summary(full_summary, max_words=30)
    print("\nShortened Summary:\n")
    print(short_summary)

    # 3) Generate a diagram from the shortened summary
    output_file = "diagram_short"
    try:
        generate_diagram(short_summary, output_file=output_file)
        print(f"\nShort diagram generated successfully: {output_file}.png")
    except Exception as e:
        print("Error generating diagram:", e)

if __name__ == "__main__":
    main()

