Skip to main content

A lightweight utility for common text preparation tasks in ML and NLP.

Project description

SimpleTextProcessor

A lightweight utility library for quick text preparation in machine learning and NLP tasks.

This package provides simple functions for

Cleaning Removing punctuation, converting to lowercase, and handling special characters.

Vectorization Creating a simple Bag-of-Words (BoW) vector representation from a list of documents.

Installation

Since this package is small, it only requires numpy as a dependency for the vectorization function.

pip install simple-text-processor

Usage

  1. Clean Text

from simple_text_processor import clean_text

text = Hello World! This is a Test sentence with some Numb3rs. cleaned_text = clean_text(text) print(cleaned_text)

Output hello world this is a test sentence with some numb rs

  1. Simple Bag-of-Words Vectorizer

from simple_text_processor import simple_vectorize

documents = [ The sun is shining brightly., A sunny day is a happy day., The moon is out tonight., ]

vectors, vocabulary = simple_vectorize(documents)

print(Vocabulary, vocabulary)

Output Vocabulary {'the' 0, 'sun' 1, 'is' 2, 'shining' 3, 'brightly' 4, 'a' 5, 'sunny' 6, 'day' 7, 'happy' 8, 'moon' 9, 'out' 10, 'tonight' 11}

print(nVectors (BoW)n, vectors)

Output (Numpy array of word counts)

[[1 1 1 1 1 0 0 0 0 0 0 0]

[0 0 1 0 0 1 1 2 1 0 0 0]

[1 0 1 0 0 0 0 0 0 1 1 1]]

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

simple_text_processor-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

simple_text_processor-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file simple_text_processor-0.1.0.tar.gz.

File metadata

  • Download URL: simple_text_processor-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for simple_text_processor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9be9bcfa399afa4b744a586b03e14510ad38b801257093fa695c67471e63a5af
MD5 ec62b34c519c2e6234c37c4d249c5ab5
BLAKE2b-256 0ee295af18c67d750585071855061434a7df99873224e2f3574a0417c6f16390

See more details on using hashes here.

File details

Details for the file simple_text_processor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_text_processor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08d465aa40a6191ec083c729dc5bfd24bf4ea6ce4ffe8c9a2595d82875996b95
MD5 46e7f1041e17701d58fb91bd1f173821
BLAKE2b-256 e605576d4921a378186299b0cdb1b0d96cfba14357de2fd3e4f6ff66f06b5e39

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