Skip to main content

Split long text into parts without breaking words

Project description

textdivider

Split long text into chunks without breaking words. Useful for social media, messaging platforms, or UI components with length limits.

Installation

pip install textdivider

Features

✅ Split text by max characters, preserving whole words

✅ Optional numbering (e.g. "1/3: ...")

✅ Split text by max number of words

Usage

from textdivider import split_text, split_by_words

text = "This is a long message that you want to divide into parts without cutting words in the middle."

# Split by character count
chunks = split_text(text, max_length=50)
print(chunks)

# With numbering
numbered = split_text(text, max_length=50, numbered=True)
print(numbered)

# Split by word count
word_chunks = split_by_words(text, max_words=5)
print(word_chunks)

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

textdivider-0.2.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

textdivider-0.2.0-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file textdivider-0.2.0.tar.gz.

File metadata

  • Download URL: textdivider-0.2.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for textdivider-0.2.0.tar.gz
Algorithm Hash digest
SHA256 99c15bb2eecec97f617328c23c12cc5933458bb2384c2216a5c90d2bbe32499f
MD5 a9a4196e56ce733081e3346b993a3df5
BLAKE2b-256 9f56f5558f9622a1ff860cf34d35ca6fa339149c42f2a7126ad624b9badad54e

See more details on using hashes here.

File details

Details for the file textdivider-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: textdivider-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for textdivider-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fade1a43a5fd0ba934c1c0c10b2bfb2988f1fe3bd0dfa58546c506233ccc0e0f
MD5 e774d6bbcb181eadc764eec65d36e5a4
BLAKE2b-256 7fafda80e0d8b5fcf0bb3bea3e5eec5dc910352c243c442630d1c15559b8b9b0

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