A Python package for data cleaning process of NLP tasks, specifically for removing punctuation and stopwords.
Project description
Text Cleaner Module for NLP based projects
A simple Python package that removes punctuation and stopwords from text using nltk & string.
Installation
First install the package:
pip install puctuation_and_stopwords_remover
Usage Example
Import the module and use the remove_punc_and_stopwords function:
from puctuation_and_stopwords_remover import remove_punc_and_stopwords
text = "This is an example sentence, with punctuation and stopwords!"
# Remove punctuation and stopwords, return as text
cleaned_text = remove_punc_and_stopwords(text)
print(cleaned_text)
# Output: example sentence punctuation stopwords
# Remove punctuation and stopwords, return as list
cleaned_list = remove_punc_and_stopwords(text, output_format="list")
print(cleaned_list)
# Output: ['example', 'sentence', 'punctuation', 'stopwords']
# Specify a different language (if supported)
cleaned_text_spanish = remove_punc_and_stopwords("Este es un ejemplo de texto.", lang="spanish")
print(cleaned_text_spanish)
Function signature:
def remove_punc_and_stopwords(text_to_clean, output_format="text", lang="english"):
"""
Removes punctuation and stopwords from the input text.
Args:
text_to_clean (str): The raw input text.
output_format (str): 'text' (default) or 'list' for list output.
lang (str): Language for stopwords (default: 'english').
Returns:
str or list: Cleaned text.
"""
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 puctuation_and_stopwords_remover-0.1.1.tar.gz.
File metadata
- Download URL: puctuation_and_stopwords_remover-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.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5adc6f0ba500b250271ad541f6d955651504eadeed4bf99bfb018405058fe36c
|
|
| MD5 |
3e3f96e7634c6abf763ebc02b5056f27
|
|
| BLAKE2b-256 |
d76246dc67a65fe8883bbebfb68b07c0e4a0d10117d6184aee56f59db9721e2a
|
File details
Details for the file puctuation_and_stopwords_remover-0.1.1-py3-none-any.whl.
File metadata
- Download URL: puctuation_and_stopwords_remover-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec9c91bc4389a686e741ebe3f28a2f4fb81f93dabedd976af939539a0bc50f5d
|
|
| MD5 |
ee99b9ca1363a9a8887062f1b99a1a25
|
|
| BLAKE2b-256 |
61749b5ae2af37b45a5baa94f9ebbc17f8e0f37489e630b76e04d786d3c00a8e
|