Skip to main content

A modular Python package for analyzing text paragraphs

Project description

txtanalyze

txtanalyze is a modular Python package for analyzing text paragraphs.
It provides a clean and simple API for word counts, sentence counts, unique words, average word length, and counting specific words.
Designed for developers, writers, and data enthusiasts who need quick insights into text.


Features

  • Extract words from text (punctuation removed, lowercase)
  • Count total and unique words
  • Count sentences
  • Calculate average word length
  • Count specific words (case-insensitive)

Installation

pip install txtanalyze

Usage Examples

Example 1 — Basic Text Analysis

from txtanalyze import get_words, get_word_count, get_unique_words

text = "Hello world! Hello Python. Python is fun."

print(get_words(text))
print(get_word_count(text))
print(get_unique_words(text))

Output

['hello', 'world', 'hello', 'python', 'python', 'is', 'fun']
7
{'hello', 'world', 'python', 'is', 'fun'}

Example 2 — Sentence and Word Metrics

from txtanalyze import get_sentence_count, get_average_word_length, count_word

text = "Hello world! Hello Python. Python is fun."

print(get_sentence_count(text))
print(round(get_average_word_length(text), 2))
print(count_word(text, "Python"))

Output

3
4.57
2

Testing

Run all tests with

pytest tests

License

MIT License © 2025 Dimuth Sakya

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

txtanalyze-1.0.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

txtanalyze-1.0.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file txtanalyze-1.0.1.tar.gz.

File metadata

  • Download URL: txtanalyze-1.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for txtanalyze-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4add5615071fdb23cbfbcf418828cda523a3bcea31ebc98641d6d634a9c37cef
MD5 0fc0d4e53c66ba53b9f640096484b723
BLAKE2b-256 6397ef911c69fba5bc446a2069272a0f2ebae7f533aedad3f30637265bea51b7

See more details on using hashes here.

File details

Details for the file txtanalyze-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: txtanalyze-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for txtanalyze-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2d198a0a7cc2b9894210a510562f3171cb25f2e4a8ccd07668c0321bdf2688c
MD5 adf44ad305c0a34304193ff446d51b0a
BLAKE2b-256 b73ef0ae3c74ea842eb0c6fcff2ba8abf61cb23a514b127756084b404f4aa2b2

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