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").
  • Lemmatizes words to their base form (e.g., "running" → "run").
  • 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 and 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.2.tar.gz (2.2 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.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: text-to-nlp-0.1.2.tar.gz
  • Upload date:
  • Size: 2.2 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.2.tar.gz
Algorithm Hash digest
SHA256 2885316fa7d7e2a4e05c94bd25f52aa62c37cd22f3234ac05d3c056806d33d3c
MD5 0b587fed16a47b457e07bfe6b4e0b726
BLAKE2b-256 267e6380bf382f526a7cd43737979264afee6561be7059c3063c24d6b3d887c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: text_to_nlp-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c6bb29f680220cf4b22f4cf5d67cd14fea3dfd551439888d2894fcb1b999af74
MD5 64bfc9b0ec58e7351993667e4d8a7920
BLAKE2b-256 d773d4f9486bc07b19ca11971c254765bd9c2fe8e68787a647736367fb2facdd

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