Skip to main content

A library for summarizing and explaining academic papers

Project description

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.
  • 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.
  • 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

pip install Groq 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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paper_academic_summarizer-0.1.7.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paper_academic_summarizer-0.1.7-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file paper_academic_summarizer-0.1.7.tar.gz.

File metadata

File hashes

Hashes for paper_academic_summarizer-0.1.7.tar.gz
Algorithm Hash digest
SHA256 e40febd613d89f21e101e33f6a95ede6f1275a029e0be0ab76069c9db0ebaff9
MD5 b11cf42abaa39967b711ae8d9039a84a
BLAKE2b-256 a3ee05b599ea608b78c13b15633e5d5df60b9ae06bac3b823a777ebb9632aef6

See more details on using hashes here.

File details

Details for the file paper_academic_summarizer-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for paper_academic_summarizer-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2433e48d4d184468efb4e8dcab16a319fcac76f206cd6cf6ab4d0f7d7c9a67ae
MD5 dffc233322b9fa53259371b3ba9a085d
BLAKE2b-256 e20685dc385dd2760a9cebde36ea342735dfe79e4b807091ade0fe8b90d14ca6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page