Summarize long text using frequency-based or AI-based summarizers. Perfect for AI agents. Perfect for AI agents and LLM applications.
Project description
pysummarize
Summarize long text using frequency-based or AI-based summarizers.
Installation
pip install pysummarize
💡 Usage Examples
Basic Operations
from pylib_summarize import summarize_frequency, extract_keywords, summarize_by_ratio
text = "Python is great. Machine learning is fun. Python and ML are powerful."
# Summarize by word frequency
summary = summarize_frequency(text, num_sentences=2)
# 'Python is great. Machine learning is fun.'
# Extract keywords
keywords = extract_keywords(text, num_keywords=3)
# ['python', 'learning', 'machine']
# Summarize by ratio
short_summary = summarize_by_ratio(text, ratio=0.5)
AI/ML Use Cases
from pylib_summarize import summarize_frequency, extract_keywords
# Summarize AI-generated content
ai_response = "Long AI-generated text..."
summary = summarize_frequency(ai_response, num_sentences=3)
# Extract key topics from text
topics = extract_keywords(ai_response, num_keywords=10)
📚 API Reference
summarize_frequency(text: str, num_sentences: int = 3) -> str
Summarizes text based on word frequency. Returns top N sentences.
extract_keywords(text: str, num_keywords: int = 5) -> List[str]
Extracts top keywords by frequency, excluding stop words.
summarize_by_ratio(text: str, ratio: float = 0.3) -> str
Summarizes text to a ratio of original length.
🤖 AI Agent Friendly
This package is optimized for AI agents and code generation tools:
- Clear function names and signatures
- Comprehensive docstrings with examples
- Type hints for better IDE support
- Common use cases documented
- Zero dependencies for reliability
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pylib_summarize-0.1.0.tar.gz.
File metadata
- Download URL: pylib_summarize-0.1.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1a868bf05a2e4db8101033bd8a879d84f252242b3430a3fa82c3590b083be44
|
|
| MD5 |
a88a291221a643397ab3a20d576260f2
|
|
| BLAKE2b-256 |
e7192b6ebdc6a9609857ae1cab9404a2d23e23ec30d5d4bfa358ba3fe4f25f7b
|
File details
Details for the file pylib_summarize-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pylib_summarize-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec5c4fb5519128525b8946027e7a00c99cf4e71257c72e10529983c9d79e5cb9
|
|
| MD5 |
b92a701ef35c9f00a6a33f83af908a1f
|
|
| BLAKE2b-256 |
86b1d8b87fbb852ab6db3de897a36b8968349a05e7bd305ab9431c3b05a40ffa
|