Skip to main content

A simple text preprocessing package for NLP

Project description

Text to NLP

A simple and efficient Python package for text preprocessing in Natural Language Processing (NLP).

Features

  • Tokenizes text into words.
  • Removes stop words (e.g., "the", "is").
  • Removes punctuation marks (e.g., "!", ".", ",").
  • Converts text to TF-IDF vectors for machine learning.

Requirements

  • Python 3.6+
  • nltk>=3.8.1
  • scikit-learn>=1.3.0

Installation

pip install text-to-nlp

Usage

from text_preprocessor import TextPreprocessor

# Initialize the preprocessor
processor = TextPreprocessor()

# Preprocess a single text
text = "I am running, jumping happily!!!"
processed_text = processor.preprocess(text)
print("Processed text:", processed_text)  # Output: running jumping happily

# Convert multiple texts to TF-IDF
texts = ["I am running happily!", "Jumping is fun?", "Sad days are bad."]
tfidf_matrix, vectorizer = processor.to_tfidf(texts)
print("TF-IDF matrix shape:", tfidf_matrix.toarray().shape)  # Output: (3, 1000)

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

text-to-nlp-0.1.4.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.

text_to_nlp-0.1.4-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file text-to-nlp-0.1.4.tar.gz.

File metadata

  • Download URL: text-to-nlp-0.1.4.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for text-to-nlp-0.1.4.tar.gz
Algorithm Hash digest
SHA256 856ce0fe5d750c4e7dfe094cc96990857068dee56cb8c8864ee6547ebc66ec37
MD5 9508e945ffb529b2dfe67789aabb071b
BLAKE2b-256 4ae6a50a488166df999c25342a266c8e644cbe9b3af96b320aa4752f9aeaad81

See more details on using hashes here.

File details

Details for the file text_to_nlp-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: text_to_nlp-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for text_to_nlp-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f91bf8e67ebb7004b89ee4c94992dc897db6453f4dca7558e8a42ce579dc9e29
MD5 2a7a5a01376b65ee93e8b590345cf829
BLAKE2b-256 74ab0b98bf5c062cf7605f2a97975b77e0538677c0fd7c821c1d8238a170b8e6

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