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
```python
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.1.tar.gz
(2.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file text-to-nlp-0.1.1.tar.gz.
File metadata
- Download URL: text-to-nlp-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36f86bd278d68e17270855e4d079a27e685bc95864c815ffbf407c9898696fec
|
|
| MD5 |
bbbe8bf2f8441bb470f774d0535901c5
|
|
| BLAKE2b-256 |
f6a1cf022c03a0db23cf5740948d0ccffc6b839d1fa2df2711fc5b06a702da88
|
File details
Details for the file text_to_nlp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: text_to_nlp-0.1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a028088f51e1f1a049dec5678842c2cf10c267533d86c72652a558db85d8367
|
|
| MD5 |
572fe54fe5e67329fa6121bc95999d25
|
|
| BLAKE2b-256 |
752ed831e3ff3122bb8ad8ffddc64298d34050eadb8a90d8192269d42b72b238
|