Skip to main content

A package for simple local text summarization.

Project description

Text Summarizer

A Python package for simple local text summarization with nltk.

Installation

pip install local_text_summarizer

Usage

I mostly use this for limiting token upload with expensive LLM API's. So this way I can get the gist of the text and send the condensed version to the API.

FOR 0.1 IMPORTANT I MADE A SMALL SPELLING MISTAKE WITH THE FIRST VERSION TO USE 0.1 from locat_text_summarizer import condense_story locat NOT local.

THIS HAS BEEN FIXED IN 0.2

Here is a simple example of how to use the local_text_summarizer package to condense a story:

from local_text_summarizer import condense_story

text = """
**The Little Boat's Big Adventure**

Once upon a time, in a small marina, there was a little boat named Luna. Luna was a sturdy sailboat with a white hull and a bright blue sail. She had been sitting in the marina for a while, waiting for her next adventure.

One day, a young couple, Alex and Maddie, came to the marina looking for a boat to rent. They had always dreamed of sailing around the world, but for now, they were just looking for a day trip. As they walked down the dock, they noticed Luna, and their eyes lit up. "She's perfect!" Alex exclaimed. Maddie nodded in agreement. "Let's take her out!"

The marina owner, a grizzled old sailor named Jack, helped them prepare Luna for the trip. He showed them the ropes, literally, and gave them a quick sailing lesson. As they set off into the open water, Luna felt the wind in her sail and the sun on her deck. She was finally free!

Alex and Maddie laughed and chatted as they sailed across the bay, taking in the sights and sounds of the ocean. As they approached a small island, they decided to drop anchor and explore. Luna bobbed gently in the water as they swam ashore and discovered a hidden cove, teeming with sea life.

As the day drew to a close, Alex and Maddie reluctantly climbed back on board. As they sailed back to the marina, Luna felt grateful for the adventure she had shared with the young couple. She knew she would always be ready for the next big adventure that came her way.

From that day on, Luna became the go-to boat for many more exciting journeys, and her legend grew as the little boat with a big heart and a love for the open sea.
"""

# Summarize the text
summary = condense_story(text, ratio=0.3)
print("Summary:")
print(summary)

we go from 1622 to 678

**The Little Boat's Big Adventure**
Once upon a time, in a small marina, there was a little boat named Luna. One day, a young couple, Alex and Maddie, came to the marina looking for a boat to rent.

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

local_text_summarizer-0.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

local_text_summarizer-0.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file local_text_summarizer-0.2.tar.gz.

File metadata

  • Download URL: local_text_summarizer-0.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.1

File hashes

Hashes for local_text_summarizer-0.2.tar.gz
Algorithm Hash digest
SHA256 e54ae8c59e920ca1a51e66916d4947c59dba4d007209bb4dbd4c1ded40ff7144
MD5 1797247651bfdf3abf0eb0f165459efc
BLAKE2b-256 cceff1fd93ffca3acd2698ebd4f7aeea820b427781c97c8821595535c5b4d5fb

See more details on using hashes here.

File details

Details for the file local_text_summarizer-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for local_text_summarizer-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7b89875ed84b3abe1f31746fe845207a8bdf6d742b000c9c14a60ba2163524b7
MD5 8f7bb88e5495282a4b213ca3bbbed462
BLAKE2b-256 d66e3179c33e30ff8a1744a8c595be6d845273907d1c363d958918e596b5b509

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