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.0.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.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: txtanalyze-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 59889904dc88a83210a9d0e02230e4fe5074815fbf3ca58f8752c9ab7b3d0047
MD5 e801b2f50553ac33f693262acb86013d
BLAKE2b-256 ecf2e4d644513cc76b10957887164979fdfa5c1e470eb8fd8af16664661441f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: txtanalyze-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d3ecea44a13c796c4055031d890ec165dc174a4b876aee42ec60c0405467b04
MD5 b04911437f8d565203e679ef4fadf69c
BLAKE2b-256 696252359b1b353e71c1cca65cf4b345b63bb741d5492bd2042958653eda37ee

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