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

Uploaded Python 3

File details

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

File metadata

  • Download URL: text-to-nlp-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 22521e9d023bd9b39332b10986444330dab86451518a55e2c947cc11b145bdd5
MD5 4ef40e97221bbc9f8a350459994bcc1e
BLAKE2b-256 782a94245492ad3200901e27b2dcc59b3085013f843028f028d84f57a56a8702

See more details on using hashes here.

File details

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

File metadata

  • Download URL: text_to_nlp-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 06a8d013bd06e5258acfa5601f2b313bcc9d9c604050a204b5d617ceda5fdbd7
MD5 b92ca3ce6d66910a8a5acd5117d3d3b8
BLAKE2b-256 9891d3b12b8dd86fc82d124c178fe6374391d13e0b9921738ac510d36dd70e90

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