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
Release files for pylib-summarize 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pylib_summarize-0.1.0.tar.gz | 2.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pylib_summarize-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.7 kB
Release files / pylib_summarize-0.1.0.tar.gz
| Download URL | pylib_summarize-0.1.0.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1a868bf05a2e4db8101033bd8a879d84f252242b3430a3fa82c3590b083be44
|
|
BLAKE2b-256 checksum How to use checksums |
e7192b6ebdc6a9609857ae1cab9404a2d23e23ec30d5d4bfa358ba3fe4f25f7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / pylib_summarize-0.1.0-py3-none-any.whl
| Download URL | pylib_summarize-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec5c4fb5519128525b8946027e7a00c99cf4e71257c72e10529983c9d79e5cb9
|
|
BLAKE2b-256 checksum How to use checksums |
86b1d8b87fbb852ab6db3de897a36b8968349a05e7bd305ab9431c3b05a40ffa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|