Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

puctuation_and_stopwords_remover-0.1.1.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.

File details

Details for the file puctuation_and_stopwords_remover-0.1.1.tar.gz.

File metadata

File hashes

Hashes for puctuation_and_stopwords_remover-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5adc6f0ba500b250271ad541f6d955651504eadeed4bf99bfb018405058fe36c
MD5 3e3f96e7634c6abf763ebc02b5056f27
BLAKE2b-256 d76246dc67a65fe8883bbebfb68b07c0e4a0d10117d6184aee56f59db9721e2a

See more details on using hashes here.

File details

Details for the file puctuation_and_stopwords_remover-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for puctuation_and_stopwords_remover-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ec9c91bc4389a686e741ebe3f28a2f4fb81f93dabedd976af939539a0bc50f5d
MD5 ee99b9ca1363a9a8887062f1b99a1a25
BLAKE2b-256 61749b5ae2af37b45a5baa94f9ebbc17f8e0f37489e630b76e04d786d3c00a8e

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